@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/action.cjs
CHANGED
|
@@ -12234,7 +12234,7 @@ var require_response = __commonJS({
|
|
|
12234
12234
|
var assert = require("node:assert");
|
|
12235
12235
|
var { types: types2 } = require("node:util");
|
|
12236
12236
|
var textEncoder = new TextEncoder("utf-8");
|
|
12237
|
-
var
|
|
12237
|
+
var Response2 = class _Response {
|
|
12238
12238
|
// Creates network error Response.
|
|
12239
12239
|
static error() {
|
|
12240
12240
|
const responseObject = fromInnerResponse(makeNetworkError(), "immutable");
|
|
@@ -12377,8 +12377,8 @@ var require_response = __commonJS({
|
|
|
12377
12377
|
return `Response ${nodeUtil.formatWithOptions(options, properties)}`;
|
|
12378
12378
|
}
|
|
12379
12379
|
};
|
|
12380
|
-
mixinBody(
|
|
12381
|
-
Object.defineProperties(
|
|
12380
|
+
mixinBody(Response2);
|
|
12381
|
+
Object.defineProperties(Response2.prototype, {
|
|
12382
12382
|
type: kEnumerableProperty,
|
|
12383
12383
|
url: kEnumerableProperty,
|
|
12384
12384
|
status: kEnumerableProperty,
|
|
@@ -12394,7 +12394,7 @@ var require_response = __commonJS({
|
|
|
12394
12394
|
configurable: true
|
|
12395
12395
|
}
|
|
12396
12396
|
});
|
|
12397
|
-
Object.defineProperties(
|
|
12397
|
+
Object.defineProperties(Response2, {
|
|
12398
12398
|
json: kEnumerableProperty,
|
|
12399
12399
|
redirect: kEnumerableProperty,
|
|
12400
12400
|
error: kEnumerableProperty
|
|
@@ -12527,7 +12527,7 @@ var require_response = __commonJS({
|
|
|
12527
12527
|
}
|
|
12528
12528
|
}
|
|
12529
12529
|
function fromInnerResponse(innerResponse, guard) {
|
|
12530
|
-
const response = new
|
|
12530
|
+
const response = new Response2(kConstruct);
|
|
12531
12531
|
response[kState] = innerResponse;
|
|
12532
12532
|
response[kHeaders] = new Headers3(kConstruct);
|
|
12533
12533
|
setHeadersList(response[kHeaders], innerResponse.headersList);
|
|
@@ -12595,7 +12595,7 @@ var require_response = __commonJS({
|
|
|
12595
12595
|
makeResponse,
|
|
12596
12596
|
makeAppropriateNetworkError,
|
|
12597
12597
|
filterResponse,
|
|
12598
|
-
Response,
|
|
12598
|
+
Response: Response2,
|
|
12599
12599
|
cloneResponse,
|
|
12600
12600
|
fromInnerResponse
|
|
12601
12601
|
};
|
|
@@ -15267,7 +15267,7 @@ var require_cache = __commonJS({
|
|
|
15267
15267
|
var { urlEquals, getFieldValues } = require_util5();
|
|
15268
15268
|
var { kEnumerableProperty, isDisturbed } = require_util();
|
|
15269
15269
|
var { webidl } = require_webidl();
|
|
15270
|
-
var { Response, cloneResponse, fromInnerResponse } = require_response();
|
|
15270
|
+
var { Response: Response2, cloneResponse, fromInnerResponse } = require_response();
|
|
15271
15271
|
var { Request, fromInnerRequest } = require_request2();
|
|
15272
15272
|
var { kState } = require_symbols2();
|
|
15273
15273
|
var { fetching } = require_fetch();
|
|
@@ -15794,7 +15794,7 @@ var require_cache = __commonJS({
|
|
|
15794
15794
|
converter: webidl.converters.DOMString
|
|
15795
15795
|
}
|
|
15796
15796
|
]);
|
|
15797
|
-
webidl.converters.Response = webidl.interfaceConverter(
|
|
15797
|
+
webidl.converters.Response = webidl.interfaceConverter(Response2);
|
|
15798
15798
|
webidl.converters["sequence<RequestInfo>"] = webidl.sequenceConverter(
|
|
15799
15799
|
webidl.converters.RequestInfo
|
|
15800
15800
|
);
|
|
@@ -98551,7 +98551,7 @@ var require_response2 = __commonJS({
|
|
|
98551
98551
|
}
|
|
98552
98552
|
return stream;
|
|
98553
98553
|
};
|
|
98554
|
-
var
|
|
98554
|
+
var Response2;
|
|
98555
98555
|
_.inherit(
|
|
98556
98556
|
/**
|
|
98557
98557
|
* Response holds data related to the request body. By default, it provides a nice wrapper for url-encoded,
|
|
@@ -98562,14 +98562,14 @@ var require_response2 = __commonJS({
|
|
|
98562
98562
|
*
|
|
98563
98563
|
* @param {Response.definition} options -
|
|
98564
98564
|
*/
|
|
98565
|
-
|
|
98566
|
-
|
|
98565
|
+
Response2 = function PostmanResponse(options) {
|
|
98566
|
+
Response2.super_.apply(this, arguments);
|
|
98567
98567
|
this.update(options || {});
|
|
98568
98568
|
},
|
|
98569
98569
|
Property
|
|
98570
98570
|
);
|
|
98571
98571
|
_.assign(
|
|
98572
|
-
|
|
98572
|
+
Response2.prototype,
|
|
98573
98573
|
/** @lends Response.prototype */
|
|
98574
98574
|
{
|
|
98575
98575
|
update(options) {
|
|
@@ -98635,7 +98635,7 @@ var require_response2 = __commonJS({
|
|
|
98635
98635
|
}
|
|
98636
98636
|
);
|
|
98637
98637
|
_.assign(
|
|
98638
|
-
|
|
98638
|
+
Response2.prototype,
|
|
98639
98639
|
/** @lends Response.prototype */
|
|
98640
98640
|
{
|
|
98641
98641
|
/**
|
|
@@ -98813,7 +98813,7 @@ var require_response2 = __commonJS({
|
|
|
98813
98813
|
}
|
|
98814
98814
|
);
|
|
98815
98815
|
_.assign(
|
|
98816
|
-
|
|
98816
|
+
Response2,
|
|
98817
98817
|
/** @lends Response */
|
|
98818
98818
|
{
|
|
98819
98819
|
/**
|
|
@@ -98831,7 +98831,7 @@ var require_response2 = __commonJS({
|
|
|
98831
98831
|
* @returns {Boolean}
|
|
98832
98832
|
*/
|
|
98833
98833
|
isResponse: function(obj) {
|
|
98834
|
-
return Boolean(obj) && (obj instanceof
|
|
98834
|
+
return Boolean(obj) && (obj instanceof Response2 || _.inSuperChain(obj.constructor, "_postman_propertyName", Response2._postman_propertyName));
|
|
98835
98835
|
},
|
|
98836
98836
|
/**
|
|
98837
98837
|
* Converts the response object from the request module to the postman responseBody format
|
|
@@ -98842,7 +98842,7 @@ var require_response2 = __commonJS({
|
|
|
98842
98842
|
* @todo Add a key: `originalRequest` to the returned object as well, referring to response.request
|
|
98843
98843
|
*/
|
|
98844
98844
|
createFromNode: function(response, cookies) {
|
|
98845
|
-
return new
|
|
98845
|
+
return new Response2({
|
|
98846
98846
|
cookie: cookies,
|
|
98847
98847
|
body: response.body.toString(),
|
|
98848
98848
|
stream: response.body,
|
|
@@ -98921,7 +98921,7 @@ var require_response2 = __commonJS({
|
|
|
98921
98921
|
}
|
|
98922
98922
|
);
|
|
98923
98923
|
module2.exports = {
|
|
98924
|
-
Response
|
|
98924
|
+
Response: Response2
|
|
98925
98925
|
};
|
|
98926
98926
|
}
|
|
98927
98927
|
});
|
|
@@ -98935,7 +98935,7 @@ var require_item = __commonJS({
|
|
|
98935
98935
|
var EventList = require_event_list().EventList;
|
|
98936
98936
|
var Request = require_request12().Request;
|
|
98937
98937
|
var RequestAuth = require_request_auth().RequestAuth;
|
|
98938
|
-
var
|
|
98938
|
+
var Response2 = require_response2().Response;
|
|
98939
98939
|
var Item;
|
|
98940
98940
|
var OBJECT2 = "object";
|
|
98941
98941
|
var STRING2 = "string";
|
|
@@ -99002,7 +99002,7 @@ var require_item = __commonJS({
|
|
|
99002
99002
|
*
|
|
99003
99003
|
* @type {PropertyList<Response>}
|
|
99004
99004
|
*/
|
|
99005
|
-
responses: new PropertyList(
|
|
99005
|
+
responses: new PropertyList(Response2, this, definition && definition.response),
|
|
99006
99006
|
/**
|
|
99007
99007
|
* Events are a set of of {@link Script}s that are executed when certain activities are triggered on an
|
|
99008
99008
|
* Item. For example, on defining an event that listens to the "test" event, would cause the associated
|
|
@@ -105143,7 +105143,7 @@ var require_scope_functions = __commonJS({
|
|
|
105143
105143
|
const normal = Math.floor(multiple + 0.5);
|
|
105144
105144
|
return normal / factor === value && normal % factorMultiple === 0;
|
|
105145
105145
|
};
|
|
105146
|
-
var
|
|
105146
|
+
var deepEqual2 = (obj, obj2) => {
|
|
105147
105147
|
if (obj === obj2) return true;
|
|
105148
105148
|
if (!obj || !obj2 || typeof obj !== typeof obj2) return false;
|
|
105149
105149
|
if (obj !== obj2 && typeof obj !== "object") return false;
|
|
@@ -105152,18 +105152,18 @@ var require_scope_functions = __commonJS({
|
|
|
105152
105152
|
if (proto === Array.prototype) {
|
|
105153
105153
|
if (!Array.isArray(obj) || !Array.isArray(obj2)) return false;
|
|
105154
105154
|
if (obj.length !== obj2.length) return false;
|
|
105155
|
-
return obj.every((x, i) =>
|
|
105155
|
+
return obj.every((x, i) => deepEqual2(x, obj2[i]));
|
|
105156
105156
|
} else if (proto === Object.prototype) {
|
|
105157
105157
|
const [keys, keys2] = [Object.keys(obj), Object.keys(obj2)];
|
|
105158
105158
|
if (keys.length !== keys2.length) return false;
|
|
105159
105159
|
const keyset2 = /* @__PURE__ */ new Set([...keys, ...keys2]);
|
|
105160
|
-
return keyset2.size === keys.length && keys.every((key) =>
|
|
105160
|
+
return keyset2.size === keys.length && keys.every((key) => deepEqual2(obj[key], obj2[key]));
|
|
105161
105161
|
}
|
|
105162
105162
|
return false;
|
|
105163
105163
|
};
|
|
105164
105164
|
var unique = (array) => {
|
|
105165
105165
|
if (array.length < 2) return true;
|
|
105166
|
-
if (array.length === 2) return !
|
|
105166
|
+
if (array.length === 2) return !deepEqual2(array[0], array[1]);
|
|
105167
105167
|
const objects = [];
|
|
105168
105168
|
const primitives = array.length > 20 ? /* @__PURE__ */ new Set() : null;
|
|
105169
105169
|
let primitivesCount = 0;
|
|
@@ -105180,7 +105180,7 @@ var require_scope_functions = __commonJS({
|
|
|
105180
105180
|
pos++;
|
|
105181
105181
|
}
|
|
105182
105182
|
for (let i = 1; i < objects.length; i++)
|
|
105183
|
-
for (let j = 0; j < i; j++) if (
|
|
105183
|
+
for (let j = 0; j < i; j++) if (deepEqual2(objects[i], objects[j])) return false;
|
|
105184
105184
|
return true;
|
|
105185
105185
|
};
|
|
105186
105186
|
var deBase64 = (string) => {
|
|
@@ -105199,7 +105199,7 @@ var require_scope_functions = __commonJS({
|
|
|
105199
105199
|
var propertyIn = (key, [properties, patterns]) => properties.includes(true) || properties.some((prop) => prop === key) || patterns.some((pattern) => new RegExp(pattern, "u").test(key));
|
|
105200
105200
|
var dynamicResolve = (anchors, id) => (anchors.filter((x) => x[id])[0] || {})[id];
|
|
105201
105201
|
var extraUtils = { toPointer, pointerPart, errorMerge, propertyIn, dynamicResolve };
|
|
105202
|
-
module2.exports = { stringLength, isMultipleOf, deepEqual, unique, deBase64, hasOwn: hasOwn2, ...extraUtils };
|
|
105202
|
+
module2.exports = { stringLength, isMultipleOf, deepEqual: deepEqual2, unique, deBase64, hasOwn: hasOwn2, ...extraUtils };
|
|
105203
105203
|
}
|
|
105204
105204
|
});
|
|
105205
105205
|
|
|
@@ -107130,9 +107130,9 @@ var require_src = __commonJS({
|
|
|
107130
107130
|
var genfun = require_generate_function();
|
|
107131
107131
|
var { buildSchemas } = require_pointer();
|
|
107132
107132
|
var { compile } = require_compile();
|
|
107133
|
-
var { deepEqual } = require_scope_functions();
|
|
107133
|
+
var { deepEqual: deepEqual2 } = require_scope_functions();
|
|
107134
107134
|
var jsonCheckWithErrors = (validate4) => function validateIsJSON(data) {
|
|
107135
|
-
if (!
|
|
107135
|
+
if (!deepEqual2(data, JSON.parse(JSON.stringify(data)))) {
|
|
107136
107136
|
validateIsJSON.errors = [{ instanceLocation: "#", error: "not JSON compatible" }];
|
|
107137
107137
|
return false;
|
|
107138
107138
|
}
|
|
@@ -107140,7 +107140,7 @@ var require_src = __commonJS({
|
|
|
107140
107140
|
validateIsJSON.errors = validate4.errors;
|
|
107141
107141
|
return res;
|
|
107142
107142
|
};
|
|
107143
|
-
var jsonCheckWithoutErrors = (validate4) => (data) =>
|
|
107143
|
+
var jsonCheckWithoutErrors = (validate4) => (data) => deepEqual2(data, JSON.parse(JSON.stringify(data))) && validate4(data);
|
|
107144
107144
|
var validator3 = (schema, { parse: parse10 = false, multi = false, jsonCheck = false, isJSON = false, schemas = [], ...opts } = {}) => {
|
|
107145
107145
|
if (jsonCheck && isJSON) throw new Error("Can not specify both isJSON and jsonCheck options");
|
|
107146
107146
|
if (parse10 && (jsonCheck || isJSON))
|
|
@@ -107156,7 +107156,7 @@ var require_src = __commonJS({
|
|
|
107156
107156
|
if (parse10) {
|
|
107157
107157
|
scope.parseWrap = opts.includeErrors ? parseWithErrors : parseWithoutErrors;
|
|
107158
107158
|
} else if (jsonCheck) {
|
|
107159
|
-
scope.deepEqual =
|
|
107159
|
+
scope.deepEqual = deepEqual2;
|
|
107160
107160
|
scope.jsonCheckWrap = opts.includeErrors ? jsonCheckWithErrors : jsonCheckWithoutErrors;
|
|
107161
107161
|
}
|
|
107162
107162
|
if (multi) {
|
|
@@ -140244,7 +140244,7 @@ var require_lib10 = __commonJS({
|
|
|
140244
140244
|
}
|
|
140245
140245
|
var INTERNALS$1 = /* @__PURE__ */ Symbol("Response internals");
|
|
140246
140246
|
var STATUS_CODES = http2.STATUS_CODES;
|
|
140247
|
-
var
|
|
140247
|
+
var Response2 = class _Response {
|
|
140248
140248
|
constructor() {
|
|
140249
140249
|
let body2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
140250
140250
|
let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -140302,8 +140302,8 @@ var require_lib10 = __commonJS({
|
|
|
140302
140302
|
});
|
|
140303
140303
|
}
|
|
140304
140304
|
};
|
|
140305
|
-
Body.mixIn(
|
|
140306
|
-
Object.defineProperties(
|
|
140305
|
+
Body.mixIn(Response2.prototype);
|
|
140306
|
+
Object.defineProperties(Response2.prototype, {
|
|
140307
140307
|
url: { enumerable: true },
|
|
140308
140308
|
status: { enumerable: true },
|
|
140309
140309
|
ok: { enumerable: true },
|
|
@@ -140312,7 +140312,7 @@ var require_lib10 = __commonJS({
|
|
|
140312
140312
|
headers: { enumerable: true },
|
|
140313
140313
|
clone: { enumerable: true }
|
|
140314
140314
|
});
|
|
140315
|
-
Object.defineProperty(
|
|
140315
|
+
Object.defineProperty(Response2.prototype, Symbol.toStringTag, {
|
|
140316
140316
|
value: "Response",
|
|
140317
140317
|
writable: false,
|
|
140318
140318
|
enumerable: false,
|
|
@@ -140621,7 +140621,7 @@ var require_lib10 = __commonJS({
|
|
|
140621
140621
|
};
|
|
140622
140622
|
const codings = headers.get("Content-Encoding");
|
|
140623
140623
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
140624
|
-
response = new
|
|
140624
|
+
response = new Response2(body2, response_options);
|
|
140625
140625
|
resolve5(response);
|
|
140626
140626
|
return;
|
|
140627
140627
|
}
|
|
@@ -140631,7 +140631,7 @@ var require_lib10 = __commonJS({
|
|
|
140631
140631
|
};
|
|
140632
140632
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
140633
140633
|
body2 = body2.pipe(zlib.createGunzip(zlibOptions));
|
|
140634
|
-
response = new
|
|
140634
|
+
response = new Response2(body2, response_options);
|
|
140635
140635
|
resolve5(response);
|
|
140636
140636
|
return;
|
|
140637
140637
|
}
|
|
@@ -140643,18 +140643,18 @@ var require_lib10 = __commonJS({
|
|
|
140643
140643
|
} else {
|
|
140644
140644
|
body2 = body2.pipe(zlib.createInflateRaw());
|
|
140645
140645
|
}
|
|
140646
|
-
response = new
|
|
140646
|
+
response = new Response2(body2, response_options);
|
|
140647
140647
|
resolve5(response);
|
|
140648
140648
|
});
|
|
140649
140649
|
return;
|
|
140650
140650
|
}
|
|
140651
140651
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
140652
140652
|
body2 = body2.pipe(zlib.createBrotliDecompress());
|
|
140653
|
-
response = new
|
|
140653
|
+
response = new Response2(body2, response_options);
|
|
140654
140654
|
resolve5(response);
|
|
140655
140655
|
return;
|
|
140656
140656
|
}
|
|
140657
|
-
response = new
|
|
140657
|
+
response = new Response2(body2, response_options);
|
|
140658
140658
|
resolve5(response);
|
|
140659
140659
|
});
|
|
140660
140660
|
writeToStream(req, request);
|
|
@@ -140669,7 +140669,7 @@ var require_lib10 = __commonJS({
|
|
|
140669
140669
|
exports2.default = exports2;
|
|
140670
140670
|
exports2.Headers = Headers3;
|
|
140671
140671
|
exports2.Request = Request;
|
|
140672
|
-
exports2.Response =
|
|
140672
|
+
exports2.Response = Response2;
|
|
140673
140673
|
exports2.FetchError = FetchError;
|
|
140674
140674
|
}
|
|
140675
140675
|
});
|
|
@@ -148290,7 +148290,7 @@ var require_lib11 = __commonJS({
|
|
|
148290
148290
|
}
|
|
148291
148291
|
var INTERNALS$1 = /* @__PURE__ */ Symbol("Response internals");
|
|
148292
148292
|
var STATUS_CODES = http2.STATUS_CODES;
|
|
148293
|
-
var
|
|
148293
|
+
var Response2 = class _Response {
|
|
148294
148294
|
constructor() {
|
|
148295
148295
|
let body2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
148296
148296
|
let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -148348,8 +148348,8 @@ var require_lib11 = __commonJS({
|
|
|
148348
148348
|
});
|
|
148349
148349
|
}
|
|
148350
148350
|
};
|
|
148351
|
-
Body.mixIn(
|
|
148352
|
-
Object.defineProperties(
|
|
148351
|
+
Body.mixIn(Response2.prototype);
|
|
148352
|
+
Object.defineProperties(Response2.prototype, {
|
|
148353
148353
|
url: { enumerable: true },
|
|
148354
148354
|
status: { enumerable: true },
|
|
148355
148355
|
ok: { enumerable: true },
|
|
@@ -148358,7 +148358,7 @@ var require_lib11 = __commonJS({
|
|
|
148358
148358
|
headers: { enumerable: true },
|
|
148359
148359
|
clone: { enumerable: true }
|
|
148360
148360
|
});
|
|
148361
|
-
Object.defineProperty(
|
|
148361
|
+
Object.defineProperty(Response2.prototype, Symbol.toStringTag, {
|
|
148362
148362
|
value: "Response",
|
|
148363
148363
|
writable: false,
|
|
148364
148364
|
enumerable: false,
|
|
@@ -148692,7 +148692,7 @@ var require_lib11 = __commonJS({
|
|
|
148692
148692
|
};
|
|
148693
148693
|
const codings = headers.get("Content-Encoding");
|
|
148694
148694
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
148695
|
-
response = new
|
|
148695
|
+
response = new Response2(body2, response_options);
|
|
148696
148696
|
resolve5(response);
|
|
148697
148697
|
return;
|
|
148698
148698
|
}
|
|
@@ -148702,7 +148702,7 @@ var require_lib11 = __commonJS({
|
|
|
148702
148702
|
};
|
|
148703
148703
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
148704
148704
|
body2 = body2.pipe(zlib.createGunzip(zlibOptions));
|
|
148705
|
-
response = new
|
|
148705
|
+
response = new Response2(body2, response_options);
|
|
148706
148706
|
resolve5(response);
|
|
148707
148707
|
return;
|
|
148708
148708
|
}
|
|
@@ -148714,12 +148714,12 @@ var require_lib11 = __commonJS({
|
|
|
148714
148714
|
} else {
|
|
148715
148715
|
body2 = body2.pipe(zlib.createInflateRaw());
|
|
148716
148716
|
}
|
|
148717
|
-
response = new
|
|
148717
|
+
response = new Response2(body2, response_options);
|
|
148718
148718
|
resolve5(response);
|
|
148719
148719
|
});
|
|
148720
148720
|
raw.on("end", function() {
|
|
148721
148721
|
if (!response) {
|
|
148722
|
-
response = new
|
|
148722
|
+
response = new Response2(body2, response_options);
|
|
148723
148723
|
resolve5(response);
|
|
148724
148724
|
}
|
|
148725
148725
|
});
|
|
@@ -148727,11 +148727,11 @@ var require_lib11 = __commonJS({
|
|
|
148727
148727
|
}
|
|
148728
148728
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
148729
148729
|
body2 = body2.pipe(zlib.createBrotliDecompress());
|
|
148730
|
-
response = new
|
|
148730
|
+
response = new Response2(body2, response_options);
|
|
148731
148731
|
resolve5(response);
|
|
148732
148732
|
return;
|
|
148733
148733
|
}
|
|
148734
|
-
response = new
|
|
148734
|
+
response = new Response2(body2, response_options);
|
|
148735
148735
|
resolve5(response);
|
|
148736
148736
|
});
|
|
148737
148737
|
writeToStream(req, request);
|
|
@@ -148773,7 +148773,7 @@ var require_lib11 = __commonJS({
|
|
|
148773
148773
|
exports2.default = exports2;
|
|
148774
148774
|
exports2.Headers = Headers3;
|
|
148775
148775
|
exports2.Request = Request;
|
|
148776
|
-
exports2.Response =
|
|
148776
|
+
exports2.Response = Response2;
|
|
148777
148777
|
exports2.FetchError = FetchError;
|
|
148778
148778
|
exports2.AbortError = AbortError;
|
|
148779
148779
|
}
|
|
@@ -258629,6 +258629,9 @@ function normalizeGitRepoUrl(url) {
|
|
|
258629
258629
|
// src/lib/postman/internal-integration-adapter.ts
|
|
258630
258630
|
var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter {
|
|
258631
258631
|
static MINIMUM_POSTMAN_APP_VERSION = "12.0.0";
|
|
258632
|
+
/** Per-request wall-clock deadline (ms) so a hung Bifrost proxy or app-version
|
|
258633
|
+
* endpoint aborts rather than blocking the run forever. */
|
|
258634
|
+
static REQUEST_TIMEOUT_MS = 3e4;
|
|
258632
258635
|
static POSTMAN_APP_VERSION_URL = `https://dl.pstmn.io/update/status?currentVersion=${_BifrostInternalIntegrationAdapter.MINIMUM_POSTMAN_APP_VERSION}&platform=osx_arm64`;
|
|
258633
258636
|
accessToken;
|
|
258634
258637
|
tokenProvider;
|
|
@@ -258673,6 +258676,23 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258673
258676
|
mask: this.secretMasker
|
|
258674
258677
|
};
|
|
258675
258678
|
}
|
|
258679
|
+
/**
|
|
258680
|
+
* fetch with a wall-clock deadline. A slow/hung proxy aborts instead of
|
|
258681
|
+
* blocking the run forever; callers surface the abort like any other transport
|
|
258682
|
+
* rejection.
|
|
258683
|
+
*/
|
|
258684
|
+
async fetchWithDeadline(input, init = {}) {
|
|
258685
|
+
const controller = new AbortController();
|
|
258686
|
+
const timer = setTimeout(
|
|
258687
|
+
() => controller.abort(),
|
|
258688
|
+
_BifrostInternalIntegrationAdapter.REQUEST_TIMEOUT_MS
|
|
258689
|
+
);
|
|
258690
|
+
try {
|
|
258691
|
+
return await this.fetchImpl(input, { ...init, signal: controller.signal });
|
|
258692
|
+
} finally {
|
|
258693
|
+
clearTimeout(timer);
|
|
258694
|
+
}
|
|
258695
|
+
}
|
|
258676
258696
|
async proxyRequest(service, method, requestPath2, body2, options = {}) {
|
|
258677
258697
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
258678
258698
|
const headers = {
|
|
@@ -258685,7 +258705,7 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258685
258705
|
if (this.teamId && this.orgMode) {
|
|
258686
258706
|
headers["x-entity-team-id"] = this.teamId;
|
|
258687
258707
|
}
|
|
258688
|
-
return this.
|
|
258708
|
+
return this.fetchWithDeadline(url, {
|
|
258689
258709
|
method: "POST",
|
|
258690
258710
|
headers,
|
|
258691
258711
|
body: JSON.stringify({
|
|
@@ -258700,7 +258720,7 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
258700
258720
|
resolvePostmanAppVersion() {
|
|
258701
258721
|
this.appVersionPromise ??= (async () => {
|
|
258702
258722
|
try {
|
|
258703
|
-
const response = await this.
|
|
258723
|
+
const response = await this.fetchWithDeadline(
|
|
258704
258724
|
_BifrostInternalIntegrationAdapter.POSTMAN_APP_VERSION_URL,
|
|
258705
258725
|
{ method: "GET" }
|
|
258706
258726
|
);
|
|
@@ -263902,6 +263922,25 @@ function asRecord8(value) {
|
|
|
263902
263922
|
}
|
|
263903
263923
|
return value;
|
|
263904
263924
|
}
|
|
263925
|
+
var BOOTSTRAP_BARE_UUID_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
263926
|
+
function isMissingPatchValueError(error2) {
|
|
263927
|
+
return error2 instanceof HttpError && error2.status === 400 && error2.responseBody.includes("Remove operation must point to an existing value");
|
|
263928
|
+
}
|
|
263929
|
+
function canonicalize(value) {
|
|
263930
|
+
if (Array.isArray(value)) return value.map(canonicalize);
|
|
263931
|
+
if (value && typeof value === "object") {
|
|
263932
|
+
const record = value;
|
|
263933
|
+
const out = {};
|
|
263934
|
+
for (const key of Object.keys(record).sort()) {
|
|
263935
|
+
out[key] = canonicalize(record[key]);
|
|
263936
|
+
}
|
|
263937
|
+
return out;
|
|
263938
|
+
}
|
|
263939
|
+
return value;
|
|
263940
|
+
}
|
|
263941
|
+
function deepEqual(a, b) {
|
|
263942
|
+
return JSON.stringify(canonicalize(a)) === JSON.stringify(canonicalize(b));
|
|
263943
|
+
}
|
|
263905
263944
|
function resolvePollBudget(explicit, envValue, fallback, min) {
|
|
263906
263945
|
if (typeof explicit === "number" && Number.isFinite(explicit) && explicit >= min) return explicit;
|
|
263907
263946
|
if (envValue !== void 0) {
|
|
@@ -264082,6 +264121,9 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264082
264121
|
service: "specification",
|
|
264083
264122
|
method: "patch",
|
|
264084
264123
|
path: `/specifications/${specId}/files/${fileId}`,
|
|
264124
|
+
// Replacing the ROOT file content with the same value is idempotent, so a
|
|
264125
|
+
// transient downstream timeout (ESOCKETTIMEDOUT) is safe to retry.
|
|
264126
|
+
retry: "safe",
|
|
264085
264127
|
body: [{ op: "replace", path: "/content", value: specContent }]
|
|
264086
264128
|
});
|
|
264087
264129
|
}
|
|
@@ -264464,9 +264506,16 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
264464
264506
|
// (live-proven 2026-07-14 on team 172912 / Northwind — immediate post-generation
|
|
264465
264507
|
// `GET .../items/` returns 403 FORBIDDEN with bare id, 200 with full uid).
|
|
264466
264508
|
// The tagging service is distinct and takes the FULL uid.
|
|
264467
|
-
/**
|
|
264509
|
+
/**
|
|
264510
|
+
* `<owner>-<uuid>` public uid -> bare `<uuid>` model id (collection ROOT routes
|
|
264511
|
+
* only). Strip ONLY the numeric owner prefix of a full public uid; a bare UUID
|
|
264512
|
+
* (which itself contains hyphens) must pass through unchanged, so a naive
|
|
264513
|
+
* split on the first hyphen — which would lop off a UUID's first segment — is
|
|
264514
|
+
* rejected here in favour of an anchored `<digits>-<uuid>` match.
|
|
264515
|
+
*/
|
|
264468
264516
|
bareModelId(uid) {
|
|
264469
264517
|
const u = String(uid ?? "").trim();
|
|
264518
|
+
if (BOOTSTRAP_BARE_UUID_RE.test(u)) return u;
|
|
264470
264519
|
return u.includes("-") ? u.slice(u.indexOf("-") + 1) : u;
|
|
264471
264520
|
}
|
|
264472
264521
|
/**
|
|
@@ -265077,12 +265126,61 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265077
265126
|
ops.push({ op: "remove", path: "/scripts" });
|
|
265078
265127
|
}
|
|
265079
265128
|
if (ops.length === 0) return;
|
|
265080
|
-
|
|
265081
|
-
|
|
265082
|
-
|
|
265083
|
-
|
|
265084
|
-
|
|
265085
|
-
|
|
265129
|
+
try {
|
|
265130
|
+
await this.gateway.requestJson({
|
|
265131
|
+
service: "collection",
|
|
265132
|
+
method: "patch",
|
|
265133
|
+
path: `/v3/collections/${cid}`,
|
|
265134
|
+
// Fixed-path add/replace ops are idempotent, and a remove that already
|
|
265135
|
+
// committed is reconciled below, so transient downstream timeouts
|
|
265136
|
+
// (ESOCKETTIMEDOUT) are safe to retry.
|
|
265137
|
+
retry: "safe",
|
|
265138
|
+
body: ops
|
|
265139
|
+
});
|
|
265140
|
+
} catch (error2) {
|
|
265141
|
+
if (isMissingPatchValueError(error2) && ops.some((op) => op.op === "remove") && await this.verifyRootSettingsApplied(cid, ops)) {
|
|
265142
|
+
return;
|
|
265143
|
+
}
|
|
265144
|
+
throw error2;
|
|
265145
|
+
}
|
|
265146
|
+
}
|
|
265147
|
+
/**
|
|
265148
|
+
* Read the collection root and check that every JSON-Patch op's intended end
|
|
265149
|
+
* state holds. add/replace targets must be structurally equal to the exact
|
|
265150
|
+
* requested value (a stale pre-PATCH description/auth/variables/scripts is
|
|
265151
|
+
* non-null but not equal, so it can never falsely verify); remove targets must
|
|
265152
|
+
* be absent (description clears to "" rather than disappearing).
|
|
265153
|
+
*/
|
|
265154
|
+
async verifyRootSettingsApplied(cid, ops) {
|
|
265155
|
+
let current;
|
|
265156
|
+
try {
|
|
265157
|
+
const got = await this.gateway.requestJson({
|
|
265158
|
+
service: "collection",
|
|
265159
|
+
method: "get",
|
|
265160
|
+
path: `/v3/collections/${cid}`
|
|
265161
|
+
});
|
|
265162
|
+
current = asRecord8(got?.data);
|
|
265163
|
+
} catch {
|
|
265164
|
+
return false;
|
|
265165
|
+
}
|
|
265166
|
+
if (!current) return false;
|
|
265167
|
+
for (const op of ops) {
|
|
265168
|
+
const rawPath = String(op.path ?? "");
|
|
265169
|
+
const field = rawPath.startsWith("/") ? rawPath.slice(1) : rawPath;
|
|
265170
|
+
if (!field) return false;
|
|
265171
|
+
const value = current[field];
|
|
265172
|
+
if (op.op === "remove") {
|
|
265173
|
+
if (field === "description") {
|
|
265174
|
+
if (typeof value === "string" && value.length > 0) return false;
|
|
265175
|
+
} else if (!(value === void 0 || value === null || Array.isArray(value) && value.length === 0)) {
|
|
265176
|
+
return false;
|
|
265177
|
+
}
|
|
265178
|
+
} else {
|
|
265179
|
+
if (value === void 0 || value === null) return false;
|
|
265180
|
+
if (!deepEqual(value, op.value)) return false;
|
|
265181
|
+
}
|
|
265182
|
+
}
|
|
265183
|
+
return true;
|
|
265086
265184
|
}
|
|
265087
265185
|
/**
|
|
265088
265186
|
* Create a curated local v2.1.0 or collection v3 payload through the gateway v3 write
|
|
@@ -265205,6 +265303,36 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
265205
265303
|
function isExpiredAuthError(status, body2) {
|
|
265206
265304
|
return status === 401 || body2.includes("UNAUTHENTICATED") || body2.includes("authenticationError");
|
|
265207
265305
|
}
|
|
265306
|
+
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
265307
|
+
function asRecord9(value) {
|
|
265308
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
265309
|
+
}
|
|
265310
|
+
function innerEnvelopeStatus(envelope) {
|
|
265311
|
+
for (const key of ["status", "statusCode"]) {
|
|
265312
|
+
const value = envelope[key];
|
|
265313
|
+
if (typeof value === "number") return value;
|
|
265314
|
+
if (typeof value === "string" && /^\d+$/.test(value)) return Number(value);
|
|
265315
|
+
}
|
|
265316
|
+
return void 0;
|
|
265317
|
+
}
|
|
265318
|
+
function detectInnerError(body2) {
|
|
265319
|
+
const trimmed = body2.trim();
|
|
265320
|
+
if (!trimmed) return null;
|
|
265321
|
+
let parsed;
|
|
265322
|
+
try {
|
|
265323
|
+
parsed = JSON.parse(trimmed);
|
|
265324
|
+
} catch {
|
|
265325
|
+
return null;
|
|
265326
|
+
}
|
|
265327
|
+
const envelope = asRecord9(parsed);
|
|
265328
|
+
if (!envelope) return null;
|
|
265329
|
+
const innerStatus = innerEnvelopeStatus(envelope);
|
|
265330
|
+
const error2 = envelope.error;
|
|
265331
|
+
const errorRecord = asRecord9(error2);
|
|
265332
|
+
const hasError = error2 !== void 0 && error2 !== null && !(errorRecord !== null && Object.keys(errorRecord).length === 0) || envelope.success === false || typeof innerStatus === "number" && innerStatus >= 400;
|
|
265333
|
+
if (!hasError) return null;
|
|
265334
|
+
return typeof innerStatus === "number" && innerStatus >= 400 ? innerStatus : 502;
|
|
265335
|
+
}
|
|
265208
265336
|
function isTransientGatewayError(status, body2) {
|
|
265209
265337
|
if (status === 502 || status === 503 || status === 504) return true;
|
|
265210
265338
|
if (status >= 500 && (body2.includes("ESOCKETTIMEDOUT") || body2.includes("ETIMEDOUT") || body2.includes("ECONNRESET") || body2.includes("serverError") || body2.includes("downstream"))) {
|
|
@@ -265224,6 +265352,7 @@ var AccessTokenGatewayClient = class {
|
|
|
265224
265352
|
secretMasker;
|
|
265225
265353
|
maxRetries;
|
|
265226
265354
|
retryBaseDelayMs;
|
|
265355
|
+
requestTimeoutMs;
|
|
265227
265356
|
sleepImpl;
|
|
265228
265357
|
constructor(options) {
|
|
265229
265358
|
this.tokenProvider = options.tokenProvider;
|
|
@@ -265236,6 +265365,7 @@ var AccessTokenGatewayClient = class {
|
|
|
265236
265365
|
this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
|
|
265237
265366
|
this.maxRetries = options.maxRetries ?? 3;
|
|
265238
265367
|
this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
|
|
265368
|
+
this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
265239
265369
|
this.sleepImpl = options.sleepImpl ?? defaultSleep;
|
|
265240
265370
|
}
|
|
265241
265371
|
configureTeamContext(teamId, orgMode) {
|
|
@@ -265255,45 +265385,83 @@ var AccessTokenGatewayClient = class {
|
|
|
265255
265385
|
}
|
|
265256
265386
|
async send(request) {
|
|
265257
265387
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
265258
|
-
|
|
265259
|
-
|
|
265260
|
-
|
|
265261
|
-
|
|
265262
|
-
|
|
265263
|
-
|
|
265264
|
-
|
|
265265
|
-
|
|
265266
|
-
|
|
265267
|
-
|
|
265268
|
-
|
|
265388
|
+
const controller = new AbortController();
|
|
265389
|
+
const timer = setTimeout(() => controller.abort(), this.requestTimeoutMs);
|
|
265390
|
+
try {
|
|
265391
|
+
return await this.fetchImpl(url, {
|
|
265392
|
+
method: "POST",
|
|
265393
|
+
headers: this.buildHeaders(request.headers),
|
|
265394
|
+
signal: controller.signal,
|
|
265395
|
+
body: JSON.stringify({
|
|
265396
|
+
service: request.service,
|
|
265397
|
+
method: request.method,
|
|
265398
|
+
path: request.path,
|
|
265399
|
+
...request.query !== void 0 ? { query: request.query } : {},
|
|
265400
|
+
...request.body !== void 0 ? { body: request.body } : {}
|
|
265401
|
+
})
|
|
265402
|
+
});
|
|
265403
|
+
} finally {
|
|
265404
|
+
clearTimeout(timer);
|
|
265405
|
+
}
|
|
265269
265406
|
}
|
|
265270
265407
|
/**
|
|
265271
265408
|
* Send a gateway request, refreshing the token once on an auth failure and
|
|
265272
|
-
* retrying transient
|
|
265273
|
-
*
|
|
265274
|
-
*
|
|
265409
|
+
* retrying transient failures with exponential backoff. Transient covers both
|
|
265410
|
+
* HTTP 5xx / Bifrost read timeouts AND transport-level rejections (fetch
|
|
265411
|
+
* throwing on a socket hangup or the per-request deadline aborting) — a
|
|
265412
|
+
* `retry: 'safe'` request retries either; a `retry: 'none'` mutation surfaces
|
|
265413
|
+
* the failure so the caller reconciles instead of blindly resending. An HTTP
|
|
265414
|
+
* 200 envelope carrying an inner collection-service error is treated as that
|
|
265415
|
+
* inner status. The auth-refresh-once path is independent of the retry budget.
|
|
265275
265416
|
*/
|
|
265276
265417
|
async request(request) {
|
|
265277
265418
|
if (!this.tokenProvider.current() && this.tokenProvider.canRefresh()) {
|
|
265278
265419
|
await this.tokenProvider.refresh();
|
|
265279
265420
|
}
|
|
265421
|
+
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
265280
265422
|
let attempt = 0;
|
|
265281
265423
|
for (; ; ) {
|
|
265282
|
-
let response
|
|
265424
|
+
let response;
|
|
265425
|
+
try {
|
|
265426
|
+
response = await this.send(request);
|
|
265427
|
+
} catch (error2) {
|
|
265428
|
+
if (retryMode === "safe" && attempt < this.maxRetries) {
|
|
265429
|
+
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265430
|
+
attempt += 1;
|
|
265431
|
+
await this.sleepImpl(delay);
|
|
265432
|
+
continue;
|
|
265433
|
+
}
|
|
265434
|
+
throw error2;
|
|
265435
|
+
}
|
|
265283
265436
|
if (response.ok) {
|
|
265284
|
-
|
|
265437
|
+
const okBody = await response.text().catch(() => "");
|
|
265438
|
+
const innerStatus = detectInnerError(okBody);
|
|
265439
|
+
if (innerStatus !== null) {
|
|
265440
|
+
if (retryMode === "safe" && isTransientGatewayError(innerStatus, okBody) && attempt < this.maxRetries) {
|
|
265441
|
+
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265442
|
+
attempt += 1;
|
|
265443
|
+
await this.sleepImpl(delay);
|
|
265444
|
+
continue;
|
|
265445
|
+
}
|
|
265446
|
+
throw this.toInnerHttpError(request, innerStatus, okBody);
|
|
265447
|
+
}
|
|
265448
|
+
return this.rebuildResponse(response, okBody);
|
|
265285
265449
|
}
|
|
265286
265450
|
const body2 = await response.text().catch(() => "");
|
|
265287
265451
|
if (isExpiredAuthError(response.status, body2) && this.tokenProvider.canRefresh()) {
|
|
265288
265452
|
await this.tokenProvider.refresh();
|
|
265289
265453
|
response = await this.send(request);
|
|
265290
265454
|
if (response.ok) {
|
|
265291
|
-
|
|
265455
|
+
const refreshedBody = await response.text().catch(() => "");
|
|
265456
|
+
const innerStatus = detectInnerError(refreshedBody);
|
|
265457
|
+
if (innerStatus !== null) {
|
|
265458
|
+
throw this.toInnerHttpError(request, innerStatus, refreshedBody);
|
|
265459
|
+
}
|
|
265460
|
+
return this.rebuildResponse(response, refreshedBody);
|
|
265292
265461
|
}
|
|
265293
265462
|
const retryBody = await response.text().catch(() => "");
|
|
265294
265463
|
throw this.toHttpError(request, response, retryBody);
|
|
265295
265464
|
}
|
|
265296
|
-
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
265297
265465
|
if (retryMode === "safe" && isTransientGatewayError(response.status, body2) && attempt < this.maxRetries) {
|
|
265298
265466
|
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
265299
265467
|
attempt += 1;
|
|
@@ -265303,6 +265471,18 @@ var AccessTokenGatewayClient = class {
|
|
|
265303
265471
|
throw this.toHttpError(request, response, body2);
|
|
265304
265472
|
}
|
|
265305
265473
|
}
|
|
265474
|
+
/**
|
|
265475
|
+
* The success path reads the body to inspect for an inner error, which
|
|
265476
|
+
* consumes the stream. Hand callers a fresh Response over the buffered text so
|
|
265477
|
+
* `requestJson` can still parse it.
|
|
265478
|
+
*/
|
|
265479
|
+
rebuildResponse(response, body2) {
|
|
265480
|
+
return new Response(body2, {
|
|
265481
|
+
status: response.status,
|
|
265482
|
+
statusText: response.statusText,
|
|
265483
|
+
headers: response.headers
|
|
265484
|
+
});
|
|
265485
|
+
}
|
|
265306
265486
|
/** Send a gateway request and parse the JSON body, or null when empty. */
|
|
265307
265487
|
async requestJson(request) {
|
|
265308
265488
|
const response = await this.request(request);
|
|
@@ -265327,6 +265507,17 @@ var AccessTokenGatewayClient = class {
|
|
|
265327
265507
|
secretValues: [this.tokenProvider.current()]
|
|
265328
265508
|
});
|
|
265329
265509
|
}
|
|
265510
|
+
toInnerHttpError(request, status, body2) {
|
|
265511
|
+
return new HttpError({
|
|
265512
|
+
method: request.method.toUpperCase(),
|
|
265513
|
+
url: `${this.bifrostBaseUrl}/ws/proxy (${request.service}: ${request.method} ${request.path}) [inner]`,
|
|
265514
|
+
status,
|
|
265515
|
+
statusText: "Inner Error",
|
|
265516
|
+
requestHeaders: this.buildHeaders(request.headers),
|
|
265517
|
+
responseBody: this.secretMasker(body2),
|
|
265518
|
+
secretValues: [this.tokenProvider.current()]
|
|
265519
|
+
});
|
|
265520
|
+
}
|
|
265330
265521
|
};
|
|
265331
265522
|
|
|
265332
265523
|
// src/lib/postman/token-provider.ts
|
|
@@ -281644,7 +281835,7 @@ function compileErrors(result) {
|
|
|
281644
281835
|
|
|
281645
281836
|
// src/lib/spec/openapi-loader.ts
|
|
281646
281837
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
281647
|
-
function
|
|
281838
|
+
function asRecord10(value) {
|
|
281648
281839
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
281649
281840
|
return value;
|
|
281650
281841
|
}
|
|
@@ -281659,7 +281850,7 @@ function parseOpenApiDocument(content) {
|
|
|
281659
281850
|
throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content is not valid JSON or YAML");
|
|
281660
281851
|
}
|
|
281661
281852
|
}
|
|
281662
|
-
const doc =
|
|
281853
|
+
const doc = asRecord10(parsed);
|
|
281663
281854
|
if (!doc) throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content must be a JSON or YAML object");
|
|
281664
281855
|
return doc;
|
|
281665
281856
|
}
|
|
@@ -281687,7 +281878,7 @@ function collectExternalRefs(node, baseUrl, refs) {
|
|
|
281687
281878
|
node.forEach((entry) => collectExternalRefs(entry, baseUrl, refs));
|
|
281688
281879
|
return;
|
|
281689
281880
|
}
|
|
281690
|
-
const record =
|
|
281881
|
+
const record = asRecord10(node);
|
|
281691
281882
|
if (!record) return;
|
|
281692
281883
|
const ref = typeof record.$ref === "string" ? record.$ref : "";
|
|
281693
281884
|
if (ref && !ref.startsWith("#")) {
|
|
@@ -294283,7 +294474,7 @@ function buildGraphQLCollection(index, opts = {}) {
|
|
|
294283
294474
|
}
|
|
294284
294475
|
|
|
294285
294476
|
// src/lib/protocols/graphql/schema-lints.ts
|
|
294286
|
-
function
|
|
294477
|
+
function asRecord11(value) {
|
|
294287
294478
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294288
294479
|
return value;
|
|
294289
294480
|
}
|
|
@@ -294294,7 +294485,7 @@ var BUILT_IN_SCALAR_NAMES = new Set(specifiedScalarTypes.map((scalar) => scalar.
|
|
|
294294
294485
|
var VALID_TYPE_KINDS = /* @__PURE__ */ new Set(["SCALAR", "OBJECT", "INTERFACE", "UNION", "ENUM", "INPUT_OBJECT", "LIST", "NON_NULL"]);
|
|
294295
294486
|
var VALID_DIRECTIVE_LOCATIONS = new Set(Object.values(DirectiveLocation));
|
|
294296
294487
|
function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
294297
|
-
const current =
|
|
294488
|
+
const current = asRecord11(ref);
|
|
294298
294489
|
if (!current || depth > 32 || typeof current.kind !== "string") return null;
|
|
294299
294490
|
if (current.kind === "NON_NULL") {
|
|
294300
294491
|
const inner = renderIntrospectionTypeRef(current.ofType, depth + 1);
|
|
@@ -294307,12 +294498,12 @@ function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
|
294307
294498
|
return typeof current.name === "string" && current.name.length > 0 ? current.name : null;
|
|
294308
294499
|
}
|
|
294309
294500
|
function readIntrospectionDirectiveShape(value) {
|
|
294310
|
-
const directive =
|
|
294501
|
+
const directive = asRecord11(value);
|
|
294311
294502
|
if (!directive || typeof directive.isRepeatable !== "boolean") return null;
|
|
294312
294503
|
return {
|
|
294313
294504
|
isRepeatable: directive.isRepeatable,
|
|
294314
294505
|
locations: asArray5(directive.locations).filter((entry) => typeof entry === "string"),
|
|
294315
|
-
args: asArray5(directive.args).map(
|
|
294506
|
+
args: asArray5(directive.args).map(asRecord11).filter((entry) => entry !== null && typeof entry.name === "string").map((arg) => ({
|
|
294316
294507
|
name: arg.name,
|
|
294317
294508
|
type: renderIntrospectionTypeRef(arg.type),
|
|
294318
294509
|
defaultValue: Object.prototype.hasOwnProperty.call(arg, "defaultValue") ? arg.defaultValue : void 0
|
|
@@ -294322,10 +294513,10 @@ function readIntrospectionDirectiveShape(value) {
|
|
|
294322
294513
|
var BUILT_IN_INTROSPECTION_DIRECTIVE_SHAPES = (() => {
|
|
294323
294514
|
const shapes = /* @__PURE__ */ new Map();
|
|
294324
294515
|
const reference = introspectionFromSchema(buildSchema("type Query { _: Boolean }"));
|
|
294325
|
-
const schemaRecord =
|
|
294516
|
+
const schemaRecord = asRecord11(asRecord11(reference)?.__schema);
|
|
294326
294517
|
if (!schemaRecord) return shapes;
|
|
294327
294518
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
294328
|
-
const directive =
|
|
294519
|
+
const directive = asRecord11(entry);
|
|
294329
294520
|
if (!directive || typeof directive.name !== "string") continue;
|
|
294330
294521
|
const shape = readIntrospectionDirectiveShape(directive);
|
|
294331
294522
|
if (shape) shapes.set(directive.name, shape);
|
|
@@ -294421,11 +294612,11 @@ function lintDirectiveDefinitions(schema) {
|
|
|
294421
294612
|
const warnings = [];
|
|
294422
294613
|
const builtIn = new Set(specifiedDirectives.map((directive) => directive.name));
|
|
294423
294614
|
const usesDirective = (astNode, name) => {
|
|
294424
|
-
const record =
|
|
294615
|
+
const record = asRecord11(astNode);
|
|
294425
294616
|
if (!record) return false;
|
|
294426
294617
|
return asArray5(record.directives).some((entry) => {
|
|
294427
|
-
const applied =
|
|
294428
|
-
const appliedName = applied ?
|
|
294618
|
+
const applied = asRecord11(entry);
|
|
294619
|
+
const appliedName = applied ? asRecord11(applied.name) : null;
|
|
294429
294620
|
return Boolean(appliedName && appliedName.value === name);
|
|
294430
294621
|
});
|
|
294431
294622
|
};
|
|
@@ -294435,7 +294626,7 @@ function lintDirectiveDefinitions(schema) {
|
|
|
294435
294626
|
warnings.push("GQL_DIRECTIVE_NAME_RESERVED: directive @" + directive.name + ' must not begin with "__" (GraphQL spec 3.13)');
|
|
294436
294627
|
}
|
|
294437
294628
|
let selfReferenced = false;
|
|
294438
|
-
const ownAst =
|
|
294629
|
+
const ownAst = asRecord11(directive.astNode);
|
|
294439
294630
|
if (ownAst) {
|
|
294440
294631
|
for (const argNode of asArray5(ownAst.arguments)) {
|
|
294441
294632
|
if (usesDirective(argNode, directive.name)) selfReferenced = true;
|
|
@@ -294579,10 +294770,10 @@ function lintSdlDocument(sdl) {
|
|
|
294579
294770
|
return warnings;
|
|
294580
294771
|
}
|
|
294581
294772
|
function lintTypeRefChain(ref, context, warnings) {
|
|
294582
|
-
let current =
|
|
294773
|
+
let current = asRecord11(ref);
|
|
294583
294774
|
let depth = 0;
|
|
294584
294775
|
while (current && depth < 32) {
|
|
294585
|
-
const ofType =
|
|
294776
|
+
const ofType = asRecord11(current.ofType);
|
|
294586
294777
|
if (current.kind === "NON_NULL" && ofType && ofType.kind === "NON_NULL") {
|
|
294587
294778
|
warnings.push("GQL_INTROSPECTION_NONNULL_NESTED: " + context + " wraps NON_NULL directly inside NON_NULL, which the type system forbids (GraphQL spec 3.12)");
|
|
294588
294779
|
return;
|
|
@@ -294593,7 +294784,7 @@ function lintTypeRefChain(ref, context, warnings) {
|
|
|
294593
294784
|
}
|
|
294594
294785
|
function lintDeprecationFlags(entries, context, warnings) {
|
|
294595
294786
|
for (const entry of entries) {
|
|
294596
|
-
const record =
|
|
294787
|
+
const record = asRecord11(entry);
|
|
294597
294788
|
if (!record) continue;
|
|
294598
294789
|
const label = context + "." + (typeof record.name === "string" ? record.name : "<unnamed>");
|
|
294599
294790
|
if (record.isDeprecated !== void 0 && typeof record.isDeprecated !== "boolean") {
|
|
@@ -294614,7 +294805,7 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
294614
294805
|
const warnings = [];
|
|
294615
294806
|
const directives = /* @__PURE__ */ new Map();
|
|
294616
294807
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
294617
|
-
const directive =
|
|
294808
|
+
const directive = asRecord11(entry);
|
|
294618
294809
|
if (directive && typeof directive.name === "string" && !directives.has(directive.name)) {
|
|
294619
294810
|
directives.set(directive.name, directive);
|
|
294620
294811
|
}
|
|
@@ -294668,13 +294859,13 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
294668
294859
|
}
|
|
294669
294860
|
function lintIntrospectionJson(introspection) {
|
|
294670
294861
|
const warnings = [];
|
|
294671
|
-
const root =
|
|
294672
|
-
const dataRecord = root ?
|
|
294673
|
-
const schemaRecord = root ?
|
|
294862
|
+
const root = asRecord11(introspection);
|
|
294863
|
+
const dataRecord = root ? asRecord11(root.data) : null;
|
|
294864
|
+
const schemaRecord = root ? asRecord11(root.__schema) ?? (dataRecord ? asRecord11(dataRecord.__schema) : null) : null;
|
|
294674
294865
|
if (!schemaRecord) return warnings;
|
|
294675
294866
|
const typeCounts = /* @__PURE__ */ new Map();
|
|
294676
294867
|
for (const entry of asArray5(schemaRecord.types)) {
|
|
294677
|
-
const type =
|
|
294868
|
+
const type = asRecord11(entry);
|
|
294678
294869
|
if (!type) continue;
|
|
294679
294870
|
const name = typeof type.name === "string" ? type.name : "<unnamed>";
|
|
294680
294871
|
typeCounts.set(name, (typeCounts.get(name) ?? 0) + 1);
|
|
@@ -294682,7 +294873,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294682
294873
|
warnings.push("GQL_INTROSPECTION_KIND_INVALID: type " + name + " declares unknown __TypeKind '" + type.kind + "'");
|
|
294683
294874
|
}
|
|
294684
294875
|
for (const memberEntry of asArray5(type.possibleTypes)) {
|
|
294685
|
-
const member =
|
|
294876
|
+
const member = asRecord11(memberEntry);
|
|
294686
294877
|
if (member && member.kind !== void 0 && member.kind !== "OBJECT") {
|
|
294687
294878
|
warnings.push("GQL_INTROSPECTION_POSSIBLE_TYPE_NOT_OBJECT: " + name + ".possibleTypes entry " + String(member.name ?? "<unnamed>") + " has kind " + String(member.kind) + "; union/interface possible types must be OBJECT types (GraphQL spec 3.7/3.8)");
|
|
294688
294879
|
}
|
|
@@ -294690,18 +294881,18 @@ function lintIntrospectionJson(introspection) {
|
|
|
294690
294881
|
lintDeprecationFlags(asArray5(type.fields), name + ".fields", warnings);
|
|
294691
294882
|
lintDeprecationFlags(asArray5(type.enumValues), name + ".enumValues", warnings);
|
|
294692
294883
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
294693
|
-
const field =
|
|
294884
|
+
const field = asRecord11(fieldEntry);
|
|
294694
294885
|
if (!field) continue;
|
|
294695
294886
|
const fieldLabel = name + "." + String(field.name ?? "<unnamed>");
|
|
294696
294887
|
lintTypeRefChain(field.type, fieldLabel, warnings);
|
|
294697
294888
|
for (const argEntry of asArray5(field.args)) {
|
|
294698
|
-
const arg =
|
|
294889
|
+
const arg = asRecord11(argEntry);
|
|
294699
294890
|
if (arg) lintTypeRefChain(arg.type, fieldLabel + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
294700
294891
|
}
|
|
294701
294892
|
lintDeprecationFlags(asArray5(field.args), fieldLabel + ".args", warnings);
|
|
294702
294893
|
}
|
|
294703
294894
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
294704
|
-
const input =
|
|
294895
|
+
const input = asRecord11(inputEntry);
|
|
294705
294896
|
if (input) lintTypeRefChain(input.type, name + "." + String(input.name ?? "<unnamed>"), warnings);
|
|
294706
294897
|
}
|
|
294707
294898
|
lintDeprecationFlags(asArray5(type.inputFields), name + ".inputFields", warnings);
|
|
@@ -294713,7 +294904,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294713
294904
|
}
|
|
294714
294905
|
const directiveNameCounts = /* @__PURE__ */ new Map();
|
|
294715
294906
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
294716
|
-
const directive =
|
|
294907
|
+
const directive = asRecord11(directiveEntry);
|
|
294717
294908
|
if (!directive) continue;
|
|
294718
294909
|
if (typeof directive.name !== "string" || directive.name.length === 0) {
|
|
294719
294910
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: a __schema.directives entry is missing its name");
|
|
@@ -294729,7 +294920,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294729
294920
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: directive @" + directive.name + " isRepeatable must be a boolean (__Directive contract)");
|
|
294730
294921
|
}
|
|
294731
294922
|
for (const argEntry of asArray5(directive.args)) {
|
|
294732
|
-
const arg =
|
|
294923
|
+
const arg = asRecord11(argEntry);
|
|
294733
294924
|
if (arg) lintTypeRefChain(arg.type, "@" + directive.name + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
294734
294925
|
}
|
|
294735
294926
|
lintDeprecationFlags(asArray5(directive.args), "@" + directive.name + ".args", warnings);
|
|
@@ -294748,7 +294939,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
294748
294939
|
return warnings;
|
|
294749
294940
|
}
|
|
294750
294941
|
function introspectionTypeEntries(schemaRecord) {
|
|
294751
|
-
return asArray5(schemaRecord.types).map(
|
|
294942
|
+
return asArray5(schemaRecord.types).map(asRecord11).filter((entry) => entry !== null);
|
|
294752
294943
|
}
|
|
294753
294944
|
function introspectionTypesByName(entries) {
|
|
294754
294945
|
const byName = /* @__PURE__ */ new Map();
|
|
@@ -294759,7 +294950,7 @@ function introspectionTypesByName(entries) {
|
|
|
294759
294950
|
}
|
|
294760
294951
|
function describeIntrospectionRootRecord(value) {
|
|
294761
294952
|
if (value === void 0 || value === null) return "<missing>";
|
|
294762
|
-
const record =
|
|
294953
|
+
const record = asRecord11(value);
|
|
294763
294954
|
if (!record) return "<invalid>";
|
|
294764
294955
|
return typeof record.name === "string" && record.name.length > 0 ? record.name : "<unnamed>";
|
|
294765
294956
|
}
|
|
@@ -294779,7 +294970,7 @@ function lintIntrospectionRootMap(schemaRecord) {
|
|
|
294779
294970
|
}
|
|
294780
294971
|
continue;
|
|
294781
294972
|
}
|
|
294782
|
-
const record =
|
|
294973
|
+
const record = asRecord11(value);
|
|
294783
294974
|
if (!record || typeof record.name !== "string" || record.name.length === 0) {
|
|
294784
294975
|
warnings.push("GQL_INTROSPECTION_ROOT_INVALID: __schema." + rootKind + "Type must name the " + rootKind + " root operation type (GraphQL spec 3.3). Root map: " + rootMap);
|
|
294785
294976
|
continue;
|
|
@@ -294839,13 +295030,13 @@ function lintIntrospectionTypeMatrix(schemaRecord) {
|
|
|
294839
295030
|
return warnings;
|
|
294840
295031
|
}
|
|
294841
295032
|
function namedTypeRefName(ref) {
|
|
294842
|
-
let current =
|
|
295033
|
+
let current = asRecord11(ref);
|
|
294843
295034
|
let depth = 0;
|
|
294844
295035
|
while (current && depth < 32) {
|
|
294845
295036
|
if (current.kind !== "LIST" && current.kind !== "NON_NULL") {
|
|
294846
295037
|
return typeof current.name === "string" ? current.name : null;
|
|
294847
295038
|
}
|
|
294848
|
-
current =
|
|
295039
|
+
current = asRecord11(current.ofType);
|
|
294849
295040
|
depth += 1;
|
|
294850
295041
|
}
|
|
294851
295042
|
return null;
|
|
@@ -294859,31 +295050,31 @@ function lintIntrospectionReferenceGraph(schemaRecord) {
|
|
|
294859
295050
|
if (name) referenced.add(name);
|
|
294860
295051
|
};
|
|
294861
295052
|
for (const rootKind of ["query", "mutation", "subscription"]) {
|
|
294862
|
-
const record =
|
|
295053
|
+
const record = asRecord11(schemaRecord[rootKind + "Type"]);
|
|
294863
295054
|
if (record && typeof record.name === "string") referenced.add(record.name);
|
|
294864
295055
|
}
|
|
294865
295056
|
for (const type of entries) {
|
|
294866
295057
|
for (const entry of asArray5(type.interfaces)) addRef(namedTypeRefName(entry));
|
|
294867
295058
|
for (const entry of asArray5(type.possibleTypes)) addRef(namedTypeRefName(entry));
|
|
294868
295059
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
294869
|
-
const field =
|
|
295060
|
+
const field = asRecord11(fieldEntry);
|
|
294870
295061
|
if (!field) continue;
|
|
294871
295062
|
addRef(namedTypeRefName(field.type));
|
|
294872
295063
|
for (const argEntry of asArray5(field.args)) {
|
|
294873
|
-
const arg =
|
|
295064
|
+
const arg = asRecord11(argEntry);
|
|
294874
295065
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
294875
295066
|
}
|
|
294876
295067
|
}
|
|
294877
295068
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
294878
|
-
const input =
|
|
295069
|
+
const input = asRecord11(inputEntry);
|
|
294879
295070
|
if (input) addRef(namedTypeRefName(input.type));
|
|
294880
295071
|
}
|
|
294881
295072
|
}
|
|
294882
295073
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
294883
|
-
const directive =
|
|
295074
|
+
const directive = asRecord11(directiveEntry);
|
|
294884
295075
|
if (!directive) continue;
|
|
294885
295076
|
for (const argEntry of asArray5(directive.args)) {
|
|
294886
|
-
const arg =
|
|
295077
|
+
const arg = asRecord11(argEntry);
|
|
294887
295078
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
294888
295079
|
}
|
|
294889
295080
|
}
|
|
@@ -294904,7 +295095,7 @@ function lintIntrospectionAbstractConsistency(schemaRecord) {
|
|
|
294904
295095
|
const entries = introspectionTypeEntries(schemaRecord);
|
|
294905
295096
|
const byName = introspectionTypesByName(entries);
|
|
294906
295097
|
const names = (value) => asArray5(value).map((entry) => {
|
|
294907
|
-
const record =
|
|
295098
|
+
const record = asRecord11(entry);
|
|
294908
295099
|
return record && typeof record.name === "string" ? record.name : "";
|
|
294909
295100
|
}).filter((name) => name.length > 0);
|
|
294910
295101
|
for (const type of entries) {
|
|
@@ -294933,7 +295124,7 @@ function lintIntrospectionDeprecationProvenance(schemaRecord) {
|
|
|
294933
295124
|
let flagged = 0;
|
|
294934
295125
|
for (const type of introspectionTypeEntries(schemaRecord)) {
|
|
294935
295126
|
for (const entry of [...asArray5(type.fields), ...asArray5(type.enumValues)]) {
|
|
294936
|
-
const record =
|
|
295127
|
+
const record = asRecord11(entry);
|
|
294937
295128
|
if (!record) continue;
|
|
294938
295129
|
entries += 1;
|
|
294939
295130
|
if (record.isDeprecated !== void 0) flagged += 1;
|
|
@@ -294959,7 +295150,7 @@ function lintGeneratedDocument(schema, operationId, documentText) {
|
|
|
294959
295150
|
}
|
|
294960
295151
|
|
|
294961
295152
|
// src/lib/protocols/graphql/parser.ts
|
|
294962
|
-
function
|
|
295153
|
+
function asRecord12(value) {
|
|
294963
295154
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294964
295155
|
return value;
|
|
294965
295156
|
}
|
|
@@ -295077,14 +295268,14 @@ function collectRootOperations(rootType, kind, schema, shapes) {
|
|
|
295077
295268
|
});
|
|
295078
295269
|
}
|
|
295079
295270
|
function looksLikeIntrospection2(value) {
|
|
295080
|
-
const record =
|
|
295271
|
+
const record = asRecord12(value);
|
|
295081
295272
|
if (!record) return false;
|
|
295082
|
-
if (
|
|
295083
|
-
const data =
|
|
295084
|
-
return Boolean(data &&
|
|
295273
|
+
if (asRecord12(record.__schema)) return true;
|
|
295274
|
+
const data = asRecord12(record.data);
|
|
295275
|
+
return Boolean(data && asRecord12(data.__schema));
|
|
295085
295276
|
}
|
|
295086
295277
|
function buildSchemaFromIntrospection(value) {
|
|
295087
|
-
const introspection =
|
|
295278
|
+
const introspection = asRecord12(value.__schema) ? value : asRecord12(value.data);
|
|
295088
295279
|
return buildClientSchema(introspection);
|
|
295089
295280
|
}
|
|
295090
295281
|
function selectIntrospectionRootWarnings(warnings) {
|
|
@@ -295107,7 +295298,7 @@ function parseGraphQLSchema(content, opts = {}) {
|
|
|
295107
295298
|
if (parsedJson !== void 0 && looksLikeIntrospection2(parsedJson)) {
|
|
295108
295299
|
introspectionWarnings = lintIntrospectionJson(parsedJson);
|
|
295109
295300
|
try {
|
|
295110
|
-
schema = buildSchemaFromIntrospection(
|
|
295301
|
+
schema = buildSchemaFromIntrospection(asRecord12(parsedJson));
|
|
295111
295302
|
} catch (error2) {
|
|
295112
295303
|
const rootWarnings = selectIntrospectionRootWarnings(introspectionWarnings);
|
|
295113
295304
|
const rootDiagnostics = rootWarnings.length > 0 ? " " + rootWarnings.join(" ") : "";
|
|
@@ -295224,7 +295415,7 @@ function collectDeprecatedSelectionWarnings(schema, operation, index) {
|
|
|
295224
295415
|
}
|
|
295225
295416
|
|
|
295226
295417
|
// src/lib/protocols/graphql/instrumenter.ts
|
|
295227
|
-
function
|
|
295418
|
+
function asRecord13(value) {
|
|
295228
295419
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
295229
295420
|
return value;
|
|
295230
295421
|
}
|
|
@@ -295734,24 +295925,24 @@ function buildProbeScript(probeId, index, warnings) {
|
|
|
295734
295925
|
];
|
|
295735
295926
|
}
|
|
295736
295927
|
function isGraphQLHttpRequest(item) {
|
|
295737
|
-
const request =
|
|
295928
|
+
const request = asRecord13(item.request);
|
|
295738
295929
|
if (!request) return false;
|
|
295739
|
-
const body2 =
|
|
295930
|
+
const body2 = asRecord13(request.body);
|
|
295740
295931
|
return body2?.mode === "graphql";
|
|
295741
295932
|
}
|
|
295742
295933
|
function injectItem(item, index, covered, warnings) {
|
|
295743
295934
|
const children4 = asArray6(item.item);
|
|
295744
295935
|
if (children4.length > 0) {
|
|
295745
295936
|
for (const child4 of children4) {
|
|
295746
|
-
const childRecord =
|
|
295937
|
+
const childRecord = asRecord13(child4);
|
|
295747
295938
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
295748
295939
|
}
|
|
295749
295940
|
return;
|
|
295750
295941
|
}
|
|
295751
295942
|
const itemId = String(item.id ?? "");
|
|
295752
|
-
if (itemId.startsWith("__gql_probe_") &&
|
|
295943
|
+
if (itemId.startsWith("__gql_probe_") && asRecord13(item.request)) {
|
|
295753
295944
|
const exec2 = buildProbeScript(itemId, index, warnings);
|
|
295754
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
295945
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295755
295946
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec: exec2 } }];
|
|
295756
295947
|
return;
|
|
295757
295948
|
}
|
|
@@ -295767,7 +295958,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
295767
295958
|
" pm.expect.fail(contractMappingError);",
|
|
295768
295959
|
"});"
|
|
295769
295960
|
];
|
|
295770
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
295961
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295771
295962
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
295772
295963
|
return;
|
|
295773
295964
|
}
|
|
@@ -295783,7 +295974,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
295783
295974
|
`GQL_SCRIPT_SIZE_EXCEEDED: generated test script for '${operation.id}' exceeded ${GRAPHQL_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`
|
|
295784
295975
|
);
|
|
295785
295976
|
}
|
|
295786
|
-
const events2 = asArray6(item.event).filter((entry) =>
|
|
295977
|
+
const events2 = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
295787
295978
|
item.event = [
|
|
295788
295979
|
...events2,
|
|
295789
295980
|
{ listen: "test", script: { type: "text/javascript", exec: exec2 } }
|
|
@@ -295794,7 +295985,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
295794
295985
|
const warnings = [...index.warnings];
|
|
295795
295986
|
const covered = /* @__PURE__ */ new Set();
|
|
295796
295987
|
for (const child4 of asArray6(collection.item)) {
|
|
295797
|
-
const childRecord =
|
|
295988
|
+
const childRecord = asRecord13(child4);
|
|
295798
295989
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
295799
295990
|
}
|
|
295800
295991
|
const missing = index.operations.filter((operation) => !covered.has(operation.id));
|
|
@@ -295808,7 +295999,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
295808
295999
|
|
|
295809
296000
|
// src/lib/protocols/grpc/proto-parser.ts
|
|
295810
296001
|
var protobufjs = __toESM(require_protobufjs(), 1);
|
|
295811
|
-
function
|
|
296002
|
+
function asRecord14(value) {
|
|
295812
296003
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
295813
296004
|
return value;
|
|
295814
296005
|
}
|
|
@@ -296108,7 +296299,7 @@ function upperCamelCase(name) {
|
|
|
296108
296299
|
function lintMessage(message, warnings, proto3) {
|
|
296109
296300
|
const fullName = stripLeadingDot(message.fullName);
|
|
296110
296301
|
const { ranges: reservedRanges } = lintReserved(message.reserved, `message ${fullName}`, { lo: 1, hi: FIELD_NUMBER_MAX, label: "field-number" }, warnings);
|
|
296111
|
-
lintOptionSet(
|
|
296302
|
+
lintOptionSet(asRecord14(message.options), "message", fullName, warnings);
|
|
296112
296303
|
const jsonNames = /* @__PURE__ */ new Map();
|
|
296113
296304
|
for (const field of asArray7(message.fieldsArray)) {
|
|
296114
296305
|
const id = field.id;
|
|
@@ -296129,7 +296320,7 @@ function lintMessage(message, warnings, proto3) {
|
|
|
296129
296320
|
}
|
|
296130
296321
|
jsonNames.set(jsonName, String(field.name));
|
|
296131
296322
|
}
|
|
296132
|
-
if (
|
|
296323
|
+
if (asRecord14(message.options)?.deprecated === true) {
|
|
296133
296324
|
warnings.push(`GRPC_DEPRECATED: message ${fullName} is marked deprecated`);
|
|
296134
296325
|
}
|
|
296135
296326
|
const nestedNames = new Set(asArray7(message.nestedArray).map((child4) => child4.name));
|
|
@@ -296158,13 +296349,13 @@ function lintMessage(message, warnings, proto3) {
|
|
|
296158
296349
|
for (const child4 of asArray7(message.nestedArray)) {
|
|
296159
296350
|
declare(child4.name, isEnum(child4) ? "nested enum" : "nested type");
|
|
296160
296351
|
if (isEnum(child4)) {
|
|
296161
|
-
for (const valueName of Object.keys(
|
|
296352
|
+
for (const valueName of Object.keys(asRecord14(child4.values) ?? {})) declare(valueName, `enum value of ${child4.name}`);
|
|
296162
296353
|
}
|
|
296163
296354
|
}
|
|
296164
296355
|
}
|
|
296165
296356
|
function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
296166
296357
|
const fullName = stripLeadingDot(enumObj.fullName);
|
|
296167
|
-
const entries = Object.entries(
|
|
296358
|
+
const entries = Object.entries(asRecord14(enumObj.values) ?? {});
|
|
296168
296359
|
const { ranges: reservedRanges, names: reservedNames } = lintReserved(
|
|
296169
296360
|
enumObj.reserved,
|
|
296170
296361
|
`enum ${fullName}`,
|
|
@@ -296192,7 +296383,7 @@ function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
|
296192
296383
|
warnings.push(`GRPC_ENUM_ZERO_NAME_CONVENTION: enum ${fullName} zero value ${zero[0]} is conventionally named *_UNSPECIFIED (buf/AIP enum conventions)`);
|
|
296193
296384
|
}
|
|
296194
296385
|
}
|
|
296195
|
-
if (
|
|
296386
|
+
if (asRecord14(enumObj.options)?.deprecated === true) {
|
|
296196
296387
|
warnings.push(`GRPC_DEPRECATED: enum ${fullName} is marked deprecated`);
|
|
296197
296388
|
}
|
|
296198
296389
|
}
|
|
@@ -296277,7 +296468,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
296277
296468
|
for (const verb of HTTP_RULE_VERBS) {
|
|
296278
296469
|
if (typeof rule[verb] === "string") patterns.push({ verb, path: rule[verb] });
|
|
296279
296470
|
}
|
|
296280
|
-
const custom =
|
|
296471
|
+
const custom = asRecord14(rule.custom);
|
|
296281
296472
|
if (custom && typeof custom.path === "string") patterns.push({ verb: String(custom.kind ?? "custom"), path: custom.path });
|
|
296282
296473
|
if (patterns.length === 0) {
|
|
296283
296474
|
warnings.push(`GRPC_HTTP_RULE_PATTERN_MISSING: ${operationId} google.api.http ${nested ? "additional binding" : "rule"} declares no URL pattern (get/put/post/delete/patch/custom); transcoding requires exactly one (google.api.http pattern oneof)`);
|
|
@@ -296339,7 +296530,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
296339
296530
|
return;
|
|
296340
296531
|
}
|
|
296341
296532
|
for (const binding of bindingList) {
|
|
296342
|
-
const record =
|
|
296533
|
+
const record = asRecord14(binding);
|
|
296343
296534
|
if (record) lintHttpRule(record, requestFields, responseFieldNames, warnings, operationId, true);
|
|
296344
296535
|
}
|
|
296345
296536
|
}
|
|
@@ -296367,10 +296558,10 @@ function lintMethodOptions(method, operationId, warnings) {
|
|
|
296367
296558
|
const requestFields = httpFieldInfo(method.resolvedRequestType);
|
|
296368
296559
|
const responseFieldNames = method.resolvedResponseType ? new Set(asArray7(method.resolvedResponseType.fieldsArray).map((field) => String(field.name))) : null;
|
|
296369
296560
|
for (const entry of asArray7(method.parsedOptions)) {
|
|
296370
|
-
const http2 =
|
|
296561
|
+
const http2 = asRecord14(asRecord14(entry)?.["(google.api.http)"]);
|
|
296371
296562
|
if (http2) lintHttpRule(http2, requestFields, responseFieldNames, warnings, operationId, false);
|
|
296372
296563
|
}
|
|
296373
|
-
if (
|
|
296564
|
+
if (asRecord14(method.options)?.deprecated === true) {
|
|
296374
296565
|
warnings.push(`GRPC_DEPRECATED: rpc ${operationId} is marked deprecated`);
|
|
296375
296566
|
}
|
|
296376
296567
|
}
|
|
@@ -296475,7 +296666,7 @@ function parseProtoSchema(content, deps) {
|
|
|
296475
296666
|
}
|
|
296476
296667
|
const enumIndex = {};
|
|
296477
296668
|
for (const enumObj of enums) {
|
|
296478
|
-
const values = Object.keys(
|
|
296669
|
+
const values = Object.keys(asRecord14(enumObj.values) ?? {}).sort();
|
|
296479
296670
|
enumIndex[stripLeadingDot(enumObj.fullName)] = values;
|
|
296480
296671
|
lintEnum(enumObj, warnings, proto3, conventions);
|
|
296481
296672
|
}
|
|
@@ -296604,7 +296795,7 @@ var GRPC_INSTRUMENT_LIMITS = {
|
|
|
296604
296795
|
maxTestScriptBytes: 9e5,
|
|
296605
296796
|
maxCollectionUpdateBytes: 4e6
|
|
296606
296797
|
};
|
|
296607
|
-
function
|
|
296798
|
+
function asRecord15(value) {
|
|
296608
296799
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
296609
296800
|
return value;
|
|
296610
296801
|
}
|
|
@@ -297201,7 +297392,7 @@ function createMappingFailureScript2(message) {
|
|
|
297201
297392
|
];
|
|
297202
297393
|
}
|
|
297203
297394
|
function methodPathOf(item) {
|
|
297204
|
-
const payload =
|
|
297395
|
+
const payload = asRecord15(item.payload);
|
|
297205
297396
|
const value = payload?.methodPath;
|
|
297206
297397
|
return typeof value === "string" ? value : "";
|
|
297207
297398
|
}
|
|
@@ -297416,7 +297607,7 @@ function matchesFormatValue(format3, value) {
|
|
|
297416
297607
|
}
|
|
297417
297608
|
function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
297418
297609
|
if (!shape) return;
|
|
297419
|
-
const message =
|
|
297610
|
+
const message = asRecord15(asRecord15(item.payload)?.message);
|
|
297420
297611
|
const raw = typeof message?.content === "string" ? message.content : "";
|
|
297421
297612
|
if (!raw.trim()) return;
|
|
297422
297613
|
if (/\{\{[^}]+\}\}|<[a-zA-Z]/.test(raw)) return;
|
|
@@ -297427,7 +297618,7 @@ function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
|
297427
297618
|
warnings.push(`PROTO_REQUEST_BODY_INVALID_JSON: ${methodPath2} generated request message content is not valid JSON and is not validated`);
|
|
297428
297619
|
return;
|
|
297429
297620
|
}
|
|
297430
|
-
const record =
|
|
297621
|
+
const record = asRecord15(body2);
|
|
297431
297622
|
if (!record) return;
|
|
297432
297623
|
for (const field of shape.fields) {
|
|
297433
297624
|
const key = Object.prototype.hasOwnProperty.call(record, field.jsonName) ? field.jsonName : Object.prototype.hasOwnProperty.call(record, field.name) ? field.name : void 0;
|
|
@@ -297487,16 +297678,16 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
297487
297678
|
if (scriptBytes > GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes) {
|
|
297488
297679
|
throw new Error(`PROTO_SCRIPT_SIZE_EXCEEDED: generated test script for ${methodPath2} exceeded ${GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`);
|
|
297489
297680
|
}
|
|
297490
|
-
const events2 = asArray8(item.event).filter((entry) =>
|
|
297681
|
+
const events2 = asArray8(item.event).filter((entry) => asRecord15(entry)?.listen !== "test");
|
|
297491
297682
|
item.event = [...events2, { listen: "test", script: { type: "text/javascript", exec: script } }];
|
|
297492
297683
|
}
|
|
297493
297684
|
for (const child4 of asArray8(item.item)) {
|
|
297494
|
-
const childRecord =
|
|
297685
|
+
const childRecord = asRecord15(child4);
|
|
297495
297686
|
if (childRecord) inject(childRecord);
|
|
297496
297687
|
}
|
|
297497
297688
|
};
|
|
297498
297689
|
for (const entry of asArray8(collection.item)) {
|
|
297499
|
-
const item =
|
|
297690
|
+
const item = asRecord15(entry);
|
|
297500
297691
|
if (item) inject(item);
|
|
297501
297692
|
}
|
|
297502
297693
|
const missing = index.operations.filter((operation) => !covered.has(operation.methodPath));
|
|
@@ -297511,7 +297702,7 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
297511
297702
|
}
|
|
297512
297703
|
|
|
297513
297704
|
// src/lib/protocols/grpc/service-config.ts
|
|
297514
|
-
function
|
|
297705
|
+
function asRecord16(value) {
|
|
297515
297706
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
297516
297707
|
return value;
|
|
297517
297708
|
}
|
|
@@ -297670,7 +297861,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
297670
297861
|
return;
|
|
297671
297862
|
}
|
|
297672
297863
|
for (const entry of entries) {
|
|
297673
|
-
const record =
|
|
297864
|
+
const record = asRecord16(entry);
|
|
297674
297865
|
const keys = record ? Object.keys(record) : [];
|
|
297675
297866
|
if (!record || keys.length !== 1) {
|
|
297676
297867
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: each ${label} entry must be an object with exactly one policy key (service_config.proto)`);
|
|
@@ -297681,7 +297872,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
297681
297872
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_POLICY_UNKNOWN: ${label} policy "${policy}" is not a registered gRPC LB policy; clients skip unknown policies (service_config.proto)`);
|
|
297682
297873
|
continue;
|
|
297683
297874
|
}
|
|
297684
|
-
const config =
|
|
297875
|
+
const config = asRecord16(record[policy]);
|
|
297685
297876
|
if (!config) {
|
|
297686
297877
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: ${label} policy "${policy}" config must be a JSON object (service_config.proto)`);
|
|
297687
297878
|
continue;
|
|
@@ -297806,7 +297997,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297806
297997
|
const declaredServices = new Set(index.operations.map((operation) => operation.serviceFullName));
|
|
297807
297998
|
const seenApis = /* @__PURE__ */ new Set();
|
|
297808
297999
|
asArray9(config.apis).forEach((entry, i) => {
|
|
297809
|
-
const record =
|
|
298000
|
+
const record = asRecord16(entry);
|
|
297810
298001
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
297811
298002
|
if (!name) {
|
|
297812
298003
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: apis[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -297823,7 +298014,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297823
298014
|
const lintTypeList = (listKey, resolves, kind) => {
|
|
297824
298015
|
const seen = /* @__PURE__ */ new Set();
|
|
297825
298016
|
asArray9(config[listKey]).forEach((entry, i) => {
|
|
297826
|
-
const record =
|
|
298017
|
+
const record = asRecord16(entry);
|
|
297827
298018
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
297828
298019
|
if (!name) {
|
|
297829
298020
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: ${listKey}[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -297851,7 +298042,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
297851
298042
|
};
|
|
297852
298043
|
lintTypeList("types", (name) => index.messages[name] !== void 0, "message");
|
|
297853
298044
|
lintTypeList("enums", (name) => index.enums[name] !== void 0, "enum");
|
|
297854
|
-
const declaredDetails = asArray9(config.types).map((entry) =>
|
|
298045
|
+
const declaredDetails = asArray9(config.types).map((entry) => asRecord16(entry)?.name).filter((name) => typeof name === "string" && GOOGLE_RPC_ERROR_DETAIL_TYPES.has(name));
|
|
297855
298046
|
if (declaredDetails.length > 0 && !declaredDetails.includes("google.rpc.ErrorInfo")) {
|
|
297856
298047
|
warnings.push("GRPC_GOOGLE_API_CONFIG_ERRORINFO_MISSING: types[] declares google.rpc error-detail payloads but omits google.rpc.ErrorInfo; AIP-193 requires ErrorInfo in service errors");
|
|
297857
298048
|
}
|
|
@@ -297879,7 +298070,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297879
298070
|
warnings.push("GRPC_SERVICE_CONFIG_LB_RUNTIME_UNSUPPORTED: the generated Postman grpc-request items expose no load-balancing settings, so LB policy selection is not applied when the collection runs in Postman");
|
|
297880
298071
|
}
|
|
297881
298072
|
if (config.healthCheckConfig !== void 0) {
|
|
297882
|
-
const health =
|
|
298073
|
+
const health = asRecord16(config.healthCheckConfig);
|
|
297883
298074
|
if (!health) {
|
|
297884
298075
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: healthCheckConfig must be an object (service_config.proto)");
|
|
297885
298076
|
} else {
|
|
@@ -297893,7 +298084,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297893
298084
|
}
|
|
297894
298085
|
}
|
|
297895
298086
|
}
|
|
297896
|
-
const throttling =
|
|
298087
|
+
const throttling = asRecord16(config.retryThrottling);
|
|
297897
298088
|
if (config.retryThrottling !== void 0) {
|
|
297898
298089
|
const maxTokens = throttling?.maxTokens;
|
|
297899
298090
|
const tokenRatio = throttling?.tokenRatio;
|
|
@@ -297930,7 +298121,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297930
298121
|
const where = `methodConfig[${i}]`;
|
|
297931
298122
|
const meta = { targets: /* @__PURE__ */ new Set(), unresolved: false, retry: false, hedge: false, selectorCount: 0 };
|
|
297932
298123
|
entryMeta.push(meta);
|
|
297933
|
-
const methodConfig =
|
|
298124
|
+
const methodConfig = asRecord16(entry);
|
|
297934
298125
|
if (!methodConfig) {
|
|
297935
298126
|
warnings.push(`GRPC_SERVICE_CONFIG_INVALID: ${where} must be an object (service_config.proto)`);
|
|
297936
298127
|
return;
|
|
@@ -297948,7 +298139,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297948
298139
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name must be a non-empty list of {service, method} selectors (service_config.proto)`);
|
|
297949
298140
|
} else {
|
|
297950
298141
|
names.forEach((nameEntry, j) => {
|
|
297951
|
-
const selector =
|
|
298142
|
+
const selector = asRecord16(nameEntry);
|
|
297952
298143
|
if (!selector) {
|
|
297953
298144
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name[${j}] must be an object (service_config.proto)`);
|
|
297954
298145
|
return;
|
|
@@ -297991,8 +298182,8 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
297991
298182
|
warnings.push(`GRPC_SERVICE_CONFIG_INVALID: ${where}.${key} must be a non-negative integer within uint32 range [0, ${UINT32_MAX}] (service_config.proto google.protobuf.UInt32Value); got ${JSON.stringify(methodConfig[key])}`);
|
|
297992
298183
|
}
|
|
297993
298184
|
}
|
|
297994
|
-
const retryPolicy =
|
|
297995
|
-
const hedgingPolicy =
|
|
298185
|
+
const retryPolicy = asRecord16(methodConfig.retryPolicy);
|
|
298186
|
+
const hedgingPolicy = asRecord16(methodConfig.hedgingPolicy);
|
|
297996
298187
|
meta.retry = methodConfig.retryPolicy !== void 0;
|
|
297997
298188
|
meta.hedge = methodConfig.hedgingPolicy !== void 0;
|
|
297998
298189
|
if (methodConfig.retryPolicy !== void 0 && methodConfig.hedgingPolicy !== void 0) {
|
|
@@ -298060,7 +298251,7 @@ ${warnings.join("\n")}`);
|
|
|
298060
298251
|
if (Array.isArray(parsed)) {
|
|
298061
298252
|
parsed.forEach((entry, i) => {
|
|
298062
298253
|
const where = `grpc_config[${i}]`;
|
|
298063
|
-
const choice =
|
|
298254
|
+
const choice = asRecord16(entry);
|
|
298064
298255
|
if (!choice) {
|
|
298065
298256
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where} must be an object (gRFC A2 choice list)`);
|
|
298066
298257
|
return;
|
|
@@ -298079,7 +298270,7 @@ ${warnings.join("\n")}`);
|
|
|
298079
298270
|
if (choice.percentage !== void 0 && !(typeof choice.percentage === "number" && choice.percentage >= 0 && choice.percentage <= 100)) {
|
|
298080
298271
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.percentage must be a number in [0, 100] (gRFC A2)`);
|
|
298081
298272
|
}
|
|
298082
|
-
const embedded =
|
|
298273
|
+
const embedded = asRecord16(choice.serviceConfig);
|
|
298083
298274
|
if (!embedded) {
|
|
298084
298275
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.serviceConfig must be a JSON object (gRFC A2)`);
|
|
298085
298276
|
return;
|
|
@@ -298088,7 +298279,7 @@ ${warnings.join("\n")}`);
|
|
|
298088
298279
|
});
|
|
298089
298280
|
return finish();
|
|
298090
298281
|
}
|
|
298091
|
-
const config =
|
|
298282
|
+
const config = asRecord16(parsed);
|
|
298092
298283
|
if (!config) {
|
|
298093
298284
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: service config must be a JSON object (service_config.proto)");
|
|
298094
298285
|
return finish();
|
|
@@ -304346,7 +304537,7 @@ function lintWsdl20Services(services, interfaces, bindings, warnings) {
|
|
|
304346
304537
|
|
|
304347
304538
|
// src/lib/protocols/soap/xsd-index.ts
|
|
304348
304539
|
var XSD_NS = "http://www.w3.org/2001/XMLSchema";
|
|
304349
|
-
function
|
|
304540
|
+
function asRecord17(value) {
|
|
304350
304541
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
304351
304542
|
return value;
|
|
304352
304543
|
}
|
|
@@ -304382,7 +304573,7 @@ function children2(record, local2) {
|
|
|
304382
304573
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
304383
304574
|
if (localName(key) !== local2) continue;
|
|
304384
304575
|
for (const entry of asArray10(record[key])) {
|
|
304385
|
-
const rec =
|
|
304576
|
+
const rec = asRecord17(entry);
|
|
304386
304577
|
if (rec) out.push(rec);
|
|
304387
304578
|
}
|
|
304388
304579
|
}
|
|
@@ -304418,7 +304609,7 @@ function parseOccursMax(raw) {
|
|
|
304418
304609
|
return Number.isNaN(value) ? 1 : value;
|
|
304419
304610
|
}
|
|
304420
304611
|
function simpleTypeFacets(simpleType, scopes) {
|
|
304421
|
-
const restriction =
|
|
304612
|
+
const restriction = asRecord17(child2(simpleType, "restriction"));
|
|
304422
304613
|
if (!restriction) return {};
|
|
304423
304614
|
const baseQName = attr2(restriction, "base");
|
|
304424
304615
|
const baseNs = baseQName ? namespaceForPrefix([...scopes, restriction], prefixOf(baseQName)) : "";
|
|
@@ -304445,7 +304636,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
304445
304636
|
if (!complexType) return void 0;
|
|
304446
304637
|
if (child2(complexType, "complexContent") !== void 0 || child2(complexType, "simpleContent") !== void 0) return void 0;
|
|
304447
304638
|
if (child2(complexType, "choice") !== void 0 || child2(complexType, "all") !== void 0 || child2(complexType, "group") !== void 0) return void 0;
|
|
304448
|
-
const sequence =
|
|
304639
|
+
const sequence = asRecord17(child2(complexType, "sequence"));
|
|
304449
304640
|
if (!sequence) return [];
|
|
304450
304641
|
if (child2(sequence, "choice") !== void 0 || child2(sequence, "sequence") !== void 0 || child2(sequence, "any") !== void 0 || child2(sequence, "group") !== void 0) return void 0;
|
|
304451
304642
|
const out = [];
|
|
@@ -304464,7 +304655,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
304464
304655
|
enumeration = sameSchema.enums;
|
|
304465
304656
|
}
|
|
304466
304657
|
}
|
|
304467
|
-
const inlineSimple =
|
|
304658
|
+
const inlineSimple = asRecord17(child2(el, "simpleType"));
|
|
304468
304659
|
if (inlineSimple) {
|
|
304469
304660
|
const facets = simpleTypeFacets(inlineSimple, [...scopes, el]);
|
|
304470
304661
|
builtinType = facets.base ?? builtinType;
|
|
@@ -304509,7 +304700,7 @@ function buildXsdIndex(docNode) {
|
|
|
304509
304700
|
for (const el of children2(schema, "element")) {
|
|
304510
304701
|
const name = attr2(el, "name");
|
|
304511
304702
|
if (!name) continue;
|
|
304512
|
-
const inline =
|
|
304703
|
+
const inline = asRecord17(child2(el, "complexType"));
|
|
304513
304704
|
const typeQName = attr2(el, "type");
|
|
304514
304705
|
const named = typeQName && namespaceForPrefix([...scopes, el], prefixOf(typeQName)) !== XSD_NS ? complexTypes.get(localName(typeQName)) ?? null : null;
|
|
304515
304706
|
index.elements.set(tns + "|" + name, {
|
|
@@ -304536,7 +304727,7 @@ function lookupXsdElement(index, namespace, name) {
|
|
|
304536
304727
|
}
|
|
304537
304728
|
|
|
304538
304729
|
// src/lib/protocols/soap/parser.ts
|
|
304539
|
-
function
|
|
304730
|
+
function asRecord18(value) {
|
|
304540
304731
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
304541
304732
|
return value;
|
|
304542
304733
|
}
|
|
@@ -304583,7 +304774,7 @@ function children3(record, local2) {
|
|
|
304583
304774
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
304584
304775
|
if (localName2(key) !== local2) continue;
|
|
304585
304776
|
for (const entry of asArray11(record[key])) {
|
|
304586
|
-
const rec =
|
|
304777
|
+
const rec = asRecord18(entry);
|
|
304587
304778
|
if (rec) out.push(rec);
|
|
304588
304779
|
}
|
|
304589
304780
|
}
|
|
@@ -304687,7 +304878,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304687
304878
|
else if (ns === SOAP11_BINDING_NS) soapVersion = "1.1";
|
|
304688
304879
|
else continue;
|
|
304689
304880
|
for (const marker of asArray11(binding[key])) {
|
|
304690
|
-
const style = attr3(
|
|
304881
|
+
const style = attr3(asRecord18(marker), "style");
|
|
304691
304882
|
if (style) bindingStyle = style;
|
|
304692
304883
|
}
|
|
304693
304884
|
}
|
|
@@ -304700,7 +304891,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304700
304891
|
for (const key of Object.keys(operation)) {
|
|
304701
304892
|
if (localName2(key) !== "operation") continue;
|
|
304702
304893
|
for (const marker of asArray11(operation[key])) {
|
|
304703
|
-
const rec =
|
|
304894
|
+
const rec = asRecord18(marker);
|
|
304704
304895
|
const action = attr3(rec, "soapAction");
|
|
304705
304896
|
if (action) soapAction = action;
|
|
304706
304897
|
const style2 = attr3(rec, "style");
|
|
@@ -304713,8 +304904,8 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
304713
304904
|
warnings.push(`SOAP_BINDING_STYLE_UNPARSEABLE: binding ${bindingName} operation ${opName} declares style "${styleRaw}" (expected document|rpc); style-specific assertions are skipped`);
|
|
304714
304905
|
style = void 0;
|
|
304715
304906
|
}
|
|
304716
|
-
const inputDirection =
|
|
304717
|
-
const outputDirection =
|
|
304907
|
+
const inputDirection = asRecord18(child3(operation, "input"));
|
|
304908
|
+
const outputDirection = asRecord18(child3(operation, "output"));
|
|
304718
304909
|
const inputBody = bodyMarker(inputDirection);
|
|
304719
304910
|
const outputBody = bodyMarker(outputDirection);
|
|
304720
304911
|
const useRaw = attr3(outputBody, "use") || attr3(inputBody, "use");
|
|
@@ -304794,8 +304985,8 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
304794
304985
|
return children3(portType, "operation").map((operation) => {
|
|
304795
304986
|
const name = attr3(operation, "name");
|
|
304796
304987
|
const opWarnings = [];
|
|
304797
|
-
const inputRecord =
|
|
304798
|
-
const outputRecord =
|
|
304988
|
+
const inputRecord = asRecord18(child3(operation, "input"));
|
|
304989
|
+
const outputRecord = asRecord18(child3(operation, "output"));
|
|
304799
304990
|
const inputRef = localName2(attr3(inputRecord, "message"));
|
|
304800
304991
|
const outputRef = localName2(attr3(outputRecord, "message"));
|
|
304801
304992
|
const input = inputRef ? messages.get(inputRef) : void 0;
|
|
@@ -304849,7 +305040,7 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
304849
305040
|
const seenPortTypes = /* @__PURE__ */ new Set();
|
|
304850
305041
|
for (const port of ports) {
|
|
304851
305042
|
const bindingName = localName2(attr3(port, "binding"));
|
|
304852
|
-
const address =
|
|
305043
|
+
const address = asRecord18(child3(port, "address"));
|
|
304853
305044
|
const location2 = attr3(address, "location");
|
|
304854
305045
|
if (location2 && !endpoint) endpoint = location2;
|
|
304855
305046
|
const portTypeName = bindingToPortType.get(bindingName);
|
|
@@ -304938,8 +305129,8 @@ function parseServices20(description, warnings) {
|
|
|
304938
305129
|
const buildOperations = (iface, binding) => children3(iface, "operation").map((operation) => {
|
|
304939
305130
|
const name = attr3(operation, "name");
|
|
304940
305131
|
const opWarnings = [];
|
|
304941
|
-
const inputRecord =
|
|
304942
|
-
const outputRecord =
|
|
305132
|
+
const inputRecord = asRecord18(child3(operation, "input"));
|
|
305133
|
+
const outputRecord = asRecord18(child3(operation, "output"));
|
|
304943
305134
|
const inputElement = attr3(inputRecord, "element");
|
|
304944
305135
|
const outputElement = attr3(outputRecord, "element");
|
|
304945
305136
|
const outLocal = outputElement.startsWith("#") ? "" : localName2(outputElement);
|
|
@@ -304987,9 +305178,9 @@ function parseServices20(description, warnings) {
|
|
|
304987
305178
|
for (const ep of children3(service, "endpoint")) {
|
|
304988
305179
|
let address = attr3(ep, "address");
|
|
304989
305180
|
if (!address) {
|
|
304990
|
-
const epr =
|
|
305181
|
+
const epr = asRecord18(child3(ep, "EndpointReference"));
|
|
304991
305182
|
const addressNode = child3(epr, "Address");
|
|
304992
|
-
const addressRecord =
|
|
305183
|
+
const addressRecord = asRecord18(addressNode);
|
|
304993
305184
|
address = addressRecord ? asString2(addressRecord["#text"]) : asString2(addressNode);
|
|
304994
305185
|
if (address) warnings.push(`SOAP_WSDL20_ENDPOINT_EPR: endpoint ${attr3(ep, "name")} address taken from its child wsa:EndpointReference/Address; reference parameters are not propagated`);
|
|
304995
305186
|
}
|
|
@@ -305010,7 +305201,7 @@ function parseServices20(description, warnings) {
|
|
|
305010
305201
|
return services;
|
|
305011
305202
|
}
|
|
305012
305203
|
function detectAddressing(node) {
|
|
305013
|
-
const record =
|
|
305204
|
+
const record = asRecord18(node);
|
|
305014
305205
|
if (!record) return false;
|
|
305015
305206
|
for (const key of Object.keys(record)) {
|
|
305016
305207
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
@@ -305077,7 +305268,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305077
305268
|
const ns = namespaceForPrefix2([definitions, binding], prefixOf2(key));
|
|
305078
305269
|
if (ns !== SOAP11_BINDING_NS && ns !== SOAP12_BINDING_NS) continue;
|
|
305079
305270
|
for (const entry of asArray11(binding[key])) {
|
|
305080
|
-
const marker =
|
|
305271
|
+
const marker = asRecord18(entry);
|
|
305081
305272
|
if (!marker) continue;
|
|
305082
305273
|
const style = attr3(marker, "style");
|
|
305083
305274
|
if (style) bindingStyle = style;
|
|
@@ -305105,14 +305296,14 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305105
305296
|
for (const key of Object.keys(operation)) {
|
|
305106
305297
|
if (localName2(key) !== "operation") continue;
|
|
305107
305298
|
for (const entry of asArray11(operation[key])) {
|
|
305108
|
-
const style = attr3(
|
|
305299
|
+
const style = attr3(asRecord18(entry), "style");
|
|
305109
305300
|
if (style) styleRaw = style;
|
|
305110
305301
|
}
|
|
305111
305302
|
}
|
|
305112
305303
|
const effStyle = styleRaw === "rpc" ? "rpc" : "document";
|
|
305113
305304
|
styles.add(effStyle);
|
|
305114
|
-
const inputDirection =
|
|
305115
|
-
const outputDirection =
|
|
305305
|
+
const inputDirection = asRecord18(child3(operation, "input"));
|
|
305306
|
+
const outputDirection = asRecord18(child3(operation, "output"));
|
|
305116
305307
|
const inputBody = bodyMarker(inputDirection);
|
|
305117
305308
|
const outputBody = bodyMarker(outputDirection);
|
|
305118
305309
|
for (const [direction, body2] of [["input", inputBody], ["output", outputBody]]) {
|
|
@@ -305137,8 +305328,8 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305137
305328
|
}
|
|
305138
305329
|
}
|
|
305139
305330
|
const portTypeOp = portTypeOps.get(opName);
|
|
305140
|
-
const inputMessage = portTypeOp ? messages.get(localName2(attr3(
|
|
305141
|
-
const outputMessage = portTypeOp ? messages.get(localName2(attr3(
|
|
305331
|
+
const inputMessage = portTypeOp ? messages.get(localName2(attr3(asRecord18(child3(portTypeOp, "input")), "message"))) : void 0;
|
|
305332
|
+
const outputMessage = portTypeOp ? messages.get(localName2(attr3(asRecord18(child3(portTypeOp, "output")), "message"))) : void 0;
|
|
305142
305333
|
if (portTypeOp) {
|
|
305143
305334
|
const bindingHasOutput = child3(operation, "output") !== void 0;
|
|
305144
305335
|
const portTypeHasOutput = child3(portTypeOp, "output") !== void 0;
|
|
@@ -305198,7 +305389,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
305198
305389
|
for (const service of children3(definitions, "service")) {
|
|
305199
305390
|
for (const port of children3(service, "port")) {
|
|
305200
305391
|
const portName = attr3(port, "name");
|
|
305201
|
-
const location2 = attr3(
|
|
305392
|
+
const location2 = attr3(asRecord18(child3(port, "address")), "location");
|
|
305202
305393
|
if (!location2) continue;
|
|
305203
305394
|
if (!/^https?:\/\//i.test(location2)) warnings.push(`SOAP_LINT_ADDRESS_NOT_HTTP: port ${portName} soap:address location "${location2}" is not an http(s) URL`);
|
|
305204
305395
|
const prior = addressLocations.get(location2);
|
|
@@ -305217,13 +305408,13 @@ function parseWsdl(content, opts) {
|
|
|
305217
305408
|
const parser = createParser();
|
|
305218
305409
|
let root;
|
|
305219
305410
|
try {
|
|
305220
|
-
root =
|
|
305411
|
+
root = asRecord18(parser.parse(text));
|
|
305221
305412
|
} catch (error2) {
|
|
305222
305413
|
throw new Error(`SOAP_WSDL_PARSE_ERROR: ${error2.message}`, { cause: error2 });
|
|
305223
305414
|
}
|
|
305224
305415
|
if (!root) throw new Error("SOAP_WSDL_PARSE_ERROR: document did not parse to an element");
|
|
305225
|
-
const definitions =
|
|
305226
|
-
const description =
|
|
305416
|
+
const definitions = asRecord18(child3(root, "definitions"));
|
|
305417
|
+
const description = asRecord18(child3(root, "description"));
|
|
305227
305418
|
if (!definitions && !description) {
|
|
305228
305419
|
throw new Error("SOAP_WSDL_ROOT_INVALID: expected a WSDL <definitions> (1.1) or <description> (2.0) root element");
|
|
305229
305420
|
}
|
|
@@ -305683,7 +305874,7 @@ function xsdPayloadLines(operation, index) {
|
|
|
305683
305874
|
}
|
|
305684
305875
|
|
|
305685
305876
|
// src/lib/protocols/soap/instrumenter.ts
|
|
305686
|
-
function
|
|
305877
|
+
function asRecord19(value) {
|
|
305687
305878
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
305688
305879
|
return value;
|
|
305689
305880
|
}
|
|
@@ -306365,12 +306556,12 @@ function forEachHttpRequest(node, visit4) {
|
|
|
306365
306556
|
const children4 = asArray12(node.item);
|
|
306366
306557
|
if (children4.length > 0) {
|
|
306367
306558
|
for (const child4 of children4) {
|
|
306368
|
-
const record =
|
|
306559
|
+
const record = asRecord19(child4);
|
|
306369
306560
|
if (record) forEachHttpRequest(record, visit4);
|
|
306370
306561
|
}
|
|
306371
306562
|
return;
|
|
306372
306563
|
}
|
|
306373
|
-
if (
|
|
306564
|
+
if (asRecord19(node.request)) visit4(node);
|
|
306374
306565
|
}
|
|
306375
306566
|
function instrumentSoapCollection(collection, index) {
|
|
306376
306567
|
const warnings = [...index.warnings];
|
|
@@ -306395,7 +306586,7 @@ function instrumentSoapCollection(collection, index) {
|
|
|
306395
306586
|
' pm.expect(code, "unsupported media types map to HTTP 415 (SOAP 1.2 Part 2 section 7)").to.eql(415);',
|
|
306396
306587
|
"});"
|
|
306397
306588
|
];
|
|
306398
|
-
const existingEvents = asArray12(item.event).map((entry) =>
|
|
306589
|
+
const existingEvents = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306399
306590
|
item.event = [...existingEvents, { listen: "test", script: { type: "text/javascript", exec: probeExec } }];
|
|
306400
306591
|
return;
|
|
306401
306592
|
}
|
|
@@ -306409,13 +306600,13 @@ function instrumentSoapCollection(collection, index) {
|
|
|
306409
306600
|
" pm.expect.fail(contractMappingError);",
|
|
306410
306601
|
"});"
|
|
306411
306602
|
];
|
|
306412
|
-
const existing2 = asArray12(item.event).map((entry) =>
|
|
306603
|
+
const existing2 = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306413
306604
|
item.event = [...existing2, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
306414
306605
|
return;
|
|
306415
306606
|
}
|
|
306416
306607
|
covered.add(operation.name);
|
|
306417
306608
|
const exec2 = createSoapScript(operation, warnings, { declaresAddressing: index.declaresAddressing, targetNamespace: index.targetNamespace, schemaIndex: index.schemaIndex }).split("\n");
|
|
306418
|
-
const existing = asArray12(item.event).map((entry) =>
|
|
306609
|
+
const existing = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
306419
306610
|
item.event = [
|
|
306420
306611
|
...existing,
|
|
306421
306612
|
{ listen: "test", script: { type: "text/javascript", exec: exec2 } }
|
|
@@ -306434,7 +306625,7 @@ var SOCKETIO_PROTOCOLS = /* @__PURE__ */ new Set(["socketio", "socket.io", "sio"
|
|
|
306434
306625
|
var MQTT_PROTOCOLS = /* @__PURE__ */ new Set(["mqtt", "mqtts", "secure-mqtt", "mqtt5"]);
|
|
306435
306626
|
var DEFAULT_SOCKETIO_PATH = "/socket.io";
|
|
306436
306627
|
var SAMPLE_MAX_DEPTH = 5;
|
|
306437
|
-
function
|
|
306628
|
+
function asRecord20(value) {
|
|
306438
306629
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
306439
306630
|
return value;
|
|
306440
306631
|
}
|
|
@@ -306457,7 +306648,7 @@ function contentKindFor(contentType2) {
|
|
|
306457
306648
|
return "binary";
|
|
306458
306649
|
}
|
|
306459
306650
|
function sampleFromSchema(schema, depth) {
|
|
306460
|
-
const record =
|
|
306651
|
+
const record = asRecord20(schema);
|
|
306461
306652
|
if (!record) return record === null ? null : {};
|
|
306462
306653
|
if (record.example !== void 0) return record.example;
|
|
306463
306654
|
if (record.default !== void 0) return record.default;
|
|
@@ -306473,7 +306664,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
306473
306664
|
switch (type) {
|
|
306474
306665
|
case "object":
|
|
306475
306666
|
case void 0: {
|
|
306476
|
-
const properties =
|
|
306667
|
+
const properties = asRecord20(record.properties);
|
|
306477
306668
|
if (!properties) return {};
|
|
306478
306669
|
const required = new Set(asArray13(record.required));
|
|
306479
306670
|
const out = {};
|
|
@@ -306502,7 +306693,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
306502
306693
|
}
|
|
306503
306694
|
}
|
|
306504
306695
|
function bindingKeyValues(bindingSchema) {
|
|
306505
|
-
const properties =
|
|
306696
|
+
const properties = asRecord20(asRecord20(bindingSchema)?.properties);
|
|
306506
306697
|
if (!properties) return [];
|
|
306507
306698
|
return Object.keys(properties).sort().map((key) => ({ key, value: "" }));
|
|
306508
306699
|
}
|
|
@@ -306516,8 +306707,8 @@ function detectTransport(channel, servers, messagesRaw, documentJson, warnings)
|
|
|
306516
306707
|
const protocolSocketio = servers.some((server) => SOCKETIO_PROTOCOLS.has(server.protocol().toLowerCase()));
|
|
306517
306708
|
if (protocolSocketio) return "socketio";
|
|
306518
306709
|
const channelJson = channel.json();
|
|
306519
|
-
const hasAck = messagesRaw.some((message) =>
|
|
306520
|
-
const hasSocketioExt = channelJson["x-socketio"] !== void 0 || documentJson["x-socketio"] !== void 0 ||
|
|
306710
|
+
const hasAck = messagesRaw.some((message) => asRecord20(message.json())?.["x-ack"] !== void 0);
|
|
306711
|
+
const hasSocketioExt = channelJson["x-socketio"] !== void 0 || documentJson["x-socketio"] !== void 0 || asRecord20(channelJson.bindings)?.socketio !== void 0;
|
|
306521
306712
|
if (hasAck || hasSocketioExt) {
|
|
306522
306713
|
warnings.push(
|
|
306523
306714
|
`ASYNCAPI_SOCKETIO_CONVENTION: channel ${channel.id()} is treated as Socket.IO from convention (x-ack / x-socketio / protocol), not a normative AsyncAPI binding; event=message name, namespace=channel address, acknowledgement=x-ack`
|
|
@@ -306532,7 +306723,7 @@ function wsBindingKeyValues(channel) {
|
|
|
306532
306723
|
return protocol === "ws" || protocol === "wss" || protocol === "websockets";
|
|
306533
306724
|
});
|
|
306534
306725
|
if (!wsBinding) return { headers: [], queryParams: [] };
|
|
306535
|
-
const value =
|
|
306726
|
+
const value = asRecord20(wsBinding.value()) ?? {};
|
|
306536
306727
|
return {
|
|
306537
306728
|
headers: bindingKeyValues(value.headers),
|
|
306538
306729
|
queryParams: bindingKeyValues(value.query),
|
|
@@ -306543,33 +306734,33 @@ function collectMqttInfo(channel, servers, messagesRaw, documentJson) {
|
|
|
306543
306734
|
const channelJson = channel.json();
|
|
306544
306735
|
const operationBindings = [];
|
|
306545
306736
|
for (const operationKey of ["publish", "subscribe"]) {
|
|
306546
|
-
const binding =
|
|
306737
|
+
const binding = asRecord20(asRecord20(asRecord20(channelJson[operationKey])?.bindings)?.mqtt);
|
|
306547
306738
|
if (binding) operationBindings.push(binding);
|
|
306548
306739
|
}
|
|
306549
306740
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
306550
|
-
const operations =
|
|
306741
|
+
const operations = asRecord20(documentJson.operations) ?? {};
|
|
306551
306742
|
for (const operation of Object.values(operations)) {
|
|
306552
|
-
const operationRecord =
|
|
306743
|
+
const operationRecord = asRecord20(operation);
|
|
306553
306744
|
if (!operationRecord) continue;
|
|
306554
|
-
const ref = String(
|
|
306745
|
+
const ref = String(asRecord20(operationRecord.channel)?.$ref ?? "");
|
|
306555
306746
|
const lastSegment = ref.includes("/") ? unescapePointer(ref.slice(ref.lastIndexOf("/") + 1)) : "";
|
|
306556
306747
|
if (lastSegment !== channel.id()) continue;
|
|
306557
|
-
const binding =
|
|
306748
|
+
const binding = asRecord20(asRecord20(operationRecord.bindings)?.mqtt);
|
|
306558
306749
|
if (binding) operationBindings.push(binding);
|
|
306559
306750
|
}
|
|
306560
306751
|
const serverBindings = [];
|
|
306561
306752
|
let protocolVersion = 4;
|
|
306562
306753
|
for (const server of servers) {
|
|
306563
|
-
const serverJson =
|
|
306754
|
+
const serverJson = asRecord20(server.json()) ?? {};
|
|
306564
306755
|
if (String(serverJson.protocolVersion ?? "") === "5" || server.protocol().toLowerCase() === "mqtt5") {
|
|
306565
306756
|
protocolVersion = 5;
|
|
306566
306757
|
}
|
|
306567
|
-
const binding =
|
|
306758
|
+
const binding = asRecord20(asRecord20(serverJson.bindings)?.mqtt);
|
|
306568
306759
|
if (binding) serverBindings.push(binding);
|
|
306569
306760
|
}
|
|
306570
306761
|
const messageBindings = [];
|
|
306571
306762
|
for (const message of messagesRaw) {
|
|
306572
|
-
const binding =
|
|
306763
|
+
const binding = asRecord20(asRecord20(asRecord20(message.json())?.bindings)?.mqtt);
|
|
306573
306764
|
if (binding) messageBindings.push({ messageId: message.id() || message.name() || "message", binding });
|
|
306574
306765
|
}
|
|
306575
306766
|
return { operationBindings, serverBindings, messageBindings, protocolVersion };
|
|
@@ -306586,7 +306777,7 @@ function buildReplySchemaByMessageId(document2) {
|
|
|
306586
306777
|
}
|
|
306587
306778
|
if (!reply) continue;
|
|
306588
306779
|
const replyMessage = reply.messages().all().find((message) => message.hasPayload());
|
|
306589
|
-
const replySchema = replyMessage ?
|
|
306780
|
+
const replySchema = replyMessage ? asRecord20(replyMessage.payload()?.json()) ?? void 0 : void 0;
|
|
306590
306781
|
if (!replySchema) continue;
|
|
306591
306782
|
for (const requestMessage of operation.messages().all()) {
|
|
306592
306783
|
const id = requestMessage.id();
|
|
@@ -306601,16 +306792,16 @@ function messageDescriptor2(message, warnings, channelId, defaultContentType, re
|
|
|
306601
306792
|
const title = message.title() || message.name() || id;
|
|
306602
306793
|
const contentType2 = message.contentType() || defaultContentType || "application/json";
|
|
306603
306794
|
const contentKind = contentKindFor(contentType2);
|
|
306604
|
-
const payloadSchema = message.hasPayload() ?
|
|
306795
|
+
const payloadSchema = message.hasPayload() ? asRecord20(message.payload()?.json()) ?? void 0 : void 0;
|
|
306605
306796
|
if (!payloadSchema) {
|
|
306606
306797
|
warnings.push(`ASYNCAPI_MESSAGE_NO_PAYLOAD: message ${id} on channel ${channelId} declares no payload schema; its content is an empty sample and is not schema-validated`);
|
|
306607
306798
|
}
|
|
306608
|
-
const rawMessage =
|
|
306609
|
-
const xAckSchema =
|
|
306799
|
+
const rawMessage = asRecord20(message.json()) ?? {};
|
|
306800
|
+
const xAckSchema = asRecord20(rawMessage["x-ack"]) ?? void 0;
|
|
306610
306801
|
const replySchema = replyByMessageId.get(message.id());
|
|
306611
306802
|
const ackSchema = xAckSchema ?? replySchema;
|
|
306612
306803
|
const ackSource = xAckSchema ? "x-ack" : replySchema ? "reply" : void 0;
|
|
306613
|
-
const correlationRaw =
|
|
306804
|
+
const correlationRaw = asRecord20(rawMessage.correlationId)?.location;
|
|
306614
306805
|
const correlationLocation = typeof correlationRaw === "string" ? correlationRaw : void 0;
|
|
306615
306806
|
const examples = message.examples().all().filter((example) => example.hasPayload());
|
|
306616
306807
|
const hasExample = examples.length > 0;
|
|
@@ -306646,7 +306837,7 @@ function channelDescriptor(channel, document2, documentJson, defaultContentType,
|
|
|
306646
306837
|
const servers = resolveServers(channel, document2);
|
|
306647
306838
|
const messagesRaw = channel.messages().all();
|
|
306648
306839
|
const transport = detectTransport(channel, servers, messagesRaw, documentJson, warnings);
|
|
306649
|
-
const parameterNames = Object.keys(
|
|
306840
|
+
const parameterNames = Object.keys(asRecord20(channel.json().parameters) ?? {}).sort();
|
|
306650
306841
|
const serverUrl = servers.find((server) => server.url())?.url() || options.endpointUrl?.trim() || "";
|
|
306651
306842
|
if (!serverUrl) {
|
|
306652
306843
|
warnings.push(`ASYNCAPI_NO_SERVER_URL: channel ${channel.id()} has no resolvable server url; the generated request url is derived from the channel address only and must be completed before use`);
|
|
@@ -307088,7 +307279,7 @@ var SCHEMES_BY_FAMILY = {
|
|
|
307088
307279
|
http: /* @__PURE__ */ new Set(["http", "https"]),
|
|
307089
307280
|
amqp: /* @__PURE__ */ new Set(["amqp", "amqps"])
|
|
307090
307281
|
};
|
|
307091
|
-
function
|
|
307282
|
+
function asRecord21(value) {
|
|
307092
307283
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
307093
307284
|
return value;
|
|
307094
307285
|
}
|
|
@@ -307107,7 +307298,7 @@ function parsesAsUrl(value) {
|
|
|
307107
307298
|
}
|
|
307108
307299
|
}
|
|
307109
307300
|
function checkExternalDocs(label, raw, warnings) {
|
|
307110
|
-
const externalDocs =
|
|
307301
|
+
const externalDocs = asRecord21(raw);
|
|
307111
307302
|
if (!externalDocs) return;
|
|
307112
307303
|
const url = externalDocs.url;
|
|
307113
307304
|
if (typeof url !== "string" || !parsesAsUrl(url)) {
|
|
@@ -307121,7 +307312,7 @@ function lintTagsAndExternalDocs(label, node, warnings) {
|
|
|
307121
307312
|
const seen = /* @__PURE__ */ new Set();
|
|
307122
307313
|
const reported = /* @__PURE__ */ new Set();
|
|
307123
307314
|
tags.forEach((entry, i) => {
|
|
307124
|
-
const tag =
|
|
307315
|
+
const tag = asRecord21(entry);
|
|
307125
307316
|
const name = typeof tag?.name === "string" ? tag.name : void 0;
|
|
307126
307317
|
if (name !== void 0) {
|
|
307127
307318
|
if (seen.has(name) && !reported.has(name)) {
|
|
@@ -307157,7 +307348,7 @@ function lintSchemaFormat(label, value, warnings) {
|
|
|
307157
307348
|
}
|
|
307158
307349
|
function lintTraits(label, traitsRaw, warnings) {
|
|
307159
307350
|
asArray14(traitsRaw).forEach((entry, i) => {
|
|
307160
|
-
const trait =
|
|
307351
|
+
const trait = asRecord21(entry);
|
|
307161
307352
|
if (trait && trait.payload !== void 0) {
|
|
307162
307353
|
warnings.push(
|
|
307163
307354
|
`ASYNCAPI_TRAIT_PAYLOAD_FORBIDDEN: ${label} trait #${i} defines payload; the Message/Operation Trait Object is the message/operation definition minus payload, so a trait MUST NOT carry one`
|
|
@@ -307166,7 +307357,7 @@ function lintTraits(label, traitsRaw, warnings) {
|
|
|
307166
307357
|
});
|
|
307167
307358
|
}
|
|
307168
307359
|
function lintParameter(label, raw, warnings) {
|
|
307169
|
-
const parameter =
|
|
307360
|
+
const parameter = asRecord21(raw);
|
|
307170
307361
|
if (!parameter) return;
|
|
307171
307362
|
const enumValues = asArray14(parameter.enum);
|
|
307172
307363
|
if (enumValues.length > 0) {
|
|
@@ -307186,9 +307377,9 @@ function lintParameter(label, raw, warnings) {
|
|
|
307186
307377
|
}
|
|
307187
307378
|
}
|
|
307188
307379
|
function lintSecurityRequirements(documentJson, is3, label, securityRaw, warnings) {
|
|
307189
|
-
const declared =
|
|
307380
|
+
const declared = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
307190
307381
|
for (const entry of asArray14(securityRaw)) {
|
|
307191
|
-
const requirement =
|
|
307382
|
+
const requirement = asRecord21(entry);
|
|
307192
307383
|
if (!requirement) continue;
|
|
307193
307384
|
if (is3) {
|
|
307194
307385
|
const type = String(requirement.type ?? "");
|
|
@@ -307201,7 +307392,7 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
307201
307392
|
continue;
|
|
307202
307393
|
}
|
|
307203
307394
|
for (const [schemeName, scopesRaw] of Object.entries(requirement)) {
|
|
307204
|
-
const scheme =
|
|
307395
|
+
const scheme = asRecord21(declared[schemeName]);
|
|
307205
307396
|
if (!scheme) {
|
|
307206
307397
|
warnings.push(
|
|
307207
307398
|
`ASYNCAPI_SECURITY_REQUIREMENT_UNDECLARED: ${label} security requirement references scheme ${JSON.stringify(schemeName)}, which is not declared in components.securitySchemes`
|
|
@@ -307218,9 +307409,9 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
307218
307409
|
}
|
|
307219
307410
|
}
|
|
307220
307411
|
function lintSecuritySchemes(documentJson, warnings) {
|
|
307221
|
-
const schemes =
|
|
307412
|
+
const schemes = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
307222
307413
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
307223
|
-
const scheme =
|
|
307414
|
+
const scheme = asRecord21(raw);
|
|
307224
307415
|
if (!scheme) continue;
|
|
307225
307416
|
const type = scheme.type;
|
|
307226
307417
|
if (typeof type !== "string" || !ASYNCAPI_SECURITY_SCHEME_TYPES.has(type)) {
|
|
@@ -307242,9 +307433,9 @@ function lintSecuritySchemes(documentJson, warnings) {
|
|
|
307242
307433
|
}
|
|
307243
307434
|
}
|
|
307244
307435
|
function lintComponentKeys(documentJson, warnings) {
|
|
307245
|
-
const components =
|
|
307436
|
+
const components = asRecord21(documentJson.components) ?? {};
|
|
307246
307437
|
for (const [sectionName, sectionRaw] of Object.entries(components)) {
|
|
307247
|
-
const section =
|
|
307438
|
+
const section = asRecord21(sectionRaw);
|
|
307248
307439
|
if (!section) continue;
|
|
307249
307440
|
for (const key of Object.keys(section)) {
|
|
307250
307441
|
if (!COMPONENT_KEY_RE.test(key)) {
|
|
@@ -307256,7 +307447,7 @@ function lintComponentKeys(documentJson, warnings) {
|
|
|
307256
307447
|
}
|
|
307257
307448
|
}
|
|
307258
307449
|
function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
307259
|
-
const variables =
|
|
307450
|
+
const variables = asRecord21(variablesRaw) ?? {};
|
|
307260
307451
|
const used = /* @__PURE__ */ new Set();
|
|
307261
307452
|
for (const match of template.matchAll(/\{([^{}]+)\}/g)) {
|
|
307262
307453
|
used.add(match[1]);
|
|
@@ -307270,7 +307461,7 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
307270
307461
|
if (!used.has(name)) {
|
|
307271
307462
|
warnings.push(`ASYNCAPI_SERVER_VARIABLE_UNUSED: ${serverLabel} declares variable ${name} that never appears in the server url/host/pathname`);
|
|
307272
307463
|
}
|
|
307273
|
-
const variable =
|
|
307464
|
+
const variable = asRecord21(raw);
|
|
307274
307465
|
if (!variable) continue;
|
|
307275
307466
|
if (variable.default === void 0) {
|
|
307276
307467
|
warnings.push(
|
|
@@ -307291,10 +307482,10 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
307291
307482
|
}
|
|
307292
307483
|
}
|
|
307293
307484
|
function lintServers(documentJson, is3, warnings) {
|
|
307294
|
-
const servers =
|
|
307485
|
+
const servers = asRecord21(documentJson.servers) ?? {};
|
|
307295
307486
|
let httpProtocolSeen = false;
|
|
307296
307487
|
for (const [name, raw] of Object.entries(servers)) {
|
|
307297
|
-
const server =
|
|
307488
|
+
const server = asRecord21(raw);
|
|
307298
307489
|
if (!server) continue;
|
|
307299
307490
|
const label = `server ${name}`;
|
|
307300
307491
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : void 0;
|
|
@@ -307337,9 +307528,9 @@ function lintServers(documentJson, is3, warnings) {
|
|
|
307337
307528
|
}
|
|
307338
307529
|
}
|
|
307339
307530
|
function lintBindings(label, bindingsRaw, warnings) {
|
|
307340
|
-
const bindings =
|
|
307531
|
+
const bindings = asRecord21(bindingsRaw);
|
|
307341
307532
|
if (!bindings) return;
|
|
307342
|
-
const kafka =
|
|
307533
|
+
const kafka = asRecord21(bindings.kafka);
|
|
307343
307534
|
if (kafka) {
|
|
307344
307535
|
if (typeof kafka.topic === "string" && (kafka.topic === "." || kafka.topic === ".." || !KAFKA_TOPIC_NAME_RE.test(kafka.topic))) {
|
|
307345
307536
|
warnings.push(
|
|
@@ -307354,15 +307545,15 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307354
307545
|
}
|
|
307355
307546
|
}
|
|
307356
307547
|
}
|
|
307357
|
-
const amqp =
|
|
307548
|
+
const amqp = asRecord21(bindings.amqp);
|
|
307358
307549
|
if (amqp) {
|
|
307359
|
-
const queue =
|
|
307550
|
+
const queue = asRecord21(amqp.queue);
|
|
307360
307551
|
if (queue && typeof queue.name === "string" && queue.name.length > 255) {
|
|
307361
307552
|
warnings.push(
|
|
307362
307553
|
`ASYNCAPI_AMQP_BINDING_INVALID: ${label} amqp binding queue name exceeds 255 characters (AMQP 0-9-1 short-string limit; amqp binding README, bindingVersion-scoped, non-normative source)`
|
|
307363
307554
|
);
|
|
307364
307555
|
}
|
|
307365
|
-
const exchange =
|
|
307556
|
+
const exchange = asRecord21(amqp.exchange);
|
|
307366
307557
|
if (exchange && exchange.type !== void 0 && !AMQP_EXCHANGE_TYPES.has(String(exchange.type))) {
|
|
307367
307558
|
warnings.push(
|
|
307368
307559
|
`ASYNCAPI_AMQP_BINDING_INVALID: ${label} amqp binding exchange type ${JSON.stringify(exchange.type)} must be one of default, direct, topic, fanout, headers (amqp binding README, bindingVersion-scoped, non-normative source)`
|
|
@@ -307379,7 +307570,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307379
307570
|
);
|
|
307380
307571
|
}
|
|
307381
307572
|
}
|
|
307382
|
-
const http2 =
|
|
307573
|
+
const http2 = asRecord21(bindings.http);
|
|
307383
307574
|
if (http2) {
|
|
307384
307575
|
if (http2.method !== void 0 && (typeof http2.method !== "string" || !HTTP_BINDING_METHODS.has(http2.method))) {
|
|
307385
307576
|
warnings.push(
|
|
@@ -307392,7 +307583,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307392
307583
|
);
|
|
307393
307584
|
}
|
|
307394
307585
|
}
|
|
307395
|
-
const ws =
|
|
307586
|
+
const ws = asRecord21(bindings.ws) ?? asRecord21(bindings.websockets);
|
|
307396
307587
|
if (ws && typeof ws.subprotocol === "string" && !IANA_WEBSOCKET_SUBPROTOCOLS.has(ws.subprotocol)) {
|
|
307397
307588
|
warnings.push(
|
|
307398
307589
|
`ASYNCAPI_WS_SUBPROTOCOL_UNREGISTERED: ${label} ws binding declares subprotocol ${JSON.stringify(ws.subprotocol)}, which is not in the IANA WebSocket Subprotocol Name Registry (vendored snapshot 2026-07)`
|
|
@@ -307400,11 +307591,11 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
307400
307591
|
}
|
|
307401
307592
|
}
|
|
307402
307593
|
function effectiveSchema(label, slot, raw, warnings) {
|
|
307403
|
-
const node =
|
|
307594
|
+
const node = asRecord21(raw);
|
|
307404
307595
|
if (!node) return void 0;
|
|
307405
307596
|
if (typeof node.schemaFormat === "string" && node.schema !== void 0) {
|
|
307406
307597
|
lintSchemaFormat(`${label} ${slot}`, node.schemaFormat, warnings);
|
|
307407
|
-
return
|
|
307598
|
+
return asRecord21(node.schema) ?? void 0;
|
|
307408
307599
|
}
|
|
307409
307600
|
return node;
|
|
307410
307601
|
}
|
|
@@ -307435,7 +307626,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307435
307626
|
const examples = asArray14(message.examples);
|
|
307436
307627
|
if (!is3) {
|
|
307437
307628
|
examples.forEach((entry, i) => {
|
|
307438
|
-
const example =
|
|
307629
|
+
const example = asRecord21(entry);
|
|
307439
307630
|
if (!example) return;
|
|
307440
307631
|
for (const key of Object.keys(example)) {
|
|
307441
307632
|
if (!MESSAGE_EXAMPLE_KEYS.has(key) && !key.startsWith("x-")) {
|
|
@@ -307446,7 +307637,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307446
307637
|
}
|
|
307447
307638
|
});
|
|
307448
307639
|
}
|
|
307449
|
-
if (headersSchema && examples.some((entry) =>
|
|
307640
|
+
if (headersSchema && examples.some((entry) => asRecord21(entry)?.headers !== void 0)) {
|
|
307450
307641
|
const packed = packSchema(documentJson, headersSchema, "3.0", "response");
|
|
307451
307642
|
const validate4 = packed.unsupported ? null : compileSchemaValidator(packed.schema);
|
|
307452
307643
|
if (!validate4) {
|
|
@@ -307455,7 +307646,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307455
307646
|
);
|
|
307456
307647
|
} else {
|
|
307457
307648
|
examples.forEach((entry, i) => {
|
|
307458
|
-
const example =
|
|
307649
|
+
const example = asRecord21(entry);
|
|
307459
307650
|
if (!example || example.headers === void 0) return;
|
|
307460
307651
|
if (!validate4(example.headers)) {
|
|
307461
307652
|
warnings.push(
|
|
@@ -307470,23 +307661,23 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
307470
307661
|
lintTagsAndExternalDocs(label, message, warnings);
|
|
307471
307662
|
}
|
|
307472
307663
|
function messagesOfOperation2x(op) {
|
|
307473
|
-
const root =
|
|
307664
|
+
const root = asRecord21(op.message);
|
|
307474
307665
|
if (!root) return [];
|
|
307475
|
-
const oneOf = asArray14(root.oneOf).map((entry) =>
|
|
307666
|
+
const oneOf = asArray14(root.oneOf).map((entry) => asRecord21(entry)).filter((entry) => entry !== null);
|
|
307476
307667
|
return oneOf.length > 0 ? oneOf : [root];
|
|
307477
307668
|
}
|
|
307478
307669
|
function lintChannels(documentJson, is3, minor, warnings) {
|
|
307479
|
-
const channels =
|
|
307670
|
+
const channels = asRecord21(documentJson.channels) ?? {};
|
|
307480
307671
|
const state = { seen: /* @__PURE__ */ new WeakSet(), messageIds: /* @__PURE__ */ new Map() };
|
|
307481
307672
|
const operationIds = /* @__PURE__ */ new Map();
|
|
307482
307673
|
const addresses = /* @__PURE__ */ new Map();
|
|
307483
307674
|
for (const [channelKey, channelRaw] of Object.entries(channels)) {
|
|
307484
|
-
const channel =
|
|
307675
|
+
const channel = asRecord21(channelRaw);
|
|
307485
307676
|
if (!channel) continue;
|
|
307486
307677
|
const channelLabel = `channel ${channelKey}`;
|
|
307487
307678
|
lintBindings(channelLabel, channel.bindings, warnings);
|
|
307488
307679
|
lintTagsAndExternalDocs(channelLabel, channel, warnings);
|
|
307489
|
-
const parameters =
|
|
307680
|
+
const parameters = asRecord21(channel.parameters) ?? {};
|
|
307490
307681
|
for (const [parameterName, parameterRaw] of Object.entries(parameters)) {
|
|
307491
307682
|
lintParameter(`${channelLabel} parameter ${parameterName}`, parameterRaw, warnings);
|
|
307492
307683
|
}
|
|
@@ -307499,15 +307690,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
307499
307690
|
addresses.set(channel.address, channelKey);
|
|
307500
307691
|
}
|
|
307501
307692
|
}
|
|
307502
|
-
const messages =
|
|
307693
|
+
const messages = asRecord21(channel.messages) ?? {};
|
|
307503
307694
|
for (const [messageKey, messageRaw] of Object.entries(messages)) {
|
|
307504
|
-
const message =
|
|
307695
|
+
const message = asRecord21(messageRaw);
|
|
307505
307696
|
if (message) lintMessage2(documentJson, `message ${messageKey} on channel ${channelKey}`, message, is3, minor, state, warnings);
|
|
307506
307697
|
}
|
|
307507
307698
|
continue;
|
|
307508
307699
|
}
|
|
307509
307700
|
for (const opKey of ["publish", "subscribe"]) {
|
|
307510
|
-
const op =
|
|
307701
|
+
const op = asRecord21(channel[opKey]);
|
|
307511
307702
|
if (!op) continue;
|
|
307512
307703
|
const opLabel = `${opKey} operation on channel ${channelKey}`;
|
|
307513
307704
|
if (typeof op.operationId === "string") {
|
|
@@ -307530,15 +307721,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
307530
307721
|
}
|
|
307531
307722
|
}
|
|
307532
307723
|
function lintOperations3(documentJson, warnings) {
|
|
307533
|
-
const operations =
|
|
307724
|
+
const operations = asRecord21(documentJson.operations) ?? {};
|
|
307534
307725
|
for (const [operationKey, operationRaw] of Object.entries(operations)) {
|
|
307535
|
-
const operation =
|
|
307726
|
+
const operation = asRecord21(operationRaw);
|
|
307536
307727
|
if (!operation) continue;
|
|
307537
307728
|
const label = `operation ${operationKey}`;
|
|
307538
307729
|
if (operation.action !== "send" && operation.action !== "receive") {
|
|
307539
307730
|
warnings.push(`ASYNCAPI_OPERATION_ACTION_INVALID: ${label} action ${JSON.stringify(operation.action)} must be "send" or "receive" (AsyncAPI 3.0 Operation Object)`);
|
|
307540
307731
|
}
|
|
307541
|
-
const replyAddress =
|
|
307732
|
+
const replyAddress = asRecord21(asRecord21(operation.reply)?.address);
|
|
307542
307733
|
if (replyAddress && typeof replyAddress.location === "string" && !isAsyncApiRuntimeExpression(replyAddress.location)) {
|
|
307543
307734
|
warnings.push(
|
|
307544
307735
|
`ASYNCAPI_RUNTIME_EXPRESSION_INVALID: ${label} reply.address location ${JSON.stringify(replyAddress.location)} is not a valid AsyncAPI runtime expression ($message.header#/<pointer> or $message.payload#/<pointer>)`
|
|
@@ -307562,7 +307753,7 @@ function resolveLocalPointer(root, ref) {
|
|
|
307562
307753
|
if (!Number.isInteger(idx) || idx < 0 || idx >= node.length) return false;
|
|
307563
307754
|
node = node[idx];
|
|
307564
307755
|
} else {
|
|
307565
|
-
const record =
|
|
307756
|
+
const record = asRecord21(node);
|
|
307566
307757
|
if (!record || !(key in record)) return false;
|
|
307567
307758
|
node = record[key];
|
|
307568
307759
|
}
|
|
@@ -307606,13 +307797,13 @@ function lintAsyncApiDocument(index) {
|
|
|
307606
307797
|
lintChannels(documentJson, is3, minor, warnings);
|
|
307607
307798
|
if (is3) lintOperations3(documentJson, warnings);
|
|
307608
307799
|
lintTagsAndExternalDocs("document", documentJson, warnings);
|
|
307609
|
-
const info2 =
|
|
307800
|
+
const info2 = asRecord21(documentJson.info);
|
|
307610
307801
|
if (info2) lintTagsAndExternalDocs("info", info2, warnings);
|
|
307611
307802
|
return warnings;
|
|
307612
307803
|
}
|
|
307613
307804
|
|
|
307614
307805
|
// src/lib/protocols/asyncapi/asyncapi-binding-lints.ts
|
|
307615
|
-
function
|
|
307806
|
+
function asRecord22(value) {
|
|
307616
307807
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
307617
307808
|
return value;
|
|
307618
307809
|
}
|
|
@@ -307707,46 +307898,46 @@ function pushSite(ctx, site) {
|
|
|
307707
307898
|
if (site) ctx.sites.push(site);
|
|
307708
307899
|
}
|
|
307709
307900
|
function siteOf(scope, label, raw, direction) {
|
|
307710
|
-
const bindings =
|
|
307901
|
+
const bindings = asRecord22(raw);
|
|
307711
307902
|
if (!bindings) return null;
|
|
307712
307903
|
return { scope, label, bindings, direction };
|
|
307713
307904
|
}
|
|
307714
307905
|
function collectSites(ctx) {
|
|
307715
307906
|
const { doc } = ctx;
|
|
307716
|
-
const servers =
|
|
307907
|
+
const servers = asRecord22(doc.servers) ?? {};
|
|
307717
307908
|
for (const [name, raw] of Object.entries(servers)) {
|
|
307718
|
-
const server =
|
|
307909
|
+
const server = asRecord22(raw);
|
|
307719
307910
|
if (server) pushSite(ctx, siteOf("server", "server " + name, server.bindings));
|
|
307720
307911
|
}
|
|
307721
|
-
const channels =
|
|
307912
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
307722
307913
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
307723
|
-
const channel =
|
|
307914
|
+
const channel = asRecord22(rawCh);
|
|
307724
307915
|
if (!channel) continue;
|
|
307725
307916
|
pushSite(ctx, siteOf("channel", "channel " + chName, channel.bindings));
|
|
307726
307917
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
307727
|
-
const op =
|
|
307918
|
+
const op = asRecord22(channel[opKeyword]);
|
|
307728
307919
|
if (!op) continue;
|
|
307729
307920
|
const direction = opKeyword === "publish" ? "send" : "receive";
|
|
307730
307921
|
pushSite(ctx, siteOf("operation", "channel " + chName + " " + opKeyword, op.bindings, direction));
|
|
307731
|
-
const message =
|
|
307922
|
+
const message = asRecord22(op.message);
|
|
307732
307923
|
if (message) collectMessageSites(ctx, "channel " + chName + " " + opKeyword + " message", message, direction);
|
|
307733
307924
|
}
|
|
307734
|
-
const chMessages =
|
|
307925
|
+
const chMessages = asRecord22(channel.messages);
|
|
307735
307926
|
if (chMessages) {
|
|
307736
307927
|
for (const [msgName, rawMsg] of Object.entries(chMessages)) {
|
|
307737
|
-
const message =
|
|
307928
|
+
const message = asRecord22(rawMsg);
|
|
307738
307929
|
if (message) collectMessageSites(ctx, "channel " + chName + " message " + msgName, message, void 0);
|
|
307739
307930
|
}
|
|
307740
307931
|
}
|
|
307741
307932
|
}
|
|
307742
|
-
const operations =
|
|
307933
|
+
const operations = asRecord22(doc.operations) ?? {};
|
|
307743
307934
|
for (const [opName, rawOp] of Object.entries(operations)) {
|
|
307744
|
-
const op =
|
|
307935
|
+
const op = asRecord22(rawOp);
|
|
307745
307936
|
if (!op) continue;
|
|
307746
307937
|
const direction = op.action === "send" ? "send" : op.action === "receive" ? "receive" : void 0;
|
|
307747
307938
|
pushSite(ctx, siteOf("operation", "operation " + opName, op.bindings, direction));
|
|
307748
307939
|
}
|
|
307749
|
-
const components =
|
|
307940
|
+
const components = asRecord22(doc.components) ?? {};
|
|
307750
307941
|
const componentScopes = [
|
|
307751
307942
|
["serverBindings", "server"],
|
|
307752
307943
|
["channelBindings", "channel"],
|
|
@@ -307754,21 +307945,21 @@ function collectSites(ctx) {
|
|
|
307754
307945
|
["messageBindings", "message"]
|
|
307755
307946
|
];
|
|
307756
307947
|
for (const [key, scope] of componentScopes) {
|
|
307757
|
-
const group2 =
|
|
307948
|
+
const group2 = asRecord22(components[key]) ?? {};
|
|
307758
307949
|
for (const [name, raw] of Object.entries(group2)) {
|
|
307759
307950
|
pushSite(ctx, siteOf(scope, "components." + key + " " + name, raw));
|
|
307760
307951
|
}
|
|
307761
307952
|
}
|
|
307762
|
-
const compMessages =
|
|
307953
|
+
const compMessages = asRecord22(components.messages) ?? {};
|
|
307763
307954
|
for (const [name, raw] of Object.entries(compMessages)) {
|
|
307764
|
-
const message =
|
|
307955
|
+
const message = asRecord22(raw);
|
|
307765
307956
|
if (message) collectMessageSites(ctx, "components.messages " + name, message, void 0);
|
|
307766
307957
|
}
|
|
307767
307958
|
}
|
|
307768
307959
|
function collectMessageSites(ctx, label, message, direction) {
|
|
307769
307960
|
pushSite(ctx, siteOf("message", label, message.bindings, direction));
|
|
307770
307961
|
for (const entry of asArray15(message.oneOf)) {
|
|
307771
|
-
const alt =
|
|
307962
|
+
const alt = asRecord22(entry);
|
|
307772
307963
|
if (alt) pushSite(ctx, siteOf("message", label + " oneOf alternative", alt.bindings, direction));
|
|
307773
307964
|
}
|
|
307774
307965
|
}
|
|
@@ -307793,7 +307984,7 @@ function lintBindingSites(ctx) {
|
|
|
307793
307984
|
}
|
|
307794
307985
|
const family = BINDING_KEY_FAMILY[key];
|
|
307795
307986
|
if (family) familiesSeen.set(family, site.label + " bindings." + key);
|
|
307796
|
-
const binding =
|
|
307987
|
+
const binding = asRecord22(site.bindings[key]);
|
|
307797
307988
|
if (!binding) continue;
|
|
307798
307989
|
if (key === "mqtt5") {
|
|
307799
307990
|
warnings.push(
|
|
@@ -307836,8 +308027,8 @@ function lintBindingSites(ctx) {
|
|
|
307836
308027
|
}
|
|
307837
308028
|
}
|
|
307838
308029
|
const serverFamilies = /* @__PURE__ */ new Set();
|
|
307839
|
-
for (const raw of Object.values(
|
|
307840
|
-
const server =
|
|
308030
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308031
|
+
const server = asRecord22(raw);
|
|
307841
308032
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
307842
308033
|
const family = SERVER_PROTOCOL_FAMILY[protocol];
|
|
307843
308034
|
if (family) serverFamilies.add(family);
|
|
@@ -307853,7 +308044,7 @@ function lintBindingSites(ctx) {
|
|
|
307853
308044
|
}
|
|
307854
308045
|
}
|
|
307855
308046
|
function compileBindingSchema(ctx, label, schema) {
|
|
307856
|
-
const record =
|
|
308047
|
+
const record = asRecord22(schema);
|
|
307857
308048
|
if (!record) return null;
|
|
307858
308049
|
const packed = packSchema(ctx.doc, record, "3.0", "response");
|
|
307859
308050
|
if (packed.unsupported) {
|
|
@@ -307887,9 +308078,9 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
307887
308078
|
for (const part of ["query", "headers"]) {
|
|
307888
308079
|
const schemaRaw = binding[part];
|
|
307889
308080
|
if (schemaRaw === void 0) continue;
|
|
307890
|
-
const schema =
|
|
308081
|
+
const schema = asRecord22(schemaRaw);
|
|
307891
308082
|
if (!schema) continue;
|
|
307892
|
-
const properties =
|
|
308083
|
+
const properties = asRecord22(schema.properties);
|
|
307893
308084
|
if (!properties || Object.keys(properties).length === 0) {
|
|
307894
308085
|
warnings.push(
|
|
307895
308086
|
"ASYNCAPI_WS_BINDING_SCHEMA_NO_PROPERTIES: " + label + " ws binding " + part + " schema declares no properties; the generated handshake carries nothing from it (ws binding README: object schema with properties)"
|
|
@@ -307906,7 +308097,7 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
307906
308097
|
}
|
|
307907
308098
|
if (part !== "headers") continue;
|
|
307908
308099
|
const lower = name.toLowerCase();
|
|
307909
|
-
const prop =
|
|
308100
|
+
const prop = asRecord22(rawProp) ?? {};
|
|
307910
308101
|
if (WS_RUNTIME_OWNED_HEADERS.has(lower)) {
|
|
307911
308102
|
const detail = required.has(lower) ? "is required by the binding but" : "";
|
|
307912
308103
|
warnings.push(
|
|
@@ -307957,10 +308148,10 @@ function substituteTemplates(value) {
|
|
|
307957
308148
|
}
|
|
307958
308149
|
function lintChannelAddresses(ctx) {
|
|
307959
308150
|
const { doc, warnings } = ctx;
|
|
307960
|
-
const channels =
|
|
308151
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
307961
308152
|
const wsServers = [];
|
|
307962
|
-
for (const [name, raw] of Object.entries(
|
|
307963
|
-
const server =
|
|
308153
|
+
for (const [name, raw] of Object.entries(asRecord22(doc.servers) ?? {})) {
|
|
308154
|
+
const server = asRecord22(raw);
|
|
307964
308155
|
if (!server) continue;
|
|
307965
308156
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
307966
308157
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "ws") continue;
|
|
@@ -307968,7 +308159,7 @@ function lintChannelAddresses(ctx) {
|
|
|
307968
308159
|
if (url) wsServers.push({ name, base: url });
|
|
307969
308160
|
}
|
|
307970
308161
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
307971
|
-
const channel =
|
|
308162
|
+
const channel = asRecord22(rawCh);
|
|
307972
308163
|
if (!channel) continue;
|
|
307973
308164
|
const address = ctx.isV3 ? channel.address : chName;
|
|
307974
308165
|
if (typeof address !== "string" || address.length === 0) continue;
|
|
@@ -308005,8 +308196,8 @@ function lintChannelAddresses(ctx) {
|
|
|
308005
308196
|
}
|
|
308006
308197
|
}
|
|
308007
308198
|
function collectMqttServerVersions(ctx) {
|
|
308008
|
-
for (const raw of Object.values(
|
|
308009
|
-
const server =
|
|
308199
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308200
|
+
const server = asRecord22(raw);
|
|
308010
308201
|
if (!server) continue;
|
|
308011
308202
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
308012
308203
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "mqtt") continue;
|
|
@@ -308027,7 +308218,7 @@ function lintMqttBindings(ctx) {
|
|
|
308027
308218
|
const { warnings } = ctx;
|
|
308028
308219
|
const only3x = ctx.mqttVersions.size > 0 && !ctx.mqttVersions.has(5) && !ctx.mqttVersions.has(0);
|
|
308029
308220
|
for (const site of ctx.sites) {
|
|
308030
|
-
const binding =
|
|
308221
|
+
const binding = asRecord22(site.bindings.mqtt);
|
|
308031
308222
|
if (!binding) continue;
|
|
308032
308223
|
if (only3x) {
|
|
308033
308224
|
const gated = MQTT5_ONLY_FIELDS[site.scope];
|
|
@@ -308043,7 +308234,7 @@ function lintMqttBindings(ctx) {
|
|
|
308043
308234
|
}
|
|
308044
308235
|
if (site.scope === "server") {
|
|
308045
308236
|
const clientId = binding.clientId;
|
|
308046
|
-
if (clientId !== void 0 && typeof clientId !== "string" && !
|
|
308237
|
+
if (clientId !== void 0 && typeof clientId !== "string" && !asRecord22(clientId)) {
|
|
308047
308238
|
warnings.push("ASYNCAPI_MQTT_CLIENT_ID_INVALID: " + site.label + " mqtt binding clientId must be a string or schema object (mqtt binding README)");
|
|
308048
308239
|
}
|
|
308049
308240
|
if (typeof clientId === "string") {
|
|
@@ -308056,12 +308247,12 @@ function lintMqttBindings(ctx) {
|
|
|
308056
308247
|
if (clientId === "" && only3x && binding.cleanSession !== true) {
|
|
308057
308248
|
warnings.push("ASYNCAPI_MQTT_CLIENT_ID_EMPTY_REQUIRES_CLEAN_SESSION: " + site.label + " mqtt binding declares an empty clientId without cleanSession true; MQTT 3.1.1 requires CleanSession 1 for zero-byte ClientIds (MQTT 3.1.1 section 3.1.3.1)");
|
|
308058
308249
|
}
|
|
308059
|
-
} else if (
|
|
308250
|
+
} else if (asRecord22(clientId)) {
|
|
308060
308251
|
compileBindingSchema(ctx, site.label + " mqtt binding clientId", clientId);
|
|
308061
308252
|
}
|
|
308062
308253
|
const lastWill = binding.lastWill;
|
|
308063
308254
|
if (lastWill !== void 0) {
|
|
308064
|
-
const will =
|
|
308255
|
+
const will = asRecord22(lastWill);
|
|
308065
308256
|
if (!will) {
|
|
308066
308257
|
warnings.push("ASYNCAPI_MQTT_LAST_WILL_INVALID: " + site.label + " mqtt binding lastWill must be an object (mqtt binding README)");
|
|
308067
308258
|
} else {
|
|
@@ -308078,7 +308269,7 @@ function lintMqttBindings(ctx) {
|
|
|
308078
308269
|
}
|
|
308079
308270
|
for (const [field, max] of [["sessionExpiryInterval", 4294967295], ["maximumPacketSize", 268435455]]) {
|
|
308080
308271
|
const value = binding[field];
|
|
308081
|
-
if (
|
|
308272
|
+
if (asRecord22(value)) compileBindingSchema(ctx, site.label + " mqtt binding " + field, value);
|
|
308082
308273
|
else if (typeof value === "number" && value > max) {
|
|
308083
308274
|
warnings.push("ASYNCAPI_MQTT_VALUE_OUT_OF_RANGE: " + site.label + " mqtt binding " + field + " " + value + " exceeds the MQTT wire ceiling " + max);
|
|
308084
308275
|
}
|
|
@@ -308086,7 +308277,7 @@ function lintMqttBindings(ctx) {
|
|
|
308086
308277
|
}
|
|
308087
308278
|
if (site.scope === "operation") {
|
|
308088
308279
|
const expiry = binding.messageExpiryInterval;
|
|
308089
|
-
if (
|
|
308280
|
+
if (asRecord22(expiry)) compileBindingSchema(ctx, site.label + " mqtt binding messageExpiryInterval", expiry);
|
|
308090
308281
|
else if (typeof expiry === "number" && expiry > 4294967295) {
|
|
308091
308282
|
warnings.push("ASYNCAPI_MQTT_VALUE_OUT_OF_RANGE: " + site.label + " mqtt binding messageExpiryInterval " + expiry + " exceeds the four-byte-integer ceiling 4294967295 (MQTT 5.0 section 3.3.2.3.3)");
|
|
308092
308283
|
}
|
|
@@ -308106,15 +308297,15 @@ function lintMqttBindings(ctx) {
|
|
|
308106
308297
|
warnings.push("ASYNCAPI_MQTT_CONTENT_TYPE_INVALID: " + site.label + " mqtt binding contentType " + JSON.stringify(contentType2) + " is not RFC 6838 type/subtype syntax (MQTT 5.0 section 3.3.2.3.9)");
|
|
308107
308298
|
}
|
|
308108
308299
|
const correlationData = binding.correlationData;
|
|
308109
|
-
if (
|
|
308300
|
+
if (asRecord22(correlationData)) {
|
|
308110
308301
|
compileBindingSchema(ctx, site.label + " mqtt binding correlationData", correlationData);
|
|
308111
|
-
const maxLength =
|
|
308302
|
+
const maxLength = asRecord22(correlationData)?.maxLength;
|
|
308112
308303
|
if (typeof maxLength === "number" && maxLength > 65535) {
|
|
308113
308304
|
warnings.push("ASYNCAPI_MQTT_CORRELATION_DATA_TOO_LONG: " + site.label + " mqtt binding correlationData maxLength " + maxLength + " exceeds the 65535-byte binary-data ceiling (MQTT 5.0 section 1.5.6)");
|
|
308114
308305
|
}
|
|
308115
308306
|
}
|
|
308116
308307
|
const responseTopic = binding.responseTopic;
|
|
308117
|
-
if (
|
|
308308
|
+
if (asRecord22(responseTopic)) compileBindingSchema(ctx, site.label + " mqtt binding responseTopic", responseTopic);
|
|
308118
308309
|
const pfi = binding.payloadFormatIndicator;
|
|
308119
308310
|
if (pfi === 1) {
|
|
308120
308311
|
const message = siteMessageRecord(ctx, site);
|
|
@@ -308144,38 +308335,38 @@ function normalizeMediaType(value) {
|
|
|
308144
308335
|
function siteMessageRecord(ctx, site) {
|
|
308145
308336
|
const doc = ctx.doc;
|
|
308146
308337
|
const matches = (message) => {
|
|
308147
|
-
return message !== null &&
|
|
308338
|
+
return message !== null && asRecord22(message.bindings)?.mqtt === site.bindings.mqtt;
|
|
308148
308339
|
};
|
|
308149
|
-
for (const rawCh of Object.values(
|
|
308150
|
-
const channel =
|
|
308340
|
+
for (const rawCh of Object.values(asRecord22(doc.channels) ?? {})) {
|
|
308341
|
+
const channel = asRecord22(rawCh);
|
|
308151
308342
|
if (!channel) continue;
|
|
308152
308343
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308153
|
-
const op =
|
|
308154
|
-
const message =
|
|
308344
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308345
|
+
const message = asRecord22(op?.message);
|
|
308155
308346
|
if (matches(message)) return message;
|
|
308156
308347
|
for (const entry of asArray15(message?.oneOf)) {
|
|
308157
|
-
const alt =
|
|
308348
|
+
const alt = asRecord22(entry);
|
|
308158
308349
|
if (matches(alt)) return alt;
|
|
308159
308350
|
}
|
|
308160
308351
|
}
|
|
308161
|
-
for (const rawMsg of Object.values(
|
|
308162
|
-
const message =
|
|
308352
|
+
for (const rawMsg of Object.values(asRecord22(channel.messages) ?? {})) {
|
|
308353
|
+
const message = asRecord22(rawMsg);
|
|
308163
308354
|
if (matches(message)) return message;
|
|
308164
308355
|
}
|
|
308165
308356
|
}
|
|
308166
|
-
for (const rawMsg of Object.values(
|
|
308167
|
-
const message =
|
|
308357
|
+
for (const rawMsg of Object.values(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
308358
|
+
const message = asRecord22(rawMsg);
|
|
308168
308359
|
if (matches(message)) return message;
|
|
308169
308360
|
}
|
|
308170
308361
|
return null;
|
|
308171
308362
|
}
|
|
308172
308363
|
function lintHttpBindings(ctx) {
|
|
308173
308364
|
for (const site of ctx.sites) {
|
|
308174
|
-
const binding =
|
|
308365
|
+
const binding = asRecord22(site.bindings.http);
|
|
308175
308366
|
if (!binding) continue;
|
|
308176
308367
|
if (site.scope === "operation" && binding.query !== void 0) {
|
|
308177
|
-
const schema =
|
|
308178
|
-
const properties =
|
|
308368
|
+
const schema = asRecord22(binding.query);
|
|
308369
|
+
const properties = asRecord22(schema?.properties);
|
|
308179
308370
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
308180
308371
|
ctx.warnings.push(
|
|
308181
308372
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding query must be an object schema with properties (http binding README)"
|
|
@@ -308190,8 +308381,8 @@ function lintHttpBindings(ctx) {
|
|
|
308190
308381
|
}
|
|
308191
308382
|
}
|
|
308192
308383
|
if (site.scope === "message" && binding.headers !== void 0) {
|
|
308193
|
-
const schema =
|
|
308194
|
-
const properties =
|
|
308384
|
+
const schema = asRecord22(binding.headers);
|
|
308385
|
+
const properties = asRecord22(schema?.properties);
|
|
308195
308386
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
308196
308387
|
ctx.warnings.push(
|
|
308197
308388
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding headers must be an object schema with properties (http binding README)"
|
|
@@ -308227,19 +308418,19 @@ var HTTP_PROTOCOL_HEADER_DENYLIST = /* @__PURE__ */ new Set([
|
|
|
308227
308418
|
function collectMessages2(ctx) {
|
|
308228
308419
|
const out = [];
|
|
308229
308420
|
const doc = ctx.doc;
|
|
308230
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308231
|
-
const channel =
|
|
308421
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
308422
|
+
const channel = asRecord22(rawCh);
|
|
308232
308423
|
if (!channel) continue;
|
|
308233
308424
|
const siblingList = [];
|
|
308234
308425
|
const push = (label, raw) => {
|
|
308235
|
-
const message =
|
|
308426
|
+
const message = asRecord22(raw);
|
|
308236
308427
|
if (!message) return;
|
|
308237
308428
|
siblingList.push(message);
|
|
308238
308429
|
out.push({ label, message, channelMessages: siblingList });
|
|
308239
308430
|
};
|
|
308240
308431
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308241
|
-
const op =
|
|
308242
|
-
const message =
|
|
308432
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308433
|
+
const message = asRecord22(op?.message);
|
|
308243
308434
|
if (!message) continue;
|
|
308244
308435
|
const alternatives = asArray15(message.oneOf);
|
|
308245
308436
|
if (alternatives.length > 0) {
|
|
@@ -308248,12 +308439,12 @@ function collectMessages2(ctx) {
|
|
|
308248
308439
|
push("channel " + chName + " " + opKeyword + " message", message);
|
|
308249
308440
|
}
|
|
308250
308441
|
}
|
|
308251
|
-
for (const [msgName, rawMsg] of Object.entries(
|
|
308442
|
+
for (const [msgName, rawMsg] of Object.entries(asRecord22(channel.messages) ?? {})) {
|
|
308252
308443
|
push("channel " + chName + " message " + msgName, rawMsg);
|
|
308253
308444
|
}
|
|
308254
308445
|
}
|
|
308255
|
-
for (const [name, raw] of Object.entries(
|
|
308256
|
-
const message =
|
|
308446
|
+
for (const [name, raw] of Object.entries(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
308447
|
+
const message = asRecord22(raw);
|
|
308257
308448
|
if (message) out.push({ label: "components.messages " + name, message, channelMessages: null });
|
|
308258
308449
|
}
|
|
308259
308450
|
return out;
|
|
@@ -308262,7 +308453,7 @@ function effectiveMessageId(message) {
|
|
|
308262
308453
|
if (typeof message.messageId === "string") return message.messageId;
|
|
308263
308454
|
let fromTraits;
|
|
308264
308455
|
for (const entry of asArray15(message.traits)) {
|
|
308265
|
-
const trait =
|
|
308456
|
+
const trait = asRecord22(entry);
|
|
308266
308457
|
if (trait && typeof trait.messageId === "string") fromTraits = trait.messageId;
|
|
308267
308458
|
}
|
|
308268
308459
|
return fromTraits;
|
|
@@ -308276,7 +308467,7 @@ function lintMessages(ctx) {
|
|
|
308276
308467
|
const validatorFor = (message) => {
|
|
308277
308468
|
if (validatorCache.has(message)) return validatorCache.get(message) ?? null;
|
|
308278
308469
|
let validate4 = null;
|
|
308279
|
-
const payload =
|
|
308470
|
+
const payload = asRecord22(message.payload);
|
|
308280
308471
|
if (payload) {
|
|
308281
308472
|
const packed = packSchema(ctx.doc, payload, "3.0", "response");
|
|
308282
308473
|
if (!packed.unsupported) {
|
|
@@ -308296,10 +308487,10 @@ function lintMessages(ctx) {
|
|
|
308296
308487
|
}
|
|
308297
308488
|
if (owner === void 0) idOwners.set(id, label);
|
|
308298
308489
|
}
|
|
308299
|
-
const headers =
|
|
308490
|
+
const headers = asRecord22(message.headers);
|
|
308300
308491
|
if (headers) {
|
|
308301
308492
|
compileBindingSchema(ctx, label + " headers", headers);
|
|
308302
|
-
const properties =
|
|
308493
|
+
const properties = asRecord22(headers.properties) ?? {};
|
|
308303
308494
|
for (const name of Object.keys(properties)) {
|
|
308304
308495
|
if (!HTTP_TOKEN_RE.test(name)) {
|
|
308305
308496
|
warnings.push("ASYNCAPI_BINDING_HEADER_NAME_INVALID: " + label + " headers property " + JSON.stringify(name) + " is not a valid RFC 9110 token");
|
|
@@ -308321,7 +308512,7 @@ function lintMessages(ctx) {
|
|
|
308321
308512
|
return compileSchemaValidator(packed.schema);
|
|
308322
308513
|
})() : null;
|
|
308323
308514
|
asArray15(message.examples).forEach((entry, i) => {
|
|
308324
|
-
const example =
|
|
308515
|
+
const example = asRecord22(entry);
|
|
308325
308516
|
if (!example) return;
|
|
308326
308517
|
if (example.payload === void 0 && example.headers !== void 0) {
|
|
308327
308518
|
if (headerValidate) {
|
|
@@ -308348,7 +308539,7 @@ function lintMessages(ctx) {
|
|
|
308348
308539
|
const traits = asArray15(message.traits);
|
|
308349
308540
|
const traitKeyValues = /* @__PURE__ */ new Map();
|
|
308350
308541
|
traits.forEach((entry, i) => {
|
|
308351
|
-
const trait =
|
|
308542
|
+
const trait = asRecord22(entry);
|
|
308352
308543
|
if (!trait) return;
|
|
308353
308544
|
if (trait.traits !== void 0) {
|
|
308354
308545
|
warnings.push("ASYNCAPI_TRAIT_FORBIDDEN_FIELD: " + label + " trait #" + i + ' declares "traits"; a Message Trait Object cannot itself carry traits (AsyncAPI Message Trait Object)');
|
|
@@ -308365,14 +308556,14 @@ function lintMessages(ctx) {
|
|
|
308365
308556
|
}
|
|
308366
308557
|
});
|
|
308367
308558
|
}
|
|
308368
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308369
|
-
const channel =
|
|
308559
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(ctx.doc.channels) ?? {})) {
|
|
308560
|
+
const channel = asRecord22(rawCh);
|
|
308370
308561
|
if (!channel) continue;
|
|
308371
308562
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
308372
|
-
const op =
|
|
308563
|
+
const op = asRecord22(channel[opKeyword]);
|
|
308373
308564
|
if (!op) continue;
|
|
308374
308565
|
asArray15(op.traits).forEach((entry, i) => {
|
|
308375
|
-
const trait =
|
|
308566
|
+
const trait = asRecord22(entry);
|
|
308376
308567
|
if (!trait) return;
|
|
308377
308568
|
for (const forbidden of ["message", "traits"]) {
|
|
308378
308569
|
if (trait[forbidden] !== void 0) {
|
|
@@ -308382,13 +308573,13 @@ function lintMessages(ctx) {
|
|
|
308382
308573
|
});
|
|
308383
308574
|
}
|
|
308384
308575
|
}
|
|
308385
|
-
const channelsRecord =
|
|
308386
|
-
const channelValues = Object.values(channelsRecord).map(
|
|
308387
|
-
for (const [opName, rawOp] of Object.entries(
|
|
308388
|
-
const op =
|
|
308576
|
+
const channelsRecord = asRecord22(ctx.doc.channels) ?? {};
|
|
308577
|
+
const channelValues = Object.values(channelsRecord).map(asRecord22).filter((c) => c !== null);
|
|
308578
|
+
for (const [opName, rawOp] of Object.entries(asRecord22(ctx.doc.operations) ?? {})) {
|
|
308579
|
+
const op = asRecord22(rawOp);
|
|
308389
308580
|
if (!op) continue;
|
|
308390
308581
|
asArray15(op.traits).forEach((entry, i) => {
|
|
308391
|
-
const trait =
|
|
308582
|
+
const trait = asRecord22(entry);
|
|
308392
308583
|
if (!trait) return;
|
|
308393
308584
|
for (const forbidden of ["action", "channel", "traits"]) {
|
|
308394
308585
|
if (trait[forbidden] !== void 0) {
|
|
@@ -308396,13 +308587,13 @@ function lintMessages(ctx) {
|
|
|
308396
308587
|
}
|
|
308397
308588
|
}
|
|
308398
308589
|
});
|
|
308399
|
-
const opChannel =
|
|
308590
|
+
const opChannel = asRecord22(op.channel);
|
|
308400
308591
|
if (opChannel && channelValues.length > 0 && !channelValues.includes(opChannel)) {
|
|
308401
308592
|
warnings.push("ASYNCAPI_OPERATION_CHANNEL_UNRESOLVED: operation " + opName + " channel does not resolve to a declared channel of this document (AsyncAPI 3.0 Operation Object channel)");
|
|
308402
308593
|
}
|
|
308403
308594
|
if (opChannel) {
|
|
308404
|
-
const channelMessages = Object.values(
|
|
308405
|
-
const opMessages = asArray15(op.messages).map(
|
|
308595
|
+
const channelMessages = Object.values(asRecord22(opChannel.messages) ?? {}).map(asRecord22).filter((m) => m !== null);
|
|
308596
|
+
const opMessages = asArray15(op.messages).map(asRecord22).filter((m) => m !== null);
|
|
308406
308597
|
for (const opMessage of opMessages) {
|
|
308407
308598
|
const inChannel = channelMessages.some((cm) => cm === opMessage || JSON.stringify(cm) === JSON.stringify(opMessage));
|
|
308408
308599
|
if (!inChannel) {
|
|
@@ -308410,16 +308601,16 @@ function lintMessages(ctx) {
|
|
|
308410
308601
|
}
|
|
308411
308602
|
}
|
|
308412
308603
|
}
|
|
308413
|
-
const reply =
|
|
308604
|
+
const reply = asRecord22(op.reply);
|
|
308414
308605
|
if (reply) {
|
|
308415
|
-
const replyChannel =
|
|
308416
|
-
const replyAddress =
|
|
308606
|
+
const replyChannel = asRecord22(reply.channel);
|
|
308607
|
+
const replyAddress = asRecord22(reply.address);
|
|
308417
308608
|
if (replyAddress && replyChannel && typeof replyChannel.address === "string" && replyChannel.address.length > 0) {
|
|
308418
308609
|
warnings.push("ASYNCAPI_REPLY_ADDRESS_CONFLICT: operation " + opName + " reply declares a dynamic reply address while its reply channel pins address " + JSON.stringify(replyChannel.address) + "; a dynamic reply channel address SHOULD be null (AsyncAPI 3.0 Operation Reply Object)");
|
|
308419
308610
|
}
|
|
308420
308611
|
if (replyChannel) {
|
|
308421
|
-
const replyChannelMessages = Object.values(
|
|
308422
|
-
const replyMessages = asArray15(reply.messages).map(
|
|
308612
|
+
const replyChannelMessages = Object.values(asRecord22(replyChannel.messages) ?? {}).map(asRecord22).filter((m) => m !== null);
|
|
308613
|
+
const replyMessages = asArray15(reply.messages).map(asRecord22).filter((m) => m !== null);
|
|
308423
308614
|
for (const replyMessage of replyMessages) {
|
|
308424
308615
|
const inChannel = replyChannelMessages.some((cm) => cm === replyMessage || JSON.stringify(cm) === JSON.stringify(replyMessage));
|
|
308425
308616
|
if (!inChannel) {
|
|
@@ -308431,8 +308622,8 @@ function lintMessages(ctx) {
|
|
|
308431
308622
|
}
|
|
308432
308623
|
}
|
|
308433
308624
|
function hasWsSurface(ctx) {
|
|
308434
|
-
for (const raw of Object.values(
|
|
308435
|
-
const server =
|
|
308625
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308626
|
+
const server = asRecord22(raw);
|
|
308436
308627
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
308437
308628
|
if (SERVER_PROTOCOL_FAMILY[protocol] === "ws") return true;
|
|
308438
308629
|
}
|
|
@@ -308443,11 +308634,11 @@ var API_KEY_LOCATIONS_V2 = /* @__PURE__ */ new Set(["user", "password"]);
|
|
|
308443
308634
|
var SYNTHESIZABLE_SCHEME_TYPES = /* @__PURE__ */ new Set(["http", "httpApiKey", "apiKey", "userPassword"]);
|
|
308444
308635
|
function lintSecuritySchemes2(ctx) {
|
|
308445
308636
|
const { warnings } = ctx;
|
|
308446
|
-
const schemes =
|
|
308637
|
+
const schemes = asRecord22(asRecord22(ctx.doc.components)?.securitySchemes) ?? {};
|
|
308447
308638
|
const oauthLikeNames = /* @__PURE__ */ new Set();
|
|
308448
308639
|
const unsatisfiable = [];
|
|
308449
308640
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
308450
|
-
const scheme =
|
|
308641
|
+
const scheme = asRecord22(raw);
|
|
308451
308642
|
if (!scheme) continue;
|
|
308452
308643
|
const type = typeof scheme.type === "string" ? scheme.type : "";
|
|
308453
308644
|
if (type === "oauth2" || type === "openIdConnect") oauthLikeNames.add(name);
|
|
@@ -308467,9 +308658,9 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308467
308658
|
}
|
|
308468
308659
|
}
|
|
308469
308660
|
if (type === "oauth2") {
|
|
308470
|
-
const flows =
|
|
308661
|
+
const flows = asRecord22(scheme.flows) ?? {};
|
|
308471
308662
|
for (const [flowName, rawFlow] of Object.entries(flows)) {
|
|
308472
|
-
const flow =
|
|
308663
|
+
const flow = asRecord22(rawFlow);
|
|
308473
308664
|
if (!flow) continue;
|
|
308474
308665
|
for (const field of ["authorizationUrl", "tokenUrl", "refreshUrl"]) {
|
|
308475
308666
|
const url = flow[field];
|
|
@@ -308486,11 +308677,11 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308486
308677
|
if (unsatisfiable.length > 0) {
|
|
308487
308678
|
warnings.push("ASYNCAPI_SECURITY_NOT_SYNTHESIZED: generated collection items carry no credential material for security scheme(s) " + unsatisfiable.join(", ") + "; connections that enforce them must be configured manually");
|
|
308488
308679
|
}
|
|
308489
|
-
for (const [serverName, raw] of Object.entries(
|
|
308490
|
-
const server =
|
|
308680
|
+
for (const [serverName, raw] of Object.entries(asRecord22(ctx.doc.servers) ?? {})) {
|
|
308681
|
+
const server = asRecord22(raw);
|
|
308491
308682
|
if (!server) continue;
|
|
308492
308683
|
asArray15(server.security).forEach((entry, i) => {
|
|
308493
|
-
const requirement =
|
|
308684
|
+
const requirement = asRecord22(entry);
|
|
308494
308685
|
if (!requirement) return;
|
|
308495
308686
|
for (const [schemeName, value] of Object.entries(requirement)) {
|
|
308496
308687
|
if (!Array.isArray(value)) {
|
|
@@ -308500,7 +308691,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308500
308691
|
if (value.some((scope) => typeof scope !== "string")) {
|
|
308501
308692
|
warnings.push("ASYNCAPI_SECURITY_REQUIREMENT_INVALID: server " + serverName + " security requirement #" + i + " scopes for " + schemeName + " must be strings (AsyncAPI Security Requirement Object)");
|
|
308502
308693
|
}
|
|
308503
|
-
if (value.length > 0 && !oauthLikeNames.has(schemeName) &&
|
|
308694
|
+
if (value.length > 0 && !oauthLikeNames.has(schemeName) && asRecord22(schemes[schemeName])) {
|
|
308504
308695
|
warnings.push("ASYNCAPI_SECURITY_REQUIREMENT_INVALID: server " + serverName + " security requirement #" + i + " lists scopes for non-OAuth scheme " + schemeName + "; the array MUST be empty for such schemes (AsyncAPI Security Requirement Object)");
|
|
308505
308696
|
}
|
|
308506
308697
|
}
|
|
@@ -308510,7 +308701,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
308510
308701
|
function lintSocketIo(ctx) {
|
|
308511
308702
|
if (!ctx.socketIo) return;
|
|
308512
308703
|
const { warnings, doc } = ctx;
|
|
308513
|
-
const xSocketIo =
|
|
308704
|
+
const xSocketIo = asRecord22(doc["x-socketio"]) ?? {};
|
|
308514
308705
|
const declaredVersion = xSocketIo.version ?? xSocketIo.eio ?? xSocketIo.EIO;
|
|
308515
308706
|
if (declaredVersion !== void 0 && String(declaredVersion) !== "4") {
|
|
308516
308707
|
warnings.push("ASYNCAPI_SOCKETIO_VERSION_UNSUPPORTED: x-socketio declares version " + JSON.stringify(declaredVersion) + " but generated Socket.IO items target Socket.IO v4 / Engine.IO 4");
|
|
@@ -308519,8 +308710,8 @@ function lintSocketIo(ctx) {
|
|
|
308519
308710
|
if (typeof path10 === "string" && path10 !== "/socket.io/" && path10 !== "/socket.io") {
|
|
308520
308711
|
warnings.push("ASYNCAPI_SOCKETIO_PATH_UNSUPPORTED: x-socketio declares path " + JSON.stringify(path10) + " but generated Socket.IO items connect on the default /socket.io/ path");
|
|
308521
308712
|
}
|
|
308522
|
-
for (const [chName, rawCh] of Object.entries(
|
|
308523
|
-
const channel =
|
|
308713
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
308714
|
+
const channel = asRecord22(rawCh);
|
|
308524
308715
|
if (!channel) continue;
|
|
308525
308716
|
const address = ctx.isV3 ? typeof channel.address === "string" ? channel.address : "" : chName;
|
|
308526
308717
|
if (address && address !== "/" && !address.startsWith("/")) {
|
|
@@ -308528,10 +308719,10 @@ function lintSocketIo(ctx) {
|
|
|
308528
308719
|
} else if (address && address !== "/") {
|
|
308529
308720
|
warnings.push("ASYNCAPI_SOCKETIO_NAMESPACE_NOT_ROUTED: channel " + chName + " implies Socket.IO namespace " + JSON.stringify(address) + " but generated items connect to the root namespace");
|
|
308530
308721
|
}
|
|
308531
|
-
const wsBinding =
|
|
308532
|
-
const queryProps =
|
|
308722
|
+
const wsBinding = asRecord22(asRecord22(channel.bindings)?.ws);
|
|
308723
|
+
const queryProps = asRecord22(asRecord22(wsBinding?.query)?.properties) ?? {};
|
|
308533
308724
|
for (const [propName2, rawProp] of Object.entries(queryProps)) {
|
|
308534
|
-
const prop =
|
|
308725
|
+
const prop = asRecord22(rawProp);
|
|
308535
308726
|
if (!prop) continue;
|
|
308536
308727
|
const declared = schemaDeclaredValues(prop).map(String);
|
|
308537
308728
|
if (propName2 === "EIO" && declared.some((v) => v !== "4")) {
|
|
@@ -308551,7 +308742,7 @@ function lintSocketIo(ctx) {
|
|
|
308551
308742
|
if (message.contentKind === "binary") {
|
|
308552
308743
|
warnings.push("ASYNCAPI_SOCKETIO_BINARY_NOT_SYNTHESIZED: channel " + channel.id + " message " + message.id + " is binary; generated Socket.IO events carry placeholder text arguments, not binary attachments");
|
|
308553
308744
|
}
|
|
308554
|
-
const ack =
|
|
308745
|
+
const ack = asRecord22(message.ackSchema);
|
|
308555
308746
|
if (ack) {
|
|
308556
308747
|
const declaredType = Array.isArray(ack.type) ? ack.type.map(String) : ack.type !== void 0 ? [String(ack.type)] : [];
|
|
308557
308748
|
if (declaredType.length > 0 && !declaredType.includes("array")) {
|
|
@@ -308562,7 +308753,7 @@ function lintSocketIo(ctx) {
|
|
|
308562
308753
|
}
|
|
308563
308754
|
}
|
|
308564
308755
|
function lintAsyncApiBindingSurfaces(index) {
|
|
308565
|
-
const doc =
|
|
308756
|
+
const doc = asRecord22(index.documentJson);
|
|
308566
308757
|
if (!doc) return [];
|
|
308567
308758
|
const ctx = {
|
|
308568
308759
|
index,
|
|
@@ -308584,7 +308775,7 @@ function lintAsyncApiBindingSurfaces(index) {
|
|
|
308584
308775
|
lintSocketIo(ctx);
|
|
308585
308776
|
for (const site of ctx.sites) {
|
|
308586
308777
|
if (site.scope !== "channel") continue;
|
|
308587
|
-
const wsBinding =
|
|
308778
|
+
const wsBinding = asRecord22(site.bindings.ws);
|
|
308588
308779
|
if (wsBinding) lintWsChannelBinding(ctx, site.label, wsBinding);
|
|
308589
308780
|
}
|
|
308590
308781
|
return ctx.warnings;
|
|
@@ -308596,7 +308787,7 @@ var ASYNCAPI_INSTRUMENT_LIMITS = {
|
|
|
308596
308787
|
};
|
|
308597
308788
|
var MESSAGE_NODE_TYPES = /* @__PURE__ */ new Set(["ws-raw-message", "ws-socketio-message", "mqtt-message"]);
|
|
308598
308789
|
var BASE64_RE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
308599
|
-
function
|
|
308790
|
+
function asRecord23(value) {
|
|
308600
308791
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
308601
308792
|
return value;
|
|
308602
308793
|
}
|
|
@@ -308604,7 +308795,7 @@ function asArray16(value) {
|
|
|
308604
308795
|
return Array.isArray(value) ? value : [];
|
|
308605
308796
|
}
|
|
308606
308797
|
function schemaAllowsStringInstance(schema) {
|
|
308607
|
-
const record =
|
|
308798
|
+
const record = asRecord23(schema);
|
|
308608
308799
|
if (!record) return false;
|
|
308609
308800
|
const declared = record.type;
|
|
308610
308801
|
const types2 = Array.isArray(declared) ? declared.map(String) : declared !== void 0 ? [String(declared)] : [];
|
|
@@ -308697,18 +308888,18 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308697
308888
|
if (binding.messageExpiryInterval !== void 0 && !isNonNegativeInteger(binding.messageExpiryInterval)) bad("messageExpiryInterval", "must be a non-negative integer (seconds)");
|
|
308698
308889
|
if (binding.cleanSession !== void 0 && typeof binding.cleanSession !== "boolean") bad("cleanSession", "must be a boolean");
|
|
308699
308890
|
if (binding.keepAlive !== void 0 && !isIntegerInRange(binding.keepAlive, 0, 65535)) bad("keepAlive", "must be an integer in 0-65535 (seconds, MQTT two-byte Keep Alive)");
|
|
308700
|
-
if (binding.sessionExpiryInterval !== void 0 && !isIntegerInRange(binding.sessionExpiryInterval, 0, 4294967295) &&
|
|
308701
|
-
if (binding.maximumPacketSize !== void 0 && !isIntegerInRange(binding.maximumPacketSize, 1, 268435455) &&
|
|
308891
|
+
if (binding.sessionExpiryInterval !== void 0 && !isIntegerInRange(binding.sessionExpiryInterval, 0, 4294967295) && asRecord23(binding.sessionExpiryInterval) === null) bad("sessionExpiryInterval", "must be an integer in 0-4294967295 (seconds, MQTT 5.0 four-byte property) or a schema object");
|
|
308892
|
+
if (binding.maximumPacketSize !== void 0 && !isIntegerInRange(binding.maximumPacketSize, 1, 268435455) && asRecord23(binding.maximumPacketSize) === null) bad("maximumPacketSize", "must be an integer in 1-268435455 (bytes, MQTT 5.0 packet size limit) or a schema object");
|
|
308702
308893
|
if (binding.payloadFormatIndicator !== void 0 && binding.payloadFormatIndicator !== 0 && binding.payloadFormatIndicator !== 1) bad("payloadFormatIndicator", "must be 0 (unspecified bytes) or 1 (UTF-8)");
|
|
308703
308894
|
if (binding.contentType !== void 0 && typeof binding.contentType !== "string") bad("contentType", "must be a string");
|
|
308704
308895
|
if (typeof binding.responseTopic === "string") {
|
|
308705
308896
|
const violation = mqttTopicViolation(binding.responseTopic, false);
|
|
308706
308897
|
if (violation) warnings.push(`ASYNCAPI_MQTT_TOPIC_INVALID: channel ${channelId} ${scope} binding responseTopic "${binding.responseTopic}" ${violation}`);
|
|
308707
|
-
} else if (binding.responseTopic !== void 0 &&
|
|
308898
|
+
} else if (binding.responseTopic !== void 0 && asRecord23(binding.responseTopic) === null) {
|
|
308708
308899
|
bad("responseTopic", "must be a string or a schema object");
|
|
308709
308900
|
}
|
|
308710
308901
|
if (binding.correlationData !== void 0) {
|
|
308711
|
-
const correlationData =
|
|
308902
|
+
const correlationData = asRecord23(binding.correlationData);
|
|
308712
308903
|
if (!correlationData) {
|
|
308713
308904
|
bad("correlationData", "must be a Schema Object describing the binary correlation data");
|
|
308714
308905
|
} else if (correlationData.type !== "string" || correlationData.format !== "byte" && correlationData.format !== "binary") {
|
|
@@ -308717,7 +308908,7 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308717
308908
|
);
|
|
308718
308909
|
}
|
|
308719
308910
|
}
|
|
308720
|
-
const lastWill =
|
|
308911
|
+
const lastWill = asRecord23(binding.lastWill);
|
|
308721
308912
|
if (lastWill) {
|
|
308722
308913
|
if (typeof lastWill.topic === "string") {
|
|
308723
308914
|
const violation = mqttTopicViolation(lastWill.topic, false);
|
|
@@ -308732,14 +308923,14 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
308732
308923
|
}
|
|
308733
308924
|
}
|
|
308734
308925
|
function channelHasPublishDirection(documentJson, channelId) {
|
|
308735
|
-
const channel =
|
|
308926
|
+
const channel = asRecord23(asRecord23(documentJson.channels)?.[channelId]);
|
|
308736
308927
|
if (channel?.publish !== void 0) return true;
|
|
308737
308928
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
308738
|
-
const operations =
|
|
308929
|
+
const operations = asRecord23(documentJson.operations) ?? {};
|
|
308739
308930
|
for (const operationRaw of Object.values(operations)) {
|
|
308740
|
-
const operation =
|
|
308931
|
+
const operation = asRecord23(operationRaw);
|
|
308741
308932
|
if (!operation || operation.action !== "send") continue;
|
|
308742
|
-
const opChannel =
|
|
308933
|
+
const opChannel = asRecord23(operation.channel);
|
|
308743
308934
|
if (!opChannel) continue;
|
|
308744
308935
|
if (channel && opChannel === channel) return true;
|
|
308745
308936
|
const uid = opChannel["x-parser-unique-object-id"];
|
|
@@ -308792,7 +308983,7 @@ function collectMessageNodeIds(node, ids, path10) {
|
|
|
308792
308983
|
}
|
|
308793
308984
|
const children4 = node.children !== void 0 ? asArray16(node.children) : asArray16(node.item);
|
|
308794
308985
|
children4.forEach((child4, i) => {
|
|
308795
|
-
const record =
|
|
308986
|
+
const record = asRecord23(child4);
|
|
308796
308987
|
if (record) collectMessageNodeIds(record, ids, `${path10}/${i}`);
|
|
308797
308988
|
});
|
|
308798
308989
|
}
|
|
@@ -308835,7 +309026,7 @@ function validateWsBinding(channel, warnings) {
|
|
|
308835
309026
|
for (const key of ["query", "headers"]) {
|
|
308836
309027
|
const schema = binding[key];
|
|
308837
309028
|
if (schema === void 0) continue;
|
|
308838
|
-
const record =
|
|
309029
|
+
const record = asRecord23(schema);
|
|
308839
309030
|
if (!record || record.type !== void 0 && record.type !== "object") {
|
|
308840
309031
|
warnings.push(`ASYNCAPI_WS_BINDING_INVALID: channel ${channel.id} ws binding ${key} must be a Schema Object of type object`);
|
|
308841
309032
|
}
|
|
@@ -308871,7 +309062,7 @@ function instrumentAsyncApiCollection(collection, index) {
|
|
|
308871
309062
|
const expected = index.channels.reduce((sum, channel) => sum + channel.messages.length, 0);
|
|
308872
309063
|
const ids = [];
|
|
308873
309064
|
asArray16(collection.item).forEach((entry, i) => {
|
|
308874
|
-
const record =
|
|
309065
|
+
const record = asRecord23(entry);
|
|
308875
309066
|
if (record) collectMessageNodeIds(record, ids, `item/${i}`);
|
|
308876
309067
|
});
|
|
308877
309068
|
const unique = new Set(ids).size;
|
|
@@ -309647,7 +309838,7 @@ var validateRegistryServerSchema = (() => {
|
|
|
309647
309838
|
}
|
|
309648
309839
|
}
|
|
309649
309840
|
})();
|
|
309650
|
-
function
|
|
309841
|
+
function asRecord24(value) {
|
|
309651
309842
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
309652
309843
|
return value;
|
|
309653
309844
|
}
|
|
@@ -309662,7 +309853,7 @@ function registrySchemaKey(key) {
|
|
|
309662
309853
|
}
|
|
309663
309854
|
function normalizeRegistrySchemaValue(value) {
|
|
309664
309855
|
if (Array.isArray(value)) return value.map((entry) => normalizeRegistrySchemaValue(entry));
|
|
309665
|
-
const record =
|
|
309856
|
+
const record = asRecord24(value);
|
|
309666
309857
|
if (!record) return value;
|
|
309667
309858
|
const out = {};
|
|
309668
309859
|
for (const [key, entry] of Object.entries(record)) {
|
|
@@ -309678,7 +309869,7 @@ function normalizeRegistryPackageForSchema(pkg) {
|
|
|
309678
309869
|
}
|
|
309679
309870
|
function normalizeRegistryManifestForSchema(record) {
|
|
309680
309871
|
const out = normalizeRegistrySchemaValue(record);
|
|
309681
|
-
if (Array.isArray(record.packages)) out.packages = record.packages.map((entry) => normalizeRegistryPackageForSchema(
|
|
309872
|
+
if (Array.isArray(record.packages)) out.packages = record.packages.map((entry) => normalizeRegistryPackageForSchema(asRecord24(entry) ?? {}));
|
|
309682
309873
|
return out;
|
|
309683
309874
|
}
|
|
309684
309875
|
function isRegistrySchemaDocument(record) {
|
|
@@ -309740,7 +309931,7 @@ function validateUriTemplate(value) {
|
|
|
309740
309931
|
return { variables: [...variables] };
|
|
309741
309932
|
}
|
|
309742
309933
|
function sampleFromSchema2(schema, depth) {
|
|
309743
|
-
const record =
|
|
309934
|
+
const record = asRecord24(schema);
|
|
309744
309935
|
if (!record) return record === null ? null : {};
|
|
309745
309936
|
if (record.example !== void 0) return record.example;
|
|
309746
309937
|
if (record.default !== void 0) return record.default;
|
|
@@ -309756,7 +309947,7 @@ function sampleFromSchema2(schema, depth) {
|
|
|
309756
309947
|
switch (type) {
|
|
309757
309948
|
case "object":
|
|
309758
309949
|
case void 0: {
|
|
309759
|
-
const properties =
|
|
309950
|
+
const properties = asRecord24(record.properties);
|
|
309760
309951
|
if (!properties) return {};
|
|
309761
309952
|
const required = new Set(asArray17(record.required));
|
|
309762
309953
|
const out = {};
|
|
@@ -309796,10 +309987,10 @@ function registryInputValue(name, input) {
|
|
|
309796
309987
|
}
|
|
309797
309988
|
function registryVariableValues(variables) {
|
|
309798
309989
|
const out = {};
|
|
309799
|
-
const record =
|
|
309990
|
+
const record = asRecord24(variables);
|
|
309800
309991
|
if (!record) return out;
|
|
309801
309992
|
for (const [name, input] of Object.entries(record)) {
|
|
309802
|
-
const value =
|
|
309993
|
+
const value = asRecord24(input);
|
|
309803
309994
|
if (value) out[name] = registryInputValue(name, value);
|
|
309804
309995
|
}
|
|
309805
309996
|
return out;
|
|
@@ -309812,7 +310003,7 @@ function resolveRegistryVariables(value, variables, context, warnings) {
|
|
|
309812
310003
|
});
|
|
309813
310004
|
}
|
|
309814
310005
|
function registryHeaderKeyValues(headers, variables = {}, warnings = [], context = "remote header") {
|
|
309815
|
-
return asArray17(headers).map((entry) =>
|
|
310006
|
+
return asArray17(headers).map((entry) => asRecord24(entry)).filter((entry) => entry !== null && typeof entry.name === "string" && entry.name !== "").map((entry) => {
|
|
309816
310007
|
const name = String(entry.name);
|
|
309817
310008
|
const value = registryInputValue(name, entry);
|
|
309818
310009
|
const resolvedValue = resolveRegistryVariables(value, variables, `${context} ${name}`, warnings);
|
|
@@ -309820,7 +310011,7 @@ function registryHeaderKeyValues(headers, variables = {}, warnings = [], context
|
|
|
309820
310011
|
});
|
|
309821
310012
|
}
|
|
309822
310013
|
function registryEnvKeyValues(variables) {
|
|
309823
|
-
return asArray17(variables).map((entry) =>
|
|
310014
|
+
return asArray17(variables).map((entry) => asRecord24(entry)).filter((entry) => entry !== null && typeof entry.name === "string" && entry.name !== "").map((entry) => {
|
|
309824
310015
|
const name = String(entry.name);
|
|
309825
310016
|
const secret = pickValue(entry, "isSecret", "is_secret") === true;
|
|
309826
310017
|
const value = typeof entry.value === "string" && entry.value && !secret ? entry.value : `{{${name}}}`;
|
|
@@ -309830,7 +310021,7 @@ function registryEnvKeyValues(variables) {
|
|
|
309830
310021
|
function stringArguments(values) {
|
|
309831
310022
|
return asArray17(values).map((entry) => {
|
|
309832
310023
|
if (typeof entry === "string") return entry;
|
|
309833
|
-
const record =
|
|
310024
|
+
const record = asRecord24(entry);
|
|
309834
310025
|
if (!record) return "";
|
|
309835
310026
|
if (typeof record.name === "string" && record.name) {
|
|
309836
310027
|
return typeof record.value === "string" && record.value ? `${record.name}=${record.value}` : String(record.name);
|
|
@@ -309867,11 +310058,11 @@ function hasModernPackageShape(pkg) {
|
|
|
309867
310058
|
return ["registryType", "runtimeHint", "runtimeArguments", "packageArguments", "environmentVariables"].some((key) => hasOwn(pkg, key));
|
|
309868
310059
|
}
|
|
309869
310060
|
function packageDescriptor(pkg, id, warnings) {
|
|
309870
|
-
if (pkg.transport !== void 0 &&
|
|
310061
|
+
if (pkg.transport !== void 0 && asRecord24(pkg.transport) === null) {
|
|
309871
310062
|
warnings.push(`MCP_PACKAGE_TRANSPORT_INVALID: server ${id} package transport must be an object when present; the package is skipped`);
|
|
309872
310063
|
return null;
|
|
309873
310064
|
}
|
|
309874
|
-
const transport =
|
|
310065
|
+
const transport = asRecord24(pkg.transport);
|
|
309875
310066
|
const transportType = typeof transport?.type === "string" ? String(transport.type).toLowerCase() : "";
|
|
309876
310067
|
if (transport) {
|
|
309877
310068
|
if (!transportType) {
|
|
@@ -309917,11 +310108,11 @@ function clientConfigDescriptor(id, entry) {
|
|
|
309917
310108
|
`MCP_STREAMABLE_HTTP_AS_SSE: server ${id} declares a ${type || "http"} remote; the Postman mcp-request item models only sse/stdio transports, so it is emitted as sse and the endpoint must speak SSE or be adjusted in-app`
|
|
309918
310109
|
);
|
|
309919
310110
|
}
|
|
309920
|
-
const headers = Object.entries(
|
|
310111
|
+
const headers = Object.entries(asRecord24(entry.headers) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
309921
310112
|
return { id, transport: "sse", url, headers, env: [], warnings };
|
|
309922
310113
|
}
|
|
309923
310114
|
const command = [typeof entry.command === "string" ? entry.command : "", ...stringArguments(entry.args)].filter(Boolean).join(" ");
|
|
309924
|
-
const env = Object.entries(
|
|
310115
|
+
const env = Object.entries(asRecord24(entry.env) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
309925
310116
|
return { id, transport: "stdio", headers: [], command, env, warnings: [] };
|
|
309926
310117
|
}
|
|
309927
310118
|
function toolDescriptor(tool, warnings) {
|
|
@@ -309930,7 +310121,7 @@ function toolDescriptor(tool, warnings) {
|
|
|
309930
310121
|
warnings.push("MCP_TOOL_NAME_MISSING: a tools[] entry has no name; it is skipped and generates no tools/call template");
|
|
309931
310122
|
return null;
|
|
309932
310123
|
}
|
|
309933
|
-
const inputSchema =
|
|
310124
|
+
const inputSchema = asRecord24(tool.inputSchema) ?? void 0;
|
|
309934
310125
|
const toolWarnings = [];
|
|
309935
310126
|
if (!inputSchema) {
|
|
309936
310127
|
toolWarnings.push(`MCP_TOOL_NO_INPUT_SCHEMA: tool ${name} declares no inputSchema; its tools/call arguments are an empty object and are not schema-validated`);
|
|
@@ -309939,8 +310130,8 @@ function toolDescriptor(tool, warnings) {
|
|
|
309939
310130
|
name,
|
|
309940
310131
|
description: typeof tool.description === "string" ? tool.description : void 0,
|
|
309941
310132
|
inputSchema,
|
|
309942
|
-
outputSchema:
|
|
309943
|
-
annotations:
|
|
310133
|
+
outputSchema: asRecord24(tool.outputSchema) ?? void 0,
|
|
310134
|
+
annotations: asRecord24(tool.annotations) ?? void 0,
|
|
309944
310135
|
sampleArguments: inputSchema ? sampleFromSchema2(inputSchema, 0) : {},
|
|
309945
310136
|
warnings: toolWarnings
|
|
309946
310137
|
};
|
|
@@ -309969,7 +310160,7 @@ function resourceDescriptor(resource, warnings) {
|
|
|
309969
310160
|
if (resource.mimeType !== void 0 && typeof resource.mimeType !== "string") {
|
|
309970
310161
|
resourceWarnings.push(`MCP_RESOURCE_FIELD_INVALID: resource ${name} mimeType must be a string when present`);
|
|
309971
310162
|
}
|
|
309972
|
-
if (resource.annotations !== void 0 && !
|
|
310163
|
+
if (resource.annotations !== void 0 && !asRecord24(resource.annotations)) {
|
|
309973
310164
|
resourceWarnings.push(`MCP_RESOURCE_ANNOTATIONS_INVALID: resource ${name} annotations must be an object when present`);
|
|
309974
310165
|
}
|
|
309975
310166
|
return {
|
|
@@ -309978,8 +310169,8 @@ function resourceDescriptor(resource, warnings) {
|
|
|
309978
310169
|
description: asOptionalString(resource.description),
|
|
309979
310170
|
uri,
|
|
309980
310171
|
mimeType: asOptionalString(resource.mimeType),
|
|
309981
|
-
meta:
|
|
309982
|
-
annotations:
|
|
310172
|
+
meta: asRecord24(resource._meta) ?? void 0,
|
|
310173
|
+
annotations: asRecord24(resource.annotations) ?? void 0,
|
|
309983
310174
|
warnings: resourceWarnings
|
|
309984
310175
|
};
|
|
309985
310176
|
}
|
|
@@ -310008,7 +310199,7 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
310008
310199
|
if (template.mimeType !== void 0 && typeof template.mimeType !== "string") {
|
|
310009
310200
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_FIELD_INVALID: resource template ${name} mimeType must be a string when present`);
|
|
310010
310201
|
}
|
|
310011
|
-
if (template.annotations !== void 0 && !
|
|
310202
|
+
if (template.annotations !== void 0 && !asRecord24(template.annotations)) {
|
|
310012
310203
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_ANNOTATIONS_INVALID: resource template ${name} annotations must be an object when present`);
|
|
310013
310204
|
}
|
|
310014
310205
|
return {
|
|
@@ -310017,14 +310208,14 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
310017
310208
|
description: asOptionalString(template.description),
|
|
310018
310209
|
uriTemplate,
|
|
310019
310210
|
mimeType: asOptionalString(template.mimeType),
|
|
310020
|
-
meta:
|
|
310021
|
-
annotations:
|
|
310211
|
+
meta: asRecord24(template._meta) ?? void 0,
|
|
310212
|
+
annotations: asRecord24(template.annotations) ?? void 0,
|
|
310022
310213
|
variables: inspectedTemplate.variables,
|
|
310023
310214
|
warnings: templateWarnings
|
|
310024
310215
|
};
|
|
310025
310216
|
}
|
|
310026
310217
|
function promptArgumentDescriptor(promptName, argument, warnings, index) {
|
|
310027
|
-
const record =
|
|
310218
|
+
const record = asRecord24(argument);
|
|
310028
310219
|
if (!record) {
|
|
310029
310220
|
warnings.push(`MCP_PROMPT_ARGUMENT_INVALID: prompt ${promptName} argument[${index}] must be an object`);
|
|
310030
310221
|
return null;
|
|
@@ -310063,7 +310254,7 @@ function promptDescriptor(prompt, warnings) {
|
|
|
310063
310254
|
if (prompt.arguments !== void 0 && !Array.isArray(prompt.arguments)) {
|
|
310064
310255
|
promptWarnings.push(`MCP_PROMPT_ARGUMENTS_INVALID: prompt ${name} arguments must be an array when present`);
|
|
310065
310256
|
}
|
|
310066
|
-
if (prompt.annotations !== void 0 && !
|
|
310257
|
+
if (prompt.annotations !== void 0 && !asRecord24(prompt.annotations)) {
|
|
310067
310258
|
promptWarnings.push(`MCP_PROMPT_ANNOTATIONS_INVALID: prompt ${name} annotations must be an object when present`);
|
|
310068
310259
|
}
|
|
310069
310260
|
const seenArgumentNames = /* @__PURE__ */ new Set();
|
|
@@ -310082,8 +310273,8 @@ function promptDescriptor(prompt, warnings) {
|
|
|
310082
310273
|
name,
|
|
310083
310274
|
title: asOptionalString(prompt.title),
|
|
310084
310275
|
description: asOptionalString(prompt.description),
|
|
310085
|
-
meta:
|
|
310086
|
-
annotations:
|
|
310276
|
+
meta: asRecord24(prompt._meta) ?? void 0,
|
|
310277
|
+
annotations: asRecord24(prompt.annotations) ?? void 0,
|
|
310087
310278
|
arguments: argumentsList,
|
|
310088
310279
|
warnings: promptWarnings
|
|
310089
310280
|
};
|
|
@@ -310098,17 +310289,17 @@ function parseMcpServerSpec(content) {
|
|
|
310098
310289
|
} catch (error2) {
|
|
310099
310290
|
throw new Error(`MCP_PARSE_FAILED: MCP server description is not valid JSON: ${error2 instanceof Error ? error2.message : String(error2)}`, { cause: error2 });
|
|
310100
310291
|
}
|
|
310101
|
-
const documentJson =
|
|
310292
|
+
const documentJson = asRecord24(parsed);
|
|
310102
310293
|
if (!documentJson) {
|
|
310103
310294
|
throw new Error("MCP_PARSE_FAILED: MCP server description must be a JSON object");
|
|
310104
310295
|
}
|
|
310105
310296
|
const warnings = [];
|
|
310106
310297
|
const servers = [];
|
|
310107
310298
|
if (isRegistrySchemaDocument(documentJson)) warnings.push(...registrySchemaWarnings(documentJson));
|
|
310108
|
-
const mcpServers =
|
|
310299
|
+
const mcpServers = asRecord24(documentJson.mcpServers);
|
|
310109
310300
|
if (mcpServers) {
|
|
310110
310301
|
for (const [id, entry] of Object.entries(mcpServers)) {
|
|
310111
|
-
const record =
|
|
310302
|
+
const record = asRecord24(entry);
|
|
310112
310303
|
if (!record) {
|
|
310113
310304
|
warnings.push(`MCP_SERVER_ENTRY_INVALID: mcpServers.${id} is not an object; it is skipped`);
|
|
310114
310305
|
continue;
|
|
@@ -310117,8 +310308,8 @@ function parseMcpServerSpec(content) {
|
|
|
310117
310308
|
}
|
|
310118
310309
|
}
|
|
310119
310310
|
const registryName = typeof documentJson.name === "string" ? documentJson.name : "";
|
|
310120
|
-
const remotes = asArray17(documentJson.remotes).map((entry) =>
|
|
310121
|
-
const packages = asArray17(documentJson.packages).map((entry) =>
|
|
310311
|
+
const remotes = asArray17(documentJson.remotes).map((entry) => asRecord24(entry)).filter((entry) => entry !== null);
|
|
310312
|
+
const packages = asArray17(documentJson.packages).map((entry) => asRecord24(entry)).filter((entry) => entry !== null);
|
|
310122
310313
|
if (!mcpServers && (remotes.length > 0 || packages.length > 0)) {
|
|
310123
310314
|
const multi = remotes.length + packages.length > 1;
|
|
310124
310315
|
remotes.forEach((remote, i) => {
|
|
@@ -310133,7 +310324,7 @@ function parseMcpServerSpec(content) {
|
|
|
310133
310324
|
if (servers.length === 0) {
|
|
310134
310325
|
throw new Error("MCP_NO_SERVERS: MCP description defines no servers (no mcpServers entries, remotes, or packages); contract generation requires at least one server");
|
|
310135
310326
|
}
|
|
310136
|
-
const toolsRaw = asArray17(documentJson.tools).map((entry) =>
|
|
310327
|
+
const toolsRaw = asArray17(documentJson.tools).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((tool) => toolDescriptor(tool, warnings)).filter((tool) => tool !== null);
|
|
310137
310328
|
const seenToolNames = /* @__PURE__ */ new Set();
|
|
310138
310329
|
const tools = [];
|
|
310139
310330
|
for (const tool of toolsRaw) {
|
|
@@ -310145,7 +310336,7 @@ function parseMcpServerSpec(content) {
|
|
|
310145
310336
|
tools.push(tool);
|
|
310146
310337
|
}
|
|
310147
310338
|
tools.sort((a, b) => a.name.localeCompare(b.name));
|
|
310148
|
-
const resourcesRaw = asArray17(documentJson.resources).map((entry) =>
|
|
310339
|
+
const resourcesRaw = asArray17(documentJson.resources).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((resource) => resourceDescriptor(resource, warnings)).filter((resource) => resource !== null);
|
|
310149
310340
|
const seenResourceNames = /* @__PURE__ */ new Set();
|
|
310150
310341
|
const resources = [];
|
|
310151
310342
|
for (const resource of resourcesRaw) {
|
|
@@ -310157,7 +310348,7 @@ function parseMcpServerSpec(content) {
|
|
|
310157
310348
|
resources.push(resource);
|
|
310158
310349
|
}
|
|
310159
310350
|
resources.sort((a, b) => a.name.localeCompare(b.name));
|
|
310160
|
-
const resourceTemplatesRaw = asArray17(documentJson.resourceTemplates).map((entry) =>
|
|
310351
|
+
const resourceTemplatesRaw = asArray17(documentJson.resourceTemplates).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((template) => resourceTemplateDescriptor(template, warnings)).filter((template) => template !== null);
|
|
310161
310352
|
const seenTemplateNames = /* @__PURE__ */ new Set();
|
|
310162
310353
|
const resourceTemplates = [];
|
|
310163
310354
|
for (const template of resourceTemplatesRaw) {
|
|
@@ -310169,7 +310360,7 @@ function parseMcpServerSpec(content) {
|
|
|
310169
310360
|
resourceTemplates.push(template);
|
|
310170
310361
|
}
|
|
310171
310362
|
resourceTemplates.sort((a, b) => a.name.localeCompare(b.name));
|
|
310172
|
-
const promptsRaw = asArray17(documentJson.prompts).map((entry) =>
|
|
310363
|
+
const promptsRaw = asArray17(documentJson.prompts).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((prompt) => promptDescriptor(prompt, warnings)).filter((prompt) => prompt !== null);
|
|
310173
310364
|
const seenPromptNames = /* @__PURE__ */ new Set();
|
|
310174
310365
|
const prompts = [];
|
|
310175
310366
|
for (const prompt of promptsRaw) {
|
|
@@ -310181,10 +310372,10 @@ function parseMcpServerSpec(content) {
|
|
|
310181
310372
|
prompts.push(prompt);
|
|
310182
310373
|
}
|
|
310183
310374
|
prompts.sort((a, b) => a.name.localeCompare(b.name));
|
|
310184
|
-
const versionDetail =
|
|
310375
|
+
const versionDetail = asRecord24(documentJson.version_detail);
|
|
310185
310376
|
const version = typeof documentJson.version === "string" ? documentJson.version : typeof versionDetail?.version === "string" ? String(versionDetail.version) : void 0;
|
|
310186
310377
|
servers.sort((a, b) => a.id.localeCompare(b.id));
|
|
310187
|
-
const capabilities =
|
|
310378
|
+
const capabilities = asRecord24(documentJson.capabilities);
|
|
310188
310379
|
if (documentJson.capabilities !== void 0 && !capabilities) {
|
|
310189
310380
|
warnings.push(`MCP_CAPABILITIES_INVALID: top-level capabilities must be an object when present; got ${JSON.stringify(documentJson.capabilities)}`);
|
|
310190
310381
|
}
|
|
@@ -310921,7 +311112,7 @@ function oldSessionPingScript() {
|
|
|
310921
311112
|
|
|
310922
311113
|
// src/lib/protocols/mcp/mcp-collection-builder.ts
|
|
310923
311114
|
var MCP_TOOLS_LIST_PAGINATION_PROBE_COUNT = 5;
|
|
310924
|
-
function
|
|
311115
|
+
function asRecord25(value) {
|
|
310925
311116
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
310926
311117
|
return value;
|
|
310927
311118
|
}
|
|
@@ -310976,7 +311167,7 @@ function promptsListMessage() {
|
|
|
310976
311167
|
return jsonRpc(9, "prompts/list", {});
|
|
310977
311168
|
}
|
|
310978
311169
|
function toolArguments(tool) {
|
|
310979
|
-
return
|
|
311170
|
+
return asRecord25(tool.sampleArguments) ?? {};
|
|
310980
311171
|
}
|
|
310981
311172
|
function promptArguments(prompt) {
|
|
310982
311173
|
const out = {};
|
|
@@ -311280,7 +311471,7 @@ var MIME_TYPE_RE = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\/[A-Za-z0-9][A-Za-z0-9!#$&
|
|
|
311280
311471
|
var TOOL_FIELDS_2025_06_18 = /* @__PURE__ */ new Set(["name", "title", "description", "inputSchema", "outputSchema", "annotations", "_meta"]);
|
|
311281
311472
|
var JSON_RPC_STANDARD_ERROR_CODES = /* @__PURE__ */ new Set([-32700, -32600, -32601, -32602, -32603]);
|
|
311282
311473
|
var MCP_PROTOCOL_VERSIONS = /* @__PURE__ */ new Set(["2024-11-05", "2025-03-26", "2025-06-18", "2025-11-25"]);
|
|
311283
|
-
function
|
|
311474
|
+
function asRecord26(value) {
|
|
311284
311475
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
311285
311476
|
return value;
|
|
311286
311477
|
}
|
|
@@ -311296,7 +311487,7 @@ function isStrictBase64(value) {
|
|
|
311296
311487
|
}
|
|
311297
311488
|
}
|
|
311298
311489
|
function walkDocument(value, path10, visit4) {
|
|
311299
|
-
const record =
|
|
311490
|
+
const record = asRecord26(value);
|
|
311300
311491
|
if (record) {
|
|
311301
311492
|
visit4(record, path10);
|
|
311302
311493
|
for (const [key, child4] of Object.entries(record)) walkDocument(child4, `${path10}.${key}`, visit4);
|
|
@@ -311309,10 +311500,10 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311309
311500
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type must be a string`);
|
|
311310
311501
|
return;
|
|
311311
311502
|
}
|
|
311312
|
-
if (block2.annotations !== void 0 &&
|
|
311503
|
+
if (block2.annotations !== void 0 && asRecord26(block2.annotations) === null) {
|
|
311313
311504
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} annotations must be an object when present`);
|
|
311314
311505
|
}
|
|
311315
|
-
if (block2._meta !== void 0 &&
|
|
311506
|
+
if (block2._meta !== void 0 && asRecord26(block2._meta) === null) {
|
|
311316
311507
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} _meta must be an object when present`);
|
|
311317
311508
|
}
|
|
311318
311509
|
if (block2.type === "text") {
|
|
@@ -311325,7 +311516,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311325
311516
|
return;
|
|
311326
311517
|
}
|
|
311327
311518
|
if (block2.type === "resource") {
|
|
311328
|
-
const resource =
|
|
311519
|
+
const resource = asRecord26(block2.resource);
|
|
311329
311520
|
if (!resource) {
|
|
311330
311521
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} resource content block must carry a resource object`);
|
|
311331
311522
|
return;
|
|
@@ -311339,7 +311530,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
311339
311530
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type "${block2.type}" is not a known MCP 2025-06-18 content discriminator`);
|
|
311340
311531
|
}
|
|
311341
311532
|
function validateStaticResultFixture(record, path10, warnings) {
|
|
311342
|
-
const result =
|
|
311533
|
+
const result = asRecord26(record.result);
|
|
311343
311534
|
if (!result) return;
|
|
311344
311535
|
for (const key of ["tools", "resources", "prompts"]) {
|
|
311345
311536
|
if (result[key] !== void 0 && !Array.isArray(result[key])) warnings.push(`MCP_STATIC_PAGINATION_RESULT_INVALID: ${path10}.${key} must be an array in static list-result fixtures`);
|
|
@@ -311349,8 +311540,8 @@ function validateStaticResultFixture(record, path10, warnings) {
|
|
|
311349
311540
|
}
|
|
311350
311541
|
if (result.protocolVersion !== void 0 || result.capabilities !== void 0 || result.serverInfo !== void 0) {
|
|
311351
311542
|
if (typeof result.protocolVersion !== "string" || !MCP_PROTOCOL_VERSIONS.has(result.protocolVersion)) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.protocolVersion must be a supported MCP protocol version`);
|
|
311352
|
-
if (
|
|
311353
|
-
const serverInfo =
|
|
311543
|
+
if (asRecord26(result.capabilities) === null) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.capabilities must be an object`);
|
|
311544
|
+
const serverInfo = asRecord26(result.serverInfo);
|
|
311354
311545
|
if (!serverInfo) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.serverInfo must be an object`);
|
|
311355
311546
|
else {
|
|
311356
311547
|
if (typeof serverInfo.name !== "string" || !serverInfo.name) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path10}.serverInfo.name must be a non-empty string`);
|
|
@@ -311360,7 +311551,7 @@ function validateStaticResultFixture(record, path10, warnings) {
|
|
|
311360
311551
|
}
|
|
311361
311552
|
function validateStaticJsonRpcFixtures(index, warnings) {
|
|
311362
311553
|
walkDocument(index.documentJson, "$", (record, path10) => {
|
|
311363
|
-
const error2 =
|
|
311554
|
+
const error2 = asRecord26(record.error);
|
|
311364
311555
|
if (record.jsonrpc === "2.0" && error2) {
|
|
311365
311556
|
if (typeof error2.code !== "number" || Math.floor(error2.code) !== error2.code) warnings.push(`MCP_STATIC_ERROR_CODE_INVALID: ${path10}.error.code must be an integer JSON-RPC error code`);
|
|
311366
311557
|
else if (error2.code >= -32768 && error2.code <= -32e3 && !JSON_RPC_STANDARD_ERROR_CODES.has(error2.code) && !(error2.code >= -32099 && error2.code <= -32e3)) warnings.push(`MCP_STATIC_ERROR_CODE_INVALID: ${path10}.error.code ${error2.code} is inside the reserved JSON-RPC range but is not a standard or server-error code`);
|
|
@@ -311369,19 +311560,19 @@ function validateStaticJsonRpcFixtures(index, warnings) {
|
|
|
311369
311560
|
validateStaticResultFixture(record, path10, warnings);
|
|
311370
311561
|
if (Array.isArray(record.content)) {
|
|
311371
311562
|
record.content.forEach((entry, i) => {
|
|
311372
|
-
const block2 =
|
|
311563
|
+
const block2 = asRecord26(entry);
|
|
311373
311564
|
if (block2) validateStaticContentBlock(block2, `${path10}.content[${i}]`, warnings);
|
|
311374
311565
|
});
|
|
311375
311566
|
}
|
|
311376
311567
|
if (Array.isArray(record.messages)) {
|
|
311377
311568
|
record.messages.forEach((entry, i) => {
|
|
311378
|
-
const message =
|
|
311569
|
+
const message = asRecord26(entry);
|
|
311379
311570
|
if (!message) {
|
|
311380
311571
|
warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}] must be an object`);
|
|
311381
311572
|
return;
|
|
311382
311573
|
}
|
|
311383
311574
|
if (message.role !== "user" && message.role !== "assistant") warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}].role must be user or assistant`);
|
|
311384
|
-
const content =
|
|
311575
|
+
const content = asRecord26(message.content);
|
|
311385
311576
|
if (!content) warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path10}.messages[${i}].content must be a content block object`);
|
|
311386
311577
|
else validateStaticContentBlock(content, `${path10}.messages[${i}].content`, warnings);
|
|
311387
311578
|
});
|
|
@@ -311395,10 +311586,10 @@ function walkManifest(value, path10, warnings) {
|
|
|
311395
311586
|
return;
|
|
311396
311587
|
}
|
|
311397
311588
|
const record = value;
|
|
311398
|
-
if (Object.prototype.hasOwnProperty.call(record, "_meta") &&
|
|
311589
|
+
if (Object.prototype.hasOwnProperty.call(record, "_meta") && asRecord26(record._meta) === null) {
|
|
311399
311590
|
warnings.push(`MCP_META_OBJECT_INVALID: ${path10}._meta must be an object when present (MCP 2025-06-18 BaseMetadata)`);
|
|
311400
311591
|
}
|
|
311401
|
-
const meta =
|
|
311592
|
+
const meta = asRecord26(record._meta);
|
|
311402
311593
|
if (meta) {
|
|
311403
311594
|
for (const key of Object.keys(meta)) {
|
|
311404
311595
|
if (!META_KEY_RE.test(key)) {
|
|
@@ -311417,7 +311608,7 @@ function walkManifest(value, path10, warnings) {
|
|
|
311417
311608
|
}
|
|
311418
311609
|
function validateManifestDocument(index, warnings) {
|
|
311419
311610
|
walkManifest(index.documentJson, "$", warnings);
|
|
311420
|
-
const tools = asArray18(index.documentJson.tools).map((entry) =>
|
|
311611
|
+
const tools = asArray18(index.documentJson.tools).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
311421
311612
|
const seen = /* @__PURE__ */ new Set();
|
|
311422
311613
|
for (const tool of tools) {
|
|
311423
311614
|
const name = typeof tool.name === "string" ? tool.name : "<unnamed>";
|
|
@@ -311436,7 +311627,7 @@ function validateManifestDocument(index, warnings) {
|
|
|
311436
311627
|
warnings.push(`MCP_TOOL_FIELD_UNKNOWN_2025_06_18: tool ${name} field "${field}" is not part of the MCP 2025-06-18 Tool object`);
|
|
311437
311628
|
}
|
|
311438
311629
|
}
|
|
311439
|
-
const annotations =
|
|
311630
|
+
const annotations = asRecord26(tool.annotations);
|
|
311440
311631
|
if (typeof tool.title === "string" && typeof annotations?.title === "string") {
|
|
311441
311632
|
warnings.push(`MCP_TOOL_TITLE_PRECEDENCE: tool ${name} declares both title and annotations.title; clients should prefer title for MCP 2025-06-18 display metadata`);
|
|
311442
311633
|
}
|
|
@@ -311457,7 +311648,7 @@ function validateCapabilities(index, warnings) {
|
|
|
311457
311648
|
shaped[name] = null;
|
|
311458
311649
|
continue;
|
|
311459
311650
|
}
|
|
311460
|
-
const record =
|
|
311651
|
+
const record = asRecord26(value);
|
|
311461
311652
|
if (!record) {
|
|
311462
311653
|
warnings.push(`MCP_CAPABILITY_SHAPE_INVALID: capabilities.${name} must be an object when present; got ${JSON.stringify(value)}`);
|
|
311463
311654
|
shaped[name] = null;
|
|
@@ -311513,7 +311704,7 @@ function itemServerScope(itemTitle) {
|
|
|
311513
311704
|
return separator === -1 ? itemTitle : itemTitle.slice(0, separator);
|
|
311514
311705
|
}
|
|
311515
311706
|
function assertRecordValue(value, reason, fail2) {
|
|
311516
|
-
const record =
|
|
311707
|
+
const record = asRecord26(value);
|
|
311517
311708
|
if (!record) fail2(reason);
|
|
311518
311709
|
return record;
|
|
311519
311710
|
}
|
|
@@ -311535,7 +311726,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311535
311726
|
} catch {
|
|
311536
311727
|
return fail2("message is not valid JSON");
|
|
311537
311728
|
}
|
|
311538
|
-
const record =
|
|
311729
|
+
const record = asRecord26(parsed);
|
|
311539
311730
|
if (!record) return fail2("message is not a JSON object");
|
|
311540
311731
|
if (record.jsonrpc !== "2.0") return fail2('jsonrpc must be the string "2.0"');
|
|
311541
311732
|
if (typeof record.method !== "string" || !record.method) return fail2("method must be a non-empty string");
|
|
@@ -311547,7 +311738,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311547
311738
|
} else {
|
|
311548
311739
|
return fail2("id must be a string or number");
|
|
311549
311740
|
}
|
|
311550
|
-
if (record.params !== void 0 &&
|
|
311741
|
+
if (record.params !== void 0 && asRecord26(record.params) === null) return fail2("params must be an object when present");
|
|
311551
311742
|
switch (record.method) {
|
|
311552
311743
|
case "notifications/initialized":
|
|
311553
311744
|
assertOptionalObjectParams(record, "notifications/initialized", fail2);
|
|
@@ -311580,14 +311771,14 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
311580
311771
|
case "prompts/get": {
|
|
311581
311772
|
const params = assertObjectParams(record, "prompts/get", fail2);
|
|
311582
311773
|
if (typeof params.name !== "string" || !params.name) fail2("prompts/get params.name must be a non-empty string");
|
|
311583
|
-
if (params.arguments !== void 0 &&
|
|
311774
|
+
if (params.arguments !== void 0 && asRecord26(params.arguments) === null) fail2("prompts/get params.arguments must be an object when present");
|
|
311584
311775
|
break;
|
|
311585
311776
|
}
|
|
311586
311777
|
case "tools/call": {
|
|
311587
311778
|
const params = assertObjectParams(record, "tools/call", fail2);
|
|
311588
311779
|
if (typeof params.name !== "string" || !params.name) fail2("tools/call params.name must be a non-empty string");
|
|
311589
|
-
if (params.arguments !== void 0 &&
|
|
311590
|
-
if (params._meta !== void 0 &&
|
|
311780
|
+
if (params.arguments !== void 0 && asRecord26(params.arguments) === null) fail2("tools/call params.arguments must be an object when present");
|
|
311781
|
+
if (params._meta !== void 0 && asRecord26(params._meta) === null) fail2("tools/call params._meta must be an object when present");
|
|
311591
311782
|
break;
|
|
311592
311783
|
}
|
|
311593
311784
|
case "ping":
|
|
@@ -311688,7 +311879,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
311688
311879
|
validateAnnotatedDeclarations(index, warnings);
|
|
311689
311880
|
validateStaticJsonRpcFixtures(index, warnings);
|
|
311690
311881
|
for (const tool of index.tools) warnings.push(...toolsCallScript(index, tool).warnings);
|
|
311691
|
-
const items = asArray18(collection.item).map((entry) =>
|
|
311882
|
+
const items = asArray18(collection.item).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
311692
311883
|
const ids = [];
|
|
311693
311884
|
const httpIds = [];
|
|
311694
311885
|
const requestIdsByServer = /* @__PURE__ */ new Set();
|
|
@@ -311696,7 +311887,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
311696
311887
|
if (String(item.type) === "mcp-request") {
|
|
311697
311888
|
ids.push(typeof item.id === "string" && item.id ? item.id : `#${ids.length}`);
|
|
311698
311889
|
const itemTitle = String(item.title ?? item.id ?? "mcp-request");
|
|
311699
|
-
const request = assertJsonRpcRequest(
|
|
311890
|
+
const request = assertJsonRpcRequest(asRecord26(item.payload)?.message, itemTitle);
|
|
311700
311891
|
if (request.id !== void 0) {
|
|
311701
311892
|
const scopedId = `${itemServerScope(itemTitle)}\0${typeof request.id === "number" ? `n:${request.id}` : `s:${request.id}`}`;
|
|
311702
311893
|
if (requestIdsByServer.has(scopedId)) {
|