@postman-cse/onboarding-bootstrap 2.9.3 → 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 +638 -447
- package/dist/cli.cjs +638 -447
- package/dist/index.cjs +638 -447
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12234,7 +12234,7 @@ var require_response = __commonJS({
|
|
|
12234
12234
|
var assert = require("node:assert");
|
|
12235
12235
|
var { types: types2 } = require("node:util");
|
|
12236
12236
|
var textEncoder = new TextEncoder("utf-8");
|
|
12237
|
-
var
|
|
12237
|
+
var Response2 = class _Response {
|
|
12238
12238
|
// Creates network error Response.
|
|
12239
12239
|
static error() {
|
|
12240
12240
|
const responseObject = fromInnerResponse(makeNetworkError(), "immutable");
|
|
@@ -12377,8 +12377,8 @@ var require_response = __commonJS({
|
|
|
12377
12377
|
return `Response ${nodeUtil.formatWithOptions(options, properties)}`;
|
|
12378
12378
|
}
|
|
12379
12379
|
};
|
|
12380
|
-
mixinBody(
|
|
12381
|
-
Object.defineProperties(
|
|
12380
|
+
mixinBody(Response2);
|
|
12381
|
+
Object.defineProperties(Response2.prototype, {
|
|
12382
12382
|
type: kEnumerableProperty,
|
|
12383
12383
|
url: kEnumerableProperty,
|
|
12384
12384
|
status: kEnumerableProperty,
|
|
@@ -12394,7 +12394,7 @@ var require_response = __commonJS({
|
|
|
12394
12394
|
configurable: true
|
|
12395
12395
|
}
|
|
12396
12396
|
});
|
|
12397
|
-
Object.defineProperties(
|
|
12397
|
+
Object.defineProperties(Response2, {
|
|
12398
12398
|
json: kEnumerableProperty,
|
|
12399
12399
|
redirect: kEnumerableProperty,
|
|
12400
12400
|
error: kEnumerableProperty
|
|
@@ -12527,7 +12527,7 @@ var require_response = __commonJS({
|
|
|
12527
12527
|
}
|
|
12528
12528
|
}
|
|
12529
12529
|
function fromInnerResponse(innerResponse, guard) {
|
|
12530
|
-
const response = new
|
|
12530
|
+
const response = new Response2(kConstruct);
|
|
12531
12531
|
response[kState] = innerResponse;
|
|
12532
12532
|
response[kHeaders] = new Headers3(kConstruct);
|
|
12533
12533
|
setHeadersList(response[kHeaders], innerResponse.headersList);
|
|
@@ -12595,7 +12595,7 @@ var require_response = __commonJS({
|
|
|
12595
12595
|
makeResponse,
|
|
12596
12596
|
makeAppropriateNetworkError,
|
|
12597
12597
|
filterResponse,
|
|
12598
|
-
Response,
|
|
12598
|
+
Response: Response2,
|
|
12599
12599
|
cloneResponse,
|
|
12600
12600
|
fromInnerResponse
|
|
12601
12601
|
};
|
|
@@ -15267,7 +15267,7 @@ var require_cache = __commonJS({
|
|
|
15267
15267
|
var { urlEquals, getFieldValues } = require_util5();
|
|
15268
15268
|
var { kEnumerableProperty, isDisturbed } = require_util();
|
|
15269
15269
|
var { webidl } = require_webidl();
|
|
15270
|
-
var { Response, cloneResponse, fromInnerResponse } = require_response();
|
|
15270
|
+
var { Response: Response2, cloneResponse, fromInnerResponse } = require_response();
|
|
15271
15271
|
var { Request, fromInnerRequest } = require_request2();
|
|
15272
15272
|
var { kState } = require_symbols2();
|
|
15273
15273
|
var { fetching } = require_fetch();
|
|
@@ -15794,7 +15794,7 @@ var require_cache = __commonJS({
|
|
|
15794
15794
|
converter: webidl.converters.DOMString
|
|
15795
15795
|
}
|
|
15796
15796
|
]);
|
|
15797
|
-
webidl.converters.Response = webidl.interfaceConverter(
|
|
15797
|
+
webidl.converters.Response = webidl.interfaceConverter(Response2);
|
|
15798
15798
|
webidl.converters["sequence<RequestInfo>"] = webidl.sequenceConverter(
|
|
15799
15799
|
webidl.converters.RequestInfo
|
|
15800
15800
|
);
|
|
@@ -98551,7 +98551,7 @@ var require_response2 = __commonJS({
|
|
|
98551
98551
|
}
|
|
98552
98552
|
return stream;
|
|
98553
98553
|
};
|
|
98554
|
-
var
|
|
98554
|
+
var Response2;
|
|
98555
98555
|
_.inherit(
|
|
98556
98556
|
/**
|
|
98557
98557
|
* Response holds data related to the request body. By default, it provides a nice wrapper for url-encoded,
|
|
@@ -98562,14 +98562,14 @@ var require_response2 = __commonJS({
|
|
|
98562
98562
|
*
|
|
98563
98563
|
* @param {Response.definition} options -
|
|
98564
98564
|
*/
|
|
98565
|
-
|
|
98566
|
-
|
|
98565
|
+
Response2 = function PostmanResponse(options) {
|
|
98566
|
+
Response2.super_.apply(this, arguments);
|
|
98567
98567
|
this.update(options || {});
|
|
98568
98568
|
},
|
|
98569
98569
|
Property
|
|
98570
98570
|
);
|
|
98571
98571
|
_.assign(
|
|
98572
|
-
|
|
98572
|
+
Response2.prototype,
|
|
98573
98573
|
/** @lends Response.prototype */
|
|
98574
98574
|
{
|
|
98575
98575
|
update(options) {
|
|
@@ -98635,7 +98635,7 @@ var require_response2 = __commonJS({
|
|
|
98635
98635
|
}
|
|
98636
98636
|
);
|
|
98637
98637
|
_.assign(
|
|
98638
|
-
|
|
98638
|
+
Response2.prototype,
|
|
98639
98639
|
/** @lends Response.prototype */
|
|
98640
98640
|
{
|
|
98641
98641
|
/**
|
|
@@ -98813,7 +98813,7 @@ var require_response2 = __commonJS({
|
|
|
98813
98813
|
}
|
|
98814
98814
|
);
|
|
98815
98815
|
_.assign(
|
|
98816
|
-
|
|
98816
|
+
Response2,
|
|
98817
98817
|
/** @lends Response */
|
|
98818
98818
|
{
|
|
98819
98819
|
/**
|
|
@@ -98831,7 +98831,7 @@ var require_response2 = __commonJS({
|
|
|
98831
98831
|
* @returns {Boolean}
|
|
98832
98832
|
*/
|
|
98833
98833
|
isResponse: function(obj) {
|
|
98834
|
-
return Boolean(obj) && (obj instanceof
|
|
98834
|
+
return Boolean(obj) && (obj instanceof Response2 || _.inSuperChain(obj.constructor, "_postman_propertyName", Response2._postman_propertyName));
|
|
98835
98835
|
},
|
|
98836
98836
|
/**
|
|
98837
98837
|
* Converts the response object from the request module to the postman responseBody format
|
|
@@ -98842,7 +98842,7 @@ var require_response2 = __commonJS({
|
|
|
98842
98842
|
* @todo Add a key: `originalRequest` to the returned object as well, referring to response.request
|
|
98843
98843
|
*/
|
|
98844
98844
|
createFromNode: function(response, cookies) {
|
|
98845
|
-
return new
|
|
98845
|
+
return new Response2({
|
|
98846
98846
|
cookie: cookies,
|
|
98847
98847
|
body: response.body.toString(),
|
|
98848
98848
|
stream: response.body,
|
|
@@ -98921,7 +98921,7 @@ var require_response2 = __commonJS({
|
|
|
98921
98921
|
}
|
|
98922
98922
|
);
|
|
98923
98923
|
module2.exports = {
|
|
98924
|
-
Response
|
|
98924
|
+
Response: Response2
|
|
98925
98925
|
};
|
|
98926
98926
|
}
|
|
98927
98927
|
});
|
|
@@ -98935,7 +98935,7 @@ var require_item = __commonJS({
|
|
|
98935
98935
|
var EventList = require_event_list().EventList;
|
|
98936
98936
|
var Request = require_request12().Request;
|
|
98937
98937
|
var RequestAuth = require_request_auth().RequestAuth;
|
|
98938
|
-
var
|
|
98938
|
+
var Response2 = require_response2().Response;
|
|
98939
98939
|
var Item;
|
|
98940
98940
|
var OBJECT2 = "object";
|
|
98941
98941
|
var STRING2 = "string";
|
|
@@ -99002,7 +99002,7 @@ var require_item = __commonJS({
|
|
|
99002
99002
|
*
|
|
99003
99003
|
* @type {PropertyList<Response>}
|
|
99004
99004
|
*/
|
|
99005
|
-
responses: new PropertyList(
|
|
99005
|
+
responses: new PropertyList(Response2, this, definition && definition.response),
|
|
99006
99006
|
/**
|
|
99007
99007
|
* Events are a set of of {@link Script}s that are executed when certain activities are triggered on an
|
|
99008
99008
|
* Item. For example, on defining an event that listens to the "test" event, would cause the associated
|
|
@@ -105143,7 +105143,7 @@ var require_scope_functions = __commonJS({
|
|
|
105143
105143
|
const normal = Math.floor(multiple + 0.5);
|
|
105144
105144
|
return normal / factor === value && normal % factorMultiple === 0;
|
|
105145
105145
|
};
|
|
105146
|
-
var
|
|
105146
|
+
var deepEqual2 = (obj, obj2) => {
|
|
105147
105147
|
if (obj === obj2) return true;
|
|
105148
105148
|
if (!obj || !obj2 || typeof obj !== typeof obj2) return false;
|
|
105149
105149
|
if (obj !== obj2 && typeof obj !== "object") return false;
|
|
@@ -105152,18 +105152,18 @@ var require_scope_functions = __commonJS({
|
|
|
105152
105152
|
if (proto === Array.prototype) {
|
|
105153
105153
|
if (!Array.isArray(obj) || !Array.isArray(obj2)) return false;
|
|
105154
105154
|
if (obj.length !== obj2.length) return false;
|
|
105155
|
-
return obj.every((x, i) =>
|
|
105155
|
+
return obj.every((x, i) => deepEqual2(x, obj2[i]));
|
|
105156
105156
|
} else if (proto === Object.prototype) {
|
|
105157
105157
|
const [keys, keys2] = [Object.keys(obj), Object.keys(obj2)];
|
|
105158
105158
|
if (keys.length !== keys2.length) return false;
|
|
105159
105159
|
const keyset2 = /* @__PURE__ */ new Set([...keys, ...keys2]);
|
|
105160
|
-
return keyset2.size === keys.length && keys.every((key) =>
|
|
105160
|
+
return keyset2.size === keys.length && keys.every((key) => deepEqual2(obj[key], obj2[key]));
|
|
105161
105161
|
}
|
|
105162
105162
|
return false;
|
|
105163
105163
|
};
|
|
105164
105164
|
var unique = (array) => {
|
|
105165
105165
|
if (array.length < 2) return true;
|
|
105166
|
-
if (array.length === 2) return !
|
|
105166
|
+
if (array.length === 2) return !deepEqual2(array[0], array[1]);
|
|
105167
105167
|
const objects = [];
|
|
105168
105168
|
const primitives = array.length > 20 ? /* @__PURE__ */ new Set() : null;
|
|
105169
105169
|
let primitivesCount = 0;
|
|
@@ -105180,7 +105180,7 @@ var require_scope_functions = __commonJS({
|
|
|
105180
105180
|
pos++;
|
|
105181
105181
|
}
|
|
105182
105182
|
for (let i = 1; i < objects.length; i++)
|
|
105183
|
-
for (let j = 0; j < i; j++) if (
|
|
105183
|
+
for (let j = 0; j < i; j++) if (deepEqual2(objects[i], objects[j])) return false;
|
|
105184
105184
|
return true;
|
|
105185
105185
|
};
|
|
105186
105186
|
var deBase64 = (string) => {
|
|
@@ -105199,7 +105199,7 @@ var require_scope_functions = __commonJS({
|
|
|
105199
105199
|
var propertyIn = (key, [properties, patterns]) => properties.includes(true) || properties.some((prop) => prop === key) || patterns.some((pattern) => new RegExp(pattern, "u").test(key));
|
|
105200
105200
|
var dynamicResolve = (anchors, id) => (anchors.filter((x) => x[id])[0] || {})[id];
|
|
105201
105201
|
var extraUtils = { toPointer, pointerPart, errorMerge, propertyIn, dynamicResolve };
|
|
105202
|
-
module2.exports = { stringLength, isMultipleOf, deepEqual, unique, deBase64, hasOwn: hasOwn2, ...extraUtils };
|
|
105202
|
+
module2.exports = { stringLength, isMultipleOf, deepEqual: deepEqual2, unique, deBase64, hasOwn: hasOwn2, ...extraUtils };
|
|
105203
105203
|
}
|
|
105204
105204
|
});
|
|
105205
105205
|
|
|
@@ -107130,9 +107130,9 @@ var require_src = __commonJS({
|
|
|
107130
107130
|
var genfun = require_generate_function();
|
|
107131
107131
|
var { buildSchemas } = require_pointer();
|
|
107132
107132
|
var { compile } = require_compile();
|
|
107133
|
-
var { deepEqual } = require_scope_functions();
|
|
107133
|
+
var { deepEqual: deepEqual2 } = require_scope_functions();
|
|
107134
107134
|
var jsonCheckWithErrors = (validate4) => function validateIsJSON(data) {
|
|
107135
|
-
if (!
|
|
107135
|
+
if (!deepEqual2(data, JSON.parse(JSON.stringify(data)))) {
|
|
107136
107136
|
validateIsJSON.errors = [{ instanceLocation: "#", error: "not JSON compatible" }];
|
|
107137
107137
|
return false;
|
|
107138
107138
|
}
|
|
@@ -107140,7 +107140,7 @@ var require_src = __commonJS({
|
|
|
107140
107140
|
validateIsJSON.errors = validate4.errors;
|
|
107141
107141
|
return res;
|
|
107142
107142
|
};
|
|
107143
|
-
var jsonCheckWithoutErrors = (validate4) => (data) =>
|
|
107143
|
+
var jsonCheckWithoutErrors = (validate4) => (data) => deepEqual2(data, JSON.parse(JSON.stringify(data))) && validate4(data);
|
|
107144
107144
|
var validator3 = (schema, { parse: parse10 = false, multi = false, jsonCheck = false, isJSON = false, schemas = [], ...opts } = {}) => {
|
|
107145
107145
|
if (jsonCheck && isJSON) throw new Error("Can not specify both isJSON and jsonCheck options");
|
|
107146
107146
|
if (parse10 && (jsonCheck || isJSON))
|
|
@@ -107156,7 +107156,7 @@ var require_src = __commonJS({
|
|
|
107156
107156
|
if (parse10) {
|
|
107157
107157
|
scope.parseWrap = opts.includeErrors ? parseWithErrors : parseWithoutErrors;
|
|
107158
107158
|
} else if (jsonCheck) {
|
|
107159
|
-
scope.deepEqual =
|
|
107159
|
+
scope.deepEqual = deepEqual2;
|
|
107160
107160
|
scope.jsonCheckWrap = opts.includeErrors ? jsonCheckWithErrors : jsonCheckWithoutErrors;
|
|
107161
107161
|
}
|
|
107162
107162
|
if (multi) {
|
|
@@ -140244,7 +140244,7 @@ var require_lib10 = __commonJS({
|
|
|
140244
140244
|
}
|
|
140245
140245
|
var INTERNALS$1 = /* @__PURE__ */ Symbol("Response internals");
|
|
140246
140246
|
var STATUS_CODES = http2.STATUS_CODES;
|
|
140247
|
-
var
|
|
140247
|
+
var Response2 = class _Response {
|
|
140248
140248
|
constructor() {
|
|
140249
140249
|
let body2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
140250
140250
|
let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -140302,8 +140302,8 @@ var require_lib10 = __commonJS({
|
|
|
140302
140302
|
});
|
|
140303
140303
|
}
|
|
140304
140304
|
};
|
|
140305
|
-
Body.mixIn(
|
|
140306
|
-
Object.defineProperties(
|
|
140305
|
+
Body.mixIn(Response2.prototype);
|
|
140306
|
+
Object.defineProperties(Response2.prototype, {
|
|
140307
140307
|
url: { enumerable: true },
|
|
140308
140308
|
status: { enumerable: true },
|
|
140309
140309
|
ok: { enumerable: true },
|
|
@@ -140312,7 +140312,7 @@ var require_lib10 = __commonJS({
|
|
|
140312
140312
|
headers: { enumerable: true },
|
|
140313
140313
|
clone: { enumerable: true }
|
|
140314
140314
|
});
|
|
140315
|
-
Object.defineProperty(
|
|
140315
|
+
Object.defineProperty(Response2.prototype, Symbol.toStringTag, {
|
|
140316
140316
|
value: "Response",
|
|
140317
140317
|
writable: false,
|
|
140318
140318
|
enumerable: false,
|
|
@@ -140621,7 +140621,7 @@ var require_lib10 = __commonJS({
|
|
|
140621
140621
|
};
|
|
140622
140622
|
const codings = headers.get("Content-Encoding");
|
|
140623
140623
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
140624
|
-
response = new
|
|
140624
|
+
response = new Response2(body2, response_options);
|
|
140625
140625
|
resolve5(response);
|
|
140626
140626
|
return;
|
|
140627
140627
|
}
|
|
@@ -140631,7 +140631,7 @@ var require_lib10 = __commonJS({
|
|
|
140631
140631
|
};
|
|
140632
140632
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
140633
140633
|
body2 = body2.pipe(zlib.createGunzip(zlibOptions));
|
|
140634
|
-
response = new
|
|
140634
|
+
response = new Response2(body2, response_options);
|
|
140635
140635
|
resolve5(response);
|
|
140636
140636
|
return;
|
|
140637
140637
|
}
|
|
@@ -140643,18 +140643,18 @@ var require_lib10 = __commonJS({
|
|
|
140643
140643
|
} else {
|
|
140644
140644
|
body2 = body2.pipe(zlib.createInflateRaw());
|
|
140645
140645
|
}
|
|
140646
|
-
response = new
|
|
140646
|
+
response = new Response2(body2, response_options);
|
|
140647
140647
|
resolve5(response);
|
|
140648
140648
|
});
|
|
140649
140649
|
return;
|
|
140650
140650
|
}
|
|
140651
140651
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
140652
140652
|
body2 = body2.pipe(zlib.createBrotliDecompress());
|
|
140653
|
-
response = new
|
|
140653
|
+
response = new Response2(body2, response_options);
|
|
140654
140654
|
resolve5(response);
|
|
140655
140655
|
return;
|
|
140656
140656
|
}
|
|
140657
|
-
response = new
|
|
140657
|
+
response = new Response2(body2, response_options);
|
|
140658
140658
|
resolve5(response);
|
|
140659
140659
|
});
|
|
140660
140660
|
writeToStream(req, request);
|
|
@@ -140669,7 +140669,7 @@ var require_lib10 = __commonJS({
|
|
|
140669
140669
|
exports2.default = exports2;
|
|
140670
140670
|
exports2.Headers = Headers3;
|
|
140671
140671
|
exports2.Request = Request;
|
|
140672
|
-
exports2.Response =
|
|
140672
|
+
exports2.Response = Response2;
|
|
140673
140673
|
exports2.FetchError = FetchError;
|
|
140674
140674
|
}
|
|
140675
140675
|
});
|
|
@@ -148290,7 +148290,7 @@ var require_lib11 = __commonJS({
|
|
|
148290
148290
|
}
|
|
148291
148291
|
var INTERNALS$1 = /* @__PURE__ */ Symbol("Response internals");
|
|
148292
148292
|
var STATUS_CODES = http2.STATUS_CODES;
|
|
148293
|
-
var
|
|
148293
|
+
var Response2 = class _Response {
|
|
148294
148294
|
constructor() {
|
|
148295
148295
|
let body2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
148296
148296
|
let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -148348,8 +148348,8 @@ var require_lib11 = __commonJS({
|
|
|
148348
148348
|
});
|
|
148349
148349
|
}
|
|
148350
148350
|
};
|
|
148351
|
-
Body.mixIn(
|
|
148352
|
-
Object.defineProperties(
|
|
148351
|
+
Body.mixIn(Response2.prototype);
|
|
148352
|
+
Object.defineProperties(Response2.prototype, {
|
|
148353
148353
|
url: { enumerable: true },
|
|
148354
148354
|
status: { enumerable: true },
|
|
148355
148355
|
ok: { enumerable: true },
|
|
@@ -148358,7 +148358,7 @@ var require_lib11 = __commonJS({
|
|
|
148358
148358
|
headers: { enumerable: true },
|
|
148359
148359
|
clone: { enumerable: true }
|
|
148360
148360
|
});
|
|
148361
|
-
Object.defineProperty(
|
|
148361
|
+
Object.defineProperty(Response2.prototype, Symbol.toStringTag, {
|
|
148362
148362
|
value: "Response",
|
|
148363
148363
|
writable: false,
|
|
148364
148364
|
enumerable: false,
|
|
@@ -148692,7 +148692,7 @@ var require_lib11 = __commonJS({
|
|
|
148692
148692
|
};
|
|
148693
148693
|
const codings = headers.get("Content-Encoding");
|
|
148694
148694
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
148695
|
-
response = new
|
|
148695
|
+
response = new Response2(body2, response_options);
|
|
148696
148696
|
resolve5(response);
|
|
148697
148697
|
return;
|
|
148698
148698
|
}
|
|
@@ -148702,7 +148702,7 @@ var require_lib11 = __commonJS({
|
|
|
148702
148702
|
};
|
|
148703
148703
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
148704
148704
|
body2 = body2.pipe(zlib.createGunzip(zlibOptions));
|
|
148705
|
-
response = new
|
|
148705
|
+
response = new Response2(body2, response_options);
|
|
148706
148706
|
resolve5(response);
|
|
148707
148707
|
return;
|
|
148708
148708
|
}
|
|
@@ -148714,12 +148714,12 @@ var require_lib11 = __commonJS({
|
|
|
148714
148714
|
} else {
|
|
148715
148715
|
body2 = body2.pipe(zlib.createInflateRaw());
|
|
148716
148716
|
}
|
|
148717
|
-
response = new
|
|
148717
|
+
response = new Response2(body2, response_options);
|
|
148718
148718
|
resolve5(response);
|
|
148719
148719
|
});
|
|
148720
148720
|
raw.on("end", function() {
|
|
148721
148721
|
if (!response) {
|
|
148722
|
-
response = new
|
|
148722
|
+
response = new Response2(body2, response_options);
|
|
148723
148723
|
resolve5(response);
|
|
148724
148724
|
}
|
|
148725
148725
|
});
|
|
@@ -148727,11 +148727,11 @@ var require_lib11 = __commonJS({
|
|
|
148727
148727
|
}
|
|
148728
148728
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
148729
148729
|
body2 = body2.pipe(zlib.createBrotliDecompress());
|
|
148730
|
-
response = new
|
|
148730
|
+
response = new Response2(body2, response_options);
|
|
148731
148731
|
resolve5(response);
|
|
148732
148732
|
return;
|
|
148733
148733
|
}
|
|
148734
|
-
response = new
|
|
148734
|
+
response = new Response2(body2, response_options);
|
|
148735
148735
|
resolve5(response);
|
|
148736
148736
|
});
|
|
148737
148737
|
writeToStream(req, request);
|
|
@@ -148773,7 +148773,7 @@ var require_lib11 = __commonJS({
|
|
|
148773
148773
|
exports2.default = exports2;
|
|
148774
148774
|
exports2.Headers = Headers3;
|
|
148775
148775
|
exports2.Request = Request;
|
|
148776
|
-
exports2.Response =
|
|
148776
|
+
exports2.Response = Response2;
|
|
148777
148777
|
exports2.FetchError = FetchError;
|
|
148778
148778
|
exports2.AbortError = AbortError;
|
|
148779
148779
|
}
|
|
@@ -258648,6 +258648,9 @@ function normalizeGitRepoUrl(url) {
|
|
|
258648
258648
|
// src/lib/postman/internal-integration-adapter.ts
|
|
258649
258649
|
var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter {
|
|
258650
258650
|
static MINIMUM_POSTMAN_APP_VERSION = "12.0.0";
|
|
258651
|
+
/** Per-request wall-clock deadline (ms) so a hung Bifrost proxy or app-version
|
|
258652
|
+
* endpoint aborts rather than blocking the run forever. */
|
|
258653
|
+
static REQUEST_TIMEOUT_MS = 3e4;
|
|
258651
258654
|
static POSTMAN_APP_VERSION_URL = `https://dl.pstmn.io/update/status?currentVersion=${_BifrostInternalIntegrationAdapter.MINIMUM_POSTMAN_APP_VERSION}&platform=osx_arm64`;
|
|
258652
258655
|
accessToken;
|
|
258653
258656
|
tokenProvider;
|
|
@@ -258692,6 +258695,23 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258692
258695
|
mask: this.secretMasker
|
|
258693
258696
|
};
|
|
258694
258697
|
}
|
|
258698
|
+
/**
|
|
258699
|
+
* fetch with a wall-clock deadline. A slow/hung proxy aborts instead of
|
|
258700
|
+
* blocking the run forever; callers surface the abort like any other transport
|
|
258701
|
+
* rejection.
|
|
258702
|
+
*/
|
|
258703
|
+
async fetchWithDeadline(input, init = {}) {
|
|
258704
|
+
const controller = new AbortController();
|
|
258705
|
+
const timer = setTimeout(
|
|
258706
|
+
() => controller.abort(),
|
|
258707
|
+
_BifrostInternalIntegrationAdapter.REQUEST_TIMEOUT_MS
|
|
258708
|
+
);
|
|
258709
|
+
try {
|
|
258710
|
+
return await this.fetchImpl(input, { ...init, signal: controller.signal });
|
|
258711
|
+
} finally {
|
|
258712
|
+
clearTimeout(timer);
|
|
258713
|
+
}
|
|
258714
|
+
}
|
|
258695
258715
|
async proxyRequest(service, method, requestPath2, body2, options = {}) {
|
|
258696
258716
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
258697
258717
|
const headers = {
|
|
@@ -258704,7 +258724,7 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258704
258724
|
if (this.teamId && this.orgMode) {
|
|
258705
258725
|
headers["x-entity-team-id"] = this.teamId;
|
|
258706
258726
|
}
|
|
258707
|
-
return this.
|
|
258727
|
+
return this.fetchWithDeadline(url, {
|
|
258708
258728
|
method: "POST",
|
|
258709
258729
|
headers,
|
|
258710
258730
|
body: JSON.stringify({
|
|
@@ -258719,7 +258739,7 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258719
258739
|
resolvePostmanAppVersion() {
|
|
258720
258740
|
this.appVersionPromise ??= (async () => {
|
|
258721
258741
|
try {
|
|
258722
|
-
const response = await this.
|
|
258742
|
+
const response = await this.fetchWithDeadline(
|
|
258723
258743
|
_BifrostInternalIntegrationAdapter.POSTMAN_APP_VERSION_URL,
|
|
258724
258744
|
{ method: "GET" }
|
|
258725
258745
|
);
|
|
@@ -263921,6 +263941,25 @@ function asRecord8(value) {
|
|
|
263921
263941
|
}
|
|
263922
263942
|
return value;
|
|
263923
263943
|
}
|
|
263944
|
+
var BOOTSTRAP_BARE_UUID_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
263945
|
+
function isMissingPatchValueError(error2) {
|
|
263946
|
+
return error2 instanceof HttpError && error2.status === 400 && error2.responseBody.includes("Remove operation must point to an existing value");
|
|
263947
|
+
}
|
|
263948
|
+
function canonicalize(value) {
|
|
263949
|
+
if (Array.isArray(value)) return value.map(canonicalize);
|
|
263950
|
+
if (value && typeof value === "object") {
|
|
263951
|
+
const record = value;
|
|
263952
|
+
const out = {};
|
|
263953
|
+
for (const key of Object.keys(record).sort()) {
|
|
263954
|
+
out[key] = canonicalize(record[key]);
|
|
263955
|
+
}
|
|
263956
|
+
return out;
|
|
263957
|
+
}
|
|
263958
|
+
return value;
|
|
263959
|
+
}
|
|
263960
|
+
function deepEqual(a, b) {
|
|
263961
|
+
return JSON.stringify(canonicalize(a)) === JSON.stringify(canonicalize(b));
|
|
263962
|
+
}
|
|
263924
263963
|
function resolvePollBudget(explicit, envValue, fallback, min) {
|
|
263925
263964
|
if (typeof explicit === "number" && Number.isFinite(explicit) && explicit >= min) return explicit;
|
|
263926
263965
|
if (envValue !== void 0) {
|
|
@@ -264101,6 +264140,9 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264101
264140
|
service: "specification",
|
|
264102
264141
|
method: "patch",
|
|
264103
264142
|
path: `/specifications/${specId}/files/${fileId}`,
|
|
264143
|
+
// Replacing the ROOT file content with the same value is idempotent, so a
|
|
264144
|
+
// transient downstream timeout (ESOCKETTIMEDOUT) is safe to retry.
|
|
264145
|
+
retry: "safe",
|
|
264104
264146
|
body: [{ op: "replace", path: "/content", value: specContent }]
|
|
264105
264147
|
});
|
|
264106
264148
|
}
|
|
@@ -264483,9 +264525,16 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264483
264525
|
// (live-proven 2026-07-14 on team 172912 / Northwind — immediate post-generation
|
|
264484
264526
|
// `GET .../items/` returns 403 FORBIDDEN with bare id, 200 with full uid).
|
|
264485
264527
|
// The tagging service is distinct and takes the FULL uid.
|
|
264486
|
-
/**
|
|
264528
|
+
/**
|
|
264529
|
+
* `<owner>-<uuid>` public uid -> bare `<uuid>` model id (collection ROOT routes
|
|
264530
|
+
* only). Strip ONLY the numeric owner prefix of a full public uid; a bare UUID
|
|
264531
|
+
* (which itself contains hyphens) must pass through unchanged, so a naive
|
|
264532
|
+
* split on the first hyphen — which would lop off a UUID's first segment — is
|
|
264533
|
+
* rejected here in favour of an anchored `<digits>-<uuid>` match.
|
|
264534
|
+
*/
|
|
264487
264535
|
bareModelId(uid) {
|
|
264488
264536
|
const u = String(uid ?? "").trim();
|
|
264537
|
+
if (BOOTSTRAP_BARE_UUID_RE.test(u)) return u;
|
|
264489
264538
|
return u.includes("-") ? u.slice(u.indexOf("-") + 1) : u;
|
|
264490
264539
|
}
|
|
264491
264540
|
/**
|
|
@@ -265096,12 +265145,61 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265096
265145
|
ops.push({ op: "remove", path: "/scripts" });
|
|
265097
265146
|
}
|
|
265098
265147
|
if (ops.length === 0) return;
|
|
265099
|
-
|
|
265100
|
-
|
|
265101
|
-
|
|
265102
|
-
|
|
265103
|
-
|
|
265104
|
-
|
|
265148
|
+
try {
|
|
265149
|
+
await this.gateway.requestJson({
|
|
265150
|
+
service: "collection",
|
|
265151
|
+
method: "patch",
|
|
265152
|
+
path: `/v3/collections/${cid}`,
|
|
265153
|
+
// Fixed-path add/replace ops are idempotent, and a remove that already
|
|
265154
|
+
// committed is reconciled below, so transient downstream timeouts
|
|
265155
|
+
// (ESOCKETTIMEDOUT) are safe to retry.
|
|
265156
|
+
retry: "safe",
|
|
265157
|
+
body: ops
|
|
265158
|
+
});
|
|
265159
|
+
} catch (error2) {
|
|
265160
|
+
if (isMissingPatchValueError(error2) && ops.some((op) => op.op === "remove") && await this.verifyRootSettingsApplied(cid, ops)) {
|
|
265161
|
+
return;
|
|
265162
|
+
}
|
|
265163
|
+
throw error2;
|
|
265164
|
+
}
|
|
265165
|
+
}
|
|
265166
|
+
/**
|
|
265167
|
+
* Read the collection root and check that every JSON-Patch op's intended end
|
|
265168
|
+
* state holds. add/replace targets must be structurally equal to the exact
|
|
265169
|
+
* requested value (a stale pre-PATCH description/auth/variables/scripts is
|
|
265170
|
+
* non-null but not equal, so it can never falsely verify); remove targets must
|
|
265171
|
+
* be absent (description clears to "" rather than disappearing).
|
|
265172
|
+
*/
|
|
265173
|
+
async verifyRootSettingsApplied(cid, ops) {
|
|
265174
|
+
let current;
|
|
265175
|
+
try {
|
|
265176
|
+
const got = await this.gateway.requestJson({
|
|
265177
|
+
service: "collection",
|
|
265178
|
+
method: "get",
|
|
265179
|
+
path: `/v3/collections/${cid}`
|
|
265180
|
+
});
|
|
265181
|
+
current = asRecord8(got?.data);
|
|
265182
|
+
} catch {
|
|
265183
|
+
return false;
|
|
265184
|
+
}
|
|
265185
|
+
if (!current) return false;
|
|
265186
|
+
for (const op of ops) {
|
|
265187
|
+
const rawPath = String(op.path ?? "");
|
|
265188
|
+
const field = rawPath.startsWith("/") ? rawPath.slice(1) : rawPath;
|
|
265189
|
+
if (!field) return false;
|
|
265190
|
+
const value = current[field];
|
|
265191
|
+
if (op.op === "remove") {
|
|
265192
|
+
if (field === "description") {
|
|
265193
|
+
if (typeof value === "string" && value.length > 0) return false;
|
|
265194
|
+
} else if (!(value === void 0 || value === null || Array.isArray(value) && value.length === 0)) {
|
|
265195
|
+
return false;
|
|
265196
|
+
}
|
|
265197
|
+
} else {
|
|
265198
|
+
if (value === void 0 || value === null) return false;
|
|
265199
|
+
if (!deepEqual(value, op.value)) return false;
|
|
265200
|
+
}
|
|
265201
|
+
}
|
|
265202
|
+
return true;
|
|
265105
265203
|
}
|
|
265106
265204
|
/**
|
|
265107
265205
|
* Create a curated local v2.1.0 or collection v3 payload through the gateway v3 write
|
|
@@ -265224,6 +265322,36 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265224
265322
|
function isExpiredAuthError(status, body2) {
|
|
265225
265323
|
return status === 401 || body2.includes("UNAUTHENTICATED") || body2.includes("authenticationError");
|
|
265226
265324
|
}
|
|
265325
|
+
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
265326
|
+
function asRecord9(value) {
|
|
265327
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
265328
|
+
}
|
|
265329
|
+
function innerEnvelopeStatus(envelope) {
|
|
265330
|
+
for (const key of ["status", "statusCode"]) {
|
|
265331
|
+
const value = envelope[key];
|
|
265332
|
+
if (typeof value === "number") return value;
|
|
265333
|
+
if (typeof value === "string" && /^\d+$/.test(value)) return Number(value);
|
|
265334
|
+
}
|
|
265335
|
+
return void 0;
|
|
265336
|
+
}
|
|
265337
|
+
function detectInnerError(body2) {
|
|
265338
|
+
const trimmed = body2.trim();
|
|
265339
|
+
if (!trimmed) return null;
|
|
265340
|
+
let parsed;
|
|
265341
|
+
try {
|
|
265342
|
+
parsed = JSON.parse(trimmed);
|
|
265343
|
+
} catch {
|
|
265344
|
+
return null;
|
|
265345
|
+
}
|
|
265346
|
+
const envelope = asRecord9(parsed);
|
|
265347
|
+
if (!envelope) return null;
|
|
265348
|
+
const innerStatus = innerEnvelopeStatus(envelope);
|
|
265349
|
+
const error2 = envelope.error;
|
|
265350
|
+
const errorRecord = asRecord9(error2);
|
|
265351
|
+
const hasError = error2 !== void 0 && error2 !== null && !(errorRecord !== null && Object.keys(errorRecord).length === 0) || envelope.success === false || typeof innerStatus === "number" && innerStatus >= 400;
|
|
265352
|
+
if (!hasError) return null;
|
|
265353
|
+
return typeof innerStatus === "number" && innerStatus >= 400 ? innerStatus : 502;
|
|
265354
|
+
}
|
|
265227
265355
|
function isTransientGatewayError(status, body2) {
|
|
265228
265356
|
if (status === 502 || status === 503 || status === 504) return true;
|
|
265229
265357
|
if (status >= 500 && (body2.includes("ESOCKETTIMEDOUT") || body2.includes("ETIMEDOUT") || body2.includes("ECONNRESET") || body2.includes("serverError") || body2.includes("downstream"))) {
|
|
@@ -265243,6 +265371,7 @@ var AccessTokenGatewayClient = class {
|
|
|
265243
265371
|
secretMasker;
|
|
265244
265372
|
maxRetries;
|
|
265245
265373
|
retryBaseDelayMs;
|
|
265374
|
+
requestTimeoutMs;
|
|
265246
265375
|
sleepImpl;
|
|
265247
265376
|
constructor(options) {
|
|
265248
265377
|
this.tokenProvider = options.tokenProvider;
|
|
@@ -265255,6 +265384,7 @@ var AccessTokenGatewayClient = class {
|
|
|
265255
265384
|
this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
|
|
265256
265385
|
this.maxRetries = options.maxRetries ?? 3;
|
|
265257
265386
|
this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
|
|
265387
|
+
this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
265258
265388
|
this.sleepImpl = options.sleepImpl ?? defaultSleep;
|
|
265259
265389
|
}
|
|
265260
265390
|
configureTeamContext(teamId, orgMode) {
|
|
@@ -265274,45 +265404,83 @@ var AccessTokenGatewayClient = class {
|
|
|
265274
265404
|
}
|
|
265275
265405
|
async send(request) {
|
|
265276
265406
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
265277
|
-
|
|
265278
|
-
|
|
265279
|
-
|
|
265280
|
-
|
|
265281
|
-
|
|
265282
|
-
|
|
265283
|
-
|
|
265284
|
-
|
|
265285
|
-
|
|
265286
|
-
|
|
265287
|
-
|
|
265407
|
+
const controller = new AbortController();
|
|
265408
|
+
const timer = setTimeout(() => controller.abort(), this.requestTimeoutMs);
|
|
265409
|
+
try {
|
|
265410
|
+
return await this.fetchImpl(url, {
|
|
265411
|
+
method: "POST",
|
|
265412
|
+
headers: this.buildHeaders(request.headers),
|
|
265413
|
+
signal: controller.signal,
|
|
265414
|
+
body: JSON.stringify({
|
|
265415
|
+
service: request.service,
|
|
265416
|
+
method: request.method,
|
|
265417
|
+
path: request.path,
|
|
265418
|
+
...request.query !== void 0 ? { query: request.query } : {},
|
|
265419
|
+
...request.body !== void 0 ? { body: request.body } : {}
|
|
265420
|
+
})
|
|
265421
|
+
});
|
|
265422
|
+
} finally {
|
|
265423
|
+
clearTimeout(timer);
|
|
265424
|
+
}
|
|
265288
265425
|
}
|
|
265289
265426
|
/**
|
|
265290
265427
|
* Send a gateway request, refreshing the token once on an auth failure and
|
|
265291
|
-
* retrying transient
|
|
265292
|
-
*
|
|
265293
|
-
*
|
|
265428
|
+
* retrying transient failures with exponential backoff. Transient covers both
|
|
265429
|
+
* HTTP 5xx / Bifrost read timeouts AND transport-level rejections (fetch
|
|
265430
|
+
* throwing on a socket hangup or the per-request deadline aborting) — a
|
|
265431
|
+
* `retry: 'safe'` request retries either; a `retry: 'none'` mutation surfaces
|
|
265432
|
+
* the failure so the caller reconciles instead of blindly resending. An HTTP
|
|
265433
|
+
* 200 envelope carrying an inner collection-service error is treated as that
|
|
265434
|
+
* inner status. The auth-refresh-once path is independent of the retry budget.
|
|
265294
265435
|
*/
|
|
265295
265436
|
async request(request) {
|
|
265296
265437
|
if (!this.tokenProvider.current() && this.tokenProvider.canRefresh()) {
|
|
265297
265438
|
await this.tokenProvider.refresh();
|
|
265298
265439
|
}
|
|
265440
|
+
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
265299
265441
|
let attempt = 0;
|
|
265300
265442
|
for (; ; ) {
|
|
265301
|
-
let response
|
|
265443
|
+
let response;
|
|
265444
|
+
try {
|
|
265445
|
+
response = await this.send(request);
|
|
265446
|
+
} catch (error2) {
|
|
265447
|
+
if (retryMode === "safe" && attempt < this.maxRetries) {
|
|
265448
|
+
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265449
|
+
attempt += 1;
|
|
265450
|
+
await this.sleepImpl(delay);
|
|
265451
|
+
continue;
|
|
265452
|
+
}
|
|
265453
|
+
throw error2;
|
|
265454
|
+
}
|
|
265302
265455
|
if (response.ok) {
|
|
265303
|
-
|
|
265456
|
+
const okBody = await response.text().catch(() => "");
|
|
265457
|
+
const innerStatus = detectInnerError(okBody);
|
|
265458
|
+
if (innerStatus !== null) {
|
|
265459
|
+
if (retryMode === "safe" && isTransientGatewayError(innerStatus, okBody) && attempt < this.maxRetries) {
|
|
265460
|
+
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265461
|
+
attempt += 1;
|
|
265462
|
+
await this.sleepImpl(delay);
|
|
265463
|
+
continue;
|
|
265464
|
+
}
|
|
265465
|
+
throw this.toInnerHttpError(request, innerStatus, okBody);
|
|
265466
|
+
}
|
|
265467
|
+
return this.rebuildResponse(response, okBody);
|
|
265304
265468
|
}
|
|
265305
265469
|
const body2 = await response.text().catch(() => "");
|
|
265306
265470
|
if (isExpiredAuthError(response.status, body2) && this.tokenProvider.canRefresh()) {
|
|
265307
265471
|
await this.tokenProvider.refresh();
|
|
265308
265472
|
response = await this.send(request);
|
|
265309
265473
|
if (response.ok) {
|
|
265310
|
-
|
|
265474
|
+
const refreshedBody = await response.text().catch(() => "");
|
|
265475
|
+
const innerStatus = detectInnerError(refreshedBody);
|
|
265476
|
+
if (innerStatus !== null) {
|
|
265477
|
+
throw this.toInnerHttpError(request, innerStatus, refreshedBody);
|
|
265478
|
+
}
|
|
265479
|
+
return this.rebuildResponse(response, refreshedBody);
|
|
265311
265480
|
}
|
|
265312
265481
|
const retryBody = await response.text().catch(() => "");
|
|
265313
265482
|
throw this.toHttpError(request, response, retryBody);
|
|
265314
265483
|
}
|
|
265315
|
-
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
265316
265484
|
if (retryMode === "safe" && isTransientGatewayError(response.status, body2) && attempt < this.maxRetries) {
|
|
265317
265485
|
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265318
265486
|
attempt += 1;
|
|
@@ -265322,6 +265490,18 @@ var AccessTokenGatewayClient = class {
|
|
|
265322
265490
|
throw this.toHttpError(request, response, body2);
|
|
265323
265491
|
}
|
|
265324
265492
|
}
|
|
265493
|
+
/**
|
|
265494
|
+
* The success path reads the body to inspect for an inner error, which
|
|
265495
|
+
* consumes the stream. Hand callers a fresh Response over the buffered text so
|
|
265496
|
+
* `requestJson` can still parse it.
|
|
265497
|
+
*/
|
|
265498
|
+
rebuildResponse(response, body2) {
|
|
265499
|
+
return new Response(body2, {
|
|
265500
|
+
status: response.status,
|
|
265501
|
+
statusText: response.statusText,
|
|
265502
|
+
headers: response.headers
|
|
265503
|
+
});
|
|
265504
|
+
}
|
|
265325
265505
|
/** Send a gateway request and parse the JSON body, or null when empty. */
|
|
265326
265506
|
async requestJson(request) {
|
|
265327
265507
|
const response = await this.request(request);
|
|
@@ -265346,6 +265526,17 @@ var AccessTokenGatewayClient = class {
|
|
|
265346
265526
|
secretValues: [this.tokenProvider.current()]
|
|
265347
265527
|
});
|
|
265348
265528
|
}
|
|
265529
|
+
toInnerHttpError(request, status, body2) {
|
|
265530
|
+
return new HttpError({
|
|
265531
|
+
method: request.method.toUpperCase(),
|
|
265532
|
+
url: `${this.bifrostBaseUrl}/ws/proxy (${request.service}: ${request.method} ${request.path}) [inner]`,
|
|
265533
|
+
status,
|
|
265534
|
+
statusText: "Inner Error",
|
|
265535
|
+
requestHeaders: this.buildHeaders(request.headers),
|
|
265536
|
+
responseBody: this.secretMasker(body2),
|
|
265537
|
+
secretValues: [this.tokenProvider.current()]
|
|
265538
|
+
});
|
|
265539
|
+
}
|
|
265349
265540
|
};
|
|
265350
265541
|
|
|
265351
265542
|
// src/lib/postman/token-provider.ts
|
|
@@ -281663,7 +281854,7 @@ function compileErrors(result) {
|
|
|
281663
281854
|
|
|
281664
281855
|
// src/lib/spec/openapi-loader.ts
|
|
281665
281856
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
281666
|
-
function
|
|
281857
|
+
function asRecord10(value) {
|
|
281667
281858
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
281668
281859
|
return value;
|
|
281669
281860
|
}
|
|
@@ -281678,7 +281869,7 @@ function parseOpenApiDocument(content) {
|
|
|
281678
281869
|
throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content is not valid JSON or YAML");
|
|
281679
281870
|
}
|
|
281680
281871
|
}
|
|
281681
|
-
const doc =
|
|
281872
|
+
const doc = asRecord10(parsed);
|
|
281682
281873
|
if (!doc) throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content must be a JSON or YAML object");
|
|
281683
281874
|
return doc;
|
|
281684
281875
|
}
|
|
@@ -281706,7 +281897,7 @@ function collectExternalRefs(node, baseUrl, refs) {
|
|
|
281706
281897
|
node.forEach((entry) => collectExternalRefs(entry, baseUrl, refs));
|
|
281707
281898
|
return;
|
|
281708
281899
|
}
|
|
281709
|
-
const record =
|
|
281900
|
+
const record = asRecord10(node);
|
|
281710
281901
|
if (!record) return;
|
|
281711
281902
|
const ref = typeof record.$ref === "string" ? record.$ref : "";
|
|
281712
281903
|
if (ref && !ref.startsWith("#")) {
|
|
@@ -294302,7 +294493,7 @@ function buildGraphQLCollection(index, opts = {}) {
|
|
|
294302
294493
|
}
|
|
294303
294494
|
|
|
294304
294495
|
// src/lib/protocols/graphql/schema-lints.ts
|
|
294305
|
-
function
|
|
294496
|
+
function asRecord11(value) {
|
|
294306
294497
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294307
294498
|
return value;
|
|
294308
294499
|
}
|
|
@@ -294313,7 +294504,7 @@ var BUILT_IN_SCALAR_NAMES = new Set(specifiedScalarTypes.map((scalar) => scalar.
|
|
|
294313
294504
|
var VALID_TYPE_KINDS = /* @__PURE__ */ new Set(["SCALAR", "OBJECT", "INTERFACE", "UNION", "ENUM", "INPUT_OBJECT", "LIST", "NON_NULL"]);
|
|
294314
294505
|
var VALID_DIRECTIVE_LOCATIONS = new Set(Object.values(DirectiveLocation));
|
|
294315
294506
|
function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
294316
|
-
const current =
|
|
294507
|
+
const current = asRecord11(ref);
|
|
294317
294508
|
if (!current || depth > 32 || typeof current.kind !== "string") return null;
|
|
294318
294509
|
if (current.kind === "NON_NULL") {
|
|
294319
294510
|
const inner = renderIntrospectionTypeRef(current.ofType, depth + 1);
|
|
@@ -294326,12 +294517,12 @@ function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
|
294326
294517
|
return typeof current.name === "string" && current.name.length > 0 ? current.name : null;
|
|
294327
294518
|
}
|
|
294328
294519
|
function readIntrospectionDirectiveShape(value) {
|
|
294329
|
-
const directive =
|
|
294520
|
+
const directive = asRecord11(value);
|
|
294330
294521
|
if (!directive || typeof directive.isRepeatable !== "boolean") return null;
|
|
294331
294522
|
return {
|
|
294332
294523
|
isRepeatable: directive.isRepeatable,
|
|
294333
294524
|
locations: asArray5(directive.locations).filter((entry) => typeof entry === "string"),
|
|
294334
|
-
args: asArray5(directive.args).map(
|
|
294525
|
+
args: asArray5(directive.args).map(asRecord11).filter((entry) => entry !== null && typeof entry.name === "string").map((arg) => ({
|
|
294335
294526
|
name: arg.name,
|
|
294336
294527
|
type: renderIntrospectionTypeRef(arg.type),
|
|
294337
294528
|
defaultValue: Object.prototype.hasOwnProperty.call(arg, "defaultValue") ? arg.defaultValue : void 0
|
|
@@ -294341,10 +294532,10 @@ function readIntrospectionDirectiveShape(value) {
|
|
|
294341
294532
|
var BUILT_IN_INTROSPECTION_DIRECTIVE_SHAPES = (() => {
|
|
294342
294533
|
const shapes = /* @__PURE__ */ new Map();
|
|
294343
294534
|
const reference = introspectionFromSchema(buildSchema("type Query { _: Boolean }"));
|
|
294344
|
-
const schemaRecord =
|
|
294535
|
+
const schemaRecord = asRecord11(asRecord11(reference)?.__schema);
|
|
294345
294536
|
if (!schemaRecord) return shapes;
|
|
294346
294537
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
294347
|
-
const directive =
|
|
294538
|
+
const directive = asRecord11(entry);
|
|
294348
294539
|
if (!directive || typeof directive.name !== "string") continue;
|
|
294349
294540
|
const shape = readIntrospectionDirectiveShape(directive);
|
|
294350
294541
|
if (shape) shapes.set(directive.name, shape);
|
|
@@ -294440,11 +294631,11 @@ function lintDirectiveDefinitions(schema) {
|
|
|
294440
294631
|
const warnings = [];
|
|
294441
294632
|
const builtIn = new Set(specifiedDirectives.map((directive) => directive.name));
|
|
294442
294633
|
const usesDirective = (astNode, name) => {
|
|
294443
|
-
const record =
|
|
294634
|
+
const record = asRecord11(astNode);
|
|
294444
294635
|
if (!record) return false;
|
|
294445
294636
|
return asArray5(record.directives).some((entry) => {
|
|
294446
|
-
const applied =
|
|
294447
|
-
const appliedName = applied ?
|
|
294637
|
+
const applied = asRecord11(entry);
|
|
294638
|
+
const appliedName = applied ? asRecord11(applied.name) : null;
|
|
294448
294639
|
return Boolean(appliedName && appliedName.value === name);
|
|
294449
294640
|
});
|
|
294450
294641
|
};
|
|
@@ -294454,7 +294645,7 @@ function lintDirectiveDefinitions(schema) {
|
|
|
294454
294645
|
warnings.push("GQL_DIRECTIVE_NAME_RESERVED: directive @" + directive.name + ' must not begin with "__" (GraphQL spec 3.13)');
|
|
294455
294646
|
}
|
|
294456
294647
|
let selfReferenced = false;
|
|
294457
|
-
const ownAst =
|
|
294648
|
+
const ownAst = asRecord11(directive.astNode);
|
|
294458
294649
|
if (ownAst) {
|
|
294459
294650
|
for (const argNode of asArray5(ownAst.arguments)) {
|
|
294460
294651
|
if (usesDirective(argNode, directive.name)) selfReferenced = true;
|
|
@@ -294598,10 +294789,10 @@ function lintSdlDocument(sdl) {
|
|
|
294598
294789
|
return warnings;
|
|
294599
294790
|
}
|
|
294600
294791
|
function lintTypeRefChain(ref, context, warnings) {
|
|
294601
|
-
let current =
|
|
294792
|
+
let current = asRecord11(ref);
|
|
294602
294793
|
let depth = 0;
|
|
294603
294794
|
while (current && depth < 32) {
|
|
294604
|
-
const ofType =
|
|
294795
|
+
const ofType = asRecord11(current.ofType);
|
|
294605
294796
|
if (current.kind === "NON_NULL" && ofType && ofType.kind === "NON_NULL") {
|
|
294606
294797
|
warnings.push("GQL_INTROSPECTION_NONNULL_NESTED: " + context + " wraps NON_NULL directly inside NON_NULL, which the type system forbids (GraphQL spec 3.12)");
|
|
294607
294798
|
return;
|
|
@@ -294612,7 +294803,7 @@ function lintTypeRefChain(ref, context, warnings) {
|
|
|
294612
294803
|
}
|
|
294613
294804
|
function lintDeprecationFlags(entries, context, warnings) {
|
|
294614
294805
|
for (const entry of entries) {
|
|
294615
|
-
const record =
|
|
294806
|
+
const record = asRecord11(entry);
|
|
294616
294807
|
if (!record) continue;
|
|
294617
294808
|
const label = context + "." + (typeof record.name === "string" ? record.name : "<unnamed>");
|
|
294618
294809
|
if (record.isDeprecated !== void 0 && typeof record.isDeprecated !== "boolean") {
|
|
@@ -294633,7 +294824,7 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
294633
294824
|
const warnings = [];
|
|
294634
294825
|
const directives = /* @__PURE__ */ new Map();
|
|
294635
294826
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
294636
|
-
const directive =
|
|
294827
|
+
const directive = asRecord11(entry);
|
|
294637
294828
|
if (directive && typeof directive.name === "string" && !directives.has(directive.name)) {
|
|
294638
294829
|
directives.set(directive.name, directive);
|
|
294639
294830
|
}
|
|
@@ -294687,13 +294878,13 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
294687
294878
|
}
|
|
294688
294879
|
function lintIntrospectionJson(introspection) {
|
|
294689
294880
|
const warnings = [];
|
|
294690
|
-
const root =
|
|
294691
|
-
const dataRecord = root ?
|
|
294692
|
-
const schemaRecord = root ?
|
|
294881
|
+
const root = asRecord11(introspection);
|
|
294882
|
+
const dataRecord = root ? asRecord11(root.data) : null;
|
|
294883
|
+
const schemaRecord = root ? asRecord11(root.__schema) ?? (dataRecord ? asRecord11(dataRecord.__schema) : null) : null;
|
|
294693
294884
|
if (!schemaRecord) return warnings;
|
|
294694
294885
|
const typeCounts = /* @__PURE__ */ new Map();
|
|
294695
294886
|
for (const entry of asArray5(schemaRecord.types)) {
|
|
294696
|
-
const type =
|
|
294887
|
+
const type = asRecord11(entry);
|
|
294697
294888
|
if (!type) continue;
|
|
294698
294889
|
const name = typeof type.name === "string" ? type.name : "<unnamed>";
|
|
294699
294890
|
typeCounts.set(name, (typeCounts.get(name) ?? 0) + 1);
|
|
@@ -294701,7 +294892,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294701
294892
|
warnings.push("GQL_INTROSPECTION_KIND_INVALID: type " + name + " declares unknown __TypeKind '" + type.kind + "'");
|
|
294702
294893
|
}
|
|
294703
294894
|
for (const memberEntry of asArray5(type.possibleTypes)) {
|
|
294704
|
-
const member =
|
|
294895
|
+
const member = asRecord11(memberEntry);
|
|
294705
294896
|
if (member && member.kind !== void 0 && member.kind !== "OBJECT") {
|
|
294706
294897
|
warnings.push("GQL_INTROSPECTION_POSSIBLE_TYPE_NOT_OBJECT: " + name + ".possibleTypes entry " + String(member.name ?? "<unnamed>") + " has kind " + String(member.kind) + "; union/interface possible types must be OBJECT types (GraphQL spec 3.7/3.8)");
|
|
294707
294898
|
}
|
|
@@ -294709,18 +294900,18 @@ function lintIntrospectionJson(introspection) {
|
|
|
294709
294900
|
lintDeprecationFlags(asArray5(type.fields), name + ".fields", warnings);
|
|
294710
294901
|
lintDeprecationFlags(asArray5(type.enumValues), name + ".enumValues", warnings);
|
|
294711
294902
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
294712
|
-
const field =
|
|
294903
|
+
const field = asRecord11(fieldEntry);
|
|
294713
294904
|
if (!field) continue;
|
|
294714
294905
|
const fieldLabel = name + "." + String(field.name ?? "<unnamed>");
|
|
294715
294906
|
lintTypeRefChain(field.type, fieldLabel, warnings);
|
|
294716
294907
|
for (const argEntry of asArray5(field.args)) {
|
|
294717
|
-
const arg =
|
|
294908
|
+
const arg = asRecord11(argEntry);
|
|
294718
294909
|
if (arg) lintTypeRefChain(arg.type, fieldLabel + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
294719
294910
|
}
|
|
294720
294911
|
lintDeprecationFlags(asArray5(field.args), fieldLabel + ".args", warnings);
|
|
294721
294912
|
}
|
|
294722
294913
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
294723
|
-
const input =
|
|
294914
|
+
const input = asRecord11(inputEntry);
|
|
294724
294915
|
if (input) lintTypeRefChain(input.type, name + "." + String(input.name ?? "<unnamed>"), warnings);
|
|
294725
294916
|
}
|
|
294726
294917
|
lintDeprecationFlags(asArray5(type.inputFields), name + ".inputFields", warnings);
|
|
@@ -294732,7 +294923,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294732
294923
|
}
|
|
294733
294924
|
const directiveNameCounts = /* @__PURE__ */ new Map();
|
|
294734
294925
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
294735
|
-
const directive =
|
|
294926
|
+
const directive = asRecord11(directiveEntry);
|
|
294736
294927
|
if (!directive) continue;
|
|
294737
294928
|
if (typeof directive.name !== "string" || directive.name.length === 0) {
|
|
294738
294929
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: a __schema.directives entry is missing its name");
|
|
@@ -294748,7 +294939,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294748
294939
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: directive @" + directive.name + " isRepeatable must be a boolean (__Directive contract)");
|
|
294749
294940
|
}
|
|
294750
294941
|
for (const argEntry of asArray5(directive.args)) {
|
|
294751
|
-
const arg =
|
|
294942
|
+
const arg = asRecord11(argEntry);
|
|
294752
294943
|
if (arg) lintTypeRefChain(arg.type, "@" + directive.name + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
294753
294944
|
}
|
|
294754
294945
|
lintDeprecationFlags(asArray5(directive.args), "@" + directive.name + ".args", warnings);
|
|
@@ -294767,7 +294958,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294767
294958
|
return warnings;
|
|
294768
294959
|
}
|
|
294769
294960
|
function introspectionTypeEntries(schemaRecord) {
|
|
294770
|
-
return asArray5(schemaRecord.types).map(
|
|
294961
|
+
return asArray5(schemaRecord.types).map(asRecord11).filter((entry) => entry !== null);
|
|
294771
294962
|
}
|
|
294772
294963
|
function introspectionTypesByName(entries) {
|
|
294773
294964
|
const byName = /* @__PURE__ */ new Map();
|
|
@@ -294778,7 +294969,7 @@ function introspectionTypesByName(entries) {
|
|
|
294778
294969
|
}
|
|
294779
294970
|
function describeIntrospectionRootRecord(value) {
|
|
294780
294971
|
if (value === void 0 || value === null) return "<missing>";
|
|
294781
|
-
const record =
|
|
294972
|
+
const record = asRecord11(value);
|
|
294782
294973
|
if (!record) return "<invalid>";
|
|
294783
294974
|
return typeof record.name === "string" && record.name.length > 0 ? record.name : "<unnamed>";
|
|
294784
294975
|
}
|
|
@@ -294798,7 +294989,7 @@ function lintIntrospectionRootMap(schemaRecord) {
|
|
|
294798
294989
|
}
|
|
294799
294990
|
continue;
|
|
294800
294991
|
}
|
|
294801
|
-
const record =
|
|
294992
|
+
const record = asRecord11(value);
|
|
294802
294993
|
if (!record || typeof record.name !== "string" || record.name.length === 0) {
|
|
294803
294994
|
warnings.push("GQL_INTROSPECTION_ROOT_INVALID: __schema." + rootKind + "Type must name the " + rootKind + " root operation type (GraphQL spec 3.3). Root map: " + rootMap);
|
|
294804
294995
|
continue;
|
|
@@ -294858,13 +295049,13 @@ function lintIntrospectionTypeMatrix(schemaRecord) {
|
|
|
294858
295049
|
return warnings;
|
|
294859
295050
|
}
|
|
294860
295051
|
function namedTypeRefName(ref) {
|
|
294861
|
-
let current =
|
|
295052
|
+
let current = asRecord11(ref);
|
|
294862
295053
|
let depth = 0;
|
|
294863
295054
|
while (current && depth < 32) {
|
|
294864
295055
|
if (current.kind !== "LIST" && current.kind !== "NON_NULL") {
|
|
294865
295056
|
return typeof current.name === "string" ? current.name : null;
|
|
294866
295057
|
}
|
|
294867
|
-
current =
|
|
295058
|
+
current = asRecord11(current.ofType);
|
|
294868
295059
|
depth += 1;
|
|
294869
295060
|
}
|
|
294870
295061
|
return null;
|
|
@@ -294878,31 +295069,31 @@ function lintIntrospectionReferenceGraph(schemaRecord) {
|
|
|
294878
295069
|
if (name) referenced.add(name);
|
|
294879
295070
|
};
|
|
294880
295071
|
for (const rootKind of ["query", "mutation", "subscription"]) {
|
|
294881
|
-
const record =
|
|
295072
|
+
const record = asRecord11(schemaRecord[rootKind + "Type"]);
|
|
294882
295073
|
if (record && typeof record.name === "string") referenced.add(record.name);
|
|
294883
295074
|
}
|
|
294884
295075
|
for (const type of entries) {
|
|
294885
295076
|
for (const entry of asArray5(type.interfaces)) addRef(namedTypeRefName(entry));
|
|
294886
295077
|
for (const entry of asArray5(type.possibleTypes)) addRef(namedTypeRefName(entry));
|
|
294887
295078
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
294888
|
-
const field =
|
|
295079
|
+
const field = asRecord11(fieldEntry);
|
|
294889
295080
|
if (!field) continue;
|
|
294890
295081
|
addRef(namedTypeRefName(field.type));
|
|
294891
295082
|
for (const argEntry of asArray5(field.args)) {
|
|
294892
|
-
const arg =
|
|
295083
|
+
const arg = asRecord11(argEntry);
|
|
294893
295084
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
294894
295085
|
}
|
|
294895
295086
|
}
|
|
294896
295087
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
294897
|
-
const input =
|
|
295088
|
+
const input = asRecord11(inputEntry);
|
|
294898
295089
|
if (input) addRef(namedTypeRefName(input.type));
|
|
294899
295090
|
}
|
|
294900
295091
|
}
|
|
294901
295092
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
294902
|
-
const directive =
|
|
295093
|
+
const directive = asRecord11(directiveEntry);
|
|
294903
295094
|
if (!directive) continue;
|
|
294904
295095
|
for (const argEntry of asArray5(directive.args)) {
|
|
294905
|
-
const arg =
|
|
295096
|
+
const arg = asRecord11(argEntry);
|
|
294906
295097
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
294907
295098
|
}
|
|
294908
295099
|
}
|
|
@@ -294923,7 +295114,7 @@ function lintIntrospectionAbstractConsistency(schemaRecord) {
|
|
|
294923
295114
|
const entries = introspectionTypeEntries(schemaRecord);
|
|
294924
295115
|
const byName = introspectionTypesByName(entries);
|
|
294925
295116
|
const names = (value) => asArray5(value).map((entry) => {
|
|
294926
|
-
const record =
|
|
295117
|
+
const record = asRecord11(entry);
|
|
294927
295118
|
return record && typeof record.name === "string" ? record.name : "";
|
|
294928
295119
|
}).filter((name) => name.length > 0);
|
|
294929
295120
|
for (const type of entries) {
|
|
@@ -294952,7 +295143,7 @@ function lintIntrospectionDeprecationProvenance(schemaRecord) {
|
|
|
294952
295143
|
let flagged = 0;
|
|
294953
295144
|
for (const type of introspectionTypeEntries(schemaRecord)) {
|
|
294954
295145
|
for (const entry of [...asArray5(type.fields), ...asArray5(type.enumValues)]) {
|
|
294955
|
-
const record =
|
|
295146
|
+
const record = asRecord11(entry);
|
|
294956
295147
|
if (!record) continue;
|
|
294957
295148
|
entries += 1;
|
|
294958
295149
|
if (record.isDeprecated !== void 0) flagged += 1;
|
|
@@ -294978,7 +295169,7 @@ function lintGeneratedDocument(schema, operationId, documentText) {
|
|
|
294978
295169
|
}
|
|
294979
295170
|
|
|
294980
295171
|
// src/lib/protocols/graphql/parser.ts
|
|
294981
|
-
function
|
|
295172
|
+
function asRecord12(value) {
|
|
294982
295173
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294983
295174
|
return value;
|
|
294984
295175
|
}
|
|
@@ -295096,14 +295287,14 @@ function collectRootOperations(rootType, kind, schema, shapes) {
|
|
|
295096
295287
|
});
|
|
295097
295288
|
}
|
|
295098
295289
|
function looksLikeIntrospection2(value) {
|
|
295099
|
-
const record =
|
|
295290
|
+
const record = asRecord12(value);
|
|
295100
295291
|
if (!record) return false;
|
|
295101
|
-
if (
|
|
295102
|
-
const data =
|
|
295103
|
-
return Boolean(data &&
|
|
295292
|
+
if (asRecord12(record.__schema)) return true;
|
|
295293
|
+
const data = asRecord12(record.data);
|
|
295294
|
+
return Boolean(data && asRecord12(data.__schema));
|
|
295104
295295
|
}
|
|
295105
295296
|
function buildSchemaFromIntrospection(value) {
|
|
295106
|
-
const introspection =
|
|
295297
|
+
const introspection = asRecord12(value.__schema) ? value : asRecord12(value.data);
|
|
295107
295298
|
return buildClientSchema(introspection);
|
|
295108
295299
|
}
|
|
295109
295300
|
function selectIntrospectionRootWarnings(warnings) {
|
|
@@ -295126,7 +295317,7 @@ function parseGraphQLSchema(content, opts = {}) {
|
|
|
295126
295317
|
if (parsedJson !== void 0 && looksLikeIntrospection2(parsedJson)) {
|
|
295127
295318
|
introspectionWarnings = lintIntrospectionJson(parsedJson);
|
|
295128
295319
|
try {
|
|
295129
|
-
schema = buildSchemaFromIntrospection(
|
|
295320
|
+
schema = buildSchemaFromIntrospection(asRecord12(parsedJson));
|
|
295130
295321
|
} catch (error2) {
|
|
295131
295322
|
const rootWarnings = selectIntrospectionRootWarnings(introspectionWarnings);
|
|
295132
295323
|
const rootDiagnostics = rootWarnings.length > 0 ? " " + rootWarnings.join(" ") : "";
|
|
@@ -295243,7 +295434,7 @@ function collectDeprecatedSelectionWarnings(schema, operation, index) {
|
|
|
295243
295434
|
}
|
|
295244
295435
|
|
|
295245
295436
|
// src/lib/protocols/graphql/instrumenter.ts
|
|
295246
|
-
function
|
|
295437
|
+
function asRecord13(value) {
|
|
295247
295438
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
295248
295439
|
return value;
|
|
295249
295440
|
}
|
|
@@ -295753,24 +295944,24 @@ function buildProbeScript(probeId, index, warnings) {
|
|
|
295753
295944
|
];
|
|
295754
295945
|
}
|
|
295755
295946
|
function isGraphQLHttpRequest(item) {
|
|
295756
|
-
const request =
|
|
295947
|
+
const request = asRecord13(item.request);
|
|
295757
295948
|
if (!request) return false;
|
|
295758
|
-
const body2 =
|
|
295949
|
+
const body2 = asRecord13(request.body);
|
|
295759
295950
|
return body2?.mode === "graphql";
|
|
295760
295951
|
}
|
|
295761
295952
|
function injectItem(item, index, covered, warnings) {
|
|
295762
295953
|
const children4 = asArray6(item.item);
|
|
295763
295954
|
if (children4.length > 0) {
|
|
295764
295955
|
for (const child4 of children4) {
|
|
295765
|
-
const childRecord =
|
|
295956
|
+
const childRecord = asRecord13(child4);
|
|
295766
295957
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
295767
295958
|
}
|
|
295768
295959
|
return;
|
|
295769
295960
|
}
|
|
295770
295961
|
const itemId = String(item.id ?? "");
|
|
295771
|
-
if (itemId.startsWith("__gql_probe_") &&
|
|
295962
|
+
if (itemId.startsWith("__gql_probe_") && asRecord13(item.request)) {
|
|
295772
295963
|
const exec2 = buildProbeScript(itemId, index, warnings);
|
|
295773
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
295964
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295774
295965
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec: exec2 } }];
|
|
295775
295966
|
return;
|
|
295776
295967
|
}
|
|
@@ -295786,7 +295977,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
295786
295977
|
" pm.expect.fail(contractMappingError);",
|
|
295787
295978
|
"});"
|
|
295788
295979
|
];
|
|
295789
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
295980
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295790
295981
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
295791
295982
|
return;
|
|
295792
295983
|
}
|
|
@@ -295802,7 +295993,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
295802
295993
|
`GQL_SCRIPT_SIZE_EXCEEDED: generated test script for '${operation.id}' exceeded ${GRAPHQL_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`
|
|
295803
295994
|
);
|
|
295804
295995
|
}
|
|
295805
|
-
const events2 = asArray6(item.event).filter((entry) =>
|
|
295996
|
+
const events2 = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295806
295997
|
item.event = [
|
|
295807
295998
|
...events2,
|
|
295808
295999
|
{ listen: "test", script: { type: "text/javascript", exec: exec2 } }
|
|
@@ -295813,7 +296004,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
295813
296004
|
const warnings = [...index.warnings];
|
|
295814
296005
|
const covered = /* @__PURE__ */ new Set();
|
|
295815
296006
|
for (const child4 of asArray6(collection.item)) {
|
|
295816
|
-
const childRecord =
|
|
296007
|
+
const childRecord = asRecord13(child4);
|
|
295817
296008
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
295818
296009
|
}
|
|
295819
296010
|
const missing = index.operations.filter((operation) => !covered.has(operation.id));
|
|
@@ -295827,7 +296018,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
295827
296018
|
|
|
295828
296019
|
// src/lib/protocols/grpc/proto-parser.ts
|
|
295829
296020
|
var protobufjs = __toESM(require_protobufjs(), 1);
|
|
295830
|
-
function
|
|
296021
|
+
function asRecord14(value) {
|
|
295831
296022
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
295832
296023
|
return value;
|
|
295833
296024
|
}
|
|
@@ -296127,7 +296318,7 @@ function upperCamelCase(name) {
|
|
|
296127
296318
|
function lintMessage(message, warnings, proto3) {
|
|
296128
296319
|
const fullName = stripLeadingDot(message.fullName);
|
|
296129
296320
|
const { ranges: reservedRanges } = lintReserved(message.reserved, `message ${fullName}`, { lo: 1, hi: FIELD_NUMBER_MAX, label: "field-number" }, warnings);
|
|
296130
|
-
lintOptionSet(
|
|
296321
|
+
lintOptionSet(asRecord14(message.options), "message", fullName, warnings);
|
|
296131
296322
|
const jsonNames = /* @__PURE__ */ new Map();
|
|
296132
296323
|
for (const field of asArray7(message.fieldsArray)) {
|
|
296133
296324
|
const id = field.id;
|
|
@@ -296148,7 +296339,7 @@ function lintMessage(message, warnings, proto3) {
|
|
|
296148
296339
|
}
|
|
296149
296340
|
jsonNames.set(jsonName, String(field.name));
|
|
296150
296341
|
}
|
|
296151
|
-
if (
|
|
296342
|
+
if (asRecord14(message.options)?.deprecated === true) {
|
|
296152
296343
|
warnings.push(`GRPC_DEPRECATED: message ${fullName} is marked deprecated`);
|
|
296153
296344
|
}
|
|
296154
296345
|
const nestedNames = new Set(asArray7(message.nestedArray).map((child4) => child4.name));
|
|
@@ -296177,13 +296368,13 @@ function lintMessage(message, warnings, proto3) {
|
|
|
296177
296368
|
for (const child4 of asArray7(message.nestedArray)) {
|
|
296178
296369
|
declare(child4.name, isEnum(child4) ? "nested enum" : "nested type");
|
|
296179
296370
|
if (isEnum(child4)) {
|
|
296180
|
-
for (const valueName of Object.keys(
|
|
296371
|
+
for (const valueName of Object.keys(asRecord14(child4.values) ?? {})) declare(valueName, `enum value of ${child4.name}`);
|
|
296181
296372
|
}
|
|
296182
296373
|
}
|
|
296183
296374
|
}
|
|
296184
296375
|
function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
296185
296376
|
const fullName = stripLeadingDot(enumObj.fullName);
|
|
296186
|
-
const entries = Object.entries(
|
|
296377
|
+
const entries = Object.entries(asRecord14(enumObj.values) ?? {});
|
|
296187
296378
|
const { ranges: reservedRanges, names: reservedNames } = lintReserved(
|
|
296188
296379
|
enumObj.reserved,
|
|
296189
296380
|
`enum ${fullName}`,
|
|
@@ -296211,7 +296402,7 @@ function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
|
296211
296402
|
warnings.push(`GRPC_ENUM_ZERO_NAME_CONVENTION: enum ${fullName} zero value ${zero[0]} is conventionally named *_UNSPECIFIED (buf/AIP enum conventions)`);
|
|
296212
296403
|
}
|
|
296213
296404
|
}
|
|
296214
|
-
if (
|
|
296405
|
+
if (asRecord14(enumObj.options)?.deprecated === true) {
|
|
296215
296406
|
warnings.push(`GRPC_DEPRECATED: enum ${fullName} is marked deprecated`);
|
|
296216
296407
|
}
|
|
296217
296408
|
}
|
|
@@ -296296,7 +296487,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
296296
296487
|
for (const verb of HTTP_RULE_VERBS) {
|
|
296297
296488
|
if (typeof rule[verb] === "string") patterns.push({ verb, path: rule[verb] });
|
|
296298
296489
|
}
|
|
296299
|
-
const custom =
|
|
296490
|
+
const custom = asRecord14(rule.custom);
|
|
296300
296491
|
if (custom && typeof custom.path === "string") patterns.push({ verb: String(custom.kind ?? "custom"), path: custom.path });
|
|
296301
296492
|
if (patterns.length === 0) {
|
|
296302
296493
|
warnings.push(`GRPC_HTTP_RULE_PATTERN_MISSING: ${operationId} google.api.http ${nested ? "additional binding" : "rule"} declares no URL pattern (get/put/post/delete/patch/custom); transcoding requires exactly one (google.api.http pattern oneof)`);
|
|
@@ -296358,7 +296549,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
296358
296549
|
return;
|
|
296359
296550
|
}
|
|
296360
296551
|
for (const binding of bindingList) {
|
|
296361
|
-
const record =
|
|
296552
|
+
const record = asRecord14(binding);
|
|
296362
296553
|
if (record) lintHttpRule(record, requestFields, responseFieldNames, warnings, operationId, true);
|
|
296363
296554
|
}
|
|
296364
296555
|
}
|
|
@@ -296386,10 +296577,10 @@ function lintMethodOptions(method, operationId, warnings) {
|
|
|
296386
296577
|
const requestFields = httpFieldInfo(method.resolvedRequestType);
|
|
296387
296578
|
const responseFieldNames = method.resolvedResponseType ? new Set(asArray7(method.resolvedResponseType.fieldsArray).map((field) => String(field.name))) : null;
|
|
296388
296579
|
for (const entry of asArray7(method.parsedOptions)) {
|
|
296389
|
-
const http2 =
|
|
296580
|
+
const http2 = asRecord14(asRecord14(entry)?.["(google.api.http)"]);
|
|
296390
296581
|
if (http2) lintHttpRule(http2, requestFields, responseFieldNames, warnings, operationId, false);
|
|
296391
296582
|
}
|
|
296392
|
-
if (
|
|
296583
|
+
if (asRecord14(method.options)?.deprecated === true) {
|
|
296393
296584
|
warnings.push(`GRPC_DEPRECATED: rpc ${operationId} is marked deprecated`);
|
|
296394
296585
|
}
|
|
296395
296586
|
}
|
|
@@ -296494,7 +296685,7 @@ function parseProtoSchema(content, deps) {
|
|
|
296494
296685
|
}
|
|
296495
296686
|
const enumIndex = {};
|
|
296496
296687
|
for (const enumObj of enums) {
|
|
296497
|
-
const values = Object.keys(
|
|
296688
|
+
const values = Object.keys(asRecord14(enumObj.values) ?? {}).sort();
|
|
296498
296689
|
enumIndex[stripLeadingDot(enumObj.fullName)] = values;
|
|
296499
296690
|
lintEnum(enumObj, warnings, proto3, conventions);
|
|
296500
296691
|
}
|
|
@@ -296623,7 +296814,7 @@ var GRPC_INSTRUMENT_LIMITS = {
|
|
|
296623
296814
|
maxTestScriptBytes: 9e5,
|
|
296624
296815
|
maxCollectionUpdateBytes: 4e6
|
|
296625
296816
|
};
|
|
296626
|
-
function
|
|
296817
|
+
function asRecord15(value) {
|
|
296627
296818
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
296628
296819
|
return value;
|
|
296629
296820
|
}
|
|
@@ -297220,7 +297411,7 @@ function createMappingFailureScript2(message) {
|
|
|
297220
297411
|
];
|
|
297221
297412
|
}
|
|
297222
297413
|
function methodPathOf(item) {
|
|
297223
|
-
const payload =
|
|
297414
|
+
const payload = asRecord15(item.payload);
|
|
297224
297415
|
const value = payload?.methodPath;
|
|
297225
297416
|
return typeof value === "string" ? value : "";
|
|
297226
297417
|
}
|
|
@@ -297435,7 +297626,7 @@ function matchesFormatValue(format3, value) {
|
|
|
297435
297626
|
}
|
|
297436
297627
|
function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
297437
297628
|
if (!shape) return;
|
|
297438
|
-
const message =
|
|
297629
|
+
const message = asRecord15(asRecord15(item.payload)?.message);
|
|
297439
297630
|
const raw = typeof message?.content === "string" ? message.content : "";
|
|
297440
297631
|
if (!raw.trim()) return;
|
|
297441
297632
|
if (/\{\{[^}]+\}\}|<[a-zA-Z]/.test(raw)) return;
|
|
@@ -297446,7 +297637,7 @@ function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
|
297446
297637
|
warnings.push(`PROTO_REQUEST_BODY_INVALID_JSON: ${methodPath2} generated request message content is not valid JSON and is not validated`);
|
|
297447
297638
|
return;
|
|
297448
297639
|
}
|
|
297449
|
-
const record =
|
|
297640
|
+
const record = asRecord15(body2);
|
|
297450
297641
|
if (!record) return;
|
|
297451
297642
|
for (const field of shape.fields) {
|
|
297452
297643
|
const key = Object.prototype.hasOwnProperty.call(record, field.jsonName) ? field.jsonName : Object.prototype.hasOwnProperty.call(record, field.name) ? field.name : void 0;
|
|
@@ -297506,16 +297697,16 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
297506
297697
|
if (scriptBytes > GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes) {
|
|
297507
297698
|
throw new Error(`PROTO_SCRIPT_SIZE_EXCEEDED: generated test script for ${methodPath2} exceeded ${GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`);
|
|
297508
297699
|
}
|
|
297509
|
-
const events2 = asArray8(item.event).filter((entry) =>
|
|
297700
|
+
const events2 = asArray8(item.event).filter((entry) => asRecord15(entry)?.listen !== "test");
|
|
297510
297701
|
item.event = [...events2, { listen: "test", script: { type: "text/javascript", exec: script } }];
|
|
297511
297702
|
}
|
|
297512
297703
|
for (const child4 of asArray8(item.item)) {
|
|
297513
|
-
const childRecord =
|
|
297704
|
+
const childRecord = asRecord15(child4);
|
|
297514
297705
|
if (childRecord) inject(childRecord);
|
|
297515
297706
|
}
|
|
297516
297707
|
};
|
|
297517
297708
|
for (const entry of asArray8(collection.item)) {
|
|
297518
|
-
const item =
|
|
297709
|
+
const item = asRecord15(entry);
|
|
297519
297710
|
if (item) inject(item);
|
|
297520
297711
|
}
|
|
297521
297712
|
const missing = index.operations.filter((operation) => !covered.has(operation.methodPath));
|
|
@@ -297530,7 +297721,7 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
297530
297721
|
}
|
|
297531
297722
|
|
|
297532
297723
|
// src/lib/protocols/grpc/service-config.ts
|
|
297533
|
-
function
|
|
297724
|
+
function asRecord16(value) {
|
|
297534
297725
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
297535
297726
|
return value;
|
|
297536
297727
|
}
|
|
@@ -297689,7 +297880,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
297689
297880
|
return;
|
|
297690
297881
|
}
|
|
297691
297882
|
for (const entry of entries) {
|
|
297692
|
-
const record =
|
|
297883
|
+
const record = asRecord16(entry);
|
|
297693
297884
|
const keys = record ? Object.keys(record) : [];
|
|
297694
297885
|
if (!record || keys.length !== 1) {
|
|
297695
297886
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: each ${label} entry must be an object with exactly one policy key (service_config.proto)`);
|
|
@@ -297700,7 +297891,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
297700
297891
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_POLICY_UNKNOWN: ${label} policy "${policy}" is not a registered gRPC LB policy; clients skip unknown policies (service_config.proto)`);
|
|
297701
297892
|
continue;
|
|
297702
297893
|
}
|
|
297703
|
-
const config =
|
|
297894
|
+
const config = asRecord16(record[policy]);
|
|
297704
297895
|
if (!config) {
|
|
297705
297896
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: ${label} policy "${policy}" config must be a JSON object (service_config.proto)`);
|
|
297706
297897
|
continue;
|
|
@@ -297825,7 +298016,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297825
298016
|
const declaredServices = new Set(index.operations.map((operation) => operation.serviceFullName));
|
|
297826
298017
|
const seenApis = /* @__PURE__ */ new Set();
|
|
297827
298018
|
asArray9(config.apis).forEach((entry, i) => {
|
|
297828
|
-
const record =
|
|
298019
|
+
const record = asRecord16(entry);
|
|
297829
298020
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
297830
298021
|
if (!name) {
|
|
297831
298022
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: apis[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -297842,7 +298033,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297842
298033
|
const lintTypeList = (listKey, resolves, kind) => {
|
|
297843
298034
|
const seen = /* @__PURE__ */ new Set();
|
|
297844
298035
|
asArray9(config[listKey]).forEach((entry, i) => {
|
|
297845
|
-
const record =
|
|
298036
|
+
const record = asRecord16(entry);
|
|
297846
298037
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
297847
298038
|
if (!name) {
|
|
297848
298039
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: ${listKey}[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -297870,7 +298061,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297870
298061
|
};
|
|
297871
298062
|
lintTypeList("types", (name) => index.messages[name] !== void 0, "message");
|
|
297872
298063
|
lintTypeList("enums", (name) => index.enums[name] !== void 0, "enum");
|
|
297873
|
-
const declaredDetails = asArray9(config.types).map((entry) =>
|
|
298064
|
+
const declaredDetails = asArray9(config.types).map((entry) => asRecord16(entry)?.name).filter((name) => typeof name === "string" && GOOGLE_RPC_ERROR_DETAIL_TYPES.has(name));
|
|
297874
298065
|
if (declaredDetails.length > 0 && !declaredDetails.includes("google.rpc.ErrorInfo")) {
|
|
297875
298066
|
warnings.push("GRPC_GOOGLE_API_CONFIG_ERRORINFO_MISSING: types[] declares google.rpc error-detail payloads but omits google.rpc.ErrorInfo; AIP-193 requires ErrorInfo in service errors");
|
|
297876
298067
|
}
|
|
@@ -297898,7 +298089,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297898
298089
|
warnings.push("GRPC_SERVICE_CONFIG_LB_RUNTIME_UNSUPPORTED: the generated Postman grpc-request items expose no load-balancing settings, so LB policy selection is not applied when the collection runs in Postman");
|
|
297899
298090
|
}
|
|
297900
298091
|
if (config.healthCheckConfig !== void 0) {
|
|
297901
|
-
const health =
|
|
298092
|
+
const health = asRecord16(config.healthCheckConfig);
|
|
297902
298093
|
if (!health) {
|
|
297903
298094
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: healthCheckConfig must be an object (service_config.proto)");
|
|
297904
298095
|
} else {
|
|
@@ -297912,7 +298103,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297912
298103
|
}
|
|
297913
298104
|
}
|
|
297914
298105
|
}
|
|
297915
|
-
const throttling =
|
|
298106
|
+
const throttling = asRecord16(config.retryThrottling);
|
|
297916
298107
|
if (config.retryThrottling !== void 0) {
|
|
297917
298108
|
const maxTokens = throttling?.maxTokens;
|
|
297918
298109
|
const tokenRatio = throttling?.tokenRatio;
|
|
@@ -297949,7 +298140,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297949
298140
|
const where = `methodConfig[${i}]`;
|
|
297950
298141
|
const meta = { targets: /* @__PURE__ */ new Set(), unresolved: false, retry: false, hedge: false, selectorCount: 0 };
|
|
297951
298142
|
entryMeta.push(meta);
|
|
297952
|
-
const methodConfig =
|
|
298143
|
+
const methodConfig = asRecord16(entry);
|
|
297953
298144
|
if (!methodConfig) {
|
|
297954
298145
|
warnings.push(`GRPC_SERVICE_CONFIG_INVALID: ${where} must be an object (service_config.proto)`);
|
|
297955
298146
|
return;
|
|
@@ -297967,7 +298158,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297967
298158
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name must be a non-empty list of {service, method} selectors (service_config.proto)`);
|
|
297968
298159
|
} else {
|
|
297969
298160
|
names.forEach((nameEntry, j) => {
|
|
297970
|
-
const selector =
|
|
298161
|
+
const selector = asRecord16(nameEntry);
|
|
297971
298162
|
if (!selector) {
|
|
297972
298163
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name[${j}] must be an object (service_config.proto)`);
|
|
297973
298164
|
return;
|
|
@@ -298010,8 +298201,8 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
298010
298201
|
warnings.push(`GRPC_SERVICE_CONFIG_INVALID: ${where}.${key} must be a non-negative integer within uint32 range [0, ${UINT32_MAX}] (service_config.proto google.protobuf.UInt32Value); got ${JSON.stringify(methodConfig[key])}`);
|
|
298011
298202
|
}
|
|
298012
298203
|
}
|
|
298013
|
-
const retryPolicy =
|
|
298014
|
-
const hedgingPolicy =
|
|
298204
|
+
const retryPolicy = asRecord16(methodConfig.retryPolicy);
|
|
298205
|
+
const hedgingPolicy = asRecord16(methodConfig.hedgingPolicy);
|
|
298015
298206
|
meta.retry = methodConfig.retryPolicy !== void 0;
|
|
298016
298207
|
meta.hedge = methodConfig.hedgingPolicy !== void 0;
|
|
298017
298208
|
if (methodConfig.retryPolicy !== void 0 && methodConfig.hedgingPolicy !== void 0) {
|
|
@@ -298079,7 +298270,7 @@ ${warnings.join("\n")}`);
|
|
|
298079
298270
|
if (Array.isArray(parsed)) {
|
|
298080
298271
|
parsed.forEach((entry, i) => {
|
|
298081
298272
|
const where = `grpc_config[${i}]`;
|
|
298082
|
-
const choice =
|
|
298273
|
+
const choice = asRecord16(entry);
|
|
298083
298274
|
if (!choice) {
|
|
298084
298275
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where} must be an object (gRFC A2 choice list)`);
|
|
298085
298276
|
return;
|
|
@@ -298098,7 +298289,7 @@ ${warnings.join("\n")}`);
|
|
|
298098
298289
|
if (choice.percentage !== void 0 && !(typeof choice.percentage === "number" && choice.percentage >= 0 && choice.percentage <= 100)) {
|
|
298099
298290
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.percentage must be a number in [0, 100] (gRFC A2)`);
|
|
298100
298291
|
}
|
|
298101
|
-
const embedded =
|
|
298292
|
+
const embedded = asRecord16(choice.serviceConfig);
|
|
298102
298293
|
if (!embedded) {
|
|
298103
298294
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.serviceConfig must be a JSON object (gRFC A2)`);
|
|
298104
298295
|
return;
|
|
@@ -298107,7 +298298,7 @@ ${warnings.join("\n")}`);
|
|
|
298107
298298
|
});
|
|
298108
298299
|
return finish();
|
|
298109
298300
|
}
|
|
298110
|
-
const config =
|
|
298301
|
+
const config = asRecord16(parsed);
|
|
298111
298302
|
if (!config) {
|
|
298112
298303
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: service config must be a JSON object (service_config.proto)");
|
|
298113
298304
|
return finish();
|
|
@@ -304365,7 +304556,7 @@ function lintWsdl20Services(services, interfaces, bindings, warnings) {
|
|
|
304365
304556
|
|
|
304366
304557
|
// src/lib/protocols/soap/xsd-index.ts
|
|
304367
304558
|
var XSD_NS = "http://www.w3.org/2001/XMLSchema";
|
|
304368
|
-
function
|
|
304559
|
+
function asRecord17(value) {
|
|
304369
304560
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
304370
304561
|
return value;
|
|
304371
304562
|
}
|
|
@@ -304401,7 +304592,7 @@ function children2(record, local2) {
|
|
|
304401
304592
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
304402
304593
|
if (localName(key) !== local2) continue;
|
|
304403
304594
|
for (const entry of asArray10(record[key])) {
|
|
304404
|
-
const rec =
|
|
304595
|
+
const rec = asRecord17(entry);
|
|
304405
304596
|
if (rec) out.push(rec);
|
|
304406
304597
|
}
|
|
304407
304598
|
}
|
|
@@ -304437,7 +304628,7 @@ function parseOccursMax(raw) {
|
|
|
304437
304628
|
return Number.isNaN(value) ? 1 : value;
|
|
304438
304629
|
}
|
|
304439
304630
|
function simpleTypeFacets(simpleType, scopes) {
|
|
304440
|
-
const restriction =
|
|
304631
|
+
const restriction = asRecord17(child2(simpleType, "restriction"));
|
|
304441
304632
|
if (!restriction) return {};
|
|
304442
304633
|
const baseQName = attr2(restriction, "base");
|
|
304443
304634
|
const baseNs = baseQName ? namespaceForPrefix([...scopes, restriction], prefixOf(baseQName)) : "";
|
|
@@ -304464,7 +304655,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
304464
304655
|
if (!complexType) return void 0;
|
|
304465
304656
|
if (child2(complexType, "complexContent") !== void 0 || child2(complexType, "simpleContent") !== void 0) return void 0;
|
|
304466
304657
|
if (child2(complexType, "choice") !== void 0 || child2(complexType, "all") !== void 0 || child2(complexType, "group") !== void 0) return void 0;
|
|
304467
|
-
const sequence =
|
|
304658
|
+
const sequence = asRecord17(child2(complexType, "sequence"));
|
|
304468
304659
|
if (!sequence) return [];
|
|
304469
304660
|
if (child2(sequence, "choice") !== void 0 || child2(sequence, "sequence") !== void 0 || child2(sequence, "any") !== void 0 || child2(sequence, "group") !== void 0) return void 0;
|
|
304470
304661
|
const out = [];
|
|
@@ -304483,7 +304674,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
304483
304674
|
enumeration = sameSchema.enums;
|
|
304484
304675
|
}
|
|
304485
304676
|
}
|
|
304486
|
-
const inlineSimple =
|
|
304677
|
+
const inlineSimple = asRecord17(child2(el, "simpleType"));
|
|
304487
304678
|
if (inlineSimple) {
|
|
304488
304679
|
const facets = simpleTypeFacets(inlineSimple, [...scopes, el]);
|
|
304489
304680
|
builtinType = facets.base ?? builtinType;
|
|
@@ -304528,7 +304719,7 @@ function buildXsdIndex(docNode) {
|
|
|
304528
304719
|
for (const el of children2(schema, "element")) {
|
|
304529
304720
|
const name = attr2(el, "name");
|
|
304530
304721
|
if (!name) continue;
|
|
304531
|
-
const inline =
|
|
304722
|
+
const inline = asRecord17(child2(el, "complexType"));
|
|
304532
304723
|
const typeQName = attr2(el, "type");
|
|
304533
304724
|
const named = typeQName && namespaceForPrefix([...scopes, el], prefixOf(typeQName)) !== XSD_NS ? complexTypes.get(localName(typeQName)) ?? null : null;
|
|
304534
304725
|
index.elements.set(tns + "|" + name, {
|
|
@@ -304555,7 +304746,7 @@ function lookupXsdElement(index, namespace, name) {
|
|
|
304555
304746
|
}
|
|
304556
304747
|
|
|
304557
304748
|
// src/lib/protocols/soap/parser.ts
|
|
304558
|
-
function
|
|
304749
|
+
function asRecord18(value) {
|
|
304559
304750
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
304560
304751
|
return value;
|
|
304561
304752
|
}
|
|
@@ -304602,7 +304793,7 @@ function children3(record, local2) {
|
|
|
304602
304793
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
304603
304794
|
if (localName2(key) !== local2) continue;
|
|
304604
304795
|
for (const entry of asArray11(record[key])) {
|
|
304605
|
-
const rec =
|
|
304796
|
+
const rec = asRecord18(entry);
|
|
304606
304797
|
if (rec) out.push(rec);
|
|
304607
304798
|
}
|
|
304608
304799
|
}
|
|
@@ -304706,7 +304897,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304706
304897
|
else if (ns === SOAP11_BINDING_NS) soapVersion = "1.1";
|
|
304707
304898
|
else continue;
|
|
304708
304899
|
for (const marker of asArray11(binding[key])) {
|
|
304709
|
-
const style = attr3(
|
|
304900
|
+
const style = attr3(asRecord18(marker), "style");
|
|
304710
304901
|
if (style) bindingStyle = style;
|
|
304711
304902
|
}
|
|
304712
304903
|
}
|
|
@@ -304719,7 +304910,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304719
304910
|
for (const key of Object.keys(operation)) {
|
|
304720
304911
|
if (localName2(key) !== "operation") continue;
|
|
304721
304912
|
for (const marker of asArray11(operation[key])) {
|
|
304722
|
-
const rec =
|
|
304913
|
+
const rec = asRecord18(marker);
|
|
304723
304914
|
const action = attr3(rec, "soapAction");
|
|
304724
304915
|
if (action) soapAction = action;
|
|
304725
304916
|
const style2 = attr3(rec, "style");
|
|
@@ -304732,8 +304923,8 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304732
304923
|
warnings.push(`SOAP_BINDING_STYLE_UNPARSEABLE: binding ${bindingName} operation ${opName} declares style "${styleRaw}" (expected document|rpc); style-specific assertions are skipped`);
|
|
304733
304924
|
style = void 0;
|
|
304734
304925
|
}
|
|
304735
|
-
const inputDirection =
|
|
304736
|
-
const outputDirection =
|
|
304926
|
+
const inputDirection = asRecord18(child3(operation, "input"));
|
|
304927
|
+
const outputDirection = asRecord18(child3(operation, "output"));
|
|
304737
304928
|
const inputBody = bodyMarker(inputDirection);
|
|
304738
304929
|
const outputBody = bodyMarker(outputDirection);
|
|
304739
304930
|
const useRaw = attr3(outputBody, "use") || attr3(inputBody, "use");
|
|
@@ -304813,8 +305004,8 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
304813
305004
|
return children3(portType, "operation").map((operation) => {
|
|
304814
305005
|
const name = attr3(operation, "name");
|
|
304815
305006
|
const opWarnings = [];
|
|
304816
|
-
const inputRecord =
|
|
304817
|
-
const outputRecord =
|
|
305007
|
+
const inputRecord = asRecord18(child3(operation, "input"));
|
|
305008
|
+
const outputRecord = asRecord18(child3(operation, "output"));
|
|
304818
305009
|
const inputRef = localName2(attr3(inputRecord, "message"));
|
|
304819
305010
|
const outputRef = localName2(attr3(outputRecord, "message"));
|
|
304820
305011
|
const input = inputRef ? messages.get(inputRef) : void 0;
|
|
@@ -304868,7 +305059,7 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
304868
305059
|
const seenPortTypes = /* @__PURE__ */ new Set();
|
|
304869
305060
|
for (const port of ports) {
|
|
304870
305061
|
const bindingName = localName2(attr3(port, "binding"));
|
|
304871
|
-
const address =
|
|
305062
|
+
const address = asRecord18(child3(port, "address"));
|
|
304872
305063
|
const location2 = attr3(address, "location");
|
|
304873
305064
|
if (location2 && !endpoint) endpoint = location2;
|
|
304874
305065
|
const portTypeName = bindingToPortType.get(bindingName);
|
|
@@ -304957,8 +305148,8 @@ function parseServices20(description, warnings) {
|
|
|
304957
305148
|
const buildOperations = (iface, binding) => children3(iface, "operation").map((operation) => {
|
|
304958
305149
|
const name = attr3(operation, "name");
|
|
304959
305150
|
const opWarnings = [];
|
|
304960
|
-
const inputRecord =
|
|
304961
|
-
const outputRecord =
|
|
305151
|
+
const inputRecord = asRecord18(child3(operation, "input"));
|
|
305152
|
+
const outputRecord = asRecord18(child3(operation, "output"));
|
|
304962
305153
|
const inputElement = attr3(inputRecord, "element");
|
|
304963
305154
|
const outputElement = attr3(outputRecord, "element");
|
|
304964
305155
|
const outLocal = outputElement.startsWith("#") ? "" : localName2(outputElement);
|
|
@@ -305006,9 +305197,9 @@ function parseServices20(description, warnings) {
|
|
|
305006
305197
|
for (const ep of children3(service, "endpoint")) {
|
|
305007
305198
|
let address = attr3(ep, "address");
|
|
305008
305199
|
if (!address) {
|
|
305009
|
-
const epr =
|
|
305200
|
+
const epr = asRecord18(child3(ep, "EndpointReference"));
|
|
305010
305201
|
const addressNode = child3(epr, "Address");
|
|
305011
|
-
const addressRecord =
|
|
305202
|
+
const addressRecord = asRecord18(addressNode);
|
|
305012
305203
|
address = addressRecord ? asString2(addressRecord["#text"]) : asString2(addressNode);
|
|
305013
305204
|
if (address) warnings.push(`SOAP_WSDL20_ENDPOINT_EPR: endpoint ${attr3(ep, "name")} address taken from its child wsa:EndpointReference/Address; reference parameters are not propagated`);
|
|
305014
305205
|
}
|
|
@@ -305029,7 +305220,7 @@ function parseServices20(description, warnings) {
|
|
|
305029
305220
|
return services;
|
|
305030
305221
|
}
|
|
305031
305222
|
function detectAddressing(node) {
|
|
305032
|
-
const record =
|
|
305223
|
+
const record = asRecord18(node);
|
|
305033
305224
|
if (!record) return false;
|
|
305034
305225
|
for (const key of Object.keys(record)) {
|
|
305035
305226
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
@@ -305096,7 +305287,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305096
305287
|
const ns = namespaceForPrefix2([definitions, binding], prefixOf2(key));
|
|
305097
305288
|
if (ns !== SOAP11_BINDING_NS && ns !== SOAP12_BINDING_NS) continue;
|
|
305098
305289
|
for (const entry of asArray11(binding[key])) {
|
|
305099
|
-
const marker =
|
|
305290
|
+
const marker = asRecord18(entry);
|
|
305100
305291
|
if (!marker) continue;
|
|
305101
305292
|
const style = attr3(marker, "style");
|
|
305102
305293
|
if (style) bindingStyle = style;
|
|
@@ -305124,14 +305315,14 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305124
305315
|
for (const key of Object.keys(operation)) {
|
|
305125
305316
|
if (localName2(key) !== "operation") continue;
|
|
305126
305317
|
for (const entry of asArray11(operation[key])) {
|
|
305127
|
-
const style = attr3(
|
|
305318
|
+
const style = attr3(asRecord18(entry), "style");
|
|
305128
305319
|
if (style) styleRaw = style;
|
|
305129
305320
|
}
|
|
305130
305321
|
}
|
|
305131
305322
|
const effStyle = styleRaw === "rpc" ? "rpc" : "document";
|
|
305132
305323
|
styles.add(effStyle);
|
|
305133
|
-
const inputDirection =
|
|
305134
|
-
const outputDirection =
|
|
305324
|
+
const inputDirection = asRecord18(child3(operation, "input"));
|
|
305325
|
+
const outputDirection = asRecord18(child3(operation, "output"));
|
|
305135
305326
|
const inputBody = bodyMarker(inputDirection);
|
|
305136
305327
|
const outputBody = bodyMarker(outputDirection);
|
|
305137
305328
|
for (const [direction, body2] of [["input", inputBody], ["output", outputBody]]) {
|
|
@@ -305156,8 +305347,8 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305156
305347
|
}
|
|
305157
305348
|
}
|
|
305158
305349
|
const portTypeOp = portTypeOps.get(opName);
|
|
305159
|
-
const inputMessage = portTypeOp ? messages.get(localName2(attr3(
|
|
305160
|
-
const outputMessage = portTypeOp ? messages.get(localName2(attr3(
|
|
305350
|
+
const inputMessage = portTypeOp ? messages.get(localName2(attr3(asRecord18(child3(portTypeOp, "input")), "message"))) : void 0;
|
|
305351
|
+
const outputMessage = portTypeOp ? messages.get(localName2(attr3(asRecord18(child3(portTypeOp, "output")), "message"))) : void 0;
|
|
305161
305352
|
if (portTypeOp) {
|
|
305162
305353
|
const bindingHasOutput = child3(operation, "output") !== void 0;
|
|
305163
305354
|
const portTypeHasOutput = child3(portTypeOp, "output") !== void 0;
|
|
@@ -305217,7 +305408,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305217
305408
|
for (const service of children3(definitions, "service")) {
|
|
305218
305409
|
for (const port of children3(service, "port")) {
|
|
305219
305410
|
const portName = attr3(port, "name");
|
|
305220
|
-
const location2 = attr3(
|
|
305411
|
+
const location2 = attr3(asRecord18(child3(port, "address")), "location");
|
|
305221
305412
|
if (!location2) continue;
|
|
305222
305413
|
if (!/^https?:\/\//i.test(location2)) warnings.push(`SOAP_LINT_ADDRESS_NOT_HTTP: port ${portName} soap:address location "${location2}" is not an http(s) URL`);
|
|
305223
305414
|
const prior = addressLocations.get(location2);
|
|
@@ -305236,13 +305427,13 @@ function parseWsdl(content, opts) {
|
|
|
305236
305427
|
const parser = createParser();
|
|
305237
305428
|
let root;
|
|
305238
305429
|
try {
|
|
305239
|
-
root =
|
|
305430
|
+
root = asRecord18(parser.parse(text));
|
|
305240
305431
|
} catch (error2) {
|
|
305241
305432
|
throw new Error(`SOAP_WSDL_PARSE_ERROR: ${error2.message}`, { cause: error2 });
|
|
305242
305433
|
}
|
|
305243
305434
|
if (!root) throw new Error("SOAP_WSDL_PARSE_ERROR: document did not parse to an element");
|
|
305244
|
-
const definitions =
|
|
305245
|
-
const description =
|
|
305435
|
+
const definitions = asRecord18(child3(root, "definitions"));
|
|
305436
|
+
const description = asRecord18(child3(root, "description"));
|
|
305246
305437
|
if (!definitions && !description) {
|
|
305247
305438
|
throw new Error("SOAP_WSDL_ROOT_INVALID: expected a WSDL <definitions> (1.1) or <description> (2.0) root element");
|
|
305248
305439
|
}
|
|
@@ -305702,7 +305893,7 @@ function xsdPayloadLines(operation, index) {
|
|
|
305702
305893
|
}
|
|
305703
305894
|
|
|
305704
305895
|
// src/lib/protocols/soap/instrumenter.ts
|
|
305705
|
-
function
|
|
305896
|
+
function asRecord19(value) {
|
|
305706
305897
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
305707
305898
|
return value;
|
|
305708
305899
|
}
|
|
@@ -306384,12 +306575,12 @@ function forEachHttpRequest(node, visit4) {
|
|
|
306384
306575
|
const children4 = asArray12(node.item);
|
|
306385
306576
|
if (children4.length > 0) {
|
|
306386
306577
|
for (const child4 of children4) {
|
|
306387
|
-
const record =
|
|
306578
|
+
const record = asRecord19(child4);
|
|
306388
306579
|
if (record) forEachHttpRequest(record, visit4);
|
|
306389
306580
|
}
|
|
306390
306581
|
return;
|
|
306391
306582
|
}
|
|
306392
|
-
if (
|
|
306583
|
+
if (asRecord19(node.request)) visit4(node);
|
|
306393
306584
|
}
|
|
306394
306585
|
function instrumentSoapCollection(collection, index) {
|
|
306395
306586
|
const warnings = [...index.warnings];
|
|
@@ -306414,7 +306605,7 @@ function instrumentSoapCollection(collection, index) {
|
|
|
306414
306605
|
' pm.expect(code, "unsupported media types map to HTTP 415 (SOAP 1.2 Part 2 section 7)").to.eql(415);',
|
|
306415
306606
|
"});"
|
|
306416
306607
|
];
|
|
306417
|
-
const existingEvents = asArray12(item.event).map((entry) =>
|
|
306608
|
+
const existingEvents = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306418
306609
|
item.event = [...existingEvents, { listen: "test", script: { type: "text/javascript", exec: probeExec } }];
|
|
306419
306610
|
return;
|
|
306420
306611
|
}
|
|
@@ -306428,13 +306619,13 @@ function instrumentSoapCollection(collection, index) {
|
|
|
306428
306619
|
" pm.expect.fail(contractMappingError);",
|
|
306429
306620
|
"});"
|
|
306430
306621
|
];
|
|
306431
|
-
const existing2 = asArray12(item.event).map((entry) =>
|
|
306622
|
+
const existing2 = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306432
306623
|
item.event = [...existing2, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
306433
306624
|
return;
|
|
306434
306625
|
}
|
|
306435
306626
|
covered.add(operation.name);
|
|
306436
306627
|
const exec2 = createSoapScript(operation, warnings, { declaresAddressing: index.declaresAddressing, targetNamespace: index.targetNamespace, schemaIndex: index.schemaIndex }).split("\n");
|
|
306437
|
-
const existing = asArray12(item.event).map((entry) =>
|
|
306628
|
+
const existing = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306438
306629
|
item.event = [
|
|
306439
306630
|
...existing,
|
|
306440
306631
|
{ listen: "test", script: { type: "text/javascript", exec: exec2 } }
|
|
@@ -306453,7 +306644,7 @@ var SOCKETIO_PROTOCOLS = /* @__PURE__ */ new Set(["socketio", "socket.io", "sio"
|
|
|
306453
306644
|
var MQTT_PROTOCOLS = /* @__PURE__ */ new Set(["mqtt", "mqtts", "secure-mqtt", "mqtt5"]);
|
|
306454
306645
|
var DEFAULT_SOCKETIO_PATH = "/socket.io";
|
|
306455
306646
|
var SAMPLE_MAX_DEPTH = 5;
|
|
306456
|
-
function
|
|
306647
|
+
function asRecord20(value) {
|
|
306457
306648
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
306458
306649
|
return value;
|
|
306459
306650
|
}
|
|
@@ -306476,7 +306667,7 @@ function contentKindFor(contentType2) {
|
|
|
306476
306667
|
return "binary";
|
|
306477
306668
|
}
|
|
306478
306669
|
function sampleFromSchema(schema, depth) {
|
|
306479
|
-
const record =
|
|
306670
|
+
const record = asRecord20(schema);
|
|
306480
306671
|
if (!record) return record === null ? null : {};
|
|
306481
306672
|
if (record.example !== void 0) return record.example;
|
|
306482
306673
|
if (record.default !== void 0) return record.default;
|
|
@@ -306492,7 +306683,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
306492
306683
|
switch (type) {
|
|
306493
306684
|
case "object":
|
|
306494
306685
|
case void 0: {
|
|
306495
|
-
const properties =
|
|
306686
|
+
const properties = asRecord20(record.properties);
|
|
306496
306687
|
if (!properties) return {};
|
|
306497
306688
|
const required = new Set(asArray13(record.required));
|
|
306498
306689
|
const out = {};
|
|
@@ -306521,7 +306712,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
306521
306712
|
}
|
|
306522
306713
|
}
|
|
306523
306714
|
function bindingKeyValues(bindingSchema) {
|
|
306524
|
-
const properties =
|
|
306715
|
+
const properties = asRecord20(asRecord20(bindingSchema)?.properties);
|
|
306525
306716
|
if (!properties) return [];
|
|
306526
306717
|
return Object.keys(properties).sort().map((key) => ({ key, value: "" }));
|
|
306527
306718
|
}
|
|
@@ -306535,8 +306726,8 @@ function detectTransport(channel, servers, messagesRaw, documentJson, warnings)
|
|
|
306535
306726
|
const protocolSocketio = servers.some((server) => SOCKETIO_PROTOCOLS.has(server.protocol().toLowerCase()));
|
|
306536
306727
|
if (protocolSocketio) return "socketio";
|
|
306537
306728
|
const channelJson = channel.json();
|
|
306538
|
-
const hasAck = messagesRaw.some((message) =>
|
|
306539
|
-
const hasSocketioExt = channelJson["x-socketio"] !== void 0 || documentJson["x-socketio"] !== void 0 ||
|
|
306729
|
+
const hasAck = messagesRaw.some((message) => asRecord20(message.json())?.["x-ack"] !== void 0);
|
|
306730
|
+
const hasSocketioExt = channelJson["x-socketio"] !== void 0 || documentJson["x-socketio"] !== void 0 || asRecord20(channelJson.bindings)?.socketio !== void 0;
|
|
306540
306731
|
if (hasAck || hasSocketioExt) {
|
|
306541
306732
|
warnings.push(
|
|
306542
306733
|
`ASYNCAPI_SOCKETIO_CONVENTION: channel ${channel.id()} is treated as Socket.IO from convention (x-ack / x-socketio / protocol), not a normative AsyncAPI binding; event=message name, namespace=channel address, acknowledgement=x-ack`
|
|
@@ -306551,7 +306742,7 @@ function wsBindingKeyValues(channel) {
|
|
|
306551
306742
|
return protocol === "ws" || protocol === "wss" || protocol === "websockets";
|
|
306552
306743
|
});
|
|
306553
306744
|
if (!wsBinding) return { headers: [], queryParams: [] };
|
|
306554
|
-
const value =
|
|
306745
|
+
const value = asRecord20(wsBinding.value()) ?? {};
|
|
306555
306746
|
return {
|
|
306556
306747
|
headers: bindingKeyValues(value.headers),
|
|
306557
306748
|
queryParams: bindingKeyValues(value.query),
|
|
@@ -306562,33 +306753,33 @@ function collectMqttInfo(channel, servers, messagesRaw, documentJson) {
|
|
|
306562
306753
|
const channelJson = channel.json();
|
|
306563
306754
|
const operationBindings = [];
|
|
306564
306755
|
for (const operationKey of ["publish", "subscribe"]) {
|
|
306565
|
-
const binding =
|
|
306756
|
+
const binding = asRecord20(asRecord20(asRecord20(channelJson[operationKey])?.bindings)?.mqtt);
|
|
306566
306757
|
if (binding) operationBindings.push(binding);
|
|
306567
306758
|
}
|
|
306568
306759
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
306569
|
-
const operations =
|
|
306760
|
+
const operations = asRecord20(documentJson.operations) ?? {};
|
|
306570
306761
|
for (const operation of Object.values(operations)) {
|
|
306571
|
-
const operationRecord =
|
|
306762
|
+
const operationRecord = asRecord20(operation);
|
|
306572
306763
|
if (!operationRecord) continue;
|
|
306573
|
-
const ref = String(
|
|
306764
|
+
const ref = String(asRecord20(operationRecord.channel)?.$ref ?? "");
|
|
306574
306765
|
const lastSegment = ref.includes("/") ? unescapePointer(ref.slice(ref.lastIndexOf("/") + 1)) : "";
|
|
306575
306766
|
if (lastSegment !== channel.id()) continue;
|
|
306576
|
-
const binding =
|
|
306767
|
+
const binding = asRecord20(asRecord20(operationRecord.bindings)?.mqtt);
|
|
306577
306768
|
if (binding) operationBindings.push(binding);
|
|
306578
306769
|
}
|
|
306579
306770
|
const serverBindings = [];
|
|
306580
306771
|
let protocolVersion = 4;
|
|
306581
306772
|
for (const server of servers) {
|
|
306582
|
-
const serverJson =
|
|
306773
|
+
const serverJson = asRecord20(server.json()) ?? {};
|
|
306583
306774
|
if (String(serverJson.protocolVersion ?? "") === "5" || server.protocol().toLowerCase() === "mqtt5") {
|
|
306584
306775
|
protocolVersion = 5;
|
|
306585
306776
|
}
|
|
306586
|
-
const binding =
|
|
306777
|
+
const binding = asRecord20(asRecord20(serverJson.bindings)?.mqtt);
|
|
306587
306778
|
if (binding) serverBindings.push(binding);
|
|
306588
306779
|
}
|
|
306589
306780
|
const messageBindings = [];
|
|
306590
306781
|
for (const message of messagesRaw) {
|
|
306591
|
-
const binding =
|
|
306782
|
+
const binding = asRecord20(asRecord20(asRecord20(message.json())?.bindings)?.mqtt);
|
|
306592
306783
|
if (binding) messageBindings.push({ messageId: message.id() || message.name() || "message", binding });
|
|
306593
306784
|
}
|
|
306594
306785
|
return { operationBindings, serverBindings, messageBindings, protocolVersion };
|
|
@@ -306605,7 +306796,7 @@ function buildReplySchemaByMessageId(document2) {
|
|
|
306605
306796
|
}
|
|
306606
306797
|
if (!reply) continue;
|
|
306607
306798
|
const replyMessage = reply.messages().all().find((message) => message.hasPayload());
|
|
306608
|
-
const replySchema = replyMessage ?
|
|
306799
|
+
const replySchema = replyMessage ? asRecord20(replyMessage.payload()?.json()) ?? void 0 : void 0;
|
|
306609
306800
|
if (!replySchema) continue;
|
|
306610
306801
|
for (const requestMessage of operation.messages().all()) {
|
|
306611
306802
|
const id = requestMessage.id();
|
|
@@ -306620,16 +306811,16 @@ function messageDescriptor2(message, warnings, channelId, defaultContentType, re
|
|
|
306620
306811
|
const title = message.title() || message.name() || id;
|
|
306621
306812
|
const contentType2 = message.contentType() || defaultContentType || "application/json";
|
|
306622
306813
|
const contentKind = contentKindFor(contentType2);
|
|
306623
|
-
const payloadSchema = message.hasPayload() ?
|
|
306814
|
+
const payloadSchema = message.hasPayload() ? asRecord20(message.payload()?.json()) ?? void 0 : void 0;
|
|
306624
306815
|
if (!payloadSchema) {
|
|
306625
306816
|
warnings.push(`ASYNCAPI_MESSAGE_NO_PAYLOAD: message ${id} on channel ${channelId} declares no payload schema; its content is an empty sample and is not schema-validated`);
|
|
306626
306817
|
}
|
|
306627
|
-
const rawMessage =
|
|
306628
|
-
const xAckSchema =
|
|
306818
|
+
const rawMessage = asRecord20(message.json()) ?? {};
|
|
306819
|
+
const xAckSchema = asRecord20(rawMessage["x-ack"]) ?? void 0;
|
|
306629
306820
|
const replySchema = replyByMessageId.get(message.id());
|
|
306630
306821
|
const ackSchema = xAckSchema ?? replySchema;
|
|
306631
306822
|
const ackSource = xAckSchema ? "x-ack" : replySchema ? "reply" : void 0;
|
|
306632
|
-
const correlationRaw =
|
|
306823
|
+
const correlationRaw = asRecord20(rawMessage.correlationId)?.location;
|
|
306633
306824
|
const correlationLocation = typeof correlationRaw === "string" ? correlationRaw : void 0;
|
|
306634
306825
|
const examples = message.examples().all().filter((example) => example.hasPayload());
|
|
306635
306826
|
const hasExample = examples.length > 0;
|
|
@@ -306665,7 +306856,7 @@ function channelDescriptor(channel, document2, documentJson, defaultContentType,
|
|
|
306665
306856
|
const servers = resolveServers(channel, document2);
|
|
306666
306857
|
const messagesRaw = channel.messages().all();
|
|
306667
306858
|
const transport = detectTransport(channel, servers, messagesRaw, documentJson, warnings);
|
|
306668
|
-
const parameterNames = Object.keys(
|
|
306859
|
+
const parameterNames = Object.keys(asRecord20(channel.json().parameters) ?? {}).sort();
|
|
306669
306860
|
const serverUrl = servers.find((server) => server.url())?.url() || options.endpointUrl?.trim() || "";
|
|
306670
306861
|
if (!serverUrl) {
|
|
306671
306862
|
warnings.push(`ASYNCAPI_NO_SERVER_URL: channel ${channel.id()} has no resolvable server url; the generated request url is derived from the channel address only and must be completed before use`);
|
|
@@ -307107,7 +307298,7 @@ var SCHEMES_BY_FAMILY = {
|
|
|
307107
307298
|
http: /* @__PURE__ */ new Set(["http", "https"]),
|
|
307108
307299
|
amqp: /* @__PURE__ */ new Set(["amqp", "amqps"])
|
|
307109
307300
|
};
|
|
307110
|
-
function
|
|
307301
|
+
function asRecord21(value) {
|
|
307111
307302
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
307112
307303
|
return value;
|
|
307113
307304
|
}
|
|
@@ -307126,7 +307317,7 @@ function parsesAsUrl(value) {
|
|
|
307126
307317
|
}
|
|
307127
307318
|
}
|
|
307128
307319
|
function checkExternalDocs(label, raw, warnings) {
|
|
307129
|
-
const externalDocs =
|
|
307320
|
+
const externalDocs = asRecord21(raw);
|
|
307130
307321
|
if (!externalDocs) return;
|
|
307131
307322
|
const url = externalDocs.url;
|
|
307132
307323
|
if (typeof url !== "string" || !parsesAsUrl(url)) {
|
|
@@ -307140,7 +307331,7 @@ function lintTagsAndExternalDocs(label, node, warnings) {
|
|
|
307140
307331
|
const seen = /* @__PURE__ */ new Set();
|
|
307141
307332
|
const reported = /* @__PURE__ */ new Set();
|
|
307142
307333
|
tags.forEach((entry, i) => {
|
|
307143
|
-
const tag =
|
|
307334
|
+
const tag = asRecord21(entry);
|
|
307144
307335
|
const name = typeof tag?.name === "string" ? tag.name : void 0;
|
|
307145
307336
|
if (name !== void 0) {
|
|
307146
307337
|
if (seen.has(name) && !reported.has(name)) {
|
|
@@ -307176,7 +307367,7 @@ function lintSchemaFormat(label, value, warnings) {
|
|
|
307176
307367
|
}
|
|
307177
307368
|
function lintTraits(label, traitsRaw, warnings) {
|
|
307178
307369
|
asArray14(traitsRaw).forEach((entry, i) => {
|
|
307179
|
-
const trait =
|
|
307370
|
+
const trait = asRecord21(entry);
|
|
307180
307371
|
if (trait && trait.payload !== void 0) {
|
|
307181
307372
|
warnings.push(
|
|
307182
307373
|
`ASYNCAPI_TRAIT_PAYLOAD_FORBIDDEN: ${label} trait #${i} defines payload; the Message/Operation Trait Object is the message/operation definition minus payload, so a trait MUST NOT carry one`
|
|
@@ -307185,7 +307376,7 @@ function lintTraits(label, traitsRaw, warnings) {
|
|
|
307185
307376
|
});
|
|
307186
307377
|
}
|
|
307187
307378
|
function lintParameter(label, raw, warnings) {
|
|
307188
|
-
const parameter =
|
|
307379
|
+
const parameter = asRecord21(raw);
|
|
307189
307380
|
if (!parameter) return;
|
|
307190
307381
|
const enumValues = asArray14(parameter.enum);
|
|
307191
307382
|
if (enumValues.length > 0) {
|
|
@@ -307205,9 +307396,9 @@ function lintParameter(label, raw, warnings) {
|
|
|
307205
307396
|
}
|
|
307206
307397
|
}
|
|
307207
307398
|
function lintSecurityRequirements(documentJson, is3, label, securityRaw, warnings) {
|
|
307208
|
-
const declared =
|
|
307399
|
+
const declared = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
307209
307400
|
for (const entry of asArray14(securityRaw)) {
|
|
307210
|
-
const requirement =
|
|
307401
|
+
const requirement = asRecord21(entry);
|
|
307211
307402
|
if (!requirement) continue;
|
|
307212
307403
|
if (is3) {
|
|
307213
307404
|
const type = String(requirement.type ?? "");
|
|
@@ -307220,7 +307411,7 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
307220
307411
|
continue;
|
|
307221
307412
|
}
|
|
307222
307413
|
for (const [schemeName, scopesRaw] of Object.entries(requirement)) {
|
|
307223
|
-
const scheme =
|
|
307414
|
+
const scheme = asRecord21(declared[schemeName]);
|
|
307224
307415
|
if (!scheme) {
|
|
307225
307416
|
warnings.push(
|
|
307226
307417
|
`ASYNCAPI_SECURITY_REQUIREMENT_UNDECLARED: ${label} security requirement references scheme ${JSON.stringify(schemeName)}, which is not declared in components.securitySchemes`
|
|
@@ -307237,9 +307428,9 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
307237
307428
|
}
|
|
307238
307429
|
}
|
|
307239
307430
|
function lintSecuritySchemes(documentJson, warnings) {
|
|
307240
|
-
const schemes =
|
|
307431
|
+
const schemes = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
307241
307432
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
307242
|
-
const scheme =
|
|
307433
|
+
const scheme = asRecord21(raw);
|
|
307243
307434
|
if (!scheme) continue;
|
|
307244
307435
|
const type = scheme.type;
|
|
307245
307436
|
if (typeof type !== "string" || !ASYNCAPI_SECURITY_SCHEME_TYPES.has(type)) {
|
|
@@ -307261,9 +307452,9 @@ function lintSecuritySchemes(documentJson, warnings) {
|
|
|
307261
307452
|
}
|
|
307262
307453
|
}
|
|
307263
307454
|
function lintComponentKeys(documentJson, warnings) {
|
|
307264
|
-
const components =
|
|
307455
|
+
const components = asRecord21(documentJson.components) ?? {};
|
|
307265
307456
|
for (const [sectionName, sectionRaw] of Object.entries(components)) {
|
|
307266
|
-
const section =
|
|
307457
|
+
const section = asRecord21(sectionRaw);
|
|
307267
307458
|
if (!section) continue;
|
|
307268
307459
|
for (const key of Object.keys(section)) {
|
|
307269
307460
|
if (!COMPONENT_KEY_RE.test(key)) {
|
|
@@ -307275,7 +307466,7 @@ function lintComponentKeys(documentJson, warnings) {
|
|
|
307275
307466
|
}
|
|
307276
307467
|
}
|
|
307277
307468
|
function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
307278
|
-
const variables =
|
|
307469
|
+
const variables = asRecord21(variablesRaw) ?? {};
|
|
307279
307470
|
const used = /* @__PURE__ */ new Set();
|
|
307280
307471
|
for (const match of template.matchAll(/\{([^{}]+)\}/g)) {
|
|
307281
307472
|
used.add(match[1]);
|
|
@@ -307289,7 +307480,7 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
307289
307480
|
if (!used.has(name)) {
|
|
307290
307481
|
warnings.push(`ASYNCAPI_SERVER_VARIABLE_UNUSED: ${serverLabel} declares variable ${name} that never appears in the server url/host/pathname`);
|
|
307291
307482
|
}
|
|
307292
|
-
const variable =
|
|
307483
|
+
const variable = asRecord21(raw);
|
|
307293
307484
|
if (!variable) continue;
|
|
307294
307485
|
if (variable.default === void 0) {
|
|
307295
307486
|
warnings.push(
|
|
@@ -307310,10 +307501,10 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
307310
307501
|
}
|
|
307311
307502
|
}
|
|
307312
307503
|
function lintServers(documentJson, is3, warnings) {
|
|
307313
|
-
const servers =
|
|
307504
|
+
const servers = asRecord21(documentJson.servers) ?? {};
|
|
307314
307505
|
let httpProtocolSeen = false;
|
|
307315
307506
|
for (const [name, raw] of Object.entries(servers)) {
|
|
307316
|
-
const server =
|
|
307507
|
+
const server = asRecord21(raw);
|
|
307317
307508
|
if (!server) continue;
|
|
307318
307509
|
const label = `server ${name}`;
|
|
307319
307510
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : void 0;
|
|
@@ -307356,9 +307547,9 @@ function lintServers(documentJson, is3, warnings) {
|
|
|
307356
307547
|
}
|
|
307357
307548
|
}
|
|
307358
307549
|
function lintBindings(label, bindingsRaw, warnings) {
|
|
307359
|
-
const bindings =
|
|
307550
|
+
const bindings = asRecord21(bindingsRaw);
|
|
307360
307551
|
if (!bindings) return;
|
|
307361
|
-
const kafka =
|
|
307552
|
+
const kafka = asRecord21(bindings.kafka);
|
|
307362
307553
|
if (kafka) {
|
|
307363
307554
|
if (typeof kafka.topic === "string" && (kafka.topic === "." || kafka.topic === ".." || !KAFKA_TOPIC_NAME_RE.test(kafka.topic))) {
|
|
307364
307555
|
warnings.push(
|
|
@@ -307373,15 +307564,15 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307373
307564
|
}
|
|
307374
307565
|
}
|
|
307375
307566
|
}
|
|
307376
|
-
const amqp =
|
|
307567
|
+
const amqp = asRecord21(bindings.amqp);
|
|
307377
307568
|
if (amqp) {
|
|
307378
|
-
const queue =
|
|
307569
|
+
const queue = asRecord21(amqp.queue);
|
|
307379
307570
|
if (queue && typeof queue.name === "string" && queue.name.length > 255) {
|
|
307380
307571
|
warnings.push(
|
|
307381
307572
|
`ASYNCAPI_AMQP_BINDING_INVALID: ${label} amqp binding queue name exceeds 255 characters (AMQP 0-9-1 short-string limit; amqp binding README, bindingVersion-scoped, non-normative source)`
|
|
307382
307573
|
);
|
|
307383
307574
|
}
|
|
307384
|
-
const exchange =
|
|
307575
|
+
const exchange = asRecord21(amqp.exchange);
|
|
307385
307576
|
if (exchange && exchange.type !== void 0 && !AMQP_EXCHANGE_TYPES.has(String(exchange.type))) {
|
|
307386
307577
|
warnings.push(
|
|
307387
307578
|
`ASYNCAPI_AMQP_BINDING_INVALID: ${label} amqp binding exchange type ${JSON.stringify(exchange.type)} must be one of default, direct, topic, fanout, headers (amqp binding README, bindingVersion-scoped, non-normative source)`
|
|
@@ -307398,7 +307589,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307398
307589
|
);
|
|
307399
307590
|
}
|
|
307400
307591
|
}
|
|
307401
|
-
const http2 =
|
|
307592
|
+
const http2 = asRecord21(bindings.http);
|
|
307402
307593
|
if (http2) {
|
|
307403
307594
|
if (http2.method !== void 0 && (typeof http2.method !== "string" || !HTTP_BINDING_METHODS.has(http2.method))) {
|
|
307404
307595
|
warnings.push(
|
|
@@ -307411,7 +307602,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307411
307602
|
);
|
|
307412
307603
|
}
|
|
307413
307604
|
}
|
|
307414
|
-
const ws =
|
|
307605
|
+
const ws = asRecord21(bindings.ws) ?? asRecord21(bindings.websockets);
|
|
307415
307606
|
if (ws && typeof ws.subprotocol === "string" && !IANA_WEBSOCKET_SUBPROTOCOLS.has(ws.subprotocol)) {
|
|
307416
307607
|
warnings.push(
|
|
307417
307608
|
`ASYNCAPI_WS_SUBPROTOCOL_UNREGISTERED: ${label} ws binding declares subprotocol ${JSON.stringify(ws.subprotocol)}, which is not in the IANA WebSocket Subprotocol Name Registry (vendored snapshot 2026-07)`
|
|
@@ -307419,11 +307610,11 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307419
307610
|
}
|
|
307420
307611
|
}
|
|
307421
307612
|
function effectiveSchema(label, slot, raw, warnings) {
|
|
307422
|
-
const node =
|
|
307613
|
+
const node = asRecord21(raw);
|
|
307423
307614
|
if (!node) return void 0;
|
|
307424
307615
|
if (typeof node.schemaFormat === "string" && node.schema !== void 0) {
|
|
307425
307616
|
lintSchemaFormat(`${label} ${slot}`, node.schemaFormat, warnings);
|
|
307426
|
-
return
|
|
307617
|
+
return asRecord21(node.schema) ?? void 0;
|
|
307427
307618
|
}
|
|
307428
307619
|
return node;
|
|
307429
307620
|
}
|
|
@@ -307454,7 +307645,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307454
307645
|
const examples = asArray14(message.examples);
|
|
307455
307646
|
if (!is3) {
|
|
307456
307647
|
examples.forEach((entry, i) => {
|
|
307457
|
-
const example =
|
|
307648
|
+
const example = asRecord21(entry);
|
|
307458
307649
|
if (!example) return;
|
|
307459
307650
|
for (const key of Object.keys(example)) {
|
|
307460
307651
|
if (!MESSAGE_EXAMPLE_KEYS.has(key) && !key.startsWith("x-")) {
|
|
@@ -307465,7 +307656,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307465
307656
|
}
|
|
307466
307657
|
});
|
|
307467
307658
|
}
|
|
307468
|
-
if (headersSchema && examples.some((entry) =>
|
|
307659
|
+
if (headersSchema && examples.some((entry) => asRecord21(entry)?.headers !== void 0)) {
|
|
307469
307660
|
const packed = packSchema(documentJson, headersSchema, "3.0", "response");
|
|
307470
307661
|
const validate4 = packed.unsupported ? null : compileSchemaValidator(packed.schema);
|
|
307471
307662
|
if (!validate4) {
|
|
@@ -307474,7 +307665,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307474
307665
|
);
|
|
307475
307666
|
} else {
|
|
307476
307667
|
examples.forEach((entry, i) => {
|
|
307477
|
-
const example =
|
|
307668
|
+
const example = asRecord21(entry);
|
|
307478
307669
|
if (!example || example.headers === void 0) return;
|
|
307479
307670
|
if (!validate4(example.headers)) {
|
|
307480
307671
|
warnings.push(
|
|
@@ -307489,23 +307680,23 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307489
307680
|
lintTagsAndExternalDocs(label, message, warnings);
|
|
307490
307681
|
}
|
|
307491
307682
|
function messagesOfOperation2x(op) {
|
|
307492
|
-
const root =
|
|
307683
|
+
const root = asRecord21(op.message);
|
|
307493
307684
|
if (!root) return [];
|
|
307494
|
-
const oneOf = asArray14(root.oneOf).map((entry) =>
|
|
307685
|
+
const oneOf = asArray14(root.oneOf).map((entry) => asRecord21(entry)).filter((entry) => entry !== null);
|
|
307495
307686
|
return oneOf.length > 0 ? oneOf : [root];
|
|
307496
307687
|
}
|
|
307497
307688
|
function lintChannels(documentJson, is3, minor, warnings) {
|
|
307498
|
-
const channels =
|
|
307689
|
+
const channels = asRecord21(documentJson.channels) ?? {};
|
|
307499
307690
|
const state = { seen: /* @__PURE__ */ new WeakSet(), messageIds: /* @__PURE__ */ new Map() };
|
|
307500
307691
|
const operationIds = /* @__PURE__ */ new Map();
|
|
307501
307692
|
const addresses = /* @__PURE__ */ new Map();
|
|
307502
307693
|
for (const [channelKey, channelRaw] of Object.entries(channels)) {
|
|
307503
|
-
const channel =
|
|
307694
|
+
const channel = asRecord21(channelRaw);
|
|
307504
307695
|
if (!channel) continue;
|
|
307505
307696
|
const channelLabel = `channel ${channelKey}`;
|
|
307506
307697
|
lintBindings(channelLabel, channel.bindings, warnings);
|
|
307507
307698
|
lintTagsAndExternalDocs(channelLabel, channel, warnings);
|
|
307508
|
-
const parameters =
|
|
307699
|
+
const parameters = asRecord21(channel.parameters) ?? {};
|
|
307509
307700
|
for (const [parameterName, parameterRaw] of Object.entries(parameters)) {
|
|
307510
307701
|
lintParameter(`${channelLabel} parameter ${parameterName}`, parameterRaw, warnings);
|
|
307511
307702
|
}
|
|
@@ -307518,15 +307709,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
307518
307709
|
addresses.set(channel.address, channelKey);
|
|
307519
307710
|
}
|
|
307520
307711
|
}
|
|
307521
|
-
const messages =
|
|
307712
|
+
const messages = asRecord21(channel.messages) ?? {};
|
|
307522
307713
|
for (const [messageKey, messageRaw] of Object.entries(messages)) {
|
|
307523
|
-
const message =
|
|
307714
|
+
const message = asRecord21(messageRaw);
|
|
307524
307715
|
if (message) lintMessage2(documentJson, `message ${messageKey} on channel ${channelKey}`, message, is3, minor, state, warnings);
|
|
307525
307716
|
}
|
|
307526
307717
|
continue;
|
|
307527
307718
|
}
|
|
307528
307719
|
for (const opKey of ["publish", "subscribe"]) {
|
|
307529
|
-
const op =
|
|
307720
|
+
const op = asRecord21(channel[opKey]);
|
|
307530
307721
|
if (!op) continue;
|
|
307531
307722
|
const opLabel = `${opKey} operation on channel ${channelKey}`;
|
|
307532
307723
|
if (typeof op.operationId === "string") {
|
|
@@ -307549,15 +307740,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
307549
307740
|
}
|
|
307550
307741
|
}
|
|
307551
307742
|
function lintOperations3(documentJson, warnings) {
|
|
307552
|
-
const operations =
|
|
307743
|
+
const operations = asRecord21(documentJson.operations) ?? {};
|
|
307553
307744
|
for (const [operationKey, operationRaw] of Object.entries(operations)) {
|
|
307554
|
-
const operation =
|
|
307745
|
+
const operation = asRecord21(operationRaw);
|
|
307555
307746
|
if (!operation) continue;
|
|
307556
307747
|
const label = `operation ${operationKey}`;
|
|
307557
307748
|
if (operation.action !== "send" && operation.action !== "receive") {
|
|
307558
307749
|
warnings.push(`ASYNCAPI_OPERATION_ACTION_INVALID: ${label} action ${JSON.stringify(operation.action)} must be "send" or "receive" (AsyncAPI 3.0 Operation Object)`);
|
|
307559
307750
|
}
|
|
307560
|
-
const replyAddress =
|
|
307751
|
+
const replyAddress = asRecord21(asRecord21(operation.reply)?.address);
|
|
307561
307752
|
if (replyAddress && typeof replyAddress.location === "string" && !isAsyncApiRuntimeExpression(replyAddress.location)) {
|
|
307562
307753
|
warnings.push(
|
|
307563
307754
|
`ASYNCAPI_RUNTIME_EXPRESSION_INVALID: ${label} reply.address location ${JSON.stringify(replyAddress.location)} is not a valid AsyncAPI runtime expression ($message.header#/<pointer> or $message.payload#/<pointer>)`
|
|
@@ -307581,7 +307772,7 @@ function resolveLocalPointer(root, ref) {
|
|
|
307581
307772
|
if (!Number.isInteger(idx) || idx < 0 || idx >= node.length) return false;
|
|
307582
307773
|
node = node[idx];
|
|
307583
307774
|
} else {
|
|
307584
|
-
const record =
|
|
307775
|
+
const record = asRecord21(node);
|
|
307585
307776
|
if (!record || !(key in record)) return false;
|
|
307586
307777
|
node = record[key];
|
|
307587
307778
|
}
|
|
@@ -307625,13 +307816,13 @@ function lintAsyncApiDocument(index) {
|
|
|
307625
307816
|
lintChannels(documentJson, is3, minor, warnings);
|
|
307626
307817
|
if (is3) lintOperations3(documentJson, warnings);
|
|
307627
307818
|
lintTagsAndExternalDocs("document", documentJson, warnings);
|
|
307628
|
-
const info2 =
|
|
307819
|
+
const info2 = asRecord21(documentJson.info);
|
|
307629
307820
|
if (info2) lintTagsAndExternalDocs("info", info2, warnings);
|
|
307630
307821
|
return warnings;
|
|
307631
307822
|
}
|
|
307632
307823
|
|
|
307633
307824
|
// src/lib/protocols/asyncapi/asyncapi-binding-lints.ts
|
|
307634
|
-
function
|
|
307825
|
+
function asRecord22(value) {
|
|
307635
307826
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
307636
307827
|
return value;
|
|
307637
307828
|
}
|
|
@@ -307726,46 +307917,46 @@ function pushSite(ctx, site) {
|
|
|
307726
307917
|
if (site) ctx.sites.push(site);
|
|
307727
307918
|
}
|
|
307728
307919
|
function siteOf(scope, label, raw, direction) {
|
|
307729
|
-
const bindings =
|
|
307920
|
+
const bindings = asRecord22(raw);
|
|
307730
307921
|
if (!bindings) return null;
|
|
307731
307922
|
return { scope, label, bindings, direction };
|
|
307732
307923
|
}
|
|
307733
307924
|
function collectSites(ctx) {
|
|
307734
307925
|
const { doc } = ctx;
|
|
307735
|
-
const servers =
|
|
307926
|
+
const servers = asRecord22(doc.servers) ?? {};
|
|
307736
307927
|
for (const [name, raw] of Object.entries(servers)) {
|
|
307737
|
-
const server =
|
|
307928
|
+
const server = asRecord22(raw);
|
|
307738
307929
|
if (server) pushSite(ctx, siteOf("server", "server " + name, server.bindings));
|
|
307739
307930
|
}
|
|
307740
|
-
const channels =
|
|
307931
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
307741
307932
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
307742
|
-
const channel =
|
|
307933
|
+
const channel = asRecord22(rawCh);
|
|
307743
307934
|
if (!channel) continue;
|
|
307744
307935
|
pushSite(ctx, siteOf("channel", "channel " + chName, channel.bindings));
|
|
307745
307936
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
307746
|
-
const op =
|
|
307937
|
+
const op = asRecord22(channel[opKeyword]);
|
|
307747
307938
|
if (!op) continue;
|
|
307748
307939
|
const direction = opKeyword === "publish" ? "send" : "receive";
|
|
307749
307940
|
pushSite(ctx, siteOf("operation", "channel " + chName + " " + opKeyword, op.bindings, direction));
|
|
307750
|
-
const message =
|
|
307941
|
+
const message = asRecord22(op.message);
|
|
307751
307942
|
if (message) collectMessageSites(ctx, "channel " + chName + " " + opKeyword + " message", message, direction);
|
|
307752
307943
|
}
|
|
307753
|
-
const chMessages =
|
|
307944
|
+
const chMessages = asRecord22(channel.messages);
|
|
307754
307945
|
if (chMessages) {
|
|
307755
307946
|
for (const [msgName, rawMsg] of Object.entries(chMessages)) {
|
|
307756
|
-
const message =
|
|
307947
|
+
const message = asRecord22(rawMsg);
|
|
307757
307948
|
if (message) collectMessageSites(ctx, "channel " + chName + " message " + msgName, message, void 0);
|
|
307758
307949
|
}
|
|
307759
307950
|
}
|
|
307760
307951
|
}
|
|
307761
|
-
const operations =
|
|
307952
|
+
const operations = asRecord22(doc.operations) ?? {};
|
|
307762
307953
|
for (const [opName, rawOp] of Object.entries(operations)) {
|
|
307763
|
-
const op =
|
|
307954
|
+
const op = asRecord22(rawOp);
|
|
307764
307955
|
if (!op) continue;
|
|
307765
307956
|
const direction = op.action === "send" ? "send" : op.action === "receive" ? "receive" : void 0;
|
|
307766
307957
|
pushSite(ctx, siteOf("operation", "operation " + opName, op.bindings, direction));
|
|
307767
307958
|
}
|
|
307768
|
-
const components =
|
|
307959
|
+
const components = asRecord22(doc.components) ?? {};
|
|
307769
307960
|
const componentScopes = [
|
|
307770
307961
|
["serverBindings", "server"],
|
|
307771
307962
|
["channelBindings", "channel"],
|
|
@@ -307773,21 +307964,21 @@ function collectSites(ctx) {
|
|
|
307773
307964
|
["messageBindings", "message"]
|
|
307774
307965
|
];
|
|
307775
307966
|
for (const [key, scope] of componentScopes) {
|
|
307776
|
-
const group2 =
|
|
307967
|
+
const group2 = asRecord22(components[key]) ?? {};
|
|
307777
307968
|
for (const [name, raw] of Object.entries(group2)) {
|
|
307778
307969
|
pushSite(ctx, siteOf(scope, "components." + key + " " + name, raw));
|
|
307779
307970
|
}
|
|
307780
307971
|
}
|
|
307781
|
-
const compMessages =
|
|
307972
|
+
const compMessages = asRecord22(components.messages) ?? {};
|
|
307782
307973
|
for (const [name, raw] of Object.entries(compMessages)) {
|
|
307783
|
-
const message =
|
|
307974
|
+
const message = asRecord22(raw);
|
|
307784
307975
|
if (message) collectMessageSites(ctx, "components.messages " + name, message, void 0);
|
|
307785
307976
|
}
|
|
307786
307977
|
}
|
|
307787
307978
|
function collectMessageSites(ctx, label, message, direction) {
|
|
307788
307979
|
pushSite(ctx, siteOf("message", label, message.bindings, direction));
|
|
307789
307980
|
for (const entry of asArray15(message.oneOf)) {
|
|
307790
|
-
const alt =
|
|
307981
|
+
const alt = asRecord22(entry);
|
|
307791
307982
|
if (alt) pushSite(ctx, siteOf("message", label + " oneOf alternative", alt.bindings, direction));
|
|
307792
307983
|
}
|
|
307793
307984
|
}
|
|
@@ -307812,7 +308003,7 @@ function lintBindingSites(ctx) {
|
|
|
307812
308003
|
}
|
|
307813
308004
|
const family = BINDING_KEY_FAMILY[key];
|
|
307814
308005
|
if (family) familiesSeen.set(family, site.label + " bindings." + key);
|
|
307815
|
-
const binding =
|
|
308006
|
+
const binding = asRecord22(site.bindings[key]);
|
|
307816
308007
|
if (!binding) continue;
|
|
307817
308008
|
if (key === "mqtt5") {
|
|
307818
308009
|
warnings.push(
|
|
@@ -307855,8 +308046,8 @@ function lintBindingSites(ctx) {
|
|
|
307855
308046
|
}
|
|
307856
308047
|
}
|
|
307857
308048
|
const serverFamilies = /* @__PURE__ */ new Set();
|
|
307858
|
-
for (const raw of Object.values(
|
|
307859
|
-
const server =
|
|
308049
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308050
|
+
const server = asRecord22(raw);
|
|
307860
308051
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
307861
308052
|
const family = SERVER_PROTOCOL_FAMILY[protocol];
|
|
307862
308053
|
if (family) serverFamilies.add(family);
|
|
@@ -307872,7 +308063,7 @@ function lintBindingSites(ctx) {
|
|
|
307872
308063
|
}
|
|
307873
308064
|
}
|
|
307874
308065
|
function compileBindingSchema(ctx, label, schema) {
|
|
307875
|
-
const record =
|
|
308066
|
+
const record = asRecord22(schema);
|
|
307876
308067
|
if (!record) return null;
|
|
307877
308068
|
const packed = packSchema(ctx.doc, record, "3.0", "response");
|
|
307878
308069
|
if (packed.unsupported) {
|
|
@@ -307906,9 +308097,9 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
307906
308097
|
for (const part of ["query", "headers"]) {
|
|
307907
308098
|
const schemaRaw = binding[part];
|
|
307908
308099
|
if (schemaRaw === void 0) continue;
|
|
307909
|
-
const schema =
|
|
308100
|
+
const schema = asRecord22(schemaRaw);
|
|
307910
308101
|
if (!schema) continue;
|
|
307911
|
-
const properties =
|
|
308102
|
+
const properties = asRecord22(schema.properties);
|
|
307912
308103
|
if (!properties || Object.keys(properties).length === 0) {
|
|
307913
308104
|
warnings.push(
|
|
307914
308105
|
"ASYNCAPI_WS_BINDING_SCHEMA_NO_PROPERTIES: " + label + " ws binding " + part + " schema declares no properties; the generated handshake carries nothing from it (ws binding README: object schema with properties)"
|
|
@@ -307925,7 +308116,7 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
307925
308116
|
}
|
|
307926
308117
|
if (part !== "headers") continue;
|
|
307927
308118
|
const lower = name.toLowerCase();
|
|
307928
|
-
const prop =
|
|
308119
|
+
const prop = asRecord22(rawProp) ?? {};
|
|
307929
308120
|
if (WS_RUNTIME_OWNED_HEADERS.has(lower)) {
|
|
307930
308121
|
const detail = required.has(lower) ? "is required by the binding but" : "";
|
|
307931
308122
|
warnings.push(
|
|
@@ -307976,10 +308167,10 @@ function substituteTemplates(value) {
|
|
|
307976
308167
|
}
|
|
307977
308168
|
function lintChannelAddresses(ctx) {
|
|
307978
308169
|
const { doc, warnings } = ctx;
|
|
307979
|
-
const channels =
|
|
308170
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
307980
308171
|
const wsServers = [];
|
|
307981
|
-
for (const [name, raw] of Object.entries(
|
|
307982
|
-
const server =
|
|
308172
|
+
for (const [name, raw] of Object.entries(asRecord22(doc.servers) ?? {})) {
|
|
308173
|
+
const server = asRecord22(raw);
|
|
307983
308174
|
if (!server) continue;
|
|
307984
308175
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
307985
308176
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "ws") continue;
|
|
@@ -307987,7 +308178,7 @@ function lintChannelAddresses(ctx) {
|
|
|
307987
308178
|
if (url) wsServers.push({ name, base: url });
|
|
307988
308179
|
}
|
|
307989
308180
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
307990
|
-
const channel =
|
|
308181
|
+
const channel = asRecord22(rawCh);
|
|
307991
308182
|
if (!channel) continue;
|
|
307992
308183
|
const address = ctx.isV3 ? channel.address : chName;
|
|
307993
308184
|
if (typeof address !== "string" || address.length === 0) continue;
|
|
@@ -308024,8 +308215,8 @@ function lintChannelAddresses(ctx) {
|
|
|
308024
308215
|
}
|
|
308025
308216
|
}
|
|
308026
308217
|
function collectMqttServerVersions(ctx) {
|
|
308027
|
-
for (const raw of Object.values(
|
|
308028
|
-
const server =
|
|
308218
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308219
|
+
const server = asRecord22(raw);
|
|
308029
308220
|
if (!server) continue;
|
|
308030
308221
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
308031
308222
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "mqtt") continue;
|
|
@@ -308046,7 +308237,7 @@ function lintMqttBindings(ctx) {
|
|
|
308046
308237
|
const { warnings } = ctx;
|
|
308047
308238
|
const only3x = ctx.mqttVersions.size > 0 && !ctx.mqttVersions.has(5) && !ctx.mqttVersions.has(0);
|
|
308048
308239
|
for (const site of ctx.sites) {
|
|
308049
|
-
const binding =
|
|
308240
|
+
const binding = asRecord22(site.bindings.mqtt);
|
|
308050
308241
|
if (!binding) continue;
|
|
308051
308242
|
if (only3x) {
|
|
308052
308243
|
const gated = MQTT5_ONLY_FIELDS[site.scope];
|
|
@@ -308062,7 +308253,7 @@ function lintMqttBindings(ctx) {
|
|
|
308062
308253
|
}
|
|
308063
308254
|
if (site.scope === "server") {
|
|
308064
308255
|
const clientId = binding.clientId;
|
|
308065
|
-
if (clientId !== void 0 && typeof clientId !== "string" && !
|
|
308256
|
+
if (clientId !== void 0 && typeof clientId !== "string" && !asRecord22(clientId)) {
|
|
308066
308257
|
warnings.push("ASYNCAPI_MQTT_CLIENT_ID_INVALID: " + site.label + " mqtt binding clientId must be a string or schema object (mqtt binding README)");
|
|
308067
308258
|
}
|
|
308068
308259
|
if (typeof clientId === "string") {
|
|
@@ -308075,12 +308266,12 @@ function lintMqttBindings(ctx) {
|
|
|
308075
308266
|
if (clientId === "" && only3x && binding.cleanSession !== true) {
|
|
308076
308267
|
warnings.push("ASYNCAPI_MQTT_CLIENT_ID_EMPTY_REQUIRES_CLEAN_SESSION: " + site.label + " mqtt binding declares an empty clientId without cleanSession true; MQTT 3.1.1 requires CleanSession 1 for zero-byte ClientIds (MQTT 3.1.1 section 3.1.3.1)");
|
|
308077
308268
|
}
|
|
308078
|
-
} else if (
|
|
308269
|
+
} else if (asRecord22(clientId)) {
|
|
308079
308270
|
compileBindingSchema(ctx, site.label + " mqtt binding clientId", clientId);
|
|
308080
308271
|
}
|
|
308081
308272
|
const lastWill = binding.lastWill;
|
|
308082
308273
|
if (lastWill !== void 0) {
|
|
308083
|
-
const will =
|
|
308274
|
+
const will = asRecord22(lastWill);
|
|
308084
308275
|
if (!will) {
|
|
308085
308276
|
warnings.push("ASYNCAPI_MQTT_LAST_WILL_INVALID: " + site.label + " mqtt binding lastWill must be an object (mqtt binding README)");
|
|
308086
308277
|
} else {
|
|
@@ -308097,7 +308288,7 @@ function lintMqttBindings(ctx) {
|
|
|
308097
308288
|
}
|
|
308098
308289
|
for (const [field, max] of [["sessionExpiryInterval", 4294967295], ["maximumPacketSize", 268435455]]) {
|
|
308099
308290
|
const value = binding[field];
|
|
308100
|
-
if (
|
|
308291
|
+
if (asRecord22(value)) compileBindingSchema(ctx, site.label + " mqtt binding " + field, value);
|
|
308101
308292
|
else if (typeof value === "number" && value > max) {
|
|
308102
308293
|
warnings.push("ASYNCAPI_MQTT_VALUE_OUT_OF_RANGE: " + site.label + " mqtt binding " + field + " " + value + " exceeds the MQTT wire ceiling " + max);
|
|
308103
308294
|
}
|
|
@@ -308105,7 +308296,7 @@ function lintMqttBindings(ctx) {
|
|
|
308105
308296
|
}
|
|
308106
308297
|
if (site.scope === "operation") {
|
|
308107
308298
|
const expiry = binding.messageExpiryInterval;
|
|
308108
|
-
if (
|
|
308299
|
+
if (asRecord22(expiry)) compileBindingSchema(ctx, site.label + " mqtt binding messageExpiryInterval", expiry);
|
|
308109
308300
|
else if (typeof expiry === "number" && expiry > 4294967295) {
|
|
308110
308301
|
warnings.push("ASYNCAPI_MQTT_VALUE_OUT_OF_RANGE: " + site.label + " mqtt binding messageExpiryInterval " + expiry + " exceeds the four-byte-integer ceiling 4294967295 (MQTT 5.0 section 3.3.2.3.3)");
|
|
308111
308302
|
}
|
|
@@ -308125,15 +308316,15 @@ function lintMqttBindings(ctx) {
|
|
|
308125
308316
|
warnings.push("ASYNCAPI_MQTT_CONTENT_TYPE_INVALID: " + site.label + " mqtt binding contentType " + JSON.stringify(contentType2) + " is not RFC 6838 type/subtype syntax (MQTT 5.0 section 3.3.2.3.9)");
|
|
308126
308317
|
}
|
|
308127
308318
|
const correlationData = binding.correlationData;
|
|
308128
|
-
if (
|
|
308319
|
+
if (asRecord22(correlationData)) {
|
|
308129
308320
|
compileBindingSchema(ctx, site.label + " mqtt binding correlationData", correlationData);
|
|
308130
|
-
const maxLength =
|
|
308321
|
+
const maxLength = asRecord22(correlationData)?.maxLength;
|
|
308131
308322
|
if (typeof maxLength === "number" && maxLength > 65535) {
|
|
308132
308323
|
warnings.push("ASYNCAPI_MQTT_CORRELATION_DATA_TOO_LONG: " + site.label + " mqtt binding correlationData maxLength " + maxLength + " exceeds the 65535-byte binary-data ceiling (MQTT 5.0 section 1.5.6)");
|
|
308133
308324
|
}
|
|
308134
308325
|
}
|
|
308135
308326
|
const responseTopic = binding.responseTopic;
|
|
308136
|
-
if (
|
|
308327
|
+
if (asRecord22(responseTopic)) compileBindingSchema(ctx, site.label + " mqtt binding responseTopic", responseTopic);
|
|
308137
308328
|
const pfi = binding.payloadFormatIndicator;
|
|
308138
308329
|
if (pfi === 1) {
|
|
308139
308330
|
const message = siteMessageRecord(ctx, site);
|
|
@@ -308163,38 +308354,38 @@ function normalizeMediaType(value) {
|
|
|
308163
308354
|
function siteMessageRecord(ctx, site) {
|
|
308164
308355
|
const doc = ctx.doc;
|
|
308165
308356
|
const matches = (message) => {
|
|
308166
|
-
return message !== null &&
|
|
308357
|
+
return message !== null && asRecord22(message.bindings)?.mqtt === site.bindings.mqtt;
|
|
308167
308358
|
};
|
|
308168
|
-
for (const rawCh of Object.values(
|
|
308169
|
-
const channel =
|
|
308359
|
+
for (const rawCh of Object.values(asRecord22(doc.channels) ?? {})) {
|
|
308360
|
+
const channel = asRecord22(rawCh);
|
|
308170
308361
|
if (!channel) continue;
|
|
308171
308362
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308172
|
-
const op =
|
|
308173
|
-
const message =
|
|
308363
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308364
|
+
const message = asRecord22(op?.message);
|
|
308174
308365
|
if (matches(message)) return message;
|
|
308175
308366
|
for (const entry of asArray15(message?.oneOf)) {
|
|
308176
|
-
const alt =
|
|
308367
|
+
const alt = asRecord22(entry);
|
|
308177
308368
|
if (matches(alt)) return alt;
|
|
308178
308369
|
}
|
|
308179
308370
|
}
|
|
308180
|
-
for (const rawMsg of Object.values(
|
|
308181
|
-
const message =
|
|
308371
|
+
for (const rawMsg of Object.values(asRecord22(channel.messages) ?? {})) {
|
|
308372
|
+
const message = asRecord22(rawMsg);
|
|
308182
308373
|
if (matches(message)) return message;
|
|
308183
308374
|
}
|
|
308184
308375
|
}
|
|
308185
|
-
for (const rawMsg of Object.values(
|
|
308186
|
-
const message =
|
|
308376
|
+
for (const rawMsg of Object.values(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
308377
|
+
const message = asRecord22(rawMsg);
|
|
308187
308378
|
if (matches(message)) return message;
|
|
308188
308379
|
}
|
|
308189
308380
|
return null;
|
|
308190
308381
|
}
|
|
308191
308382
|
function lintHttpBindings(ctx) {
|
|
308192
308383
|
for (const site of ctx.sites) {
|
|
308193
|
-
const binding =
|
|
308384
|
+
const binding = asRecord22(site.bindings.http);
|
|
308194
308385
|
if (!binding) continue;
|
|
308195
308386
|
if (site.scope === "operation" && binding.query !== void 0) {
|
|
308196
|
-
const schema =
|
|
308197
|
-
const properties =
|
|
308387
|
+
const schema = asRecord22(binding.query);
|
|
308388
|
+
const properties = asRecord22(schema?.properties);
|
|
308198
308389
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
308199
308390
|
ctx.warnings.push(
|
|
308200
308391
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding query must be an object schema with properties (http binding README)"
|
|
@@ -308209,8 +308400,8 @@ function lintHttpBindings(ctx) {
|
|
|
308209
308400
|
}
|
|
308210
308401
|
}
|
|
308211
308402
|
if (site.scope === "message" && binding.headers !== void 0) {
|
|
308212
|
-
const schema =
|
|
308213
|
-
const properties =
|
|
308403
|
+
const schema = asRecord22(binding.headers);
|
|
308404
|
+
const properties = asRecord22(schema?.properties);
|
|
308214
308405
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
308215
308406
|
ctx.warnings.push(
|
|
308216
308407
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding headers must be an object schema with properties (http binding README)"
|
|
@@ -308246,19 +308437,19 @@ var HTTP_PROTOCOL_HEADER_DENYLIST = /* @__PURE__ */ new Set([
|
|
|
308246
308437
|
function collectMessages2(ctx) {
|
|
308247
308438
|
const out = [];
|
|
308248
308439
|
const doc = ctx.doc;
|
|
308249
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308250
|
-
const channel =
|
|
308440
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
308441
|
+
const channel = asRecord22(rawCh);
|
|
308251
308442
|
if (!channel) continue;
|
|
308252
308443
|
const siblingList = [];
|
|
308253
308444
|
const push = (label, raw) => {
|
|
308254
|
-
const message =
|
|
308445
|
+
const message = asRecord22(raw);
|
|
308255
308446
|
if (!message) return;
|
|
308256
308447
|
siblingList.push(message);
|
|
308257
308448
|
out.push({ label, message, channelMessages: siblingList });
|
|
308258
308449
|
};
|
|
308259
308450
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308260
|
-
const op =
|
|
308261
|
-
const message =
|
|
308451
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308452
|
+
const message = asRecord22(op?.message);
|
|
308262
308453
|
if (!message) continue;
|
|
308263
308454
|
const alternatives = asArray15(message.oneOf);
|
|
308264
308455
|
if (alternatives.length > 0) {
|
|
@@ -308267,12 +308458,12 @@ function collectMessages2(ctx) {
|
|
|
308267
308458
|
push("channel " + chName + " " + opKeyword + " message", message);
|
|
308268
308459
|
}
|
|
308269
308460
|
}
|
|
308270
|
-
for (const [msgName, rawMsg] of Object.entries(
|
|
308461
|
+
for (const [msgName, rawMsg] of Object.entries(asRecord22(channel.messages) ?? {})) {
|
|
308271
308462
|
push("channel " + chName + " message " + msgName, rawMsg);
|
|
308272
308463
|
}
|
|
308273
308464
|
}
|
|
308274
|
-
for (const [name, raw] of Object.entries(
|
|
308275
|
-
const message =
|
|
308465
|
+
for (const [name, raw] of Object.entries(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
308466
|
+
const message = asRecord22(raw);
|
|
308276
308467
|
if (message) out.push({ label: "components.messages " + name, message, channelMessages: null });
|
|
308277
308468
|
}
|
|
308278
308469
|
return out;
|
|
@@ -308281,7 +308472,7 @@ function effectiveMessageId(message) {
|
|
|
308281
308472
|
if (typeof message.messageId === "string") return message.messageId;
|
|
308282
308473
|
let fromTraits;
|
|
308283
308474
|
for (const entry of asArray15(message.traits)) {
|
|
308284
|
-
const trait =
|
|
308475
|
+
const trait = asRecord22(entry);
|
|
308285
308476
|
if (trait && typeof trait.messageId === "string") fromTraits = trait.messageId;
|
|
308286
308477
|
}
|
|
308287
308478
|
return fromTraits;
|
|
@@ -308295,7 +308486,7 @@ function lintMessages(ctx) {
|
|
|
308295
308486
|
const validatorFor = (message) => {
|
|
308296
308487
|
if (validatorCache.has(message)) return validatorCache.get(message) ?? null;
|
|
308297
308488
|
let validate4 = null;
|
|
308298
|
-
const payload =
|
|
308489
|
+
const payload = asRecord22(message.payload);
|
|
308299
308490
|
if (payload) {
|
|
308300
308491
|
const packed = packSchema(ctx.doc, payload, "3.0", "response");
|
|
308301
308492
|
if (!packed.unsupported) {
|
|
@@ -308315,10 +308506,10 @@ function lintMessages(ctx) {
|
|
|
308315
308506
|
}
|
|
308316
308507
|
if (owner === void 0) idOwners.set(id, label);
|
|
308317
308508
|
}
|
|
308318
|
-
const headers =
|
|
308509
|
+
const headers = asRecord22(message.headers);
|
|
308319
308510
|
if (headers) {
|
|
308320
308511
|
compileBindingSchema(ctx, label + " headers", headers);
|
|
308321
|
-
const properties =
|
|
308512
|
+
const properties = asRecord22(headers.properties) ?? {};
|
|
308322
308513
|
for (const name of Object.keys(properties)) {
|
|
308323
308514
|
if (!HTTP_TOKEN_RE.test(name)) {
|
|
308324
308515
|
warnings.push("ASYNCAPI_BINDING_HEADER_NAME_INVALID: " + label + " headers property " + JSON.stringify(name) + " is not a valid RFC 9110 token");
|
|
@@ -308340,7 +308531,7 @@ function lintMessages(ctx) {
|
|
|
308340
308531
|
return compileSchemaValidator(packed.schema);
|
|
308341
308532
|
})() : null;
|
|
308342
308533
|
asArray15(message.examples).forEach((entry, i) => {
|
|
308343
|
-
const example =
|
|
308534
|
+
const example = asRecord22(entry);
|
|
308344
308535
|
if (!example) return;
|
|
308345
308536
|
if (example.payload === void 0 && example.headers !== void 0) {
|
|
308346
308537
|
if (headerValidate) {
|
|
@@ -308367,7 +308558,7 @@ function lintMessages(ctx) {
|
|
|
308367
308558
|
const traits = asArray15(message.traits);
|
|
308368
308559
|
const traitKeyValues = /* @__PURE__ */ new Map();
|
|
308369
308560
|
traits.forEach((entry, i) => {
|
|
308370
|
-
const trait =
|
|
308561
|
+
const trait = asRecord22(entry);
|
|
308371
308562
|
if (!trait) return;
|
|
308372
308563
|
if (trait.traits !== void 0) {
|
|
308373
308564
|
warnings.push("ASYNCAPI_TRAIT_FORBIDDEN_FIELD: " + label + " trait #" + i + ' declares "traits"; a Message Trait Object cannot itself carry traits (AsyncAPI Message Trait Object)');
|
|
@@ -308384,14 +308575,14 @@ function lintMessages(ctx) {
|
|
|
308384
308575
|
}
|
|
308385
308576
|
});
|
|
308386
308577
|
}
|
|
308387
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308388
|
-
const channel =
|
|
308578
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(ctx.doc.channels) ?? {})) {
|
|
308579
|
+
const channel = asRecord22(rawCh);
|
|
308389
308580
|
if (!channel) continue;
|
|
308390
308581
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308391
|
-
const op =
|
|
308582
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308392
308583
|
if (!op) continue;
|
|
308393
308584
|
asArray15(op.traits).forEach((entry, i) => {
|
|
308394
|
-
const trait =
|
|
308585
|
+
const trait = asRecord22(entry);
|
|
308395
308586
|
if (!trait) return;
|
|
308396
308587
|
for (const forbidden of ["message", "traits"]) {
|
|
308397
308588
|
if (trait[forbidden] !== void 0) {
|
|
@@ -308401,13 +308592,13 @@ function lintMessages(ctx) {
|
|
|
308401
308592
|
});
|
|
308402
308593
|
}
|
|
308403
308594
|
}
|
|
308404
|
-
const channelsRecord =
|
|
308405
|
-
const channelValues = Object.values(channelsRecord).map(
|
|
308406
|
-
for (const [opName, rawOp] of Object.entries(
|
|
308407
|
-
const op =
|
|
308595
|
+
const channelsRecord = asRecord22(ctx.doc.channels) ?? {};
|
|
308596
|
+
const channelValues = Object.values(channelsRecord).map(asRecord22).filter((c) => c !== null);
|
|
308597
|
+
for (const [opName, rawOp] of Object.entries(asRecord22(ctx.doc.operations) ?? {})) {
|
|
308598
|
+
const op = asRecord22(rawOp);
|
|
308408
308599
|
if (!op) continue;
|
|
308409
308600
|
asArray15(op.traits).forEach((entry, i) => {
|
|
308410
|
-
const trait =
|
|
308601
|
+
const trait = asRecord22(entry);
|
|
308411
308602
|
if (!trait) return;
|
|
308412
308603
|
for (const forbidden of ["action", "channel", "traits"]) {
|
|
308413
308604
|
if (trait[forbidden] !== void 0) {
|
|
@@ -308415,13 +308606,13 @@ function lintMessages(ctx) {
|
|
|
308415
308606
|
}
|
|
308416
308607
|
}
|
|
308417
308608
|
});
|
|
308418
|
-
const opChannel =
|
|
308609
|
+
const opChannel = asRecord22(op.channel);
|
|
308419
308610
|
if (opChannel && channelValues.length > 0 && !channelValues.includes(opChannel)) {
|
|
308420
308611
|
warnings.push("ASYNCAPI_OPERATION_CHANNEL_UNRESOLVED: operation " + opName + " channel does not resolve to a declared channel of this document (AsyncAPI 3.0 Operation Object channel)");
|
|
308421
308612
|
}
|
|
308422
308613
|
if (opChannel) {
|
|
308423
|
-
const channelMessages = Object.values(
|
|
308424
|
-
const opMessages = asArray15(op.messages).map(
|
|
308614
|
+
const channelMessages = Object.values(asRecord22(opChannel.messages) ?? {}).map(asRecord22).filter((m) => m !== null);
|
|
308615
|
+
const opMessages = asArray15(op.messages).map(asRecord22).filter((m) => m !== null);
|
|
308425
308616
|
for (const opMessage of opMessages) {
|
|
308426
308617
|
const inChannel = channelMessages.some((cm) => cm === opMessage || JSON.stringify(cm) === JSON.stringify(opMessage));
|
|
308427
308618
|
if (!inChannel) {
|
|
@@ -308429,16 +308620,16 @@ function lintMessages(ctx) {
|
|
|
308429
308620
|
}
|
|
308430
308621
|
}
|
|
308431
308622
|
}
|
|
308432
|
-
const reply =
|
|
308623
|
+
const reply = asRecord22(op.reply);
|
|
308433
308624
|
if (reply) {
|
|
308434
|
-
const replyChannel =
|
|
308435
|
-
const replyAddress =
|
|
308625
|
+
const replyChannel = asRecord22(reply.channel);
|
|
308626
|
+
const replyAddress = asRecord22(reply.address);
|
|
308436
308627
|
if (replyAddress && replyChannel && typeof replyChannel.address === "string" && replyChannel.address.length > 0) {
|
|
308437
308628
|
warnings.push("ASYNCAPI_REPLY_ADDRESS_CONFLICT: operation " + opName + " reply declares a dynamic reply address while its reply channel pins address " + JSON.stringify(replyChannel.address) + "; a dynamic reply channel address SHOULD be null (AsyncAPI 3.0 Operation Reply Object)");
|
|
308438
308629
|
}
|
|
308439
308630
|
if (replyChannel) {
|
|
308440
|
-
const replyChannelMessages = Object.values(
|
|
308441
|
-
const replyMessages = asArray15(reply.messages).map(
|
|
308631
|
+
const replyChannelMessages = Object.values(asRecord22(replyChannel.messages) ?? {}).map(asRecord22).filter((m) => m !== null);
|
|
308632
|
+
const replyMessages = asArray15(reply.messages).map(asRecord22).filter((m) => m !== null);
|
|
308442
308633
|
for (const replyMessage of replyMessages) {
|
|
308443
308634
|
const inChannel = replyChannelMessages.some((cm) => cm === replyMessage || JSON.stringify(cm) === JSON.stringify(replyMessage));
|
|
308444
308635
|
if (!inChannel) {
|
|
@@ -308450,8 +308641,8 @@ function lintMessages(ctx) {
|
|
|
308450
308641
|
}
|
|
308451
308642
|
}
|
|
308452
308643
|
function hasWsSurface(ctx) {
|
|
308453
|
-
for (const raw of Object.values(
|
|
308454
|
-
const server =
|
|
308644
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308645
|
+
const server = asRecord22(raw);
|
|
308455
308646
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
308456
308647
|
if (SERVER_PROTOCOL_FAMILY[protocol] === "ws") return true;
|
|
308457
308648
|
}
|
|
@@ -308462,11 +308653,11 @@ var API_KEY_LOCATIONS_V2 = /* @__PURE__ */ new Set(["user", "password"]);
|
|
|
308462
308653
|
var SYNTHESIZABLE_SCHEME_TYPES = /* @__PURE__ */ new Set(["http", "httpApiKey", "apiKey", "userPassword"]);
|
|
308463
308654
|
function lintSecuritySchemes2(ctx) {
|
|
308464
308655
|
const { warnings } = ctx;
|
|
308465
|
-
const schemes =
|
|
308656
|
+
const schemes = asRecord22(asRecord22(ctx.doc.components)?.securitySchemes) ?? {};
|
|
308466
308657
|
const oauthLikeNames = /* @__PURE__ */ new Set();
|
|
308467
308658
|
const unsatisfiable = [];
|
|
308468
308659
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
308469
|
-
const scheme =
|
|
308660
|
+
const scheme = asRecord22(raw);
|
|
308470
308661
|
if (!scheme) continue;
|
|
308471
308662
|
const type = typeof scheme.type === "string" ? scheme.type : "";
|
|
308472
308663
|
if (type === "oauth2" || type === "openIdConnect") oauthLikeNames.add(name);
|
|
@@ -308486,9 +308677,9 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308486
308677
|
}
|
|
308487
308678
|
}
|
|
308488
308679
|
if (type === "oauth2") {
|
|
308489
|
-
const flows =
|
|
308680
|
+
const flows = asRecord22(scheme.flows) ?? {};
|
|
308490
308681
|
for (const [flowName, rawFlow] of Object.entries(flows)) {
|
|
308491
|
-
const flow =
|
|
308682
|
+
const flow = asRecord22(rawFlow);
|
|
308492
308683
|
if (!flow) continue;
|
|
308493
308684
|
for (const field of ["authorizationUrl", "tokenUrl", "refreshUrl"]) {
|
|
308494
308685
|
const url = flow[field];
|
|
@@ -308505,11 +308696,11 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308505
308696
|
if (unsatisfiable.length > 0) {
|
|
308506
308697
|
warnings.push("ASYNCAPI_SECURITY_NOT_SYNTHESIZED: generated collection items carry no credential material for security scheme(s) " + unsatisfiable.join(", ") + "; connections that enforce them must be configured manually");
|
|
308507
308698
|
}
|
|
308508
|
-
for (const [serverName, raw] of Object.entries(
|
|
308509
|
-
const server =
|
|
308699
|
+
for (const [serverName, raw] of Object.entries(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308700
|
+
const server = asRecord22(raw);
|
|
308510
308701
|
if (!server) continue;
|
|
308511
308702
|
asArray15(server.security).forEach((entry, i) => {
|
|
308512
|
-
const requirement =
|
|
308703
|
+
const requirement = asRecord22(entry);
|
|
308513
308704
|
if (!requirement) return;
|
|
308514
308705
|
for (const [schemeName, value] of Object.entries(requirement)) {
|
|
308515
308706
|
if (!Array.isArray(value)) {
|
|
@@ -308519,7 +308710,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308519
308710
|
if (value.some((scope) => typeof scope !== "string")) {
|
|
308520
308711
|
warnings.push("ASYNCAPI_SECURITY_REQUIREMENT_INVALID: server " + serverName + " security requirement #" + i + " scopes for " + schemeName + " must be strings (AsyncAPI Security Requirement Object)");
|
|
308521
308712
|
}
|
|
308522
|
-
if (value.length > 0 && !oauthLikeNames.has(schemeName) &&
|
|
308713
|
+
if (value.length > 0 && !oauthLikeNames.has(schemeName) && asRecord22(schemes[schemeName])) {
|
|
308523
308714
|
warnings.push("ASYNCAPI_SECURITY_REQUIREMENT_INVALID: server " + serverName + " security requirement #" + i + " lists scopes for non-OAuth scheme " + schemeName + "; the array MUST be empty for such schemes (AsyncAPI Security Requirement Object)");
|
|
308524
308715
|
}
|
|
308525
308716
|
}
|
|
@@ -308529,7 +308720,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308529
308720
|
function lintSocketIo(ctx) {
|
|
308530
308721
|
if (!ctx.socketIo) return;
|
|
308531
308722
|
const { warnings, doc } = ctx;
|
|
308532
|
-
const xSocketIo =
|
|
308723
|
+
const xSocketIo = asRecord22(doc["x-socketio"]) ?? {};
|
|
308533
308724
|
const declaredVersion = xSocketIo.version ?? xSocketIo.eio ?? xSocketIo.EIO;
|
|
308534
308725
|
if (declaredVersion !== void 0 && String(declaredVersion) !== "4") {
|
|
308535
308726
|
warnings.push("ASYNCAPI_SOCKETIO_VERSION_UNSUPPORTED: x-socketio declares version " + JSON.stringify(declaredVersion) + " but generated Socket.IO items target Socket.IO v4 / Engine.IO 4");
|
|
@@ -308538,8 +308729,8 @@ function lintSocketIo(ctx) {
|
|
|
308538
308729
|
if (typeof path10 === "string" && path10 !== "/socket.io/" && path10 !== "/socket.io") {
|
|
308539
308730
|
warnings.push("ASYNCAPI_SOCKETIO_PATH_UNSUPPORTED: x-socketio declares path " + JSON.stringify(path10) + " but generated Socket.IO items connect on the default /socket.io/ path");
|
|
308540
308731
|
}
|
|
308541
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308542
|
-
const channel =
|
|
308732
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
308733
|
+
const channel = asRecord22(rawCh);
|
|
308543
308734
|
if (!channel) continue;
|
|
308544
308735
|
const address = ctx.isV3 ? typeof channel.address === "string" ? channel.address : "" : chName;
|
|
308545
308736
|
if (address && address !== "/" && !address.startsWith("/")) {
|
|
@@ -308547,10 +308738,10 @@ function lintSocketIo(ctx) {
|
|
|
308547
308738
|
} else if (address && address !== "/") {
|
|
308548
308739
|
warnings.push("ASYNCAPI_SOCKETIO_NAMESPACE_NOT_ROUTED: channel " + chName + " implies Socket.IO namespace " + JSON.stringify(address) + " but generated items connect to the root namespace");
|
|
308549
308740
|
}
|
|
308550
|
-
const wsBinding =
|
|
308551
|
-
const queryProps =
|
|
308741
|
+
const wsBinding = asRecord22(asRecord22(channel.bindings)?.ws);
|
|
308742
|
+
const queryProps = asRecord22(asRecord22(wsBinding?.query)?.properties) ?? {};
|
|
308552
308743
|
for (const [propName2, rawProp] of Object.entries(queryProps)) {
|
|
308553
|
-
const prop =
|
|
308744
|
+
const prop = asRecord22(rawProp);
|
|
308554
308745
|
if (!prop) continue;
|
|
308555
308746
|
const declared = schemaDeclaredValues(prop).map(String);
|
|
308556
308747
|
if (propName2 === "EIO" && declared.some((v) => v !== "4")) {
|
|
@@ -308570,7 +308761,7 @@ function lintSocketIo(ctx) {
|
|
|
308570
308761
|
if (message.contentKind === "binary") {
|
|
308571
308762
|
warnings.push("ASYNCAPI_SOCKETIO_BINARY_NOT_SYNTHESIZED: channel " + channel.id + " message " + message.id + " is binary; generated Socket.IO events carry placeholder text arguments, not binary attachments");
|
|
308572
308763
|
}
|
|
308573
|
-
const ack =
|
|
308764
|
+
const ack = asRecord22(message.ackSchema);
|
|
308574
308765
|
if (ack) {
|
|
308575
308766
|
const declaredType = Array.isArray(ack.type) ? ack.type.map(String) : ack.type !== void 0 ? [String(ack.type)] : [];
|
|
308576
308767
|
if (declaredType.length > 0 && !declaredType.includes("array")) {
|
|
@@ -308581,7 +308772,7 @@ function lintSocketIo(ctx) {
|
|
|
308581
308772
|
}
|
|
308582
308773
|
}
|
|
308583
308774
|
function lintAsyncApiBindingSurfaces(index) {
|
|
308584
|
-
const doc =
|
|
308775
|
+
const doc = asRecord22(index.documentJson);
|
|
308585
308776
|
if (!doc) return [];
|
|
308586
308777
|
const ctx = {
|
|
308587
308778
|
index,
|
|
@@ -308603,7 +308794,7 @@ function lintAsyncApiBindingSurfaces(index) {
|
|
|
308603
308794
|
lintSocketIo(ctx);
|
|
308604
308795
|
for (const site of ctx.sites) {
|
|
308605
308796
|
if (site.scope !== "channel") continue;
|
|
308606
|
-
const wsBinding =
|
|
308797
|
+
const wsBinding = asRecord22(site.bindings.ws);
|
|
308607
308798
|
if (wsBinding) lintWsChannelBinding(ctx, site.label, wsBinding);
|
|
308608
308799
|
}
|
|
308609
308800
|
return ctx.warnings;
|
|
@@ -308615,7 +308806,7 @@ var ASYNCAPI_INSTRUMENT_LIMITS = {
|
|
|
308615
308806
|
};
|
|
308616
308807
|
var MESSAGE_NODE_TYPES = /* @__PURE__ */ new Set(["ws-raw-message", "ws-socketio-message", "mqtt-message"]);
|
|
308617
308808
|
var BASE64_RE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
308618
|
-
function
|
|
308809
|
+
function asRecord23(value) {
|
|
308619
308810
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
308620
308811
|
return value;
|
|
308621
308812
|
}
|
|
@@ -308623,7 +308814,7 @@ function asArray16(value) {
|
|
|
308623
308814
|
return Array.isArray(value) ? value : [];
|
|
308624
308815
|
}
|
|
308625
308816
|
function schemaAllowsStringInstance(schema) {
|
|
308626
|
-
const record =
|
|
308817
|
+
const record = asRecord23(schema);
|
|
308627
308818
|
if (!record) return false;
|
|
308628
308819
|
const declared = record.type;
|
|
308629
308820
|
const types2 = Array.isArray(declared) ? declared.map(String) : declared !== void 0 ? [String(declared)] : [];
|
|
@@ -308716,18 +308907,18 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308716
308907
|
if (binding.messageExpiryInterval !== void 0 && !isNonNegativeInteger(binding.messageExpiryInterval)) bad("messageExpiryInterval", "must be a non-negative integer (seconds)");
|
|
308717
308908
|
if (binding.cleanSession !== void 0 && typeof binding.cleanSession !== "boolean") bad("cleanSession", "must be a boolean");
|
|
308718
308909
|
if (binding.keepAlive !== void 0 && !isIntegerInRange(binding.keepAlive, 0, 65535)) bad("keepAlive", "must be an integer in 0-65535 (seconds, MQTT two-byte Keep Alive)");
|
|
308719
|
-
if (binding.sessionExpiryInterval !== void 0 && !isIntegerInRange(binding.sessionExpiryInterval, 0, 4294967295) &&
|
|
308720
|
-
if (binding.maximumPacketSize !== void 0 && !isIntegerInRange(binding.maximumPacketSize, 1, 268435455) &&
|
|
308910
|
+
if (binding.sessionExpiryInterval !== void 0 && !isIntegerInRange(binding.sessionExpiryInterval, 0, 4294967295) && asRecord23(binding.sessionExpiryInterval) === null) bad("sessionExpiryInterval", "must be an integer in 0-4294967295 (seconds, MQTT 5.0 four-byte property) or a schema object");
|
|
308911
|
+
if (binding.maximumPacketSize !== void 0 && !isIntegerInRange(binding.maximumPacketSize, 1, 268435455) && asRecord23(binding.maximumPacketSize) === null) bad("maximumPacketSize", "must be an integer in 1-268435455 (bytes, MQTT 5.0 packet size limit) or a schema object");
|
|
308721
308912
|
if (binding.payloadFormatIndicator !== void 0 && binding.payloadFormatIndicator !== 0 && binding.payloadFormatIndicator !== 1) bad("payloadFormatIndicator", "must be 0 (unspecified bytes) or 1 (UTF-8)");
|
|
308722
308913
|
if (binding.contentType !== void 0 && typeof binding.contentType !== "string") bad("contentType", "must be a string");
|
|
308723
308914
|
if (typeof binding.responseTopic === "string") {
|
|
308724
308915
|
const violation = mqttTopicViolation(binding.responseTopic, false);
|
|
308725
308916
|
if (violation) warnings.push(`ASYNCAPI_MQTT_TOPIC_INVALID: channel ${channelId} ${scope} binding responseTopic "${binding.responseTopic}" ${violation}`);
|
|
308726
|
-
} else if (binding.responseTopic !== void 0 &&
|
|
308917
|
+
} else if (binding.responseTopic !== void 0 && asRecord23(binding.responseTopic) === null) {
|
|
308727
308918
|
bad("responseTopic", "must be a string or a schema object");
|
|
308728
308919
|
}
|
|
308729
308920
|
if (binding.correlationData !== void 0) {
|
|
308730
|
-
const correlationData =
|
|
308921
|
+
const correlationData = asRecord23(binding.correlationData);
|
|
308731
308922
|
if (!correlationData) {
|
|
308732
308923
|
bad("correlationData", "must be a Schema Object describing the binary correlation data");
|
|
308733
308924
|
} else if (correlationData.type !== "string" || correlationData.format !== "byte" && correlationData.format !== "binary") {
|
|
@@ -308736,7 +308927,7 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308736
308927
|
);
|
|
308737
308928
|
}
|
|
308738
308929
|
}
|
|
308739
|
-
const lastWill =
|
|
308930
|
+
const lastWill = asRecord23(binding.lastWill);
|
|
308740
308931
|
if (lastWill) {
|
|
308741
308932
|
if (typeof lastWill.topic === "string") {
|
|
308742
308933
|
const violation = mqttTopicViolation(lastWill.topic, false);
|
|
@@ -308751,14 +308942,14 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308751
308942
|
}
|
|
308752
308943
|
}
|
|
308753
308944
|
function channelHasPublishDirection(documentJson, channelId) {
|
|
308754
|
-
const channel =
|
|
308945
|
+
const channel = asRecord23(asRecord23(documentJson.channels)?.[channelId]);
|
|
308755
308946
|
if (channel?.publish !== void 0) return true;
|
|
308756
308947
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
308757
|
-
const operations =
|
|
308948
|
+
const operations = asRecord23(documentJson.operations) ?? {};
|
|
308758
308949
|
for (const operationRaw of Object.values(operations)) {
|
|
308759
|
-
const operation =
|
|
308950
|
+
const operation = asRecord23(operationRaw);
|
|
308760
308951
|
if (!operation || operation.action !== "send") continue;
|
|
308761
|
-
const opChannel =
|
|
308952
|
+
const opChannel = asRecord23(operation.channel);
|
|
308762
308953
|
if (!opChannel) continue;
|
|
308763
308954
|
if (channel && opChannel === channel) return true;
|
|
308764
308955
|
const uid = opChannel["x-parser-unique-object-id"];
|
|
@@ -308811,7 +309002,7 @@ function collectMessageNodeIds(node, ids, path10) {
|
|
|
308811
309002
|
}
|
|
308812
309003
|
const children4 = node.children !== void 0 ? asArray16(node.children) : asArray16(node.item);
|
|
308813
309004
|
children4.forEach((child4, i) => {
|
|
308814
|
-
const record =
|
|
309005
|
+
const record = asRecord23(child4);
|
|
308815
309006
|
if (record) collectMessageNodeIds(record, ids, `${path10}/${i}`);
|
|
308816
309007
|
});
|
|
308817
309008
|
}
|
|
@@ -308854,7 +309045,7 @@ function validateWsBinding(channel, warnings) {
|
|
|
308854
309045
|
for (const key of ["query", "headers"]) {
|
|
308855
309046
|
const schema = binding[key];
|
|
308856
309047
|
if (schema === void 0) continue;
|
|
308857
|
-
const record =
|
|
309048
|
+
const record = asRecord23(schema);
|
|
308858
309049
|
if (!record || record.type !== void 0 && record.type !== "object") {
|
|
308859
309050
|
warnings.push(`ASYNCAPI_WS_BINDING_INVALID: channel ${channel.id} ws binding ${key} must be a Schema Object of type object`);
|
|
308860
309051
|
}
|
|
@@ -308890,7 +309081,7 @@ function instrumentAsyncApiCollection(collection, index) {
|
|
|
308890
309081
|
const expected = index.channels.reduce((sum, channel) => sum + channel.messages.length, 0);
|
|
308891
309082
|
const ids = [];
|
|
308892
309083
|
asArray16(collection.item).forEach((entry, i) => {
|
|
308893
|
-
const record =
|
|
309084
|
+
const record = asRecord23(entry);
|
|
308894
309085
|
if (record) collectMessageNodeIds(record, ids, `item/${i}`);
|
|
308895
309086
|
});
|
|
308896
309087
|
const unique = new Set(ids).size;
|
|
@@ -309666,7 +309857,7 @@ var validateRegistryServerSchema = (() => {
|
|
|
309666
309857
|
}
|
|
309667
309858
|
}
|
|
309668
309859
|
})();
|
|
309669
|
-
function
|
|
309860
|
+
function asRecord24(value) {
|
|
309670
309861
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
309671
309862
|
return value;
|
|
309672
309863
|
}
|
|
@@ -309681,7 +309872,7 @@ function registrySchemaKey(key) {
|
|
|
309681
309872
|
}
|
|
309682
309873
|
function normalizeRegistrySchemaValue(value) {
|
|
309683
309874
|
if (Array.isArray(value)) return value.map((entry) => normalizeRegistrySchemaValue(entry));
|
|
309684
|
-
const record =
|
|
309875
|
+
const record = asRecord24(value);
|
|
309685
309876
|
if (!record) return value;
|
|
309686
309877
|
const out = {};
|
|
309687
309878
|
for (const [key, entry] of Object.entries(record)) {
|
|
@@ -309697,7 +309888,7 @@ function normalizeRegistryPackageForSchema(pkg) {
|
|
|
309697
309888
|
}
|
|
309698
309889
|
function normalizeRegistryManifestForSchema(record) {
|
|
309699
309890
|
const out = normalizeRegistrySchemaValue(record);
|
|
309700
|
-
if (Array.isArray(record.packages)) out.packages = record.packages.map((entry) => normalizeRegistryPackageForSchema(
|
|
309891
|
+
if (Array.isArray(record.packages)) out.packages = record.packages.map((entry) => normalizeRegistryPackageForSchema(asRecord24(entry) ?? {}));
|
|
309701
309892
|
return out;
|
|
309702
309893
|
}
|
|
309703
309894
|
function isRegistrySchemaDocument(record) {
|
|
@@ -309759,7 +309950,7 @@ function validateUriTemplate(value) {
|
|
|
309759
309950
|
return { variables: [...variables] };
|
|
309760
309951
|
}
|
|
309761
309952
|
function sampleFromSchema2(schema, depth) {
|
|
309762
|
-
const record =
|
|
309953
|
+
const record = asRecord24(schema);
|
|
309763
309954
|
if (!record) return record === null ? null : {};
|
|
309764
309955
|
if (record.example !== void 0) return record.example;
|
|
309765
309956
|
if (record.default !== void 0) return record.default;
|
|
@@ -309775,7 +309966,7 @@ function sampleFromSchema2(schema, depth) {
|
|
|
309775
309966
|
switch (type) {
|
|
309776
309967
|
case "object":
|
|
309777
309968
|
case void 0: {
|
|
309778
|
-
const properties =
|
|
309969
|
+
const properties = asRecord24(record.properties);
|
|
309779
309970
|
if (!properties) return {};
|
|
309780
309971
|
const required = new Set(asArray17(record.required));
|
|
309781
309972
|
const out = {};
|
|
@@ -309815,10 +310006,10 @@ function registryInputValue(name, input) {
|
|
|
309815
310006
|
}
|
|
309816
310007
|
function registryVariableValues(variables) {
|
|
309817
310008
|
const out = {};
|
|
309818
|
-
const record =
|
|
310009
|
+
const record = asRecord24(variables);
|
|
309819
310010
|
if (!record) return out;
|
|
309820
310011
|
for (const [name, input] of Object.entries(record)) {
|
|
309821
|
-
const value =
|
|
310012
|
+
const value = asRecord24(input);
|
|
309822
310013
|
if (value) out[name] = registryInputValue(name, value);
|
|
309823
310014
|
}
|
|
309824
310015
|
return out;
|
|
@@ -309831,7 +310022,7 @@ function resolveRegistryVariables(value, variables, context, warnings) {
|
|
|
309831
310022
|
});
|
|
309832
310023
|
}
|
|
309833
310024
|
function registryHeaderKeyValues(headers, variables = {}, warnings = [], context = "remote header") {
|
|
309834
|
-
return asArray17(headers).map((entry) =>
|
|
310025
|
+
return asArray17(headers).map((entry) => asRecord24(entry)).filter((entry) => entry !== null && typeof entry.name === "string" && entry.name !== "").map((entry) => {
|
|
309835
310026
|
const name = String(entry.name);
|
|
309836
310027
|
const value = registryInputValue(name, entry);
|
|
309837
310028
|
const resolvedValue = resolveRegistryVariables(value, variables, `${context} ${name}`, warnings);
|
|
@@ -309839,7 +310030,7 @@ function registryHeaderKeyValues(headers, variables = {}, warnings = [], context
|
|
|
309839
310030
|
});
|
|
309840
310031
|
}
|
|
309841
310032
|
function registryEnvKeyValues(variables) {
|
|
309842
|
-
return asArray17(variables).map((entry) =>
|
|
310033
|
+
return asArray17(variables).map((entry) => asRecord24(entry)).filter((entry) => entry !== null && typeof entry.name === "string" && entry.name !== "").map((entry) => {
|
|
309843
310034
|
const name = String(entry.name);
|
|
309844
310035
|
const secret = pickValue(entry, "isSecret", "is_secret") === true;
|
|
309845
310036
|
const value = typeof entry.value === "string" && entry.value && !secret ? entry.value : `{{${name}}}`;
|
|
@@ -309849,7 +310040,7 @@ function registryEnvKeyValues(variables) {
|
|
|
309849
310040
|
function stringArguments(values) {
|
|
309850
310041
|
return asArray17(values).map((entry) => {
|
|
309851
310042
|
if (typeof entry === "string") return entry;
|
|
309852
|
-
const record =
|
|
310043
|
+
const record = asRecord24(entry);
|
|
309853
310044
|
if (!record) return "";
|
|
309854
310045
|
if (typeof record.name === "string" && record.name) {
|
|
309855
310046
|
return typeof record.value === "string" && record.value ? `${record.name}=${record.value}` : String(record.name);
|
|
@@ -309886,11 +310077,11 @@ function hasModernPackageShape(pkg) {
|
|
|
309886
310077
|
return ["registryType", "runtimeHint", "runtimeArguments", "packageArguments", "environmentVariables"].some((key) => hasOwn(pkg, key));
|
|
309887
310078
|
}
|
|
309888
310079
|
function packageDescriptor(pkg, id, warnings) {
|
|
309889
|
-
if (pkg.transport !== void 0 &&
|
|
310080
|
+
if (pkg.transport !== void 0 && asRecord24(pkg.transport) === null) {
|
|
309890
310081
|
warnings.push(`MCP_PACKAGE_TRANSPORT_INVALID: server ${id} package transport must be an object when present; the package is skipped`);
|
|
309891
310082
|
return null;
|
|
309892
310083
|
}
|
|
309893
|
-
const transport =
|
|
310084
|
+
const transport = asRecord24(pkg.transport);
|
|
309894
310085
|
const transportType = typeof transport?.type === "string" ? String(transport.type).toLowerCase() : "";
|
|
309895
310086
|
if (transport) {
|
|
309896
310087
|
if (!transportType) {
|
|
@@ -309936,11 +310127,11 @@ function clientConfigDescriptor(id, entry) {
|
|
|
309936
310127
|
`MCP_STREAMABLE_HTTP_AS_SSE: server ${id} declares a ${type || "http"} remote; the Postman mcp-request item models only sse/stdio transports, so it is emitted as sse and the endpoint must speak SSE or be adjusted in-app`
|
|
309937
310128
|
);
|
|
309938
310129
|
}
|
|
309939
|
-
const headers = Object.entries(
|
|
310130
|
+
const headers = Object.entries(asRecord24(entry.headers) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
309940
310131
|
return { id, transport: "sse", url, headers, env: [], warnings };
|
|
309941
310132
|
}
|
|
309942
310133
|
const command = [typeof entry.command === "string" ? entry.command : "", ...stringArguments(entry.args)].filter(Boolean).join(" ");
|
|
309943
|
-
const env = Object.entries(
|
|
310134
|
+
const env = Object.entries(asRecord24(entry.env) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
309944
310135
|
return { id, transport: "stdio", headers: [], command, env, warnings: [] };
|
|
309945
310136
|
}
|
|
309946
310137
|
function toolDescriptor(tool, warnings) {
|
|
@@ -309949,7 +310140,7 @@ function toolDescriptor(tool, warnings) {
|
|
|
309949
310140
|
warnings.push("MCP_TOOL_NAME_MISSING: a tools[] entry has no name; it is skipped and generates no tools/call template");
|
|
309950
310141
|
return null;
|
|
309951
310142
|
}
|
|
309952
|
-
const inputSchema =
|
|
310143
|
+
const inputSchema = asRecord24(tool.inputSchema) ?? void 0;
|
|
309953
310144
|
const toolWarnings = [];
|
|
309954
310145
|
if (!inputSchema) {
|
|
309955
310146
|
toolWarnings.push(`MCP_TOOL_NO_INPUT_SCHEMA: tool ${name} declares no inputSchema; its tools/call arguments are an empty object and are not schema-validated`);
|
|
@@ -309958,8 +310149,8 @@ function toolDescriptor(tool, warnings) {
|
|
|
309958
310149
|
name,
|
|
309959
310150
|
description: typeof tool.description === "string" ? tool.description : void 0,
|
|
309960
310151
|
inputSchema,
|
|
309961
|
-
outputSchema:
|
|
309962
|
-
annotations:
|
|
310152
|
+
outputSchema: asRecord24(tool.outputSchema) ?? void 0,
|
|
310153
|
+
annotations: asRecord24(tool.annotations) ?? void 0,
|
|
309963
310154
|
sampleArguments: inputSchema ? sampleFromSchema2(inputSchema, 0) : {},
|
|
309964
310155
|
warnings: toolWarnings
|
|
309965
310156
|
};
|
|
@@ -309988,7 +310179,7 @@ function resourceDescriptor(resource, warnings) {
|
|
|
309988
310179
|
if (resource.mimeType !== void 0 && typeof resource.mimeType !== "string") {
|
|
309989
310180
|
resourceWarnings.push(`MCP_RESOURCE_FIELD_INVALID: resource ${name} mimeType must be a string when present`);
|
|
309990
310181
|
}
|
|
309991
|
-
if (resource.annotations !== void 0 && !
|
|
310182
|
+
if (resource.annotations !== void 0 && !asRecord24(resource.annotations)) {
|
|
309992
310183
|
resourceWarnings.push(`MCP_RESOURCE_ANNOTATIONS_INVALID: resource ${name} annotations must be an object when present`);
|
|
309993
310184
|
}
|
|
309994
310185
|
return {
|
|
@@ -309997,8 +310188,8 @@ function resourceDescriptor(resource, warnings) {
|
|
|
309997
310188
|
description: asOptionalString(resource.description),
|
|
309998
310189
|
uri,
|
|
309999
310190
|
mimeType: asOptionalString(resource.mimeType),
|
|
310000
|
-
meta:
|
|
310001
|
-
annotations:
|
|
310191
|
+
meta: asRecord24(resource._meta) ?? void 0,
|
|
310192
|
+
annotations: asRecord24(resource.annotations) ?? void 0,
|
|
310002
310193
|
warnings: resourceWarnings
|
|
310003
310194
|
};
|
|
310004
310195
|
}
|
|
@@ -310027,7 +310218,7 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
310027
310218
|
if (template.mimeType !== void 0 && typeof template.mimeType !== "string") {
|
|
310028
310219
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_FIELD_INVALID: resource template ${name} mimeType must be a string when present`);
|
|
310029
310220
|
}
|
|
310030
|
-
if (template.annotations !== void 0 && !
|
|
310221
|
+
if (template.annotations !== void 0 && !asRecord24(template.annotations)) {
|
|
310031
310222
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_ANNOTATIONS_INVALID: resource template ${name} annotations must be an object when present`);
|
|
310032
310223
|
}
|
|
310033
310224
|
return {
|
|
@@ -310036,14 +310227,14 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
310036
310227
|
description: asOptionalString(template.description),
|
|
310037
310228
|
uriTemplate,
|
|
310038
310229
|
mimeType: asOptionalString(template.mimeType),
|
|
310039
|
-
meta:
|
|
310040
|
-
annotations:
|
|
310230
|
+
meta: asRecord24(template._meta) ?? void 0,
|
|
310231
|
+
annotations: asRecord24(template.annotations) ?? void 0,
|
|
310041
310232
|
variables: inspectedTemplate.variables,
|
|
310042
310233
|
warnings: templateWarnings
|
|
310043
310234
|
};
|
|
310044
310235
|
}
|
|
310045
310236
|
function promptArgumentDescriptor(promptName, argument, warnings, index) {
|
|
310046
|
-
const record =
|
|
310237
|
+
const record = asRecord24(argument);
|
|
310047
310238
|
if (!record) {
|
|
310048
310239
|
warnings.push(`MCP_PROMPT_ARGUMENT_INVALID: prompt ${promptName} argument[${index}] must be an object`);
|
|
310049
310240
|
return null;
|
|
@@ -310082,7 +310273,7 @@ function promptDescriptor(prompt, warnings) {
|
|
|
310082
310273
|
if (prompt.arguments !== void 0 && !Array.isArray(prompt.arguments)) {
|
|
310083
310274
|
promptWarnings.push(`MCP_PROMPT_ARGUMENTS_INVALID: prompt ${name} arguments must be an array when present`);
|
|
310084
310275
|
}
|
|
310085
|
-
if (prompt.annotations !== void 0 && !
|
|
310276
|
+
if (prompt.annotations !== void 0 && !asRecord24(prompt.annotations)) {
|
|
310086
310277
|
promptWarnings.push(`MCP_PROMPT_ANNOTATIONS_INVALID: prompt ${name} annotations must be an object when present`);
|
|
310087
310278
|
}
|
|
310088
310279
|
const seenArgumentNames = /* @__PURE__ */ new Set();
|
|
@@ -310101,8 +310292,8 @@ function promptDescriptor(prompt, warnings) {
|
|
|
310101
310292
|
name,
|
|
310102
310293
|
title: asOptionalString(prompt.title),
|
|
310103
310294
|
description: asOptionalString(prompt.description),
|
|
310104
|
-
meta:
|
|
310105
|
-
annotations:
|
|
310295
|
+
meta: asRecord24(prompt._meta) ?? void 0,
|
|
310296
|
+
annotations: asRecord24(prompt.annotations) ?? void 0,
|
|
310106
310297
|
arguments: argumentsList,
|
|
310107
310298
|
warnings: promptWarnings
|
|
310108
310299
|
};
|
|
@@ -310117,17 +310308,17 @@ function parseMcpServerSpec(content) {
|
|
|
310117
310308
|
} catch (error2) {
|
|
310118
310309
|
throw new Error(`MCP_PARSE_FAILED: MCP server description is not valid JSON: ${error2 instanceof Error ? error2.message : String(error2)}`, { cause: error2 });
|
|
310119
310310
|
}
|
|
310120
|
-
const documentJson =
|
|
310311
|
+
const documentJson = asRecord24(parsed);
|
|
310121
310312
|
if (!documentJson) {
|
|
310122
310313
|
throw new Error("MCP_PARSE_FAILED: MCP server description must be a JSON object");
|
|
310123
310314
|
}
|
|
310124
310315
|
const warnings = [];
|
|
310125
310316
|
const servers = [];
|
|
310126
310317
|
if (isRegistrySchemaDocument(documentJson)) warnings.push(...registrySchemaWarnings(documentJson));
|
|
310127
|
-
const mcpServers =
|
|
310318
|
+
const mcpServers = asRecord24(documentJson.mcpServers);
|
|
310128
310319
|
if (mcpServers) {
|
|
310129
310320
|
for (const [id, entry] of Object.entries(mcpServers)) {
|
|
310130
|
-
const record =
|
|
310321
|
+
const record = asRecord24(entry);
|
|
310131
310322
|
if (!record) {
|
|
310132
310323
|
warnings.push(`MCP_SERVER_ENTRY_INVALID: mcpServers.${id} is not an object; it is skipped`);
|
|
310133
310324
|
continue;
|
|
@@ -310136,8 +310327,8 @@ function parseMcpServerSpec(content) {
|
|
|
310136
310327
|
}
|
|
310137
310328
|
}
|
|
310138
310329
|
const registryName = typeof documentJson.name === "string" ? documentJson.name : "";
|
|
310139
|
-
const remotes = asArray17(documentJson.remotes).map((entry) =>
|
|
310140
|
-
const packages = asArray17(documentJson.packages).map((entry) =>
|
|
310330
|
+
const remotes = asArray17(documentJson.remotes).map((entry) => asRecord24(entry)).filter((entry) => entry !== null);
|
|
310331
|
+
const packages = asArray17(documentJson.packages).map((entry) => asRecord24(entry)).filter((entry) => entry !== null);
|
|
310141
310332
|
if (!mcpServers && (remotes.length > 0 || packages.length > 0)) {
|
|
310142
310333
|
const multi = remotes.length + packages.length > 1;
|
|
310143
310334
|
remotes.forEach((remote, i) => {
|
|
@@ -310152,7 +310343,7 @@ function parseMcpServerSpec(content) {
|
|
|
310152
310343
|
if (servers.length === 0) {
|
|
310153
310344
|
throw new Error("MCP_NO_SERVERS: MCP description defines no servers (no mcpServers entries, remotes, or packages); contract generation requires at least one server");
|
|
310154
310345
|
}
|
|
310155
|
-
const toolsRaw = asArray17(documentJson.tools).map((entry) =>
|
|
310346
|
+
const toolsRaw = asArray17(documentJson.tools).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((tool) => toolDescriptor(tool, warnings)).filter((tool) => tool !== null);
|
|
310156
310347
|
const seenToolNames = /* @__PURE__ */ new Set();
|
|
310157
310348
|
const tools = [];
|
|
310158
310349
|
for (const tool of toolsRaw) {
|
|
@@ -310164,7 +310355,7 @@ function parseMcpServerSpec(content) {
|
|
|
310164
310355
|
tools.push(tool);
|
|
310165
310356
|
}
|
|
310166
310357
|
tools.sort((a, b) => a.name.localeCompare(b.name));
|
|
310167
|
-
const resourcesRaw = asArray17(documentJson.resources).map((entry) =>
|
|
310358
|
+
const resourcesRaw = asArray17(documentJson.resources).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((resource) => resourceDescriptor(resource, warnings)).filter((resource) => resource !== null);
|
|
310168
310359
|
const seenResourceNames = /* @__PURE__ */ new Set();
|
|
310169
310360
|
const resources = [];
|
|
310170
310361
|
for (const resource of resourcesRaw) {
|
|
@@ -310176,7 +310367,7 @@ function parseMcpServerSpec(content) {
|
|
|
310176
310367
|
resources.push(resource);
|
|
310177
310368
|
}
|
|
310178
310369
|
resources.sort((a, b) => a.name.localeCompare(b.name));
|
|
310179
|
-
const resourceTemplatesRaw = asArray17(documentJson.resourceTemplates).map((entry) =>
|
|
310370
|
+
const resourceTemplatesRaw = asArray17(documentJson.resourceTemplates).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((template) => resourceTemplateDescriptor(template, warnings)).filter((template) => template !== null);
|
|
310180
310371
|
const seenTemplateNames = /* @__PURE__ */ new Set();
|
|
310181
310372
|
const resourceTemplates = [];
|
|
310182
310373
|
for (const template of resourceTemplatesRaw) {
|
|
@@ -310188,7 +310379,7 @@ function parseMcpServerSpec(content) {
|
|
|
310188
310379
|
resourceTemplates.push(template);
|
|
310189
310380
|
}
|
|
310190
310381
|
resourceTemplates.sort((a, b) => a.name.localeCompare(b.name));
|
|
310191
|
-
const promptsRaw = asArray17(documentJson.prompts).map((entry) =>
|
|
310382
|
+
const promptsRaw = asArray17(documentJson.prompts).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((prompt) => promptDescriptor(prompt, warnings)).filter((prompt) => prompt !== null);
|
|
310192
310383
|
const seenPromptNames = /* @__PURE__ */ new Set();
|
|
310193
310384
|
const prompts = [];
|
|
310194
310385
|
for (const prompt of promptsRaw) {
|
|
@@ -310200,10 +310391,10 @@ function parseMcpServerSpec(content) {
|
|
|
310200
310391
|
prompts.push(prompt);
|
|
310201
310392
|
}
|
|
310202
310393
|
prompts.sort((a, b) => a.name.localeCompare(b.name));
|
|
310203
|
-
const versionDetail =
|
|
310394
|
+
const versionDetail = asRecord24(documentJson.version_detail);
|
|
310204
310395
|
const version = typeof documentJson.version === "string" ? documentJson.version : typeof versionDetail?.version === "string" ? String(versionDetail.version) : void 0;
|
|
310205
310396
|
servers.sort((a, b) => a.id.localeCompare(b.id));
|
|
310206
|
-
const capabilities =
|
|
310397
|
+
const capabilities = asRecord24(documentJson.capabilities);
|
|
310207
310398
|
if (documentJson.capabilities !== void 0 && !capabilities) {
|
|
310208
310399
|
warnings.push(`MCP_CAPABILITIES_INVALID: top-level capabilities must be an object when present; got ${JSON.stringify(documentJson.capabilities)}`);
|
|
310209
310400
|
}
|
|
@@ -310940,7 +311131,7 @@ function oldSessionPingScript() {
|
|
|
310940
311131
|
|
|
310941
311132
|
// src/lib/protocols/mcp/mcp-collection-builder.ts
|
|
310942
311133
|
var MCP_TOOLS_LIST_PAGINATION_PROBE_COUNT = 5;
|
|
310943
|
-
function
|
|
311134
|
+
function asRecord25(value) {
|
|
310944
311135
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
310945
311136
|
return value;
|
|
310946
311137
|
}
|
|
@@ -310995,7 +311186,7 @@ function promptsListMessage() {
|
|
|
310995
311186
|
return jsonRpc(9, "prompts/list", {});
|
|
310996
311187
|
}
|
|
310997
311188
|
function toolArguments(tool) {
|
|
310998
|
-
return
|
|
311189
|
+
return asRecord25(tool.sampleArguments) ?? {};
|
|
310999
311190
|
}
|
|
311000
311191
|
function promptArguments(prompt) {
|
|
311001
311192
|
const out = {};
|
|
@@ -311299,7 +311490,7 @@ var MIME_TYPE_RE = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\/[A-Za-z0-9][A-Za-z0-9!#$&
|
|
|
311299
311490
|
var TOOL_FIELDS_2025_06_18 = /* @__PURE__ */ new Set(["name", "title", "description", "inputSchema", "outputSchema", "annotations", "_meta"]);
|
|
311300
311491
|
var JSON_RPC_STANDARD_ERROR_CODES = /* @__PURE__ */ new Set([-32700, -32600, -32601, -32602, -32603]);
|
|
311301
311492
|
var MCP_PROTOCOL_VERSIONS = /* @__PURE__ */ new Set(["2024-11-05", "2025-03-26", "2025-06-18", "2025-11-25"]);
|
|
311302
|
-
function
|
|
311493
|
+
function asRecord26(value) {
|
|
311303
311494
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
311304
311495
|
return value;
|
|
311305
311496
|
}
|
|
@@ -311315,7 +311506,7 @@ function isStrictBase64(value) {
|
|
|
311315
311506
|
}
|
|
311316
311507
|
}
|
|
311317
311508
|
function walkDocument(value, path10, visit4) {
|
|
311318
|
-
const record =
|
|
311509
|
+
const record = asRecord26(value);
|
|
311319
311510
|
if (record) {
|
|
311320
311511
|
visit4(record, path10);
|
|
311321
311512
|
for (const [key, child4] of Object.entries(record)) walkDocument(child4, `${path10}.${key}`, visit4);
|
|
@@ -311328,10 +311519,10 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311328
311519
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type must be a string`);
|
|
311329
311520
|
return;
|
|
311330
311521
|
}
|
|
311331
|
-
if (block2.annotations !== void 0 &&
|
|
311522
|
+
if (block2.annotations !== void 0 && asRecord26(block2.annotations) === null) {
|
|
311332
311523
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} annotations must be an object when present`);
|
|
311333
311524
|
}
|
|
311334
|
-
if (block2._meta !== void 0 &&
|
|
311525
|
+
if (block2._meta !== void 0 && asRecord26(block2._meta) === null) {
|
|
311335
311526
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} _meta must be an object when present`);
|
|
311336
311527
|
}
|
|
311337
311528
|
if (block2.type === "text") {
|
|
@@ -311344,7 +311535,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311344
311535
|
return;
|
|
311345
311536
|
}
|
|
311346
311537
|
if (block2.type === "resource") {
|
|
311347
|
-
const resource =
|
|
311538
|
+
const resource = asRecord26(block2.resource);
|
|
311348
311539
|
if (!resource) {
|
|
311349
311540
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} resource content block must carry a resource object`);
|
|
311350
311541
|
return;
|
|
@@ -311358,7 +311549,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311358
311549
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type "${block2.type}" is not a known MCP 2025-06-18 content discriminator`);
|
|
311359
311550
|
}
|
|
311360
311551
|
function validateStaticResultFixture(record, path10, warnings) {
|
|
311361
|
-
const result =
|
|
311552
|
+
const result = asRecord26(record.result);
|
|
311362
311553
|
if (!result) return;
|
|
311363
311554
|
for (const key of ["tools", "resources", "prompts"]) {
|
|
311364
311555
|
if (result[key] !== void 0 && !Array.isArray(result[key])) warnings.push(`MCP_STATIC_PAGINATION_RESULT_INVALID: ${path10}.${key} must be an array in static list-result fixtures`);
|
|
@@ -311368,8 +311559,8 @@ function validateStaticResultFixture(record, path10, warnings) {
|
|
|
311368
311559
|
}
|
|
311369
311560
|
if (result.protocolVersion !== void 0 || result.capabilities !== void 0 || result.serverInfo !== void 0) {
|
|
311370
311561
|
if (typeof result.protocolVersion !== "string" || !MCP_PROTOCOL_VERSIONS.has(result.protocolVersion)) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.protocolVersion must be a supported MCP protocol version`);
|
|
311371
|
-
if (
|
|
311372
|
-
const serverInfo =
|
|
311562
|
+
if (asRecord26(result.capabilities) === null) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.capabilities must be an object`);
|
|
311563
|
+
const serverInfo = asRecord26(result.serverInfo);
|
|
311373
311564
|
if (!serverInfo) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.serverInfo must be an object`);
|
|
311374
311565
|
else {
|
|
311375
311566
|
if (typeof serverInfo.name !== "string" || !serverInfo.name) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.serverInfo.name must be a non-empty string`);
|
|
@@ -311379,7 +311570,7 @@ function validateStaticResultFixture(record, path10, warnings) {
|
|
|
311379
311570
|
}
|
|
311380
311571
|
function validateStaticJsonRpcFixtures(index, warnings) {
|
|
311381
311572
|
walkDocument(index.documentJson, "$", (record, path10) => {
|
|
311382
|
-
const error2 =
|
|
311573
|
+
const error2 = asRecord26(record.error);
|
|
311383
311574
|
if (record.jsonrpc === "2.0" && error2) {
|
|
311384
311575
|
if (typeof error2.code !== "number" || Math.floor(error2.code) !== error2.code) warnings.push(`MCP_STATIC_ERROR_CODE_INVALID: ${path10}.error.code must be an integer JSON-RPC error code`);
|
|
311385
311576
|
else if (error2.code >= -32768 && error2.code <= -32e3 && !JSON_RPC_STANDARD_ERROR_CODES.has(error2.code) && !(error2.code >= -32099 && error2.code <= -32e3)) warnings.push(`MCP_STATIC_ERROR_CODE_INVALID: ${path10}.error.code ${error2.code} is inside the reserved JSON-RPC range but is not a standard or server-error code`);
|
|
@@ -311388,19 +311579,19 @@ function validateStaticJsonRpcFixtures(index, warnings) {
|
|
|
311388
311579
|
validateStaticResultFixture(record, path10, warnings);
|
|
311389
311580
|
if (Array.isArray(record.content)) {
|
|
311390
311581
|
record.content.forEach((entry, i) => {
|
|
311391
|
-
const block2 =
|
|
311582
|
+
const block2 = asRecord26(entry);
|
|
311392
311583
|
if (block2) validateStaticContentBlock(block2, `${path10}.content[${i}]`, warnings);
|
|
311393
311584
|
});
|
|
311394
311585
|
}
|
|
311395
311586
|
if (Array.isArray(record.messages)) {
|
|
311396
311587
|
record.messages.forEach((entry, i) => {
|
|
311397
|
-
const message =
|
|
311588
|
+
const message = asRecord26(entry);
|
|
311398
311589
|
if (!message) {
|
|
311399
311590
|
warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}] must be an object`);
|
|
311400
311591
|
return;
|
|
311401
311592
|
}
|
|
311402
311593
|
if (message.role !== "user" && message.role !== "assistant") warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}].role must be user or assistant`);
|
|
311403
|
-
const content =
|
|
311594
|
+
const content = asRecord26(message.content);
|
|
311404
311595
|
if (!content) warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}].content must be a content block object`);
|
|
311405
311596
|
else validateStaticContentBlock(content, `${path10}.messages[${i}].content`, warnings);
|
|
311406
311597
|
});
|
|
@@ -311414,10 +311605,10 @@ function walkManifest(value, path10, warnings) {
|
|
|
311414
311605
|
return;
|
|
311415
311606
|
}
|
|
311416
311607
|
const record = value;
|
|
311417
|
-
if (Object.prototype.hasOwnProperty.call(record, "_meta") &&
|
|
311608
|
+
if (Object.prototype.hasOwnProperty.call(record, "_meta") && asRecord26(record._meta) === null) {
|
|
311418
311609
|
warnings.push(`MCP_META_OBJECT_INVALID: ${path10}._meta must be an object when present (MCP 2025-06-18 BaseMetadata)`);
|
|
311419
311610
|
}
|
|
311420
|
-
const meta =
|
|
311611
|
+
const meta = asRecord26(record._meta);
|
|
311421
311612
|
if (meta) {
|
|
311422
311613
|
for (const key of Object.keys(meta)) {
|
|
311423
311614
|
if (!META_KEY_RE.test(key)) {
|
|
@@ -311436,7 +311627,7 @@ function walkManifest(value, path10, warnings) {
|
|
|
311436
311627
|
}
|
|
311437
311628
|
function validateManifestDocument(index, warnings) {
|
|
311438
311629
|
walkManifest(index.documentJson, "$", warnings);
|
|
311439
|
-
const tools = asArray18(index.documentJson.tools).map((entry) =>
|
|
311630
|
+
const tools = asArray18(index.documentJson.tools).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
311440
311631
|
const seen = /* @__PURE__ */ new Set();
|
|
311441
311632
|
for (const tool of tools) {
|
|
311442
311633
|
const name = typeof tool.name === "string" ? tool.name : "<unnamed>";
|
|
@@ -311455,7 +311646,7 @@ function validateManifestDocument(index, warnings) {
|
|
|
311455
311646
|
warnings.push(`MCP_TOOL_FIELD_UNKNOWN_2025_06_18: tool ${name} field "${field}" is not part of the MCP 2025-06-18 Tool object`);
|
|
311456
311647
|
}
|
|
311457
311648
|
}
|
|
311458
|
-
const annotations =
|
|
311649
|
+
const annotations = asRecord26(tool.annotations);
|
|
311459
311650
|
if (typeof tool.title === "string" && typeof annotations?.title === "string") {
|
|
311460
311651
|
warnings.push(`MCP_TOOL_TITLE_PRECEDENCE: tool ${name} declares both title and annotations.title; clients should prefer title for MCP 2025-06-18 display metadata`);
|
|
311461
311652
|
}
|
|
@@ -311476,7 +311667,7 @@ function validateCapabilities(index, warnings) {
|
|
|
311476
311667
|
shaped[name] = null;
|
|
311477
311668
|
continue;
|
|
311478
311669
|
}
|
|
311479
|
-
const record =
|
|
311670
|
+
const record = asRecord26(value);
|
|
311480
311671
|
if (!record) {
|
|
311481
311672
|
warnings.push(`MCP_CAPABILITY_SHAPE_INVALID: capabilities.${name} must be an object when present; got ${JSON.stringify(value)}`);
|
|
311482
311673
|
shaped[name] = null;
|
|
@@ -311532,7 +311723,7 @@ function itemServerScope(itemTitle) {
|
|
|
311532
311723
|
return separator === -1 ? itemTitle : itemTitle.slice(0, separator);
|
|
311533
311724
|
}
|
|
311534
311725
|
function assertRecordValue(value, reason, fail2) {
|
|
311535
|
-
const record =
|
|
311726
|
+
const record = asRecord26(value);
|
|
311536
311727
|
if (!record) fail2(reason);
|
|
311537
311728
|
return record;
|
|
311538
311729
|
}
|
|
@@ -311554,7 +311745,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311554
311745
|
} catch {
|
|
311555
311746
|
return fail2("message is not valid JSON");
|
|
311556
311747
|
}
|
|
311557
|
-
const record =
|
|
311748
|
+
const record = asRecord26(parsed);
|
|
311558
311749
|
if (!record) return fail2("message is not a JSON object");
|
|
311559
311750
|
if (record.jsonrpc !== "2.0") return fail2('jsonrpc must be the string "2.0"');
|
|
311560
311751
|
if (typeof record.method !== "string" || !record.method) return fail2("method must be a non-empty string");
|
|
@@ -311566,7 +311757,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311566
311757
|
} else {
|
|
311567
311758
|
return fail2("id must be a string or number");
|
|
311568
311759
|
}
|
|
311569
|
-
if (record.params !== void 0 &&
|
|
311760
|
+
if (record.params !== void 0 && asRecord26(record.params) === null) return fail2("params must be an object when present");
|
|
311570
311761
|
switch (record.method) {
|
|
311571
311762
|
case "notifications/initialized":
|
|
311572
311763
|
assertOptionalObjectParams(record, "notifications/initialized", fail2);
|
|
@@ -311599,14 +311790,14 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311599
311790
|
case "prompts/get": {
|
|
311600
311791
|
const params = assertObjectParams(record, "prompts/get", fail2);
|
|
311601
311792
|
if (typeof params.name !== "string" || !params.name) fail2("prompts/get params.name must be a non-empty string");
|
|
311602
|
-
if (params.arguments !== void 0 &&
|
|
311793
|
+
if (params.arguments !== void 0 && asRecord26(params.arguments) === null) fail2("prompts/get params.arguments must be an object when present");
|
|
311603
311794
|
break;
|
|
311604
311795
|
}
|
|
311605
311796
|
case "tools/call": {
|
|
311606
311797
|
const params = assertObjectParams(record, "tools/call", fail2);
|
|
311607
311798
|
if (typeof params.name !== "string" || !params.name) fail2("tools/call params.name must be a non-empty string");
|
|
311608
|
-
if (params.arguments !== void 0 &&
|
|
311609
|
-
if (params._meta !== void 0 &&
|
|
311799
|
+
if (params.arguments !== void 0 && asRecord26(params.arguments) === null) fail2("tools/call params.arguments must be an object when present");
|
|
311800
|
+
if (params._meta !== void 0 && asRecord26(params._meta) === null) fail2("tools/call params._meta must be an object when present");
|
|
311610
311801
|
break;
|
|
311611
311802
|
}
|
|
311612
311803
|
case "ping":
|
|
@@ -311707,7 +311898,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
311707
311898
|
validateAnnotatedDeclarations(index, warnings);
|
|
311708
311899
|
validateStaticJsonRpcFixtures(index, warnings);
|
|
311709
311900
|
for (const tool of index.tools) warnings.push(...toolsCallScript(index, tool).warnings);
|
|
311710
|
-
const items = asArray18(collection.item).map((entry) =>
|
|
311901
|
+
const items = asArray18(collection.item).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
311711
311902
|
const ids = [];
|
|
311712
311903
|
const httpIds = [];
|
|
311713
311904
|
const requestIdsByServer = /* @__PURE__ */ new Set();
|
|
@@ -311715,7 +311906,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
311715
311906
|
if (String(item.type) === "mcp-request") {
|
|
311716
311907
|
ids.push(typeof item.id === "string" && item.id ? item.id : `#${ids.length}`);
|
|
311717
311908
|
const itemTitle = String(item.title ?? item.id ?? "mcp-request");
|
|
311718
|
-
const request = assertJsonRpcRequest(
|
|
311909
|
+
const request = assertJsonRpcRequest(asRecord26(item.payload)?.message, itemTitle);
|
|
311719
311910
|
if (request.id !== void 0) {
|
|
311720
311911
|
const scopedId = `${itemServerScope(itemTitle)}\0${typeof request.id === "number" ? `n:${request.id}` : `s:${request.id}`}`;
|
|
311721
311912
|
if (requestIdsByServer.has(scopedId)) {
|