@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/cli.cjs
CHANGED
|
@@ -12235,7 +12235,7 @@ var require_response = __commonJS({
|
|
|
12235
12235
|
var assert = require("node:assert");
|
|
12236
12236
|
var { types: types2 } = require("node:util");
|
|
12237
12237
|
var textEncoder = new TextEncoder("utf-8");
|
|
12238
|
-
var
|
|
12238
|
+
var Response2 = class _Response {
|
|
12239
12239
|
// Creates network error Response.
|
|
12240
12240
|
static error() {
|
|
12241
12241
|
const responseObject = fromInnerResponse(makeNetworkError(), "immutable");
|
|
@@ -12378,8 +12378,8 @@ var require_response = __commonJS({
|
|
|
12378
12378
|
return `Response ${nodeUtil.formatWithOptions(options, properties)}`;
|
|
12379
12379
|
}
|
|
12380
12380
|
};
|
|
12381
|
-
mixinBody(
|
|
12382
|
-
Object.defineProperties(
|
|
12381
|
+
mixinBody(Response2);
|
|
12382
|
+
Object.defineProperties(Response2.prototype, {
|
|
12383
12383
|
type: kEnumerableProperty,
|
|
12384
12384
|
url: kEnumerableProperty,
|
|
12385
12385
|
status: kEnumerableProperty,
|
|
@@ -12395,7 +12395,7 @@ var require_response = __commonJS({
|
|
|
12395
12395
|
configurable: true
|
|
12396
12396
|
}
|
|
12397
12397
|
});
|
|
12398
|
-
Object.defineProperties(
|
|
12398
|
+
Object.defineProperties(Response2, {
|
|
12399
12399
|
json: kEnumerableProperty,
|
|
12400
12400
|
redirect: kEnumerableProperty,
|
|
12401
12401
|
error: kEnumerableProperty
|
|
@@ -12528,7 +12528,7 @@ var require_response = __commonJS({
|
|
|
12528
12528
|
}
|
|
12529
12529
|
}
|
|
12530
12530
|
function fromInnerResponse(innerResponse, guard) {
|
|
12531
|
-
const response = new
|
|
12531
|
+
const response = new Response2(kConstruct);
|
|
12532
12532
|
response[kState] = innerResponse;
|
|
12533
12533
|
response[kHeaders] = new Headers3(kConstruct);
|
|
12534
12534
|
setHeadersList(response[kHeaders], innerResponse.headersList);
|
|
@@ -12596,7 +12596,7 @@ var require_response = __commonJS({
|
|
|
12596
12596
|
makeResponse,
|
|
12597
12597
|
makeAppropriateNetworkError,
|
|
12598
12598
|
filterResponse,
|
|
12599
|
-
Response,
|
|
12599
|
+
Response: Response2,
|
|
12600
12600
|
cloneResponse,
|
|
12601
12601
|
fromInnerResponse
|
|
12602
12602
|
};
|
|
@@ -15268,7 +15268,7 @@ var require_cache = __commonJS({
|
|
|
15268
15268
|
var { urlEquals, getFieldValues } = require_util5();
|
|
15269
15269
|
var { kEnumerableProperty, isDisturbed } = require_util();
|
|
15270
15270
|
var { webidl } = require_webidl();
|
|
15271
|
-
var { Response, cloneResponse, fromInnerResponse } = require_response();
|
|
15271
|
+
var { Response: Response2, cloneResponse, fromInnerResponse } = require_response();
|
|
15272
15272
|
var { Request, fromInnerRequest } = require_request2();
|
|
15273
15273
|
var { kState } = require_symbols2();
|
|
15274
15274
|
var { fetching } = require_fetch();
|
|
@@ -15795,7 +15795,7 @@ var require_cache = __commonJS({
|
|
|
15795
15795
|
converter: webidl.converters.DOMString
|
|
15796
15796
|
}
|
|
15797
15797
|
]);
|
|
15798
|
-
webidl.converters.Response = webidl.interfaceConverter(
|
|
15798
|
+
webidl.converters.Response = webidl.interfaceConverter(Response2);
|
|
15799
15799
|
webidl.converters["sequence<RequestInfo>"] = webidl.sequenceConverter(
|
|
15800
15800
|
webidl.converters.RequestInfo
|
|
15801
15801
|
);
|
|
@@ -98552,7 +98552,7 @@ var require_response2 = __commonJS({
|
|
|
98552
98552
|
}
|
|
98553
98553
|
return stream;
|
|
98554
98554
|
};
|
|
98555
|
-
var
|
|
98555
|
+
var Response2;
|
|
98556
98556
|
_.inherit(
|
|
98557
98557
|
/**
|
|
98558
98558
|
* Response holds data related to the request body. By default, it provides a nice wrapper for url-encoded,
|
|
@@ -98563,14 +98563,14 @@ var require_response2 = __commonJS({
|
|
|
98563
98563
|
*
|
|
98564
98564
|
* @param {Response.definition} options -
|
|
98565
98565
|
*/
|
|
98566
|
-
|
|
98567
|
-
|
|
98566
|
+
Response2 = function PostmanResponse(options) {
|
|
98567
|
+
Response2.super_.apply(this, arguments);
|
|
98568
98568
|
this.update(options || {});
|
|
98569
98569
|
},
|
|
98570
98570
|
Property
|
|
98571
98571
|
);
|
|
98572
98572
|
_.assign(
|
|
98573
|
-
|
|
98573
|
+
Response2.prototype,
|
|
98574
98574
|
/** @lends Response.prototype */
|
|
98575
98575
|
{
|
|
98576
98576
|
update(options) {
|
|
@@ -98636,7 +98636,7 @@ var require_response2 = __commonJS({
|
|
|
98636
98636
|
}
|
|
98637
98637
|
);
|
|
98638
98638
|
_.assign(
|
|
98639
|
-
|
|
98639
|
+
Response2.prototype,
|
|
98640
98640
|
/** @lends Response.prototype */
|
|
98641
98641
|
{
|
|
98642
98642
|
/**
|
|
@@ -98814,7 +98814,7 @@ var require_response2 = __commonJS({
|
|
|
98814
98814
|
}
|
|
98815
98815
|
);
|
|
98816
98816
|
_.assign(
|
|
98817
|
-
|
|
98817
|
+
Response2,
|
|
98818
98818
|
/** @lends Response */
|
|
98819
98819
|
{
|
|
98820
98820
|
/**
|
|
@@ -98832,7 +98832,7 @@ var require_response2 = __commonJS({
|
|
|
98832
98832
|
* @returns {Boolean}
|
|
98833
98833
|
*/
|
|
98834
98834
|
isResponse: function(obj) {
|
|
98835
|
-
return Boolean(obj) && (obj instanceof
|
|
98835
|
+
return Boolean(obj) && (obj instanceof Response2 || _.inSuperChain(obj.constructor, "_postman_propertyName", Response2._postman_propertyName));
|
|
98836
98836
|
},
|
|
98837
98837
|
/**
|
|
98838
98838
|
* Converts the response object from the request module to the postman responseBody format
|
|
@@ -98843,7 +98843,7 @@ var require_response2 = __commonJS({
|
|
|
98843
98843
|
* @todo Add a key: `originalRequest` to the returned object as well, referring to response.request
|
|
98844
98844
|
*/
|
|
98845
98845
|
createFromNode: function(response, cookies) {
|
|
98846
|
-
return new
|
|
98846
|
+
return new Response2({
|
|
98847
98847
|
cookie: cookies,
|
|
98848
98848
|
body: response.body.toString(),
|
|
98849
98849
|
stream: response.body,
|
|
@@ -98922,7 +98922,7 @@ var require_response2 = __commonJS({
|
|
|
98922
98922
|
}
|
|
98923
98923
|
);
|
|
98924
98924
|
module2.exports = {
|
|
98925
|
-
Response
|
|
98925
|
+
Response: Response2
|
|
98926
98926
|
};
|
|
98927
98927
|
}
|
|
98928
98928
|
});
|
|
@@ -98936,7 +98936,7 @@ var require_item = __commonJS({
|
|
|
98936
98936
|
var EventList = require_event_list().EventList;
|
|
98937
98937
|
var Request = require_request12().Request;
|
|
98938
98938
|
var RequestAuth = require_request_auth().RequestAuth;
|
|
98939
|
-
var
|
|
98939
|
+
var Response2 = require_response2().Response;
|
|
98940
98940
|
var Item;
|
|
98941
98941
|
var OBJECT2 = "object";
|
|
98942
98942
|
var STRING2 = "string";
|
|
@@ -99003,7 +99003,7 @@ var require_item = __commonJS({
|
|
|
99003
99003
|
*
|
|
99004
99004
|
* @type {PropertyList<Response>}
|
|
99005
99005
|
*/
|
|
99006
|
-
responses: new PropertyList(
|
|
99006
|
+
responses: new PropertyList(Response2, this, definition && definition.response),
|
|
99007
99007
|
/**
|
|
99008
99008
|
* Events are a set of of {@link Script}s that are executed when certain activities are triggered on an
|
|
99009
99009
|
* Item. For example, on defining an event that listens to the "test" event, would cause the associated
|
|
@@ -105144,7 +105144,7 @@ var require_scope_functions = __commonJS({
|
|
|
105144
105144
|
const normal = Math.floor(multiple + 0.5);
|
|
105145
105145
|
return normal / factor === value && normal % factorMultiple === 0;
|
|
105146
105146
|
};
|
|
105147
|
-
var
|
|
105147
|
+
var deepEqual2 = (obj, obj2) => {
|
|
105148
105148
|
if (obj === obj2) return true;
|
|
105149
105149
|
if (!obj || !obj2 || typeof obj !== typeof obj2) return false;
|
|
105150
105150
|
if (obj !== obj2 && typeof obj !== "object") return false;
|
|
@@ -105153,18 +105153,18 @@ var require_scope_functions = __commonJS({
|
|
|
105153
105153
|
if (proto === Array.prototype) {
|
|
105154
105154
|
if (!Array.isArray(obj) || !Array.isArray(obj2)) return false;
|
|
105155
105155
|
if (obj.length !== obj2.length) return false;
|
|
105156
|
-
return obj.every((x, i) =>
|
|
105156
|
+
return obj.every((x, i) => deepEqual2(x, obj2[i]));
|
|
105157
105157
|
} else if (proto === Object.prototype) {
|
|
105158
105158
|
const [keys, keys2] = [Object.keys(obj), Object.keys(obj2)];
|
|
105159
105159
|
if (keys.length !== keys2.length) return false;
|
|
105160
105160
|
const keyset2 = /* @__PURE__ */ new Set([...keys, ...keys2]);
|
|
105161
|
-
return keyset2.size === keys.length && keys.every((key) =>
|
|
105161
|
+
return keyset2.size === keys.length && keys.every((key) => deepEqual2(obj[key], obj2[key]));
|
|
105162
105162
|
}
|
|
105163
105163
|
return false;
|
|
105164
105164
|
};
|
|
105165
105165
|
var unique = (array) => {
|
|
105166
105166
|
if (array.length < 2) return true;
|
|
105167
|
-
if (array.length === 2) return !
|
|
105167
|
+
if (array.length === 2) return !deepEqual2(array[0], array[1]);
|
|
105168
105168
|
const objects = [];
|
|
105169
105169
|
const primitives = array.length > 20 ? /* @__PURE__ */ new Set() : null;
|
|
105170
105170
|
let primitivesCount = 0;
|
|
@@ -105181,7 +105181,7 @@ var require_scope_functions = __commonJS({
|
|
|
105181
105181
|
pos++;
|
|
105182
105182
|
}
|
|
105183
105183
|
for (let i = 1; i < objects.length; i++)
|
|
105184
|
-
for (let j = 0; j < i; j++) if (
|
|
105184
|
+
for (let j = 0; j < i; j++) if (deepEqual2(objects[i], objects[j])) return false;
|
|
105185
105185
|
return true;
|
|
105186
105186
|
};
|
|
105187
105187
|
var deBase64 = (string) => {
|
|
@@ -105200,7 +105200,7 @@ var require_scope_functions = __commonJS({
|
|
|
105200
105200
|
var propertyIn = (key, [properties, patterns]) => properties.includes(true) || properties.some((prop) => prop === key) || patterns.some((pattern) => new RegExp(pattern, "u").test(key));
|
|
105201
105201
|
var dynamicResolve = (anchors, id) => (anchors.filter((x) => x[id])[0] || {})[id];
|
|
105202
105202
|
var extraUtils = { toPointer, pointerPart, errorMerge, propertyIn, dynamicResolve };
|
|
105203
|
-
module2.exports = { stringLength, isMultipleOf, deepEqual, unique, deBase64, hasOwn: hasOwn2, ...extraUtils };
|
|
105203
|
+
module2.exports = { stringLength, isMultipleOf, deepEqual: deepEqual2, unique, deBase64, hasOwn: hasOwn2, ...extraUtils };
|
|
105204
105204
|
}
|
|
105205
105205
|
});
|
|
105206
105206
|
|
|
@@ -107131,9 +107131,9 @@ var require_src = __commonJS({
|
|
|
107131
107131
|
var genfun = require_generate_function();
|
|
107132
107132
|
var { buildSchemas } = require_pointer();
|
|
107133
107133
|
var { compile } = require_compile();
|
|
107134
|
-
var { deepEqual } = require_scope_functions();
|
|
107134
|
+
var { deepEqual: deepEqual2 } = require_scope_functions();
|
|
107135
107135
|
var jsonCheckWithErrors = (validate4) => function validateIsJSON(data) {
|
|
107136
|
-
if (!
|
|
107136
|
+
if (!deepEqual2(data, JSON.parse(JSON.stringify(data)))) {
|
|
107137
107137
|
validateIsJSON.errors = [{ instanceLocation: "#", error: "not JSON compatible" }];
|
|
107138
107138
|
return false;
|
|
107139
107139
|
}
|
|
@@ -107141,7 +107141,7 @@ var require_src = __commonJS({
|
|
|
107141
107141
|
validateIsJSON.errors = validate4.errors;
|
|
107142
107142
|
return res;
|
|
107143
107143
|
};
|
|
107144
|
-
var jsonCheckWithoutErrors = (validate4) => (data) =>
|
|
107144
|
+
var jsonCheckWithoutErrors = (validate4) => (data) => deepEqual2(data, JSON.parse(JSON.stringify(data))) && validate4(data);
|
|
107145
107145
|
var validator3 = (schema, { parse: parse10 = false, multi = false, jsonCheck = false, isJSON = false, schemas = [], ...opts } = {}) => {
|
|
107146
107146
|
if (jsonCheck && isJSON) throw new Error("Can not specify both isJSON and jsonCheck options");
|
|
107147
107147
|
if (parse10 && (jsonCheck || isJSON))
|
|
@@ -107157,7 +107157,7 @@ var require_src = __commonJS({
|
|
|
107157
107157
|
if (parse10) {
|
|
107158
107158
|
scope.parseWrap = opts.includeErrors ? parseWithErrors : parseWithoutErrors;
|
|
107159
107159
|
} else if (jsonCheck) {
|
|
107160
|
-
scope.deepEqual =
|
|
107160
|
+
scope.deepEqual = deepEqual2;
|
|
107161
107161
|
scope.jsonCheckWrap = opts.includeErrors ? jsonCheckWithErrors : jsonCheckWithoutErrors;
|
|
107162
107162
|
}
|
|
107163
107163
|
if (multi) {
|
|
@@ -140245,7 +140245,7 @@ var require_lib10 = __commonJS({
|
|
|
140245
140245
|
}
|
|
140246
140246
|
var INTERNALS$1 = /* @__PURE__ */ Symbol("Response internals");
|
|
140247
140247
|
var STATUS_CODES = http.STATUS_CODES;
|
|
140248
|
-
var
|
|
140248
|
+
var Response2 = class _Response {
|
|
140249
140249
|
constructor() {
|
|
140250
140250
|
let body2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
140251
140251
|
let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -140303,8 +140303,8 @@ var require_lib10 = __commonJS({
|
|
|
140303
140303
|
});
|
|
140304
140304
|
}
|
|
140305
140305
|
};
|
|
140306
|
-
Body.mixIn(
|
|
140307
|
-
Object.defineProperties(
|
|
140306
|
+
Body.mixIn(Response2.prototype);
|
|
140307
|
+
Object.defineProperties(Response2.prototype, {
|
|
140308
140308
|
url: { enumerable: true },
|
|
140309
140309
|
status: { enumerable: true },
|
|
140310
140310
|
ok: { enumerable: true },
|
|
@@ -140313,7 +140313,7 @@ var require_lib10 = __commonJS({
|
|
|
140313
140313
|
headers: { enumerable: true },
|
|
140314
140314
|
clone: { enumerable: true }
|
|
140315
140315
|
});
|
|
140316
|
-
Object.defineProperty(
|
|
140316
|
+
Object.defineProperty(Response2.prototype, Symbol.toStringTag, {
|
|
140317
140317
|
value: "Response",
|
|
140318
140318
|
writable: false,
|
|
140319
140319
|
enumerable: false,
|
|
@@ -140622,7 +140622,7 @@ var require_lib10 = __commonJS({
|
|
|
140622
140622
|
};
|
|
140623
140623
|
const codings = headers.get("Content-Encoding");
|
|
140624
140624
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
140625
|
-
response = new
|
|
140625
|
+
response = new Response2(body2, response_options);
|
|
140626
140626
|
resolve4(response);
|
|
140627
140627
|
return;
|
|
140628
140628
|
}
|
|
@@ -140632,7 +140632,7 @@ var require_lib10 = __commonJS({
|
|
|
140632
140632
|
};
|
|
140633
140633
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
140634
140634
|
body2 = body2.pipe(zlib.createGunzip(zlibOptions));
|
|
140635
|
-
response = new
|
|
140635
|
+
response = new Response2(body2, response_options);
|
|
140636
140636
|
resolve4(response);
|
|
140637
140637
|
return;
|
|
140638
140638
|
}
|
|
@@ -140644,18 +140644,18 @@ var require_lib10 = __commonJS({
|
|
|
140644
140644
|
} else {
|
|
140645
140645
|
body2 = body2.pipe(zlib.createInflateRaw());
|
|
140646
140646
|
}
|
|
140647
|
-
response = new
|
|
140647
|
+
response = new Response2(body2, response_options);
|
|
140648
140648
|
resolve4(response);
|
|
140649
140649
|
});
|
|
140650
140650
|
return;
|
|
140651
140651
|
}
|
|
140652
140652
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
140653
140653
|
body2 = body2.pipe(zlib.createBrotliDecompress());
|
|
140654
|
-
response = new
|
|
140654
|
+
response = new Response2(body2, response_options);
|
|
140655
140655
|
resolve4(response);
|
|
140656
140656
|
return;
|
|
140657
140657
|
}
|
|
140658
|
-
response = new
|
|
140658
|
+
response = new Response2(body2, response_options);
|
|
140659
140659
|
resolve4(response);
|
|
140660
140660
|
});
|
|
140661
140661
|
writeToStream(req, request);
|
|
@@ -140670,7 +140670,7 @@ var require_lib10 = __commonJS({
|
|
|
140670
140670
|
exports2.default = exports2;
|
|
140671
140671
|
exports2.Headers = Headers3;
|
|
140672
140672
|
exports2.Request = Request;
|
|
140673
|
-
exports2.Response =
|
|
140673
|
+
exports2.Response = Response2;
|
|
140674
140674
|
exports2.FetchError = FetchError;
|
|
140675
140675
|
}
|
|
140676
140676
|
});
|
|
@@ -148291,7 +148291,7 @@ var require_lib11 = __commonJS({
|
|
|
148291
148291
|
}
|
|
148292
148292
|
var INTERNALS$1 = /* @__PURE__ */ Symbol("Response internals");
|
|
148293
148293
|
var STATUS_CODES = http.STATUS_CODES;
|
|
148294
|
-
var
|
|
148294
|
+
var Response2 = class _Response {
|
|
148295
148295
|
constructor() {
|
|
148296
148296
|
let body2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
148297
148297
|
let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -148349,8 +148349,8 @@ var require_lib11 = __commonJS({
|
|
|
148349
148349
|
});
|
|
148350
148350
|
}
|
|
148351
148351
|
};
|
|
148352
|
-
Body.mixIn(
|
|
148353
|
-
Object.defineProperties(
|
|
148352
|
+
Body.mixIn(Response2.prototype);
|
|
148353
|
+
Object.defineProperties(Response2.prototype, {
|
|
148354
148354
|
url: { enumerable: true },
|
|
148355
148355
|
status: { enumerable: true },
|
|
148356
148356
|
ok: { enumerable: true },
|
|
@@ -148359,7 +148359,7 @@ var require_lib11 = __commonJS({
|
|
|
148359
148359
|
headers: { enumerable: true },
|
|
148360
148360
|
clone: { enumerable: true }
|
|
148361
148361
|
});
|
|
148362
|
-
Object.defineProperty(
|
|
148362
|
+
Object.defineProperty(Response2.prototype, Symbol.toStringTag, {
|
|
148363
148363
|
value: "Response",
|
|
148364
148364
|
writable: false,
|
|
148365
148365
|
enumerable: false,
|
|
@@ -148693,7 +148693,7 @@ var require_lib11 = __commonJS({
|
|
|
148693
148693
|
};
|
|
148694
148694
|
const codings = headers.get("Content-Encoding");
|
|
148695
148695
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
148696
|
-
response = new
|
|
148696
|
+
response = new Response2(body2, response_options);
|
|
148697
148697
|
resolve4(response);
|
|
148698
148698
|
return;
|
|
148699
148699
|
}
|
|
@@ -148703,7 +148703,7 @@ var require_lib11 = __commonJS({
|
|
|
148703
148703
|
};
|
|
148704
148704
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
148705
148705
|
body2 = body2.pipe(zlib.createGunzip(zlibOptions));
|
|
148706
|
-
response = new
|
|
148706
|
+
response = new Response2(body2, response_options);
|
|
148707
148707
|
resolve4(response);
|
|
148708
148708
|
return;
|
|
148709
148709
|
}
|
|
@@ -148715,12 +148715,12 @@ var require_lib11 = __commonJS({
|
|
|
148715
148715
|
} else {
|
|
148716
148716
|
body2 = body2.pipe(zlib.createInflateRaw());
|
|
148717
148717
|
}
|
|
148718
|
-
response = new
|
|
148718
|
+
response = new Response2(body2, response_options);
|
|
148719
148719
|
resolve4(response);
|
|
148720
148720
|
});
|
|
148721
148721
|
raw.on("end", function() {
|
|
148722
148722
|
if (!response) {
|
|
148723
|
-
response = new
|
|
148723
|
+
response = new Response2(body2, response_options);
|
|
148724
148724
|
resolve4(response);
|
|
148725
148725
|
}
|
|
148726
148726
|
});
|
|
@@ -148728,11 +148728,11 @@ var require_lib11 = __commonJS({
|
|
|
148728
148728
|
}
|
|
148729
148729
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
148730
148730
|
body2 = body2.pipe(zlib.createBrotliDecompress());
|
|
148731
|
-
response = new
|
|
148731
|
+
response = new Response2(body2, response_options);
|
|
148732
148732
|
resolve4(response);
|
|
148733
148733
|
return;
|
|
148734
148734
|
}
|
|
148735
|
-
response = new
|
|
148735
|
+
response = new Response2(body2, response_options);
|
|
148736
148736
|
resolve4(response);
|
|
148737
148737
|
});
|
|
148738
148738
|
writeToStream(req, request);
|
|
@@ -148774,7 +148774,7 @@ var require_lib11 = __commonJS({
|
|
|
148774
148774
|
exports2.default = exports2;
|
|
148775
148775
|
exports2.Headers = Headers3;
|
|
148776
148776
|
exports2.Request = Request;
|
|
148777
|
-
exports2.Response =
|
|
148777
|
+
exports2.Response = Response2;
|
|
148778
148778
|
exports2.FetchError = FetchError;
|
|
148779
148779
|
exports2.AbortError = AbortError;
|
|
148780
148780
|
}
|
|
@@ -256947,6 +256947,9 @@ function normalizeGitRepoUrl(url) {
|
|
|
256947
256947
|
// src/lib/postman/internal-integration-adapter.ts
|
|
256948
256948
|
var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter {
|
|
256949
256949
|
static MINIMUM_POSTMAN_APP_VERSION = "12.0.0";
|
|
256950
|
+
/** Per-request wall-clock deadline (ms) so a hung Bifrost proxy or app-version
|
|
256951
|
+
* endpoint aborts rather than blocking the run forever. */
|
|
256952
|
+
static REQUEST_TIMEOUT_MS = 3e4;
|
|
256950
256953
|
static POSTMAN_APP_VERSION_URL = `https://dl.pstmn.io/update/status?currentVersion=${_BifrostInternalIntegrationAdapter.MINIMUM_POSTMAN_APP_VERSION}&platform=osx_arm64`;
|
|
256951
256954
|
accessToken;
|
|
256952
256955
|
tokenProvider;
|
|
@@ -256991,6 +256994,23 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
256991
256994
|
mask: this.secretMasker
|
|
256992
256995
|
};
|
|
256993
256996
|
}
|
|
256997
|
+
/**
|
|
256998
|
+
* fetch with a wall-clock deadline. A slow/hung proxy aborts instead of
|
|
256999
|
+
* blocking the run forever; callers surface the abort like any other transport
|
|
257000
|
+
* rejection.
|
|
257001
|
+
*/
|
|
257002
|
+
async fetchWithDeadline(input, init = {}) {
|
|
257003
|
+
const controller = new AbortController();
|
|
257004
|
+
const timer = setTimeout(
|
|
257005
|
+
() => controller.abort(),
|
|
257006
|
+
_BifrostInternalIntegrationAdapter.REQUEST_TIMEOUT_MS
|
|
257007
|
+
);
|
|
257008
|
+
try {
|
|
257009
|
+
return await this.fetchImpl(input, { ...init, signal: controller.signal });
|
|
257010
|
+
} finally {
|
|
257011
|
+
clearTimeout(timer);
|
|
257012
|
+
}
|
|
257013
|
+
}
|
|
256994
257014
|
async proxyRequest(service, method, requestPath2, body2, options = {}) {
|
|
256995
257015
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
256996
257016
|
const headers = {
|
|
@@ -257003,7 +257023,7 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
257003
257023
|
if (this.teamId && this.orgMode) {
|
|
257004
257024
|
headers["x-entity-team-id"] = this.teamId;
|
|
257005
257025
|
}
|
|
257006
|
-
return this.
|
|
257026
|
+
return this.fetchWithDeadline(url, {
|
|
257007
257027
|
method: "POST",
|
|
257008
257028
|
headers,
|
|
257009
257029
|
body: JSON.stringify({
|
|
@@ -257018,7 +257038,7 @@ var BifrostInternalIntegrationAdapter = class _BifrostInternalIntegrationAdapter
|
|
|
257018
257038
|
resolvePostmanAppVersion() {
|
|
257019
257039
|
this.appVersionPromise ??= (async () => {
|
|
257020
257040
|
try {
|
|
257021
|
-
const response = await this.
|
|
257041
|
+
const response = await this.fetchWithDeadline(
|
|
257022
257042
|
_BifrostInternalIntegrationAdapter.POSTMAN_APP_VERSION_URL,
|
|
257023
257043
|
{ method: "GET" }
|
|
257024
257044
|
);
|
|
@@ -262220,6 +262240,25 @@ function asRecord8(value) {
|
|
|
262220
262240
|
}
|
|
262221
262241
|
return value;
|
|
262222
262242
|
}
|
|
262243
|
+
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}$/;
|
|
262244
|
+
function isMissingPatchValueError(error) {
|
|
262245
|
+
return error instanceof HttpError && error.status === 400 && error.responseBody.includes("Remove operation must point to an existing value");
|
|
262246
|
+
}
|
|
262247
|
+
function canonicalize(value) {
|
|
262248
|
+
if (Array.isArray(value)) return value.map(canonicalize);
|
|
262249
|
+
if (value && typeof value === "object") {
|
|
262250
|
+
const record = value;
|
|
262251
|
+
const out = {};
|
|
262252
|
+
for (const key of Object.keys(record).sort()) {
|
|
262253
|
+
out[key] = canonicalize(record[key]);
|
|
262254
|
+
}
|
|
262255
|
+
return out;
|
|
262256
|
+
}
|
|
262257
|
+
return value;
|
|
262258
|
+
}
|
|
262259
|
+
function deepEqual(a, b) {
|
|
262260
|
+
return JSON.stringify(canonicalize(a)) === JSON.stringify(canonicalize(b));
|
|
262261
|
+
}
|
|
262223
262262
|
function resolvePollBudget(explicit, envValue, fallback, min) {
|
|
262224
262263
|
if (typeof explicit === "number" && Number.isFinite(explicit) && explicit >= min) return explicit;
|
|
262225
262264
|
if (envValue !== void 0) {
|
|
@@ -262400,6 +262439,9 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
262400
262439
|
service: "specification",
|
|
262401
262440
|
method: "patch",
|
|
262402
262441
|
path: `/specifications/${specId}/files/${fileId}`,
|
|
262442
|
+
// Replacing the ROOT file content with the same value is idempotent, so a
|
|
262443
|
+
// transient downstream timeout (ESOCKETTIMEDOUT) is safe to retry.
|
|
262444
|
+
retry: "safe",
|
|
262403
262445
|
body: [{ op: "replace", path: "/content", value: specContent }]
|
|
262404
262446
|
});
|
|
262405
262447
|
}
|
|
@@ -262782,9 +262824,16 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
262782
262824
|
// (live-proven 2026-07-14 on team 172912 / Northwind — immediate post-generation
|
|
262783
262825
|
// `GET .../items/` returns 403 FORBIDDEN with bare id, 200 with full uid).
|
|
262784
262826
|
// The tagging service is distinct and takes the FULL uid.
|
|
262785
|
-
/**
|
|
262827
|
+
/**
|
|
262828
|
+
* `<owner>-<uuid>` public uid -> bare `<uuid>` model id (collection ROOT routes
|
|
262829
|
+
* only). Strip ONLY the numeric owner prefix of a full public uid; a bare UUID
|
|
262830
|
+
* (which itself contains hyphens) must pass through unchanged, so a naive
|
|
262831
|
+
* split on the first hyphen — which would lop off a UUID's first segment — is
|
|
262832
|
+
* rejected here in favour of an anchored `<digits>-<uuid>` match.
|
|
262833
|
+
*/
|
|
262786
262834
|
bareModelId(uid) {
|
|
262787
262835
|
const u = String(uid ?? "").trim();
|
|
262836
|
+
if (BOOTSTRAP_BARE_UUID_RE.test(u)) return u;
|
|
262788
262837
|
return u.includes("-") ? u.slice(u.indexOf("-") + 1) : u;
|
|
262789
262838
|
}
|
|
262790
262839
|
/**
|
|
@@ -263395,12 +263444,61 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
263395
263444
|
ops.push({ op: "remove", path: "/scripts" });
|
|
263396
263445
|
}
|
|
263397
263446
|
if (ops.length === 0) return;
|
|
263398
|
-
|
|
263399
|
-
|
|
263400
|
-
|
|
263401
|
-
|
|
263402
|
-
|
|
263403
|
-
|
|
263447
|
+
try {
|
|
263448
|
+
await this.gateway.requestJson({
|
|
263449
|
+
service: "collection",
|
|
263450
|
+
method: "patch",
|
|
263451
|
+
path: `/v3/collections/${cid}`,
|
|
263452
|
+
// Fixed-path add/replace ops are idempotent, and a remove that already
|
|
263453
|
+
// committed is reconciled below, so transient downstream timeouts
|
|
263454
|
+
// (ESOCKETTIMEDOUT) are safe to retry.
|
|
263455
|
+
retry: "safe",
|
|
263456
|
+
body: ops
|
|
263457
|
+
});
|
|
263458
|
+
} catch (error) {
|
|
263459
|
+
if (isMissingPatchValueError(error) && ops.some((op) => op.op === "remove") && await this.verifyRootSettingsApplied(cid, ops)) {
|
|
263460
|
+
return;
|
|
263461
|
+
}
|
|
263462
|
+
throw error;
|
|
263463
|
+
}
|
|
263464
|
+
}
|
|
263465
|
+
/**
|
|
263466
|
+
* Read the collection root and check that every JSON-Patch op's intended end
|
|
263467
|
+
* state holds. add/replace targets must be structurally equal to the exact
|
|
263468
|
+
* requested value (a stale pre-PATCH description/auth/variables/scripts is
|
|
263469
|
+
* non-null but not equal, so it can never falsely verify); remove targets must
|
|
263470
|
+
* be absent (description clears to "" rather than disappearing).
|
|
263471
|
+
*/
|
|
263472
|
+
async verifyRootSettingsApplied(cid, ops) {
|
|
263473
|
+
let current;
|
|
263474
|
+
try {
|
|
263475
|
+
const got = await this.gateway.requestJson({
|
|
263476
|
+
service: "collection",
|
|
263477
|
+
method: "get",
|
|
263478
|
+
path: `/v3/collections/${cid}`
|
|
263479
|
+
});
|
|
263480
|
+
current = asRecord8(got?.data);
|
|
263481
|
+
} catch {
|
|
263482
|
+
return false;
|
|
263483
|
+
}
|
|
263484
|
+
if (!current) return false;
|
|
263485
|
+
for (const op of ops) {
|
|
263486
|
+
const rawPath = String(op.path ?? "");
|
|
263487
|
+
const field = rawPath.startsWith("/") ? rawPath.slice(1) : rawPath;
|
|
263488
|
+
if (!field) return false;
|
|
263489
|
+
const value = current[field];
|
|
263490
|
+
if (op.op === "remove") {
|
|
263491
|
+
if (field === "description") {
|
|
263492
|
+
if (typeof value === "string" && value.length > 0) return false;
|
|
263493
|
+
} else if (!(value === void 0 || value === null || Array.isArray(value) && value.length === 0)) {
|
|
263494
|
+
return false;
|
|
263495
|
+
}
|
|
263496
|
+
} else {
|
|
263497
|
+
if (value === void 0 || value === null) return false;
|
|
263498
|
+
if (!deepEqual(value, op.value)) return false;
|
|
263499
|
+
}
|
|
263500
|
+
}
|
|
263501
|
+
return true;
|
|
263404
263502
|
}
|
|
263405
263503
|
/**
|
|
263406
263504
|
* Create a curated local v2.1.0 or collection v3 payload through the gateway v3 write
|
|
@@ -263523,6 +263621,36 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
263523
263621
|
function isExpiredAuthError(status, body2) {
|
|
263524
263622
|
return status === 401 || body2.includes("UNAUTHENTICATED") || body2.includes("authenticationError");
|
|
263525
263623
|
}
|
|
263624
|
+
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
263625
|
+
function asRecord9(value) {
|
|
263626
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
263627
|
+
}
|
|
263628
|
+
function innerEnvelopeStatus(envelope) {
|
|
263629
|
+
for (const key of ["status", "statusCode"]) {
|
|
263630
|
+
const value = envelope[key];
|
|
263631
|
+
if (typeof value === "number") return value;
|
|
263632
|
+
if (typeof value === "string" && /^\d+$/.test(value)) return Number(value);
|
|
263633
|
+
}
|
|
263634
|
+
return void 0;
|
|
263635
|
+
}
|
|
263636
|
+
function detectInnerError(body2) {
|
|
263637
|
+
const trimmed = body2.trim();
|
|
263638
|
+
if (!trimmed) return null;
|
|
263639
|
+
let parsed;
|
|
263640
|
+
try {
|
|
263641
|
+
parsed = JSON.parse(trimmed);
|
|
263642
|
+
} catch {
|
|
263643
|
+
return null;
|
|
263644
|
+
}
|
|
263645
|
+
const envelope = asRecord9(parsed);
|
|
263646
|
+
if (!envelope) return null;
|
|
263647
|
+
const innerStatus = innerEnvelopeStatus(envelope);
|
|
263648
|
+
const error = envelope.error;
|
|
263649
|
+
const errorRecord = asRecord9(error);
|
|
263650
|
+
const hasError = error !== void 0 && error !== null && !(errorRecord !== null && Object.keys(errorRecord).length === 0) || envelope.success === false || typeof innerStatus === "number" && innerStatus >= 400;
|
|
263651
|
+
if (!hasError) return null;
|
|
263652
|
+
return typeof innerStatus === "number" && innerStatus >= 400 ? innerStatus : 502;
|
|
263653
|
+
}
|
|
263526
263654
|
function isTransientGatewayError(status, body2) {
|
|
263527
263655
|
if (status === 502 || status === 503 || status === 504) return true;
|
|
263528
263656
|
if (status >= 500 && (body2.includes("ESOCKETTIMEDOUT") || body2.includes("ETIMEDOUT") || body2.includes("ECONNRESET") || body2.includes("serverError") || body2.includes("downstream"))) {
|
|
@@ -263542,6 +263670,7 @@ var AccessTokenGatewayClient = class {
|
|
|
263542
263670
|
secretMasker;
|
|
263543
263671
|
maxRetries;
|
|
263544
263672
|
retryBaseDelayMs;
|
|
263673
|
+
requestTimeoutMs;
|
|
263545
263674
|
sleepImpl;
|
|
263546
263675
|
constructor(options) {
|
|
263547
263676
|
this.tokenProvider = options.tokenProvider;
|
|
@@ -263554,6 +263683,7 @@ var AccessTokenGatewayClient = class {
|
|
|
263554
263683
|
this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
|
|
263555
263684
|
this.maxRetries = options.maxRetries ?? 3;
|
|
263556
263685
|
this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
|
|
263686
|
+
this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
263557
263687
|
this.sleepImpl = options.sleepImpl ?? defaultSleep;
|
|
263558
263688
|
}
|
|
263559
263689
|
configureTeamContext(teamId, orgMode) {
|
|
@@ -263573,45 +263703,83 @@ var AccessTokenGatewayClient = class {
|
|
|
263573
263703
|
}
|
|
263574
263704
|
async send(request) {
|
|
263575
263705
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
263576
|
-
|
|
263577
|
-
|
|
263578
|
-
|
|
263579
|
-
|
|
263580
|
-
|
|
263581
|
-
|
|
263582
|
-
|
|
263583
|
-
|
|
263584
|
-
|
|
263585
|
-
|
|
263586
|
-
|
|
263706
|
+
const controller = new AbortController();
|
|
263707
|
+
const timer = setTimeout(() => controller.abort(), this.requestTimeoutMs);
|
|
263708
|
+
try {
|
|
263709
|
+
return await this.fetchImpl(url, {
|
|
263710
|
+
method: "POST",
|
|
263711
|
+
headers: this.buildHeaders(request.headers),
|
|
263712
|
+
signal: controller.signal,
|
|
263713
|
+
body: JSON.stringify({
|
|
263714
|
+
service: request.service,
|
|
263715
|
+
method: request.method,
|
|
263716
|
+
path: request.path,
|
|
263717
|
+
...request.query !== void 0 ? { query: request.query } : {},
|
|
263718
|
+
...request.body !== void 0 ? { body: request.body } : {}
|
|
263719
|
+
})
|
|
263720
|
+
});
|
|
263721
|
+
} finally {
|
|
263722
|
+
clearTimeout(timer);
|
|
263723
|
+
}
|
|
263587
263724
|
}
|
|
263588
263725
|
/**
|
|
263589
263726
|
* Send a gateway request, refreshing the token once on an auth failure and
|
|
263590
|
-
* retrying transient
|
|
263591
|
-
*
|
|
263592
|
-
*
|
|
263727
|
+
* retrying transient failures with exponential backoff. Transient covers both
|
|
263728
|
+
* HTTP 5xx / Bifrost read timeouts AND transport-level rejections (fetch
|
|
263729
|
+
* throwing on a socket hangup or the per-request deadline aborting) — a
|
|
263730
|
+
* `retry: 'safe'` request retries either; a `retry: 'none'` mutation surfaces
|
|
263731
|
+
* the failure so the caller reconciles instead of blindly resending. An HTTP
|
|
263732
|
+
* 200 envelope carrying an inner collection-service error is treated as that
|
|
263733
|
+
* inner status. The auth-refresh-once path is independent of the retry budget.
|
|
263593
263734
|
*/
|
|
263594
263735
|
async request(request) {
|
|
263595
263736
|
if (!this.tokenProvider.current() && this.tokenProvider.canRefresh()) {
|
|
263596
263737
|
await this.tokenProvider.refresh();
|
|
263597
263738
|
}
|
|
263739
|
+
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
263598
263740
|
let attempt = 0;
|
|
263599
263741
|
for (; ; ) {
|
|
263600
|
-
let response
|
|
263742
|
+
let response;
|
|
263743
|
+
try {
|
|
263744
|
+
response = await this.send(request);
|
|
263745
|
+
} catch (error) {
|
|
263746
|
+
if (retryMode === "safe" && attempt < this.maxRetries) {
|
|
263747
|
+
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
263748
|
+
attempt += 1;
|
|
263749
|
+
await this.sleepImpl(delay);
|
|
263750
|
+
continue;
|
|
263751
|
+
}
|
|
263752
|
+
throw error;
|
|
263753
|
+
}
|
|
263601
263754
|
if (response.ok) {
|
|
263602
|
-
|
|
263755
|
+
const okBody = await response.text().catch(() => "");
|
|
263756
|
+
const innerStatus = detectInnerError(okBody);
|
|
263757
|
+
if (innerStatus !== null) {
|
|
263758
|
+
if (retryMode === "safe" && isTransientGatewayError(innerStatus, okBody) && attempt < this.maxRetries) {
|
|
263759
|
+
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
263760
|
+
attempt += 1;
|
|
263761
|
+
await this.sleepImpl(delay);
|
|
263762
|
+
continue;
|
|
263763
|
+
}
|
|
263764
|
+
throw this.toInnerHttpError(request, innerStatus, okBody);
|
|
263765
|
+
}
|
|
263766
|
+
return this.rebuildResponse(response, okBody);
|
|
263603
263767
|
}
|
|
263604
263768
|
const body2 = await response.text().catch(() => "");
|
|
263605
263769
|
if (isExpiredAuthError(response.status, body2) && this.tokenProvider.canRefresh()) {
|
|
263606
263770
|
await this.tokenProvider.refresh();
|
|
263607
263771
|
response = await this.send(request);
|
|
263608
263772
|
if (response.ok) {
|
|
263609
|
-
|
|
263773
|
+
const refreshedBody = await response.text().catch(() => "");
|
|
263774
|
+
const innerStatus = detectInnerError(refreshedBody);
|
|
263775
|
+
if (innerStatus !== null) {
|
|
263776
|
+
throw this.toInnerHttpError(request, innerStatus, refreshedBody);
|
|
263777
|
+
}
|
|
263778
|
+
return this.rebuildResponse(response, refreshedBody);
|
|
263610
263779
|
}
|
|
263611
263780
|
const retryBody = await response.text().catch(() => "");
|
|
263612
263781
|
throw this.toHttpError(request, response, retryBody);
|
|
263613
263782
|
}
|
|
263614
|
-
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
263615
263783
|
if (retryMode === "safe" && isTransientGatewayError(response.status, body2) && attempt < this.maxRetries) {
|
|
263616
263784
|
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
263617
263785
|
attempt += 1;
|
|
@@ -263621,6 +263789,18 @@ var AccessTokenGatewayClient = class {
|
|
|
263621
263789
|
throw this.toHttpError(request, response, body2);
|
|
263622
263790
|
}
|
|
263623
263791
|
}
|
|
263792
|
+
/**
|
|
263793
|
+
* The success path reads the body to inspect for an inner error, which
|
|
263794
|
+
* consumes the stream. Hand callers a fresh Response over the buffered text so
|
|
263795
|
+
* `requestJson` can still parse it.
|
|
263796
|
+
*/
|
|
263797
|
+
rebuildResponse(response, body2) {
|
|
263798
|
+
return new Response(body2, {
|
|
263799
|
+
status: response.status,
|
|
263800
|
+
statusText: response.statusText,
|
|
263801
|
+
headers: response.headers
|
|
263802
|
+
});
|
|
263803
|
+
}
|
|
263624
263804
|
/** Send a gateway request and parse the JSON body, or null when empty. */
|
|
263625
263805
|
async requestJson(request) {
|
|
263626
263806
|
const response = await this.request(request);
|
|
@@ -263645,6 +263825,17 @@ var AccessTokenGatewayClient = class {
|
|
|
263645
263825
|
secretValues: [this.tokenProvider.current()]
|
|
263646
263826
|
});
|
|
263647
263827
|
}
|
|
263828
|
+
toInnerHttpError(request, status, body2) {
|
|
263829
|
+
return new HttpError({
|
|
263830
|
+
method: request.method.toUpperCase(),
|
|
263831
|
+
url: `${this.bifrostBaseUrl}/ws/proxy (${request.service}: ${request.method} ${request.path}) [inner]`,
|
|
263832
|
+
status,
|
|
263833
|
+
statusText: "Inner Error",
|
|
263834
|
+
requestHeaders: this.buildHeaders(request.headers),
|
|
263835
|
+
responseBody: this.secretMasker(body2),
|
|
263836
|
+
secretValues: [this.tokenProvider.current()]
|
|
263837
|
+
});
|
|
263838
|
+
}
|
|
263648
263839
|
};
|
|
263649
263840
|
|
|
263650
263841
|
// src/lib/postman/token-provider.ts
|
|
@@ -279962,7 +280153,7 @@ function compileErrors(result) {
|
|
|
279962
280153
|
|
|
279963
280154
|
// src/lib/spec/openapi-loader.ts
|
|
279964
280155
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
279965
|
-
function
|
|
280156
|
+
function asRecord10(value) {
|
|
279966
280157
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
279967
280158
|
return value;
|
|
279968
280159
|
}
|
|
@@ -279977,7 +280168,7 @@ function parseOpenApiDocument(content) {
|
|
|
279977
280168
|
throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content is not valid JSON or YAML");
|
|
279978
280169
|
}
|
|
279979
280170
|
}
|
|
279980
|
-
const doc =
|
|
280171
|
+
const doc = asRecord10(parsed);
|
|
279981
280172
|
if (!doc) throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content must be a JSON or YAML object");
|
|
279982
280173
|
return doc;
|
|
279983
280174
|
}
|
|
@@ -280005,7 +280196,7 @@ function collectExternalRefs(node, baseUrl, refs) {
|
|
|
280005
280196
|
node.forEach((entry) => collectExternalRefs(entry, baseUrl, refs));
|
|
280006
280197
|
return;
|
|
280007
280198
|
}
|
|
280008
|
-
const record =
|
|
280199
|
+
const record = asRecord10(node);
|
|
280009
280200
|
if (!record) return;
|
|
280010
280201
|
const ref = typeof record.$ref === "string" ? record.$ref : "";
|
|
280011
280202
|
if (ref && !ref.startsWith("#")) {
|
|
@@ -292601,7 +292792,7 @@ function buildGraphQLCollection(index, opts = {}) {
|
|
|
292601
292792
|
}
|
|
292602
292793
|
|
|
292603
292794
|
// src/lib/protocols/graphql/schema-lints.ts
|
|
292604
|
-
function
|
|
292795
|
+
function asRecord11(value) {
|
|
292605
292796
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
292606
292797
|
return value;
|
|
292607
292798
|
}
|
|
@@ -292612,7 +292803,7 @@ var BUILT_IN_SCALAR_NAMES = new Set(specifiedScalarTypes.map((scalar) => scalar.
|
|
|
292612
292803
|
var VALID_TYPE_KINDS = /* @__PURE__ */ new Set(["SCALAR", "OBJECT", "INTERFACE", "UNION", "ENUM", "INPUT_OBJECT", "LIST", "NON_NULL"]);
|
|
292613
292804
|
var VALID_DIRECTIVE_LOCATIONS = new Set(Object.values(DirectiveLocation));
|
|
292614
292805
|
function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
292615
|
-
const current =
|
|
292806
|
+
const current = asRecord11(ref);
|
|
292616
292807
|
if (!current || depth > 32 || typeof current.kind !== "string") return null;
|
|
292617
292808
|
if (current.kind === "NON_NULL") {
|
|
292618
292809
|
const inner = renderIntrospectionTypeRef(current.ofType, depth + 1);
|
|
@@ -292625,12 +292816,12 @@ function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
|
292625
292816
|
return typeof current.name === "string" && current.name.length > 0 ? current.name : null;
|
|
292626
292817
|
}
|
|
292627
292818
|
function readIntrospectionDirectiveShape(value) {
|
|
292628
|
-
const directive =
|
|
292819
|
+
const directive = asRecord11(value);
|
|
292629
292820
|
if (!directive || typeof directive.isRepeatable !== "boolean") return null;
|
|
292630
292821
|
return {
|
|
292631
292822
|
isRepeatable: directive.isRepeatable,
|
|
292632
292823
|
locations: asArray5(directive.locations).filter((entry) => typeof entry === "string"),
|
|
292633
|
-
args: asArray5(directive.args).map(
|
|
292824
|
+
args: asArray5(directive.args).map(asRecord11).filter((entry) => entry !== null && typeof entry.name === "string").map((arg) => ({
|
|
292634
292825
|
name: arg.name,
|
|
292635
292826
|
type: renderIntrospectionTypeRef(arg.type),
|
|
292636
292827
|
defaultValue: Object.prototype.hasOwnProperty.call(arg, "defaultValue") ? arg.defaultValue : void 0
|
|
@@ -292640,10 +292831,10 @@ function readIntrospectionDirectiveShape(value) {
|
|
|
292640
292831
|
var BUILT_IN_INTROSPECTION_DIRECTIVE_SHAPES = (() => {
|
|
292641
292832
|
const shapes = /* @__PURE__ */ new Map();
|
|
292642
292833
|
const reference = introspectionFromSchema(buildSchema("type Query { _: Boolean }"));
|
|
292643
|
-
const schemaRecord =
|
|
292834
|
+
const schemaRecord = asRecord11(asRecord11(reference)?.__schema);
|
|
292644
292835
|
if (!schemaRecord) return shapes;
|
|
292645
292836
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
292646
|
-
const directive =
|
|
292837
|
+
const directive = asRecord11(entry);
|
|
292647
292838
|
if (!directive || typeof directive.name !== "string") continue;
|
|
292648
292839
|
const shape = readIntrospectionDirectiveShape(directive);
|
|
292649
292840
|
if (shape) shapes.set(directive.name, shape);
|
|
@@ -292739,11 +292930,11 @@ function lintDirectiveDefinitions(schema) {
|
|
|
292739
292930
|
const warnings = [];
|
|
292740
292931
|
const builtIn = new Set(specifiedDirectives.map((directive) => directive.name));
|
|
292741
292932
|
const usesDirective = (astNode, name) => {
|
|
292742
|
-
const record =
|
|
292933
|
+
const record = asRecord11(astNode);
|
|
292743
292934
|
if (!record) return false;
|
|
292744
292935
|
return asArray5(record.directives).some((entry) => {
|
|
292745
|
-
const applied =
|
|
292746
|
-
const appliedName = applied ?
|
|
292936
|
+
const applied = asRecord11(entry);
|
|
292937
|
+
const appliedName = applied ? asRecord11(applied.name) : null;
|
|
292747
292938
|
return Boolean(appliedName && appliedName.value === name);
|
|
292748
292939
|
});
|
|
292749
292940
|
};
|
|
@@ -292753,7 +292944,7 @@ function lintDirectiveDefinitions(schema) {
|
|
|
292753
292944
|
warnings.push("GQL_DIRECTIVE_NAME_RESERVED: directive @" + directive.name + ' must not begin with "__" (GraphQL spec 3.13)');
|
|
292754
292945
|
}
|
|
292755
292946
|
let selfReferenced = false;
|
|
292756
|
-
const ownAst =
|
|
292947
|
+
const ownAst = asRecord11(directive.astNode);
|
|
292757
292948
|
if (ownAst) {
|
|
292758
292949
|
for (const argNode of asArray5(ownAst.arguments)) {
|
|
292759
292950
|
if (usesDirective(argNode, directive.name)) selfReferenced = true;
|
|
@@ -292897,10 +293088,10 @@ function lintSdlDocument(sdl) {
|
|
|
292897
293088
|
return warnings;
|
|
292898
293089
|
}
|
|
292899
293090
|
function lintTypeRefChain(ref, context, warnings) {
|
|
292900
|
-
let current =
|
|
293091
|
+
let current = asRecord11(ref);
|
|
292901
293092
|
let depth = 0;
|
|
292902
293093
|
while (current && depth < 32) {
|
|
292903
|
-
const ofType =
|
|
293094
|
+
const ofType = asRecord11(current.ofType);
|
|
292904
293095
|
if (current.kind === "NON_NULL" && ofType && ofType.kind === "NON_NULL") {
|
|
292905
293096
|
warnings.push("GQL_INTROSPECTION_NONNULL_NESTED: " + context + " wraps NON_NULL directly inside NON_NULL, which the type system forbids (GraphQL spec 3.12)");
|
|
292906
293097
|
return;
|
|
@@ -292911,7 +293102,7 @@ function lintTypeRefChain(ref, context, warnings) {
|
|
|
292911
293102
|
}
|
|
292912
293103
|
function lintDeprecationFlags(entries, context, warnings) {
|
|
292913
293104
|
for (const entry of entries) {
|
|
292914
|
-
const record =
|
|
293105
|
+
const record = asRecord11(entry);
|
|
292915
293106
|
if (!record) continue;
|
|
292916
293107
|
const label = context + "." + (typeof record.name === "string" ? record.name : "<unnamed>");
|
|
292917
293108
|
if (record.isDeprecated !== void 0 && typeof record.isDeprecated !== "boolean") {
|
|
@@ -292932,7 +293123,7 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
292932
293123
|
const warnings = [];
|
|
292933
293124
|
const directives = /* @__PURE__ */ new Map();
|
|
292934
293125
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
292935
|
-
const directive =
|
|
293126
|
+
const directive = asRecord11(entry);
|
|
292936
293127
|
if (directive && typeof directive.name === "string" && !directives.has(directive.name)) {
|
|
292937
293128
|
directives.set(directive.name, directive);
|
|
292938
293129
|
}
|
|
@@ -292986,13 +293177,13 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
292986
293177
|
}
|
|
292987
293178
|
function lintIntrospectionJson(introspection) {
|
|
292988
293179
|
const warnings = [];
|
|
292989
|
-
const root =
|
|
292990
|
-
const dataRecord = root ?
|
|
292991
|
-
const schemaRecord = root ?
|
|
293180
|
+
const root = asRecord11(introspection);
|
|
293181
|
+
const dataRecord = root ? asRecord11(root.data) : null;
|
|
293182
|
+
const schemaRecord = root ? asRecord11(root.__schema) ?? (dataRecord ? asRecord11(dataRecord.__schema) : null) : null;
|
|
292992
293183
|
if (!schemaRecord) return warnings;
|
|
292993
293184
|
const typeCounts = /* @__PURE__ */ new Map();
|
|
292994
293185
|
for (const entry of asArray5(schemaRecord.types)) {
|
|
292995
|
-
const type =
|
|
293186
|
+
const type = asRecord11(entry);
|
|
292996
293187
|
if (!type) continue;
|
|
292997
293188
|
const name = typeof type.name === "string" ? type.name : "<unnamed>";
|
|
292998
293189
|
typeCounts.set(name, (typeCounts.get(name) ?? 0) + 1);
|
|
@@ -293000,7 +293191,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
293000
293191
|
warnings.push("GQL_INTROSPECTION_KIND_INVALID: type " + name + " declares unknown __TypeKind '" + type.kind + "'");
|
|
293001
293192
|
}
|
|
293002
293193
|
for (const memberEntry of asArray5(type.possibleTypes)) {
|
|
293003
|
-
const member =
|
|
293194
|
+
const member = asRecord11(memberEntry);
|
|
293004
293195
|
if (member && member.kind !== void 0 && member.kind !== "OBJECT") {
|
|
293005
293196
|
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)");
|
|
293006
293197
|
}
|
|
@@ -293008,18 +293199,18 @@ function lintIntrospectionJson(introspection) {
|
|
|
293008
293199
|
lintDeprecationFlags(asArray5(type.fields), name + ".fields", warnings);
|
|
293009
293200
|
lintDeprecationFlags(asArray5(type.enumValues), name + ".enumValues", warnings);
|
|
293010
293201
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
293011
|
-
const field =
|
|
293202
|
+
const field = asRecord11(fieldEntry);
|
|
293012
293203
|
if (!field) continue;
|
|
293013
293204
|
const fieldLabel = name + "." + String(field.name ?? "<unnamed>");
|
|
293014
293205
|
lintTypeRefChain(field.type, fieldLabel, warnings);
|
|
293015
293206
|
for (const argEntry of asArray5(field.args)) {
|
|
293016
|
-
const arg =
|
|
293207
|
+
const arg = asRecord11(argEntry);
|
|
293017
293208
|
if (arg) lintTypeRefChain(arg.type, fieldLabel + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
293018
293209
|
}
|
|
293019
293210
|
lintDeprecationFlags(asArray5(field.args), fieldLabel + ".args", warnings);
|
|
293020
293211
|
}
|
|
293021
293212
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
293022
|
-
const input =
|
|
293213
|
+
const input = asRecord11(inputEntry);
|
|
293023
293214
|
if (input) lintTypeRefChain(input.type, name + "." + String(input.name ?? "<unnamed>"), warnings);
|
|
293024
293215
|
}
|
|
293025
293216
|
lintDeprecationFlags(asArray5(type.inputFields), name + ".inputFields", warnings);
|
|
@@ -293031,7 +293222,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
293031
293222
|
}
|
|
293032
293223
|
const directiveNameCounts = /* @__PURE__ */ new Map();
|
|
293033
293224
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
293034
|
-
const directive =
|
|
293225
|
+
const directive = asRecord11(directiveEntry);
|
|
293035
293226
|
if (!directive) continue;
|
|
293036
293227
|
if (typeof directive.name !== "string" || directive.name.length === 0) {
|
|
293037
293228
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: a __schema.directives entry is missing its name");
|
|
@@ -293047,7 +293238,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
293047
293238
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: directive @" + directive.name + " isRepeatable must be a boolean (__Directive contract)");
|
|
293048
293239
|
}
|
|
293049
293240
|
for (const argEntry of asArray5(directive.args)) {
|
|
293050
|
-
const arg =
|
|
293241
|
+
const arg = asRecord11(argEntry);
|
|
293051
293242
|
if (arg) lintTypeRefChain(arg.type, "@" + directive.name + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
293052
293243
|
}
|
|
293053
293244
|
lintDeprecationFlags(asArray5(directive.args), "@" + directive.name + ".args", warnings);
|
|
@@ -293066,7 +293257,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
293066
293257
|
return warnings;
|
|
293067
293258
|
}
|
|
293068
293259
|
function introspectionTypeEntries(schemaRecord) {
|
|
293069
|
-
return asArray5(schemaRecord.types).map(
|
|
293260
|
+
return asArray5(schemaRecord.types).map(asRecord11).filter((entry) => entry !== null);
|
|
293070
293261
|
}
|
|
293071
293262
|
function introspectionTypesByName(entries) {
|
|
293072
293263
|
const byName = /* @__PURE__ */ new Map();
|
|
@@ -293077,7 +293268,7 @@ function introspectionTypesByName(entries) {
|
|
|
293077
293268
|
}
|
|
293078
293269
|
function describeIntrospectionRootRecord(value) {
|
|
293079
293270
|
if (value === void 0 || value === null) return "<missing>";
|
|
293080
|
-
const record =
|
|
293271
|
+
const record = asRecord11(value);
|
|
293081
293272
|
if (!record) return "<invalid>";
|
|
293082
293273
|
return typeof record.name === "string" && record.name.length > 0 ? record.name : "<unnamed>";
|
|
293083
293274
|
}
|
|
@@ -293097,7 +293288,7 @@ function lintIntrospectionRootMap(schemaRecord) {
|
|
|
293097
293288
|
}
|
|
293098
293289
|
continue;
|
|
293099
293290
|
}
|
|
293100
|
-
const record =
|
|
293291
|
+
const record = asRecord11(value);
|
|
293101
293292
|
if (!record || typeof record.name !== "string" || record.name.length === 0) {
|
|
293102
293293
|
warnings.push("GQL_INTROSPECTION_ROOT_INVALID: __schema." + rootKind + "Type must name the " + rootKind + " root operation type (GraphQL spec 3.3). Root map: " + rootMap);
|
|
293103
293294
|
continue;
|
|
@@ -293157,13 +293348,13 @@ function lintIntrospectionTypeMatrix(schemaRecord) {
|
|
|
293157
293348
|
return warnings;
|
|
293158
293349
|
}
|
|
293159
293350
|
function namedTypeRefName(ref) {
|
|
293160
|
-
let current =
|
|
293351
|
+
let current = asRecord11(ref);
|
|
293161
293352
|
let depth = 0;
|
|
293162
293353
|
while (current && depth < 32) {
|
|
293163
293354
|
if (current.kind !== "LIST" && current.kind !== "NON_NULL") {
|
|
293164
293355
|
return typeof current.name === "string" ? current.name : null;
|
|
293165
293356
|
}
|
|
293166
|
-
current =
|
|
293357
|
+
current = asRecord11(current.ofType);
|
|
293167
293358
|
depth += 1;
|
|
293168
293359
|
}
|
|
293169
293360
|
return null;
|
|
@@ -293177,31 +293368,31 @@ function lintIntrospectionReferenceGraph(schemaRecord) {
|
|
|
293177
293368
|
if (name) referenced.add(name);
|
|
293178
293369
|
};
|
|
293179
293370
|
for (const rootKind of ["query", "mutation", "subscription"]) {
|
|
293180
|
-
const record =
|
|
293371
|
+
const record = asRecord11(schemaRecord[rootKind + "Type"]);
|
|
293181
293372
|
if (record && typeof record.name === "string") referenced.add(record.name);
|
|
293182
293373
|
}
|
|
293183
293374
|
for (const type of entries) {
|
|
293184
293375
|
for (const entry of asArray5(type.interfaces)) addRef(namedTypeRefName(entry));
|
|
293185
293376
|
for (const entry of asArray5(type.possibleTypes)) addRef(namedTypeRefName(entry));
|
|
293186
293377
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
293187
|
-
const field =
|
|
293378
|
+
const field = asRecord11(fieldEntry);
|
|
293188
293379
|
if (!field) continue;
|
|
293189
293380
|
addRef(namedTypeRefName(field.type));
|
|
293190
293381
|
for (const argEntry of asArray5(field.args)) {
|
|
293191
|
-
const arg =
|
|
293382
|
+
const arg = asRecord11(argEntry);
|
|
293192
293383
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
293193
293384
|
}
|
|
293194
293385
|
}
|
|
293195
293386
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
293196
|
-
const input =
|
|
293387
|
+
const input = asRecord11(inputEntry);
|
|
293197
293388
|
if (input) addRef(namedTypeRefName(input.type));
|
|
293198
293389
|
}
|
|
293199
293390
|
}
|
|
293200
293391
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
293201
|
-
const directive =
|
|
293392
|
+
const directive = asRecord11(directiveEntry);
|
|
293202
293393
|
if (!directive) continue;
|
|
293203
293394
|
for (const argEntry of asArray5(directive.args)) {
|
|
293204
|
-
const arg =
|
|
293395
|
+
const arg = asRecord11(argEntry);
|
|
293205
293396
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
293206
293397
|
}
|
|
293207
293398
|
}
|
|
@@ -293222,7 +293413,7 @@ function lintIntrospectionAbstractConsistency(schemaRecord) {
|
|
|
293222
293413
|
const entries = introspectionTypeEntries(schemaRecord);
|
|
293223
293414
|
const byName = introspectionTypesByName(entries);
|
|
293224
293415
|
const names = (value) => asArray5(value).map((entry) => {
|
|
293225
|
-
const record =
|
|
293416
|
+
const record = asRecord11(entry);
|
|
293226
293417
|
return record && typeof record.name === "string" ? record.name : "";
|
|
293227
293418
|
}).filter((name) => name.length > 0);
|
|
293228
293419
|
for (const type of entries) {
|
|
@@ -293251,7 +293442,7 @@ function lintIntrospectionDeprecationProvenance(schemaRecord) {
|
|
|
293251
293442
|
let flagged = 0;
|
|
293252
293443
|
for (const type of introspectionTypeEntries(schemaRecord)) {
|
|
293253
293444
|
for (const entry of [...asArray5(type.fields), ...asArray5(type.enumValues)]) {
|
|
293254
|
-
const record =
|
|
293445
|
+
const record = asRecord11(entry);
|
|
293255
293446
|
if (!record) continue;
|
|
293256
293447
|
entries += 1;
|
|
293257
293448
|
if (record.isDeprecated !== void 0) flagged += 1;
|
|
@@ -293277,7 +293468,7 @@ function lintGeneratedDocument(schema, operationId, documentText) {
|
|
|
293277
293468
|
}
|
|
293278
293469
|
|
|
293279
293470
|
// src/lib/protocols/graphql/parser.ts
|
|
293280
|
-
function
|
|
293471
|
+
function asRecord12(value) {
|
|
293281
293472
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
293282
293473
|
return value;
|
|
293283
293474
|
}
|
|
@@ -293395,14 +293586,14 @@ function collectRootOperations(rootType, kind, schema, shapes) {
|
|
|
293395
293586
|
});
|
|
293396
293587
|
}
|
|
293397
293588
|
function looksLikeIntrospection2(value) {
|
|
293398
|
-
const record =
|
|
293589
|
+
const record = asRecord12(value);
|
|
293399
293590
|
if (!record) return false;
|
|
293400
|
-
if (
|
|
293401
|
-
const data =
|
|
293402
|
-
return Boolean(data &&
|
|
293591
|
+
if (asRecord12(record.__schema)) return true;
|
|
293592
|
+
const data = asRecord12(record.data);
|
|
293593
|
+
return Boolean(data && asRecord12(data.__schema));
|
|
293403
293594
|
}
|
|
293404
293595
|
function buildSchemaFromIntrospection(value) {
|
|
293405
|
-
const introspection =
|
|
293596
|
+
const introspection = asRecord12(value.__schema) ? value : asRecord12(value.data);
|
|
293406
293597
|
return buildClientSchema(introspection);
|
|
293407
293598
|
}
|
|
293408
293599
|
function selectIntrospectionRootWarnings(warnings) {
|
|
@@ -293425,7 +293616,7 @@ function parseGraphQLSchema(content, opts = {}) {
|
|
|
293425
293616
|
if (parsedJson !== void 0 && looksLikeIntrospection2(parsedJson)) {
|
|
293426
293617
|
introspectionWarnings = lintIntrospectionJson(parsedJson);
|
|
293427
293618
|
try {
|
|
293428
|
-
schema = buildSchemaFromIntrospection(
|
|
293619
|
+
schema = buildSchemaFromIntrospection(asRecord12(parsedJson));
|
|
293429
293620
|
} catch (error) {
|
|
293430
293621
|
const rootWarnings = selectIntrospectionRootWarnings(introspectionWarnings);
|
|
293431
293622
|
const rootDiagnostics = rootWarnings.length > 0 ? " " + rootWarnings.join(" ") : "";
|
|
@@ -293542,7 +293733,7 @@ function collectDeprecatedSelectionWarnings(schema, operation, index) {
|
|
|
293542
293733
|
}
|
|
293543
293734
|
|
|
293544
293735
|
// src/lib/protocols/graphql/instrumenter.ts
|
|
293545
|
-
function
|
|
293736
|
+
function asRecord13(value) {
|
|
293546
293737
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
293547
293738
|
return value;
|
|
293548
293739
|
}
|
|
@@ -294052,24 +294243,24 @@ function buildProbeScript(probeId, index, warnings) {
|
|
|
294052
294243
|
];
|
|
294053
294244
|
}
|
|
294054
294245
|
function isGraphQLHttpRequest(item) {
|
|
294055
|
-
const request =
|
|
294246
|
+
const request = asRecord13(item.request);
|
|
294056
294247
|
if (!request) return false;
|
|
294057
|
-
const body2 =
|
|
294248
|
+
const body2 = asRecord13(request.body);
|
|
294058
294249
|
return body2?.mode === "graphql";
|
|
294059
294250
|
}
|
|
294060
294251
|
function injectItem(item, index, covered, warnings) {
|
|
294061
294252
|
const children4 = asArray6(item.item);
|
|
294062
294253
|
if (children4.length > 0) {
|
|
294063
294254
|
for (const child3 of children4) {
|
|
294064
|
-
const childRecord =
|
|
294255
|
+
const childRecord = asRecord13(child3);
|
|
294065
294256
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
294066
294257
|
}
|
|
294067
294258
|
return;
|
|
294068
294259
|
}
|
|
294069
294260
|
const itemId = String(item.id ?? "");
|
|
294070
|
-
if (itemId.startsWith("__gql_probe_") &&
|
|
294261
|
+
if (itemId.startsWith("__gql_probe_") && asRecord13(item.request)) {
|
|
294071
294262
|
const exec = buildProbeScript(itemId, index, warnings);
|
|
294072
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
294263
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
294073
294264
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec } }];
|
|
294074
294265
|
return;
|
|
294075
294266
|
}
|
|
@@ -294085,7 +294276,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
294085
294276
|
" pm.expect.fail(contractMappingError);",
|
|
294086
294277
|
"});"
|
|
294087
294278
|
];
|
|
294088
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
294279
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
294089
294280
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
294090
294281
|
return;
|
|
294091
294282
|
}
|
|
@@ -294101,7 +294292,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
294101
294292
|
`GQL_SCRIPT_SIZE_EXCEEDED: generated test script for '${operation.id}' exceeded ${GRAPHQL_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`
|
|
294102
294293
|
);
|
|
294103
294294
|
}
|
|
294104
|
-
const events = asArray6(item.event).filter((entry) =>
|
|
294295
|
+
const events = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
294105
294296
|
item.event = [
|
|
294106
294297
|
...events,
|
|
294107
294298
|
{ listen: "test", script: { type: "text/javascript", exec } }
|
|
@@ -294112,7 +294303,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
294112
294303
|
const warnings = [...index.warnings];
|
|
294113
294304
|
const covered = /* @__PURE__ */ new Set();
|
|
294114
294305
|
for (const child3 of asArray6(collection.item)) {
|
|
294115
|
-
const childRecord =
|
|
294306
|
+
const childRecord = asRecord13(child3);
|
|
294116
294307
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
294117
294308
|
}
|
|
294118
294309
|
const missing = index.operations.filter((operation) => !covered.has(operation.id));
|
|
@@ -294126,7 +294317,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
294126
294317
|
|
|
294127
294318
|
// src/lib/protocols/grpc/proto-parser.ts
|
|
294128
294319
|
var protobufjs = __toESM(require_protobufjs(), 1);
|
|
294129
|
-
function
|
|
294320
|
+
function asRecord14(value) {
|
|
294130
294321
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294131
294322
|
return value;
|
|
294132
294323
|
}
|
|
@@ -294426,7 +294617,7 @@ function upperCamelCase(name) {
|
|
|
294426
294617
|
function lintMessage(message, warnings, proto3) {
|
|
294427
294618
|
const fullName = stripLeadingDot(message.fullName);
|
|
294428
294619
|
const { ranges: reservedRanges } = lintReserved(message.reserved, `message ${fullName}`, { lo: 1, hi: FIELD_NUMBER_MAX, label: "field-number" }, warnings);
|
|
294429
|
-
lintOptionSet(
|
|
294620
|
+
lintOptionSet(asRecord14(message.options), "message", fullName, warnings);
|
|
294430
294621
|
const jsonNames = /* @__PURE__ */ new Map();
|
|
294431
294622
|
for (const field of asArray7(message.fieldsArray)) {
|
|
294432
294623
|
const id = field.id;
|
|
@@ -294447,7 +294638,7 @@ function lintMessage(message, warnings, proto3) {
|
|
|
294447
294638
|
}
|
|
294448
294639
|
jsonNames.set(jsonName, String(field.name));
|
|
294449
294640
|
}
|
|
294450
|
-
if (
|
|
294641
|
+
if (asRecord14(message.options)?.deprecated === true) {
|
|
294451
294642
|
warnings.push(`GRPC_DEPRECATED: message ${fullName} is marked deprecated`);
|
|
294452
294643
|
}
|
|
294453
294644
|
const nestedNames = new Set(asArray7(message.nestedArray).map((child3) => child3.name));
|
|
@@ -294476,13 +294667,13 @@ function lintMessage(message, warnings, proto3) {
|
|
|
294476
294667
|
for (const child3 of asArray7(message.nestedArray)) {
|
|
294477
294668
|
declare(child3.name, isEnum(child3) ? "nested enum" : "nested type");
|
|
294478
294669
|
if (isEnum(child3)) {
|
|
294479
|
-
for (const valueName of Object.keys(
|
|
294670
|
+
for (const valueName of Object.keys(asRecord14(child3.values) ?? {})) declare(valueName, `enum value of ${child3.name}`);
|
|
294480
294671
|
}
|
|
294481
294672
|
}
|
|
294482
294673
|
}
|
|
294483
294674
|
function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
294484
294675
|
const fullName = stripLeadingDot(enumObj.fullName);
|
|
294485
|
-
const entries = Object.entries(
|
|
294676
|
+
const entries = Object.entries(asRecord14(enumObj.values) ?? {});
|
|
294486
294677
|
const { ranges: reservedRanges, names: reservedNames } = lintReserved(
|
|
294487
294678
|
enumObj.reserved,
|
|
294488
294679
|
`enum ${fullName}`,
|
|
@@ -294510,7 +294701,7 @@ function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
|
294510
294701
|
warnings.push(`GRPC_ENUM_ZERO_NAME_CONVENTION: enum ${fullName} zero value ${zero[0]} is conventionally named *_UNSPECIFIED (buf/AIP enum conventions)`);
|
|
294511
294702
|
}
|
|
294512
294703
|
}
|
|
294513
|
-
if (
|
|
294704
|
+
if (asRecord14(enumObj.options)?.deprecated === true) {
|
|
294514
294705
|
warnings.push(`GRPC_DEPRECATED: enum ${fullName} is marked deprecated`);
|
|
294515
294706
|
}
|
|
294516
294707
|
}
|
|
@@ -294595,7 +294786,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
294595
294786
|
for (const verb of HTTP_RULE_VERBS) {
|
|
294596
294787
|
if (typeof rule[verb] === "string") patterns.push({ verb, path: rule[verb] });
|
|
294597
294788
|
}
|
|
294598
|
-
const custom =
|
|
294789
|
+
const custom = asRecord14(rule.custom);
|
|
294599
294790
|
if (custom && typeof custom.path === "string") patterns.push({ verb: String(custom.kind ?? "custom"), path: custom.path });
|
|
294600
294791
|
if (patterns.length === 0) {
|
|
294601
294792
|
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)`);
|
|
@@ -294657,7 +294848,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
294657
294848
|
return;
|
|
294658
294849
|
}
|
|
294659
294850
|
for (const binding of bindingList) {
|
|
294660
|
-
const record =
|
|
294851
|
+
const record = asRecord14(binding);
|
|
294661
294852
|
if (record) lintHttpRule(record, requestFields, responseFieldNames, warnings, operationId, true);
|
|
294662
294853
|
}
|
|
294663
294854
|
}
|
|
@@ -294685,10 +294876,10 @@ function lintMethodOptions(method, operationId, warnings) {
|
|
|
294685
294876
|
const requestFields = httpFieldInfo(method.resolvedRequestType);
|
|
294686
294877
|
const responseFieldNames = method.resolvedResponseType ? new Set(asArray7(method.resolvedResponseType.fieldsArray).map((field) => String(field.name))) : null;
|
|
294687
294878
|
for (const entry of asArray7(method.parsedOptions)) {
|
|
294688
|
-
const http =
|
|
294879
|
+
const http = asRecord14(asRecord14(entry)?.["(google.api.http)"]);
|
|
294689
294880
|
if (http) lintHttpRule(http, requestFields, responseFieldNames, warnings, operationId, false);
|
|
294690
294881
|
}
|
|
294691
|
-
if (
|
|
294882
|
+
if (asRecord14(method.options)?.deprecated === true) {
|
|
294692
294883
|
warnings.push(`GRPC_DEPRECATED: rpc ${operationId} is marked deprecated`);
|
|
294693
294884
|
}
|
|
294694
294885
|
}
|
|
@@ -294793,7 +294984,7 @@ function parseProtoSchema(content, deps) {
|
|
|
294793
294984
|
}
|
|
294794
294985
|
const enumIndex = {};
|
|
294795
294986
|
for (const enumObj of enums) {
|
|
294796
|
-
const values = Object.keys(
|
|
294987
|
+
const values = Object.keys(asRecord14(enumObj.values) ?? {}).sort();
|
|
294797
294988
|
enumIndex[stripLeadingDot(enumObj.fullName)] = values;
|
|
294798
294989
|
lintEnum(enumObj, warnings, proto3, conventions);
|
|
294799
294990
|
}
|
|
@@ -294922,7 +295113,7 @@ var GRPC_INSTRUMENT_LIMITS = {
|
|
|
294922
295113
|
maxTestScriptBytes: 9e5,
|
|
294923
295114
|
maxCollectionUpdateBytes: 4e6
|
|
294924
295115
|
};
|
|
294925
|
-
function
|
|
295116
|
+
function asRecord15(value) {
|
|
294926
295117
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294927
295118
|
return value;
|
|
294928
295119
|
}
|
|
@@ -295519,7 +295710,7 @@ function createMappingFailureScript2(message) {
|
|
|
295519
295710
|
];
|
|
295520
295711
|
}
|
|
295521
295712
|
function methodPathOf(item) {
|
|
295522
|
-
const payload =
|
|
295713
|
+
const payload = asRecord15(item.payload);
|
|
295523
295714
|
const value = payload?.methodPath;
|
|
295524
295715
|
return typeof value === "string" ? value : "";
|
|
295525
295716
|
}
|
|
@@ -295734,7 +295925,7 @@ function matchesFormatValue(format3, value) {
|
|
|
295734
295925
|
}
|
|
295735
295926
|
function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
295736
295927
|
if (!shape) return;
|
|
295737
|
-
const message =
|
|
295928
|
+
const message = asRecord15(asRecord15(item.payload)?.message);
|
|
295738
295929
|
const raw = typeof message?.content === "string" ? message.content : "";
|
|
295739
295930
|
if (!raw.trim()) return;
|
|
295740
295931
|
if (/\{\{[^}]+\}\}|<[a-zA-Z]/.test(raw)) return;
|
|
@@ -295745,7 +295936,7 @@ function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
|
295745
295936
|
warnings.push(`PROTO_REQUEST_BODY_INVALID_JSON: ${methodPath2} generated request message content is not valid JSON and is not validated`);
|
|
295746
295937
|
return;
|
|
295747
295938
|
}
|
|
295748
|
-
const record =
|
|
295939
|
+
const record = asRecord15(body2);
|
|
295749
295940
|
if (!record) return;
|
|
295750
295941
|
for (const field of shape.fields) {
|
|
295751
295942
|
const key = Object.prototype.hasOwnProperty.call(record, field.jsonName) ? field.jsonName : Object.prototype.hasOwnProperty.call(record, field.name) ? field.name : void 0;
|
|
@@ -295805,16 +295996,16 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
295805
295996
|
if (scriptBytes > GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes) {
|
|
295806
295997
|
throw new Error(`PROTO_SCRIPT_SIZE_EXCEEDED: generated test script for ${methodPath2} exceeded ${GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`);
|
|
295807
295998
|
}
|
|
295808
|
-
const events = asArray8(item.event).filter((entry) =>
|
|
295999
|
+
const events = asArray8(item.event).filter((entry) => asRecord15(entry)?.listen !== "test");
|
|
295809
296000
|
item.event = [...events, { listen: "test", script: { type: "text/javascript", exec: script } }];
|
|
295810
296001
|
}
|
|
295811
296002
|
for (const child3 of asArray8(item.item)) {
|
|
295812
|
-
const childRecord =
|
|
296003
|
+
const childRecord = asRecord15(child3);
|
|
295813
296004
|
if (childRecord) inject(childRecord);
|
|
295814
296005
|
}
|
|
295815
296006
|
};
|
|
295816
296007
|
for (const entry of asArray8(collection.item)) {
|
|
295817
|
-
const item =
|
|
296008
|
+
const item = asRecord15(entry);
|
|
295818
296009
|
if (item) inject(item);
|
|
295819
296010
|
}
|
|
295820
296011
|
const missing = index.operations.filter((operation) => !covered.has(operation.methodPath));
|
|
@@ -295829,7 +296020,7 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
295829
296020
|
}
|
|
295830
296021
|
|
|
295831
296022
|
// src/lib/protocols/grpc/service-config.ts
|
|
295832
|
-
function
|
|
296023
|
+
function asRecord16(value) {
|
|
295833
296024
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
295834
296025
|
return value;
|
|
295835
296026
|
}
|
|
@@ -295988,7 +296179,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
295988
296179
|
return;
|
|
295989
296180
|
}
|
|
295990
296181
|
for (const entry of entries) {
|
|
295991
|
-
const record =
|
|
296182
|
+
const record = asRecord16(entry);
|
|
295992
296183
|
const keys = record ? Object.keys(record) : [];
|
|
295993
296184
|
if (!record || keys.length !== 1) {
|
|
295994
296185
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: each ${label} entry must be an object with exactly one policy key (service_config.proto)`);
|
|
@@ -295999,7 +296190,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
295999
296190
|
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)`);
|
|
296000
296191
|
continue;
|
|
296001
296192
|
}
|
|
296002
|
-
const config =
|
|
296193
|
+
const config = asRecord16(record[policy]);
|
|
296003
296194
|
if (!config) {
|
|
296004
296195
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: ${label} policy "${policy}" config must be a JSON object (service_config.proto)`);
|
|
296005
296196
|
continue;
|
|
@@ -296124,7 +296315,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
296124
296315
|
const declaredServices = new Set(index.operations.map((operation) => operation.serviceFullName));
|
|
296125
296316
|
const seenApis = /* @__PURE__ */ new Set();
|
|
296126
296317
|
asArray9(config.apis).forEach((entry, i) => {
|
|
296127
|
-
const record =
|
|
296318
|
+
const record = asRecord16(entry);
|
|
296128
296319
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
296129
296320
|
if (!name) {
|
|
296130
296321
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: apis[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -296141,7 +296332,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
296141
296332
|
const lintTypeList = (listKey, resolves, kind) => {
|
|
296142
296333
|
const seen = /* @__PURE__ */ new Set();
|
|
296143
296334
|
asArray9(config[listKey]).forEach((entry, i) => {
|
|
296144
|
-
const record =
|
|
296335
|
+
const record = asRecord16(entry);
|
|
296145
296336
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
296146
296337
|
if (!name) {
|
|
296147
296338
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: ${listKey}[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -296169,7 +296360,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
296169
296360
|
};
|
|
296170
296361
|
lintTypeList("types", (name) => index.messages[name] !== void 0, "message");
|
|
296171
296362
|
lintTypeList("enums", (name) => index.enums[name] !== void 0, "enum");
|
|
296172
|
-
const declaredDetails = asArray9(config.types).map((entry) =>
|
|
296363
|
+
const declaredDetails = asArray9(config.types).map((entry) => asRecord16(entry)?.name).filter((name) => typeof name === "string" && GOOGLE_RPC_ERROR_DETAIL_TYPES.has(name));
|
|
296173
296364
|
if (declaredDetails.length > 0 && !declaredDetails.includes("google.rpc.ErrorInfo")) {
|
|
296174
296365
|
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");
|
|
296175
296366
|
}
|
|
@@ -296197,7 +296388,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
296197
296388
|
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");
|
|
296198
296389
|
}
|
|
296199
296390
|
if (config.healthCheckConfig !== void 0) {
|
|
296200
|
-
const health =
|
|
296391
|
+
const health = asRecord16(config.healthCheckConfig);
|
|
296201
296392
|
if (!health) {
|
|
296202
296393
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: healthCheckConfig must be an object (service_config.proto)");
|
|
296203
296394
|
} else {
|
|
@@ -296211,7 +296402,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
296211
296402
|
}
|
|
296212
296403
|
}
|
|
296213
296404
|
}
|
|
296214
|
-
const throttling =
|
|
296405
|
+
const throttling = asRecord16(config.retryThrottling);
|
|
296215
296406
|
if (config.retryThrottling !== void 0) {
|
|
296216
296407
|
const maxTokens = throttling?.maxTokens;
|
|
296217
296408
|
const tokenRatio = throttling?.tokenRatio;
|
|
@@ -296248,7 +296439,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
296248
296439
|
const where = `methodConfig[${i}]`;
|
|
296249
296440
|
const meta = { targets: /* @__PURE__ */ new Set(), unresolved: false, retry: false, hedge: false, selectorCount: 0 };
|
|
296250
296441
|
entryMeta.push(meta);
|
|
296251
|
-
const methodConfig =
|
|
296442
|
+
const methodConfig = asRecord16(entry);
|
|
296252
296443
|
if (!methodConfig) {
|
|
296253
296444
|
warnings.push(`GRPC_SERVICE_CONFIG_INVALID: ${where} must be an object (service_config.proto)`);
|
|
296254
296445
|
return;
|
|
@@ -296266,7 +296457,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
296266
296457
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name must be a non-empty list of {service, method} selectors (service_config.proto)`);
|
|
296267
296458
|
} else {
|
|
296268
296459
|
names.forEach((nameEntry, j) => {
|
|
296269
|
-
const selector =
|
|
296460
|
+
const selector = asRecord16(nameEntry);
|
|
296270
296461
|
if (!selector) {
|
|
296271
296462
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name[${j}] must be an object (service_config.proto)`);
|
|
296272
296463
|
return;
|
|
@@ -296309,8 +296500,8 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
296309
296500
|
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])}`);
|
|
296310
296501
|
}
|
|
296311
296502
|
}
|
|
296312
|
-
const retryPolicy =
|
|
296313
|
-
const hedgingPolicy =
|
|
296503
|
+
const retryPolicy = asRecord16(methodConfig.retryPolicy);
|
|
296504
|
+
const hedgingPolicy = asRecord16(methodConfig.hedgingPolicy);
|
|
296314
296505
|
meta.retry = methodConfig.retryPolicy !== void 0;
|
|
296315
296506
|
meta.hedge = methodConfig.hedgingPolicy !== void 0;
|
|
296316
296507
|
if (methodConfig.retryPolicy !== void 0 && methodConfig.hedgingPolicy !== void 0) {
|
|
@@ -296378,7 +296569,7 @@ ${warnings.join("\n")}`);
|
|
|
296378
296569
|
if (Array.isArray(parsed)) {
|
|
296379
296570
|
parsed.forEach((entry, i) => {
|
|
296380
296571
|
const where = `grpc_config[${i}]`;
|
|
296381
|
-
const choice =
|
|
296572
|
+
const choice = asRecord16(entry);
|
|
296382
296573
|
if (!choice) {
|
|
296383
296574
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where} must be an object (gRFC A2 choice list)`);
|
|
296384
296575
|
return;
|
|
@@ -296397,7 +296588,7 @@ ${warnings.join("\n")}`);
|
|
|
296397
296588
|
if (choice.percentage !== void 0 && !(typeof choice.percentage === "number" && choice.percentage >= 0 && choice.percentage <= 100)) {
|
|
296398
296589
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.percentage must be a number in [0, 100] (gRFC A2)`);
|
|
296399
296590
|
}
|
|
296400
|
-
const embedded =
|
|
296591
|
+
const embedded = asRecord16(choice.serviceConfig);
|
|
296401
296592
|
if (!embedded) {
|
|
296402
296593
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.serviceConfig must be a JSON object (gRFC A2)`);
|
|
296403
296594
|
return;
|
|
@@ -296406,7 +296597,7 @@ ${warnings.join("\n")}`);
|
|
|
296406
296597
|
});
|
|
296407
296598
|
return finish();
|
|
296408
296599
|
}
|
|
296409
|
-
const config =
|
|
296600
|
+
const config = asRecord16(parsed);
|
|
296410
296601
|
if (!config) {
|
|
296411
296602
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: service config must be a JSON object (service_config.proto)");
|
|
296412
296603
|
return finish();
|
|
@@ -302664,7 +302855,7 @@ function lintWsdl20Services(services, interfaces, bindings, warnings) {
|
|
|
302664
302855
|
|
|
302665
302856
|
// src/lib/protocols/soap/xsd-index.ts
|
|
302666
302857
|
var XSD_NS = "http://www.w3.org/2001/XMLSchema";
|
|
302667
|
-
function
|
|
302858
|
+
function asRecord17(value) {
|
|
302668
302859
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
302669
302860
|
return value;
|
|
302670
302861
|
}
|
|
@@ -302700,7 +302891,7 @@ function children2(record, local2) {
|
|
|
302700
302891
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
302701
302892
|
if (localName(key) !== local2) continue;
|
|
302702
302893
|
for (const entry of asArray10(record[key])) {
|
|
302703
|
-
const rec =
|
|
302894
|
+
const rec = asRecord17(entry);
|
|
302704
302895
|
if (rec) out.push(rec);
|
|
302705
302896
|
}
|
|
302706
302897
|
}
|
|
@@ -302736,7 +302927,7 @@ function parseOccursMax(raw) {
|
|
|
302736
302927
|
return Number.isNaN(value) ? 1 : value;
|
|
302737
302928
|
}
|
|
302738
302929
|
function simpleTypeFacets(simpleType, scopes) {
|
|
302739
|
-
const restriction =
|
|
302930
|
+
const restriction = asRecord17(child(simpleType, "restriction"));
|
|
302740
302931
|
if (!restriction) return {};
|
|
302741
302932
|
const baseQName = attr2(restriction, "base");
|
|
302742
302933
|
const baseNs = baseQName ? namespaceForPrefix([...scopes, restriction], prefixOf(baseQName)) : "";
|
|
@@ -302763,7 +302954,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
302763
302954
|
if (!complexType) return void 0;
|
|
302764
302955
|
if (child(complexType, "complexContent") !== void 0 || child(complexType, "simpleContent") !== void 0) return void 0;
|
|
302765
302956
|
if (child(complexType, "choice") !== void 0 || child(complexType, "all") !== void 0 || child(complexType, "group") !== void 0) return void 0;
|
|
302766
|
-
const sequence =
|
|
302957
|
+
const sequence = asRecord17(child(complexType, "sequence"));
|
|
302767
302958
|
if (!sequence) return [];
|
|
302768
302959
|
if (child(sequence, "choice") !== void 0 || child(sequence, "sequence") !== void 0 || child(sequence, "any") !== void 0 || child(sequence, "group") !== void 0) return void 0;
|
|
302769
302960
|
const out = [];
|
|
@@ -302782,7 +302973,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
302782
302973
|
enumeration = sameSchema.enums;
|
|
302783
302974
|
}
|
|
302784
302975
|
}
|
|
302785
|
-
const inlineSimple =
|
|
302976
|
+
const inlineSimple = asRecord17(child(el, "simpleType"));
|
|
302786
302977
|
if (inlineSimple) {
|
|
302787
302978
|
const facets = simpleTypeFacets(inlineSimple, [...scopes, el]);
|
|
302788
302979
|
builtinType = facets.base ?? builtinType;
|
|
@@ -302827,7 +303018,7 @@ function buildXsdIndex(docNode) {
|
|
|
302827
303018
|
for (const el of children2(schema, "element")) {
|
|
302828
303019
|
const name = attr2(el, "name");
|
|
302829
303020
|
if (!name) continue;
|
|
302830
|
-
const inline =
|
|
303021
|
+
const inline = asRecord17(child(el, "complexType"));
|
|
302831
303022
|
const typeQName = attr2(el, "type");
|
|
302832
303023
|
const named = typeQName && namespaceForPrefix([...scopes, el], prefixOf(typeQName)) !== XSD_NS ? complexTypes.get(localName(typeQName)) ?? null : null;
|
|
302833
303024
|
index.elements.set(tns + "|" + name, {
|
|
@@ -302854,7 +303045,7 @@ function lookupXsdElement(index, namespace, name) {
|
|
|
302854
303045
|
}
|
|
302855
303046
|
|
|
302856
303047
|
// src/lib/protocols/soap/parser.ts
|
|
302857
|
-
function
|
|
303048
|
+
function asRecord18(value) {
|
|
302858
303049
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
302859
303050
|
return value;
|
|
302860
303051
|
}
|
|
@@ -302901,7 +303092,7 @@ function children3(record, local2) {
|
|
|
302901
303092
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
302902
303093
|
if (localName2(key) !== local2) continue;
|
|
302903
303094
|
for (const entry of asArray11(record[key])) {
|
|
302904
|
-
const rec =
|
|
303095
|
+
const rec = asRecord18(entry);
|
|
302905
303096
|
if (rec) out.push(rec);
|
|
302906
303097
|
}
|
|
302907
303098
|
}
|
|
@@ -303005,7 +303196,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
303005
303196
|
else if (ns === SOAP11_BINDING_NS) soapVersion = "1.1";
|
|
303006
303197
|
else continue;
|
|
303007
303198
|
for (const marker of asArray11(binding[key])) {
|
|
303008
|
-
const style = attr3(
|
|
303199
|
+
const style = attr3(asRecord18(marker), "style");
|
|
303009
303200
|
if (style) bindingStyle = style;
|
|
303010
303201
|
}
|
|
303011
303202
|
}
|
|
@@ -303018,7 +303209,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
303018
303209
|
for (const key of Object.keys(operation)) {
|
|
303019
303210
|
if (localName2(key) !== "operation") continue;
|
|
303020
303211
|
for (const marker of asArray11(operation[key])) {
|
|
303021
|
-
const rec =
|
|
303212
|
+
const rec = asRecord18(marker);
|
|
303022
303213
|
const action = attr3(rec, "soapAction");
|
|
303023
303214
|
if (action) soapAction = action;
|
|
303024
303215
|
const style2 = attr3(rec, "style");
|
|
@@ -303031,8 +303222,8 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
303031
303222
|
warnings.push(`SOAP_BINDING_STYLE_UNPARSEABLE: binding ${bindingName} operation ${opName} declares style "${styleRaw}" (expected document|rpc); style-specific assertions are skipped`);
|
|
303032
303223
|
style = void 0;
|
|
303033
303224
|
}
|
|
303034
|
-
const inputDirection =
|
|
303035
|
-
const outputDirection =
|
|
303225
|
+
const inputDirection = asRecord18(child2(operation, "input"));
|
|
303226
|
+
const outputDirection = asRecord18(child2(operation, "output"));
|
|
303036
303227
|
const inputBody = bodyMarker(inputDirection);
|
|
303037
303228
|
const outputBody = bodyMarker(outputDirection);
|
|
303038
303229
|
const useRaw = attr3(outputBody, "use") || attr3(inputBody, "use");
|
|
@@ -303112,8 +303303,8 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
303112
303303
|
return children3(portType, "operation").map((operation) => {
|
|
303113
303304
|
const name = attr3(operation, "name");
|
|
303114
303305
|
const opWarnings = [];
|
|
303115
|
-
const inputRecord =
|
|
303116
|
-
const outputRecord =
|
|
303306
|
+
const inputRecord = asRecord18(child2(operation, "input"));
|
|
303307
|
+
const outputRecord = asRecord18(child2(operation, "output"));
|
|
303117
303308
|
const inputRef = localName2(attr3(inputRecord, "message"));
|
|
303118
303309
|
const outputRef = localName2(attr3(outputRecord, "message"));
|
|
303119
303310
|
const input = inputRef ? messages.get(inputRef) : void 0;
|
|
@@ -303167,7 +303358,7 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
303167
303358
|
const seenPortTypes = /* @__PURE__ */ new Set();
|
|
303168
303359
|
for (const port of ports) {
|
|
303169
303360
|
const bindingName = localName2(attr3(port, "binding"));
|
|
303170
|
-
const address =
|
|
303361
|
+
const address = asRecord18(child2(port, "address"));
|
|
303171
303362
|
const location2 = attr3(address, "location");
|
|
303172
303363
|
if (location2 && !endpoint) endpoint = location2;
|
|
303173
303364
|
const portTypeName = bindingToPortType.get(bindingName);
|
|
@@ -303256,8 +303447,8 @@ function parseServices20(description, warnings) {
|
|
|
303256
303447
|
const buildOperations = (iface, binding) => children3(iface, "operation").map((operation) => {
|
|
303257
303448
|
const name = attr3(operation, "name");
|
|
303258
303449
|
const opWarnings = [];
|
|
303259
|
-
const inputRecord =
|
|
303260
|
-
const outputRecord =
|
|
303450
|
+
const inputRecord = asRecord18(child2(operation, "input"));
|
|
303451
|
+
const outputRecord = asRecord18(child2(operation, "output"));
|
|
303261
303452
|
const inputElement = attr3(inputRecord, "element");
|
|
303262
303453
|
const outputElement = attr3(outputRecord, "element");
|
|
303263
303454
|
const outLocal = outputElement.startsWith("#") ? "" : localName2(outputElement);
|
|
@@ -303305,9 +303496,9 @@ function parseServices20(description, warnings) {
|
|
|
303305
303496
|
for (const ep of children3(service, "endpoint")) {
|
|
303306
303497
|
let address = attr3(ep, "address");
|
|
303307
303498
|
if (!address) {
|
|
303308
|
-
const epr =
|
|
303499
|
+
const epr = asRecord18(child2(ep, "EndpointReference"));
|
|
303309
303500
|
const addressNode = child2(epr, "Address");
|
|
303310
|
-
const addressRecord =
|
|
303501
|
+
const addressRecord = asRecord18(addressNode);
|
|
303311
303502
|
address = addressRecord ? asString2(addressRecord["#text"]) : asString2(addressNode);
|
|
303312
303503
|
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`);
|
|
303313
303504
|
}
|
|
@@ -303328,7 +303519,7 @@ function parseServices20(description, warnings) {
|
|
|
303328
303519
|
return services;
|
|
303329
303520
|
}
|
|
303330
303521
|
function detectAddressing(node) {
|
|
303331
|
-
const record =
|
|
303522
|
+
const record = asRecord18(node);
|
|
303332
303523
|
if (!record) return false;
|
|
303333
303524
|
for (const key of Object.keys(record)) {
|
|
303334
303525
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
@@ -303395,7 +303586,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
303395
303586
|
const ns = namespaceForPrefix2([definitions, binding], prefixOf2(key));
|
|
303396
303587
|
if (ns !== SOAP11_BINDING_NS && ns !== SOAP12_BINDING_NS) continue;
|
|
303397
303588
|
for (const entry of asArray11(binding[key])) {
|
|
303398
|
-
const marker =
|
|
303589
|
+
const marker = asRecord18(entry);
|
|
303399
303590
|
if (!marker) continue;
|
|
303400
303591
|
const style = attr3(marker, "style");
|
|
303401
303592
|
if (style) bindingStyle = style;
|
|
@@ -303423,14 +303614,14 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
303423
303614
|
for (const key of Object.keys(operation)) {
|
|
303424
303615
|
if (localName2(key) !== "operation") continue;
|
|
303425
303616
|
for (const entry of asArray11(operation[key])) {
|
|
303426
|
-
const style = attr3(
|
|
303617
|
+
const style = attr3(asRecord18(entry), "style");
|
|
303427
303618
|
if (style) styleRaw = style;
|
|
303428
303619
|
}
|
|
303429
303620
|
}
|
|
303430
303621
|
const effStyle = styleRaw === "rpc" ? "rpc" : "document";
|
|
303431
303622
|
styles.add(effStyle);
|
|
303432
|
-
const inputDirection =
|
|
303433
|
-
const outputDirection =
|
|
303623
|
+
const inputDirection = asRecord18(child2(operation, "input"));
|
|
303624
|
+
const outputDirection = asRecord18(child2(operation, "output"));
|
|
303434
303625
|
const inputBody = bodyMarker(inputDirection);
|
|
303435
303626
|
const outputBody = bodyMarker(outputDirection);
|
|
303436
303627
|
for (const [direction, body2] of [["input", inputBody], ["output", outputBody]]) {
|
|
@@ -303455,8 +303646,8 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
303455
303646
|
}
|
|
303456
303647
|
}
|
|
303457
303648
|
const portTypeOp = portTypeOps.get(opName);
|
|
303458
|
-
const inputMessage = portTypeOp ? messages.get(localName2(attr3(
|
|
303459
|
-
const outputMessage = portTypeOp ? messages.get(localName2(attr3(
|
|
303649
|
+
const inputMessage = portTypeOp ? messages.get(localName2(attr3(asRecord18(child2(portTypeOp, "input")), "message"))) : void 0;
|
|
303650
|
+
const outputMessage = portTypeOp ? messages.get(localName2(attr3(asRecord18(child2(portTypeOp, "output")), "message"))) : void 0;
|
|
303460
303651
|
if (portTypeOp) {
|
|
303461
303652
|
const bindingHasOutput = child2(operation, "output") !== void 0;
|
|
303462
303653
|
const portTypeHasOutput = child2(portTypeOp, "output") !== void 0;
|
|
@@ -303516,7 +303707,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
303516
303707
|
for (const service of children3(definitions, "service")) {
|
|
303517
303708
|
for (const port of children3(service, "port")) {
|
|
303518
303709
|
const portName = attr3(port, "name");
|
|
303519
|
-
const location2 = attr3(
|
|
303710
|
+
const location2 = attr3(asRecord18(child2(port, "address")), "location");
|
|
303520
303711
|
if (!location2) continue;
|
|
303521
303712
|
if (!/^https?:\/\//i.test(location2)) warnings.push(`SOAP_LINT_ADDRESS_NOT_HTTP: port ${portName} soap:address location "${location2}" is not an http(s) URL`);
|
|
303522
303713
|
const prior = addressLocations.get(location2);
|
|
@@ -303535,13 +303726,13 @@ function parseWsdl(content, opts) {
|
|
|
303535
303726
|
const parser = createParser();
|
|
303536
303727
|
let root;
|
|
303537
303728
|
try {
|
|
303538
|
-
root =
|
|
303729
|
+
root = asRecord18(parser.parse(text));
|
|
303539
303730
|
} catch (error) {
|
|
303540
303731
|
throw new Error(`SOAP_WSDL_PARSE_ERROR: ${error.message}`, { cause: error });
|
|
303541
303732
|
}
|
|
303542
303733
|
if (!root) throw new Error("SOAP_WSDL_PARSE_ERROR: document did not parse to an element");
|
|
303543
|
-
const definitions =
|
|
303544
|
-
const description =
|
|
303734
|
+
const definitions = asRecord18(child2(root, "definitions"));
|
|
303735
|
+
const description = asRecord18(child2(root, "description"));
|
|
303545
303736
|
if (!definitions && !description) {
|
|
303546
303737
|
throw new Error("SOAP_WSDL_ROOT_INVALID: expected a WSDL <definitions> (1.1) or <description> (2.0) root element");
|
|
303547
303738
|
}
|
|
@@ -304001,7 +304192,7 @@ function xsdPayloadLines(operation, index) {
|
|
|
304001
304192
|
}
|
|
304002
304193
|
|
|
304003
304194
|
// src/lib/protocols/soap/instrumenter.ts
|
|
304004
|
-
function
|
|
304195
|
+
function asRecord19(value) {
|
|
304005
304196
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
304006
304197
|
return value;
|
|
304007
304198
|
}
|
|
@@ -304683,12 +304874,12 @@ function forEachHttpRequest(node, visit4) {
|
|
|
304683
304874
|
const children4 = asArray12(node.item);
|
|
304684
304875
|
if (children4.length > 0) {
|
|
304685
304876
|
for (const child3 of children4) {
|
|
304686
|
-
const record =
|
|
304877
|
+
const record = asRecord19(child3);
|
|
304687
304878
|
if (record) forEachHttpRequest(record, visit4);
|
|
304688
304879
|
}
|
|
304689
304880
|
return;
|
|
304690
304881
|
}
|
|
304691
|
-
if (
|
|
304882
|
+
if (asRecord19(node.request)) visit4(node);
|
|
304692
304883
|
}
|
|
304693
304884
|
function instrumentSoapCollection(collection, index) {
|
|
304694
304885
|
const warnings = [...index.warnings];
|
|
@@ -304713,7 +304904,7 @@ function instrumentSoapCollection(collection, index) {
|
|
|
304713
304904
|
' pm.expect(code, "unsupported media types map to HTTP 415 (SOAP 1.2 Part 2 section 7)").to.eql(415);',
|
|
304714
304905
|
"});"
|
|
304715
304906
|
];
|
|
304716
|
-
const existingEvents = asArray12(item.event).map((entry) =>
|
|
304907
|
+
const existingEvents = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
304717
304908
|
item.event = [...existingEvents, { listen: "test", script: { type: "text/javascript", exec: probeExec } }];
|
|
304718
304909
|
return;
|
|
304719
304910
|
}
|
|
@@ -304727,13 +304918,13 @@ function instrumentSoapCollection(collection, index) {
|
|
|
304727
304918
|
" pm.expect.fail(contractMappingError);",
|
|
304728
304919
|
"});"
|
|
304729
304920
|
];
|
|
304730
|
-
const existing2 = asArray12(item.event).map((entry) =>
|
|
304921
|
+
const existing2 = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
304731
304922
|
item.event = [...existing2, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
304732
304923
|
return;
|
|
304733
304924
|
}
|
|
304734
304925
|
covered.add(operation.name);
|
|
304735
304926
|
const exec = createSoapScript(operation, warnings, { declaresAddressing: index.declaresAddressing, targetNamespace: index.targetNamespace, schemaIndex: index.schemaIndex }).split("\n");
|
|
304736
|
-
const existing = asArray12(item.event).map((entry) =>
|
|
304927
|
+
const existing = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
304737
304928
|
item.event = [
|
|
304738
304929
|
...existing,
|
|
304739
304930
|
{ listen: "test", script: { type: "text/javascript", exec } }
|
|
@@ -304752,7 +304943,7 @@ var SOCKETIO_PROTOCOLS = /* @__PURE__ */ new Set(["socketio", "socket.io", "sio"
|
|
|
304752
304943
|
var MQTT_PROTOCOLS = /* @__PURE__ */ new Set(["mqtt", "mqtts", "secure-mqtt", "mqtt5"]);
|
|
304753
304944
|
var DEFAULT_SOCKETIO_PATH = "/socket.io";
|
|
304754
304945
|
var SAMPLE_MAX_DEPTH = 5;
|
|
304755
|
-
function
|
|
304946
|
+
function asRecord20(value) {
|
|
304756
304947
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
304757
304948
|
return value;
|
|
304758
304949
|
}
|
|
@@ -304775,7 +304966,7 @@ function contentKindFor(contentType2) {
|
|
|
304775
304966
|
return "binary";
|
|
304776
304967
|
}
|
|
304777
304968
|
function sampleFromSchema(schema, depth) {
|
|
304778
|
-
const record =
|
|
304969
|
+
const record = asRecord20(schema);
|
|
304779
304970
|
if (!record) return record === null ? null : {};
|
|
304780
304971
|
if (record.example !== void 0) return record.example;
|
|
304781
304972
|
if (record.default !== void 0) return record.default;
|
|
@@ -304791,7 +304982,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
304791
304982
|
switch (type) {
|
|
304792
304983
|
case "object":
|
|
304793
304984
|
case void 0: {
|
|
304794
|
-
const properties =
|
|
304985
|
+
const properties = asRecord20(record.properties);
|
|
304795
304986
|
if (!properties) return {};
|
|
304796
304987
|
const required = new Set(asArray13(record.required));
|
|
304797
304988
|
const out = {};
|
|
@@ -304820,7 +305011,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
304820
305011
|
}
|
|
304821
305012
|
}
|
|
304822
305013
|
function bindingKeyValues(bindingSchema) {
|
|
304823
|
-
const properties =
|
|
305014
|
+
const properties = asRecord20(asRecord20(bindingSchema)?.properties);
|
|
304824
305015
|
if (!properties) return [];
|
|
304825
305016
|
return Object.keys(properties).sort().map((key) => ({ key, value: "" }));
|
|
304826
305017
|
}
|
|
@@ -304834,8 +305025,8 @@ function detectTransport(channel, servers, messagesRaw, documentJson, warnings)
|
|
|
304834
305025
|
const protocolSocketio = servers.some((server) => SOCKETIO_PROTOCOLS.has(server.protocol().toLowerCase()));
|
|
304835
305026
|
if (protocolSocketio) return "socketio";
|
|
304836
305027
|
const channelJson = channel.json();
|
|
304837
|
-
const hasAck = messagesRaw.some((message) =>
|
|
304838
|
-
const hasSocketioExt = channelJson["x-socketio"] !== void 0 || documentJson["x-socketio"] !== void 0 ||
|
|
305028
|
+
const hasAck = messagesRaw.some((message) => asRecord20(message.json())?.["x-ack"] !== void 0);
|
|
305029
|
+
const hasSocketioExt = channelJson["x-socketio"] !== void 0 || documentJson["x-socketio"] !== void 0 || asRecord20(channelJson.bindings)?.socketio !== void 0;
|
|
304839
305030
|
if (hasAck || hasSocketioExt) {
|
|
304840
305031
|
warnings.push(
|
|
304841
305032
|
`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`
|
|
@@ -304850,7 +305041,7 @@ function wsBindingKeyValues(channel) {
|
|
|
304850
305041
|
return protocol === "ws" || protocol === "wss" || protocol === "websockets";
|
|
304851
305042
|
});
|
|
304852
305043
|
if (!wsBinding) return { headers: [], queryParams: [] };
|
|
304853
|
-
const value =
|
|
305044
|
+
const value = asRecord20(wsBinding.value()) ?? {};
|
|
304854
305045
|
return {
|
|
304855
305046
|
headers: bindingKeyValues(value.headers),
|
|
304856
305047
|
queryParams: bindingKeyValues(value.query),
|
|
@@ -304861,33 +305052,33 @@ function collectMqttInfo(channel, servers, messagesRaw, documentJson) {
|
|
|
304861
305052
|
const channelJson = channel.json();
|
|
304862
305053
|
const operationBindings = [];
|
|
304863
305054
|
for (const operationKey of ["publish", "subscribe"]) {
|
|
304864
|
-
const binding =
|
|
305055
|
+
const binding = asRecord20(asRecord20(asRecord20(channelJson[operationKey])?.bindings)?.mqtt);
|
|
304865
305056
|
if (binding) operationBindings.push(binding);
|
|
304866
305057
|
}
|
|
304867
305058
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
304868
|
-
const operations =
|
|
305059
|
+
const operations = asRecord20(documentJson.operations) ?? {};
|
|
304869
305060
|
for (const operation of Object.values(operations)) {
|
|
304870
|
-
const operationRecord =
|
|
305061
|
+
const operationRecord = asRecord20(operation);
|
|
304871
305062
|
if (!operationRecord) continue;
|
|
304872
|
-
const ref = String(
|
|
305063
|
+
const ref = String(asRecord20(operationRecord.channel)?.$ref ?? "");
|
|
304873
305064
|
const lastSegment = ref.includes("/") ? unescapePointer(ref.slice(ref.lastIndexOf("/") + 1)) : "";
|
|
304874
305065
|
if (lastSegment !== channel.id()) continue;
|
|
304875
|
-
const binding =
|
|
305066
|
+
const binding = asRecord20(asRecord20(operationRecord.bindings)?.mqtt);
|
|
304876
305067
|
if (binding) operationBindings.push(binding);
|
|
304877
305068
|
}
|
|
304878
305069
|
const serverBindings = [];
|
|
304879
305070
|
let protocolVersion = 4;
|
|
304880
305071
|
for (const server of servers) {
|
|
304881
|
-
const serverJson =
|
|
305072
|
+
const serverJson = asRecord20(server.json()) ?? {};
|
|
304882
305073
|
if (String(serverJson.protocolVersion ?? "") === "5" || server.protocol().toLowerCase() === "mqtt5") {
|
|
304883
305074
|
protocolVersion = 5;
|
|
304884
305075
|
}
|
|
304885
|
-
const binding =
|
|
305076
|
+
const binding = asRecord20(asRecord20(serverJson.bindings)?.mqtt);
|
|
304886
305077
|
if (binding) serverBindings.push(binding);
|
|
304887
305078
|
}
|
|
304888
305079
|
const messageBindings = [];
|
|
304889
305080
|
for (const message of messagesRaw) {
|
|
304890
|
-
const binding =
|
|
305081
|
+
const binding = asRecord20(asRecord20(asRecord20(message.json())?.bindings)?.mqtt);
|
|
304891
305082
|
if (binding) messageBindings.push({ messageId: message.id() || message.name() || "message", binding });
|
|
304892
305083
|
}
|
|
304893
305084
|
return { operationBindings, serverBindings, messageBindings, protocolVersion };
|
|
@@ -304904,7 +305095,7 @@ function buildReplySchemaByMessageId(document2) {
|
|
|
304904
305095
|
}
|
|
304905
305096
|
if (!reply) continue;
|
|
304906
305097
|
const replyMessage = reply.messages().all().find((message) => message.hasPayload());
|
|
304907
|
-
const replySchema = replyMessage ?
|
|
305098
|
+
const replySchema = replyMessage ? asRecord20(replyMessage.payload()?.json()) ?? void 0 : void 0;
|
|
304908
305099
|
if (!replySchema) continue;
|
|
304909
305100
|
for (const requestMessage of operation.messages().all()) {
|
|
304910
305101
|
const id = requestMessage.id();
|
|
@@ -304919,16 +305110,16 @@ function messageDescriptor2(message, warnings, channelId, defaultContentType, re
|
|
|
304919
305110
|
const title = message.title() || message.name() || id;
|
|
304920
305111
|
const contentType2 = message.contentType() || defaultContentType || "application/json";
|
|
304921
305112
|
const contentKind = contentKindFor(contentType2);
|
|
304922
|
-
const payloadSchema = message.hasPayload() ?
|
|
305113
|
+
const payloadSchema = message.hasPayload() ? asRecord20(message.payload()?.json()) ?? void 0 : void 0;
|
|
304923
305114
|
if (!payloadSchema) {
|
|
304924
305115
|
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`);
|
|
304925
305116
|
}
|
|
304926
|
-
const rawMessage =
|
|
304927
|
-
const xAckSchema =
|
|
305117
|
+
const rawMessage = asRecord20(message.json()) ?? {};
|
|
305118
|
+
const xAckSchema = asRecord20(rawMessage["x-ack"]) ?? void 0;
|
|
304928
305119
|
const replySchema = replyByMessageId.get(message.id());
|
|
304929
305120
|
const ackSchema = xAckSchema ?? replySchema;
|
|
304930
305121
|
const ackSource = xAckSchema ? "x-ack" : replySchema ? "reply" : void 0;
|
|
304931
|
-
const correlationRaw =
|
|
305122
|
+
const correlationRaw = asRecord20(rawMessage.correlationId)?.location;
|
|
304932
305123
|
const correlationLocation = typeof correlationRaw === "string" ? correlationRaw : void 0;
|
|
304933
305124
|
const examples = message.examples().all().filter((example) => example.hasPayload());
|
|
304934
305125
|
const hasExample = examples.length > 0;
|
|
@@ -304964,7 +305155,7 @@ function channelDescriptor(channel, document2, documentJson, defaultContentType,
|
|
|
304964
305155
|
const servers = resolveServers(channel, document2);
|
|
304965
305156
|
const messagesRaw = channel.messages().all();
|
|
304966
305157
|
const transport = detectTransport(channel, servers, messagesRaw, documentJson, warnings);
|
|
304967
|
-
const parameterNames = Object.keys(
|
|
305158
|
+
const parameterNames = Object.keys(asRecord20(channel.json().parameters) ?? {}).sort();
|
|
304968
305159
|
const serverUrl = servers.find((server) => server.url())?.url() || options.endpointUrl?.trim() || "";
|
|
304969
305160
|
if (!serverUrl) {
|
|
304970
305161
|
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`);
|
|
@@ -305406,7 +305597,7 @@ var SCHEMES_BY_FAMILY = {
|
|
|
305406
305597
|
http: /* @__PURE__ */ new Set(["http", "https"]),
|
|
305407
305598
|
amqp: /* @__PURE__ */ new Set(["amqp", "amqps"])
|
|
305408
305599
|
};
|
|
305409
|
-
function
|
|
305600
|
+
function asRecord21(value) {
|
|
305410
305601
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
305411
305602
|
return value;
|
|
305412
305603
|
}
|
|
@@ -305425,7 +305616,7 @@ function parsesAsUrl(value) {
|
|
|
305425
305616
|
}
|
|
305426
305617
|
}
|
|
305427
305618
|
function checkExternalDocs(label, raw, warnings) {
|
|
305428
|
-
const externalDocs =
|
|
305619
|
+
const externalDocs = asRecord21(raw);
|
|
305429
305620
|
if (!externalDocs) return;
|
|
305430
305621
|
const url = externalDocs.url;
|
|
305431
305622
|
if (typeof url !== "string" || !parsesAsUrl(url)) {
|
|
@@ -305439,7 +305630,7 @@ function lintTagsAndExternalDocs(label, node, warnings) {
|
|
|
305439
305630
|
const seen = /* @__PURE__ */ new Set();
|
|
305440
305631
|
const reported = /* @__PURE__ */ new Set();
|
|
305441
305632
|
tags.forEach((entry, i) => {
|
|
305442
|
-
const tag =
|
|
305633
|
+
const tag = asRecord21(entry);
|
|
305443
305634
|
const name = typeof tag?.name === "string" ? tag.name : void 0;
|
|
305444
305635
|
if (name !== void 0) {
|
|
305445
305636
|
if (seen.has(name) && !reported.has(name)) {
|
|
@@ -305475,7 +305666,7 @@ function lintSchemaFormat(label, value, warnings) {
|
|
|
305475
305666
|
}
|
|
305476
305667
|
function lintTraits(label, traitsRaw, warnings) {
|
|
305477
305668
|
asArray14(traitsRaw).forEach((entry, i) => {
|
|
305478
|
-
const trait =
|
|
305669
|
+
const trait = asRecord21(entry);
|
|
305479
305670
|
if (trait && trait.payload !== void 0) {
|
|
305480
305671
|
warnings.push(
|
|
305481
305672
|
`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`
|
|
@@ -305484,7 +305675,7 @@ function lintTraits(label, traitsRaw, warnings) {
|
|
|
305484
305675
|
});
|
|
305485
305676
|
}
|
|
305486
305677
|
function lintParameter(label, raw, warnings) {
|
|
305487
|
-
const parameter =
|
|
305678
|
+
const parameter = asRecord21(raw);
|
|
305488
305679
|
if (!parameter) return;
|
|
305489
305680
|
const enumValues = asArray14(parameter.enum);
|
|
305490
305681
|
if (enumValues.length > 0) {
|
|
@@ -305504,9 +305695,9 @@ function lintParameter(label, raw, warnings) {
|
|
|
305504
305695
|
}
|
|
305505
305696
|
}
|
|
305506
305697
|
function lintSecurityRequirements(documentJson, is3, label, securityRaw, warnings) {
|
|
305507
|
-
const declared =
|
|
305698
|
+
const declared = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
305508
305699
|
for (const entry of asArray14(securityRaw)) {
|
|
305509
|
-
const requirement =
|
|
305700
|
+
const requirement = asRecord21(entry);
|
|
305510
305701
|
if (!requirement) continue;
|
|
305511
305702
|
if (is3) {
|
|
305512
305703
|
const type = String(requirement.type ?? "");
|
|
@@ -305519,7 +305710,7 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
305519
305710
|
continue;
|
|
305520
305711
|
}
|
|
305521
305712
|
for (const [schemeName, scopesRaw] of Object.entries(requirement)) {
|
|
305522
|
-
const scheme =
|
|
305713
|
+
const scheme = asRecord21(declared[schemeName]);
|
|
305523
305714
|
if (!scheme) {
|
|
305524
305715
|
warnings.push(
|
|
305525
305716
|
`ASYNCAPI_SECURITY_REQUIREMENT_UNDECLARED: ${label} security requirement references scheme ${JSON.stringify(schemeName)}, which is not declared in components.securitySchemes`
|
|
@@ -305536,9 +305727,9 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
305536
305727
|
}
|
|
305537
305728
|
}
|
|
305538
305729
|
function lintSecuritySchemes(documentJson, warnings) {
|
|
305539
|
-
const schemes =
|
|
305730
|
+
const schemes = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
305540
305731
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
305541
|
-
const scheme =
|
|
305732
|
+
const scheme = asRecord21(raw);
|
|
305542
305733
|
if (!scheme) continue;
|
|
305543
305734
|
const type = scheme.type;
|
|
305544
305735
|
if (typeof type !== "string" || !ASYNCAPI_SECURITY_SCHEME_TYPES.has(type)) {
|
|
@@ -305560,9 +305751,9 @@ function lintSecuritySchemes(documentJson, warnings) {
|
|
|
305560
305751
|
}
|
|
305561
305752
|
}
|
|
305562
305753
|
function lintComponentKeys(documentJson, warnings) {
|
|
305563
|
-
const components =
|
|
305754
|
+
const components = asRecord21(documentJson.components) ?? {};
|
|
305564
305755
|
for (const [sectionName, sectionRaw] of Object.entries(components)) {
|
|
305565
|
-
const section =
|
|
305756
|
+
const section = asRecord21(sectionRaw);
|
|
305566
305757
|
if (!section) continue;
|
|
305567
305758
|
for (const key of Object.keys(section)) {
|
|
305568
305759
|
if (!COMPONENT_KEY_RE.test(key)) {
|
|
@@ -305574,7 +305765,7 @@ function lintComponentKeys(documentJson, warnings) {
|
|
|
305574
305765
|
}
|
|
305575
305766
|
}
|
|
305576
305767
|
function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
305577
|
-
const variables =
|
|
305768
|
+
const variables = asRecord21(variablesRaw) ?? {};
|
|
305578
305769
|
const used = /* @__PURE__ */ new Set();
|
|
305579
305770
|
for (const match of template.matchAll(/\{([^{}]+)\}/g)) {
|
|
305580
305771
|
used.add(match[1]);
|
|
@@ -305588,7 +305779,7 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
305588
305779
|
if (!used.has(name)) {
|
|
305589
305780
|
warnings.push(`ASYNCAPI_SERVER_VARIABLE_UNUSED: ${serverLabel} declares variable ${name} that never appears in the server url/host/pathname`);
|
|
305590
305781
|
}
|
|
305591
|
-
const variable =
|
|
305782
|
+
const variable = asRecord21(raw);
|
|
305592
305783
|
if (!variable) continue;
|
|
305593
305784
|
if (variable.default === void 0) {
|
|
305594
305785
|
warnings.push(
|
|
@@ -305609,10 +305800,10 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
305609
305800
|
}
|
|
305610
305801
|
}
|
|
305611
305802
|
function lintServers(documentJson, is3, warnings) {
|
|
305612
|
-
const servers =
|
|
305803
|
+
const servers = asRecord21(documentJson.servers) ?? {};
|
|
305613
305804
|
let httpProtocolSeen = false;
|
|
305614
305805
|
for (const [name, raw] of Object.entries(servers)) {
|
|
305615
|
-
const server =
|
|
305806
|
+
const server = asRecord21(raw);
|
|
305616
305807
|
if (!server) continue;
|
|
305617
305808
|
const label = `server ${name}`;
|
|
305618
305809
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : void 0;
|
|
@@ -305655,9 +305846,9 @@ function lintServers(documentJson, is3, warnings) {
|
|
|
305655
305846
|
}
|
|
305656
305847
|
}
|
|
305657
305848
|
function lintBindings(label, bindingsRaw, warnings) {
|
|
305658
|
-
const bindings =
|
|
305849
|
+
const bindings = asRecord21(bindingsRaw);
|
|
305659
305850
|
if (!bindings) return;
|
|
305660
|
-
const kafka =
|
|
305851
|
+
const kafka = asRecord21(bindings.kafka);
|
|
305661
305852
|
if (kafka) {
|
|
305662
305853
|
if (typeof kafka.topic === "string" && (kafka.topic === "." || kafka.topic === ".." || !KAFKA_TOPIC_NAME_RE.test(kafka.topic))) {
|
|
305663
305854
|
warnings.push(
|
|
@@ -305672,15 +305863,15 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
305672
305863
|
}
|
|
305673
305864
|
}
|
|
305674
305865
|
}
|
|
305675
|
-
const amqp =
|
|
305866
|
+
const amqp = asRecord21(bindings.amqp);
|
|
305676
305867
|
if (amqp) {
|
|
305677
|
-
const queue =
|
|
305868
|
+
const queue = asRecord21(amqp.queue);
|
|
305678
305869
|
if (queue && typeof queue.name === "string" && queue.name.length > 255) {
|
|
305679
305870
|
warnings.push(
|
|
305680
305871
|
`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)`
|
|
305681
305872
|
);
|
|
305682
305873
|
}
|
|
305683
|
-
const exchange =
|
|
305874
|
+
const exchange = asRecord21(amqp.exchange);
|
|
305684
305875
|
if (exchange && exchange.type !== void 0 && !AMQP_EXCHANGE_TYPES.has(String(exchange.type))) {
|
|
305685
305876
|
warnings.push(
|
|
305686
305877
|
`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)`
|
|
@@ -305697,7 +305888,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
305697
305888
|
);
|
|
305698
305889
|
}
|
|
305699
305890
|
}
|
|
305700
|
-
const http =
|
|
305891
|
+
const http = asRecord21(bindings.http);
|
|
305701
305892
|
if (http) {
|
|
305702
305893
|
if (http.method !== void 0 && (typeof http.method !== "string" || !HTTP_BINDING_METHODS.has(http.method))) {
|
|
305703
305894
|
warnings.push(
|
|
@@ -305710,7 +305901,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
305710
305901
|
);
|
|
305711
305902
|
}
|
|
305712
305903
|
}
|
|
305713
|
-
const ws =
|
|
305904
|
+
const ws = asRecord21(bindings.ws) ?? asRecord21(bindings.websockets);
|
|
305714
305905
|
if (ws && typeof ws.subprotocol === "string" && !IANA_WEBSOCKET_SUBPROTOCOLS.has(ws.subprotocol)) {
|
|
305715
305906
|
warnings.push(
|
|
305716
305907
|
`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)`
|
|
@@ -305718,11 +305909,11 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
305718
305909
|
}
|
|
305719
305910
|
}
|
|
305720
305911
|
function effectiveSchema(label, slot, raw, warnings) {
|
|
305721
|
-
const node =
|
|
305912
|
+
const node = asRecord21(raw);
|
|
305722
305913
|
if (!node) return void 0;
|
|
305723
305914
|
if (typeof node.schemaFormat === "string" && node.schema !== void 0) {
|
|
305724
305915
|
lintSchemaFormat(`${label} ${slot}`, node.schemaFormat, warnings);
|
|
305725
|
-
return
|
|
305916
|
+
return asRecord21(node.schema) ?? void 0;
|
|
305726
305917
|
}
|
|
305727
305918
|
return node;
|
|
305728
305919
|
}
|
|
@@ -305753,7 +305944,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
305753
305944
|
const examples = asArray14(message.examples);
|
|
305754
305945
|
if (!is3) {
|
|
305755
305946
|
examples.forEach((entry, i) => {
|
|
305756
|
-
const example =
|
|
305947
|
+
const example = asRecord21(entry);
|
|
305757
305948
|
if (!example) return;
|
|
305758
305949
|
for (const key of Object.keys(example)) {
|
|
305759
305950
|
if (!MESSAGE_EXAMPLE_KEYS.has(key) && !key.startsWith("x-")) {
|
|
@@ -305764,7 +305955,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
305764
305955
|
}
|
|
305765
305956
|
});
|
|
305766
305957
|
}
|
|
305767
|
-
if (headersSchema && examples.some((entry) =>
|
|
305958
|
+
if (headersSchema && examples.some((entry) => asRecord21(entry)?.headers !== void 0)) {
|
|
305768
305959
|
const packed = packSchema(documentJson, headersSchema, "3.0", "response");
|
|
305769
305960
|
const validate4 = packed.unsupported ? null : compileSchemaValidator(packed.schema);
|
|
305770
305961
|
if (!validate4) {
|
|
@@ -305773,7 +305964,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
305773
305964
|
);
|
|
305774
305965
|
} else {
|
|
305775
305966
|
examples.forEach((entry, i) => {
|
|
305776
|
-
const example =
|
|
305967
|
+
const example = asRecord21(entry);
|
|
305777
305968
|
if (!example || example.headers === void 0) return;
|
|
305778
305969
|
if (!validate4(example.headers)) {
|
|
305779
305970
|
warnings.push(
|
|
@@ -305788,23 +305979,23 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
305788
305979
|
lintTagsAndExternalDocs(label, message, warnings);
|
|
305789
305980
|
}
|
|
305790
305981
|
function messagesOfOperation2x(op) {
|
|
305791
|
-
const root =
|
|
305982
|
+
const root = asRecord21(op.message);
|
|
305792
305983
|
if (!root) return [];
|
|
305793
|
-
const oneOf = asArray14(root.oneOf).map((entry) =>
|
|
305984
|
+
const oneOf = asArray14(root.oneOf).map((entry) => asRecord21(entry)).filter((entry) => entry !== null);
|
|
305794
305985
|
return oneOf.length > 0 ? oneOf : [root];
|
|
305795
305986
|
}
|
|
305796
305987
|
function lintChannels(documentJson, is3, minor, warnings) {
|
|
305797
|
-
const channels =
|
|
305988
|
+
const channels = asRecord21(documentJson.channels) ?? {};
|
|
305798
305989
|
const state = { seen: /* @__PURE__ */ new WeakSet(), messageIds: /* @__PURE__ */ new Map() };
|
|
305799
305990
|
const operationIds = /* @__PURE__ */ new Map();
|
|
305800
305991
|
const addresses = /* @__PURE__ */ new Map();
|
|
305801
305992
|
for (const [channelKey, channelRaw] of Object.entries(channels)) {
|
|
305802
|
-
const channel =
|
|
305993
|
+
const channel = asRecord21(channelRaw);
|
|
305803
305994
|
if (!channel) continue;
|
|
305804
305995
|
const channelLabel = `channel ${channelKey}`;
|
|
305805
305996
|
lintBindings(channelLabel, channel.bindings, warnings);
|
|
305806
305997
|
lintTagsAndExternalDocs(channelLabel, channel, warnings);
|
|
305807
|
-
const parameters =
|
|
305998
|
+
const parameters = asRecord21(channel.parameters) ?? {};
|
|
305808
305999
|
for (const [parameterName, parameterRaw] of Object.entries(parameters)) {
|
|
305809
306000
|
lintParameter(`${channelLabel} parameter ${parameterName}`, parameterRaw, warnings);
|
|
305810
306001
|
}
|
|
@@ -305817,15 +306008,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
305817
306008
|
addresses.set(channel.address, channelKey);
|
|
305818
306009
|
}
|
|
305819
306010
|
}
|
|
305820
|
-
const messages =
|
|
306011
|
+
const messages = asRecord21(channel.messages) ?? {};
|
|
305821
306012
|
for (const [messageKey, messageRaw] of Object.entries(messages)) {
|
|
305822
|
-
const message =
|
|
306013
|
+
const message = asRecord21(messageRaw);
|
|
305823
306014
|
if (message) lintMessage2(documentJson, `message ${messageKey} on channel ${channelKey}`, message, is3, minor, state, warnings);
|
|
305824
306015
|
}
|
|
305825
306016
|
continue;
|
|
305826
306017
|
}
|
|
305827
306018
|
for (const opKey of ["publish", "subscribe"]) {
|
|
305828
|
-
const op =
|
|
306019
|
+
const op = asRecord21(channel[opKey]);
|
|
305829
306020
|
if (!op) continue;
|
|
305830
306021
|
const opLabel = `${opKey} operation on channel ${channelKey}`;
|
|
305831
306022
|
if (typeof op.operationId === "string") {
|
|
@@ -305848,15 +306039,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
305848
306039
|
}
|
|
305849
306040
|
}
|
|
305850
306041
|
function lintOperations3(documentJson, warnings) {
|
|
305851
|
-
const operations =
|
|
306042
|
+
const operations = asRecord21(documentJson.operations) ?? {};
|
|
305852
306043
|
for (const [operationKey, operationRaw] of Object.entries(operations)) {
|
|
305853
|
-
const operation =
|
|
306044
|
+
const operation = asRecord21(operationRaw);
|
|
305854
306045
|
if (!operation) continue;
|
|
305855
306046
|
const label = `operation ${operationKey}`;
|
|
305856
306047
|
if (operation.action !== "send" && operation.action !== "receive") {
|
|
305857
306048
|
warnings.push(`ASYNCAPI_OPERATION_ACTION_INVALID: ${label} action ${JSON.stringify(operation.action)} must be "send" or "receive" (AsyncAPI 3.0 Operation Object)`);
|
|
305858
306049
|
}
|
|
305859
|
-
const replyAddress =
|
|
306050
|
+
const replyAddress = asRecord21(asRecord21(operation.reply)?.address);
|
|
305860
306051
|
if (replyAddress && typeof replyAddress.location === "string" && !isAsyncApiRuntimeExpression(replyAddress.location)) {
|
|
305861
306052
|
warnings.push(
|
|
305862
306053
|
`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>)`
|
|
@@ -305880,7 +306071,7 @@ function resolveLocalPointer(root, ref) {
|
|
|
305880
306071
|
if (!Number.isInteger(idx) || idx < 0 || idx >= node.length) return false;
|
|
305881
306072
|
node = node[idx];
|
|
305882
306073
|
} else {
|
|
305883
|
-
const record =
|
|
306074
|
+
const record = asRecord21(node);
|
|
305884
306075
|
if (!record || !(key in record)) return false;
|
|
305885
306076
|
node = record[key];
|
|
305886
306077
|
}
|
|
@@ -305924,13 +306115,13 @@ function lintAsyncApiDocument(index) {
|
|
|
305924
306115
|
lintChannels(documentJson, is3, minor, warnings);
|
|
305925
306116
|
if (is3) lintOperations3(documentJson, warnings);
|
|
305926
306117
|
lintTagsAndExternalDocs("document", documentJson, warnings);
|
|
305927
|
-
const info =
|
|
306118
|
+
const info = asRecord21(documentJson.info);
|
|
305928
306119
|
if (info) lintTagsAndExternalDocs("info", info, warnings);
|
|
305929
306120
|
return warnings;
|
|
305930
306121
|
}
|
|
305931
306122
|
|
|
305932
306123
|
// src/lib/protocols/asyncapi/asyncapi-binding-lints.ts
|
|
305933
|
-
function
|
|
306124
|
+
function asRecord22(value) {
|
|
305934
306125
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
305935
306126
|
return value;
|
|
305936
306127
|
}
|
|
@@ -306025,46 +306216,46 @@ function pushSite(ctx, site) {
|
|
|
306025
306216
|
if (site) ctx.sites.push(site);
|
|
306026
306217
|
}
|
|
306027
306218
|
function siteOf(scope, label, raw, direction) {
|
|
306028
|
-
const bindings =
|
|
306219
|
+
const bindings = asRecord22(raw);
|
|
306029
306220
|
if (!bindings) return null;
|
|
306030
306221
|
return { scope, label, bindings, direction };
|
|
306031
306222
|
}
|
|
306032
306223
|
function collectSites(ctx) {
|
|
306033
306224
|
const { doc } = ctx;
|
|
306034
|
-
const servers =
|
|
306225
|
+
const servers = asRecord22(doc.servers) ?? {};
|
|
306035
306226
|
for (const [name, raw] of Object.entries(servers)) {
|
|
306036
|
-
const server =
|
|
306227
|
+
const server = asRecord22(raw);
|
|
306037
306228
|
if (server) pushSite(ctx, siteOf("server", "server " + name, server.bindings));
|
|
306038
306229
|
}
|
|
306039
|
-
const channels =
|
|
306230
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
306040
306231
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
306041
|
-
const channel =
|
|
306232
|
+
const channel = asRecord22(rawCh);
|
|
306042
306233
|
if (!channel) continue;
|
|
306043
306234
|
pushSite(ctx, siteOf("channel", "channel " + chName, channel.bindings));
|
|
306044
306235
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
306045
|
-
const op =
|
|
306236
|
+
const op = asRecord22(channel[opKeyword]);
|
|
306046
306237
|
if (!op) continue;
|
|
306047
306238
|
const direction = opKeyword === "publish" ? "send" : "receive";
|
|
306048
306239
|
pushSite(ctx, siteOf("operation", "channel " + chName + " " + opKeyword, op.bindings, direction));
|
|
306049
|
-
const message =
|
|
306240
|
+
const message = asRecord22(op.message);
|
|
306050
306241
|
if (message) collectMessageSites(ctx, "channel " + chName + " " + opKeyword + " message", message, direction);
|
|
306051
306242
|
}
|
|
306052
|
-
const chMessages =
|
|
306243
|
+
const chMessages = asRecord22(channel.messages);
|
|
306053
306244
|
if (chMessages) {
|
|
306054
306245
|
for (const [msgName, rawMsg] of Object.entries(chMessages)) {
|
|
306055
|
-
const message =
|
|
306246
|
+
const message = asRecord22(rawMsg);
|
|
306056
306247
|
if (message) collectMessageSites(ctx, "channel " + chName + " message " + msgName, message, void 0);
|
|
306057
306248
|
}
|
|
306058
306249
|
}
|
|
306059
306250
|
}
|
|
306060
|
-
const operations =
|
|
306251
|
+
const operations = asRecord22(doc.operations) ?? {};
|
|
306061
306252
|
for (const [opName, rawOp] of Object.entries(operations)) {
|
|
306062
|
-
const op =
|
|
306253
|
+
const op = asRecord22(rawOp);
|
|
306063
306254
|
if (!op) continue;
|
|
306064
306255
|
const direction = op.action === "send" ? "send" : op.action === "receive" ? "receive" : void 0;
|
|
306065
306256
|
pushSite(ctx, siteOf("operation", "operation " + opName, op.bindings, direction));
|
|
306066
306257
|
}
|
|
306067
|
-
const components =
|
|
306258
|
+
const components = asRecord22(doc.components) ?? {};
|
|
306068
306259
|
const componentScopes = [
|
|
306069
306260
|
["serverBindings", "server"],
|
|
306070
306261
|
["channelBindings", "channel"],
|
|
@@ -306072,21 +306263,21 @@ function collectSites(ctx) {
|
|
|
306072
306263
|
["messageBindings", "message"]
|
|
306073
306264
|
];
|
|
306074
306265
|
for (const [key, scope] of componentScopes) {
|
|
306075
|
-
const group =
|
|
306266
|
+
const group = asRecord22(components[key]) ?? {};
|
|
306076
306267
|
for (const [name, raw] of Object.entries(group)) {
|
|
306077
306268
|
pushSite(ctx, siteOf(scope, "components." + key + " " + name, raw));
|
|
306078
306269
|
}
|
|
306079
306270
|
}
|
|
306080
|
-
const compMessages =
|
|
306271
|
+
const compMessages = asRecord22(components.messages) ?? {};
|
|
306081
306272
|
for (const [name, raw] of Object.entries(compMessages)) {
|
|
306082
|
-
const message =
|
|
306273
|
+
const message = asRecord22(raw);
|
|
306083
306274
|
if (message) collectMessageSites(ctx, "components.messages " + name, message, void 0);
|
|
306084
306275
|
}
|
|
306085
306276
|
}
|
|
306086
306277
|
function collectMessageSites(ctx, label, message, direction) {
|
|
306087
306278
|
pushSite(ctx, siteOf("message", label, message.bindings, direction));
|
|
306088
306279
|
for (const entry of asArray15(message.oneOf)) {
|
|
306089
|
-
const alt =
|
|
306280
|
+
const alt = asRecord22(entry);
|
|
306090
306281
|
if (alt) pushSite(ctx, siteOf("message", label + " oneOf alternative", alt.bindings, direction));
|
|
306091
306282
|
}
|
|
306092
306283
|
}
|
|
@@ -306111,7 +306302,7 @@ function lintBindingSites(ctx) {
|
|
|
306111
306302
|
}
|
|
306112
306303
|
const family = BINDING_KEY_FAMILY[key];
|
|
306113
306304
|
if (family) familiesSeen.set(family, site.label + " bindings." + key);
|
|
306114
|
-
const binding =
|
|
306305
|
+
const binding = asRecord22(site.bindings[key]);
|
|
306115
306306
|
if (!binding) continue;
|
|
306116
306307
|
if (key === "mqtt5") {
|
|
306117
306308
|
warnings.push(
|
|
@@ -306154,8 +306345,8 @@ function lintBindingSites(ctx) {
|
|
|
306154
306345
|
}
|
|
306155
306346
|
}
|
|
306156
306347
|
const serverFamilies = /* @__PURE__ */ new Set();
|
|
306157
|
-
for (const raw of Object.values(
|
|
306158
|
-
const server =
|
|
306348
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
306349
|
+
const server = asRecord22(raw);
|
|
306159
306350
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
306160
306351
|
const family = SERVER_PROTOCOL_FAMILY[protocol];
|
|
306161
306352
|
if (family) serverFamilies.add(family);
|
|
@@ -306171,7 +306362,7 @@ function lintBindingSites(ctx) {
|
|
|
306171
306362
|
}
|
|
306172
306363
|
}
|
|
306173
306364
|
function compileBindingSchema(ctx, label, schema) {
|
|
306174
|
-
const record =
|
|
306365
|
+
const record = asRecord22(schema);
|
|
306175
306366
|
if (!record) return null;
|
|
306176
306367
|
const packed = packSchema(ctx.doc, record, "3.0", "response");
|
|
306177
306368
|
if (packed.unsupported) {
|
|
@@ -306205,9 +306396,9 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
306205
306396
|
for (const part of ["query", "headers"]) {
|
|
306206
306397
|
const schemaRaw = binding[part];
|
|
306207
306398
|
if (schemaRaw === void 0) continue;
|
|
306208
|
-
const schema =
|
|
306399
|
+
const schema = asRecord22(schemaRaw);
|
|
306209
306400
|
if (!schema) continue;
|
|
306210
|
-
const properties =
|
|
306401
|
+
const properties = asRecord22(schema.properties);
|
|
306211
306402
|
if (!properties || Object.keys(properties).length === 0) {
|
|
306212
306403
|
warnings.push(
|
|
306213
306404
|
"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)"
|
|
@@ -306224,7 +306415,7 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
306224
306415
|
}
|
|
306225
306416
|
if (part !== "headers") continue;
|
|
306226
306417
|
const lower = name.toLowerCase();
|
|
306227
|
-
const prop =
|
|
306418
|
+
const prop = asRecord22(rawProp) ?? {};
|
|
306228
306419
|
if (WS_RUNTIME_OWNED_HEADERS.has(lower)) {
|
|
306229
306420
|
const detail = required.has(lower) ? "is required by the binding but" : "";
|
|
306230
306421
|
warnings.push(
|
|
@@ -306275,10 +306466,10 @@ function substituteTemplates(value) {
|
|
|
306275
306466
|
}
|
|
306276
306467
|
function lintChannelAddresses(ctx) {
|
|
306277
306468
|
const { doc, warnings } = ctx;
|
|
306278
|
-
const channels =
|
|
306469
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
306279
306470
|
const wsServers = [];
|
|
306280
|
-
for (const [name, raw] of Object.entries(
|
|
306281
|
-
const server =
|
|
306471
|
+
for (const [name, raw] of Object.entries(asRecord22(doc.servers) ?? {})) {
|
|
306472
|
+
const server = asRecord22(raw);
|
|
306282
306473
|
if (!server) continue;
|
|
306283
306474
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
306284
306475
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "ws") continue;
|
|
@@ -306286,7 +306477,7 @@ function lintChannelAddresses(ctx) {
|
|
|
306286
306477
|
if (url) wsServers.push({ name, base: url });
|
|
306287
306478
|
}
|
|
306288
306479
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
306289
|
-
const channel =
|
|
306480
|
+
const channel = asRecord22(rawCh);
|
|
306290
306481
|
if (!channel) continue;
|
|
306291
306482
|
const address = ctx.isV3 ? channel.address : chName;
|
|
306292
306483
|
if (typeof address !== "string" || address.length === 0) continue;
|
|
@@ -306323,8 +306514,8 @@ function lintChannelAddresses(ctx) {
|
|
|
306323
306514
|
}
|
|
306324
306515
|
}
|
|
306325
306516
|
function collectMqttServerVersions(ctx) {
|
|
306326
|
-
for (const raw of Object.values(
|
|
306327
|
-
const server =
|
|
306517
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
306518
|
+
const server = asRecord22(raw);
|
|
306328
306519
|
if (!server) continue;
|
|
306329
306520
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
306330
306521
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "mqtt") continue;
|
|
@@ -306345,7 +306536,7 @@ function lintMqttBindings(ctx) {
|
|
|
306345
306536
|
const { warnings } = ctx;
|
|
306346
306537
|
const only3x = ctx.mqttVersions.size > 0 && !ctx.mqttVersions.has(5) && !ctx.mqttVersions.has(0);
|
|
306347
306538
|
for (const site of ctx.sites) {
|
|
306348
|
-
const binding =
|
|
306539
|
+
const binding = asRecord22(site.bindings.mqtt);
|
|
306349
306540
|
if (!binding) continue;
|
|
306350
306541
|
if (only3x) {
|
|
306351
306542
|
const gated = MQTT5_ONLY_FIELDS[site.scope];
|
|
@@ -306361,7 +306552,7 @@ function lintMqttBindings(ctx) {
|
|
|
306361
306552
|
}
|
|
306362
306553
|
if (site.scope === "server") {
|
|
306363
306554
|
const clientId = binding.clientId;
|
|
306364
|
-
if (clientId !== void 0 && typeof clientId !== "string" && !
|
|
306555
|
+
if (clientId !== void 0 && typeof clientId !== "string" && !asRecord22(clientId)) {
|
|
306365
306556
|
warnings.push("ASYNCAPI_MQTT_CLIENT_ID_INVALID: " + site.label + " mqtt binding clientId must be a string or schema object (mqtt binding README)");
|
|
306366
306557
|
}
|
|
306367
306558
|
if (typeof clientId === "string") {
|
|
@@ -306374,12 +306565,12 @@ function lintMqttBindings(ctx) {
|
|
|
306374
306565
|
if (clientId === "" && only3x && binding.cleanSession !== true) {
|
|
306375
306566
|
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)");
|
|
306376
306567
|
}
|
|
306377
|
-
} else if (
|
|
306568
|
+
} else if (asRecord22(clientId)) {
|
|
306378
306569
|
compileBindingSchema(ctx, site.label + " mqtt binding clientId", clientId);
|
|
306379
306570
|
}
|
|
306380
306571
|
const lastWill = binding.lastWill;
|
|
306381
306572
|
if (lastWill !== void 0) {
|
|
306382
|
-
const will =
|
|
306573
|
+
const will = asRecord22(lastWill);
|
|
306383
306574
|
if (!will) {
|
|
306384
306575
|
warnings.push("ASYNCAPI_MQTT_LAST_WILL_INVALID: " + site.label + " mqtt binding lastWill must be an object (mqtt binding README)");
|
|
306385
306576
|
} else {
|
|
@@ -306396,7 +306587,7 @@ function lintMqttBindings(ctx) {
|
|
|
306396
306587
|
}
|
|
306397
306588
|
for (const [field, max] of [["sessionExpiryInterval", 4294967295], ["maximumPacketSize", 268435455]]) {
|
|
306398
306589
|
const value = binding[field];
|
|
306399
|
-
if (
|
|
306590
|
+
if (asRecord22(value)) compileBindingSchema(ctx, site.label + " mqtt binding " + field, value);
|
|
306400
306591
|
else if (typeof value === "number" && value > max) {
|
|
306401
306592
|
warnings.push("ASYNCAPI_MQTT_VALUE_OUT_OF_RANGE: " + site.label + " mqtt binding " + field + " " + value + " exceeds the MQTT wire ceiling " + max);
|
|
306402
306593
|
}
|
|
@@ -306404,7 +306595,7 @@ function lintMqttBindings(ctx) {
|
|
|
306404
306595
|
}
|
|
306405
306596
|
if (site.scope === "operation") {
|
|
306406
306597
|
const expiry = binding.messageExpiryInterval;
|
|
306407
|
-
if (
|
|
306598
|
+
if (asRecord22(expiry)) compileBindingSchema(ctx, site.label + " mqtt binding messageExpiryInterval", expiry);
|
|
306408
306599
|
else if (typeof expiry === "number" && expiry > 4294967295) {
|
|
306409
306600
|
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)");
|
|
306410
306601
|
}
|
|
@@ -306424,15 +306615,15 @@ function lintMqttBindings(ctx) {
|
|
|
306424
306615
|
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)");
|
|
306425
306616
|
}
|
|
306426
306617
|
const correlationData = binding.correlationData;
|
|
306427
|
-
if (
|
|
306618
|
+
if (asRecord22(correlationData)) {
|
|
306428
306619
|
compileBindingSchema(ctx, site.label + " mqtt binding correlationData", correlationData);
|
|
306429
|
-
const maxLength =
|
|
306620
|
+
const maxLength = asRecord22(correlationData)?.maxLength;
|
|
306430
306621
|
if (typeof maxLength === "number" && maxLength > 65535) {
|
|
306431
306622
|
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)");
|
|
306432
306623
|
}
|
|
306433
306624
|
}
|
|
306434
306625
|
const responseTopic = binding.responseTopic;
|
|
306435
|
-
if (
|
|
306626
|
+
if (asRecord22(responseTopic)) compileBindingSchema(ctx, site.label + " mqtt binding responseTopic", responseTopic);
|
|
306436
306627
|
const pfi = binding.payloadFormatIndicator;
|
|
306437
306628
|
if (pfi === 1) {
|
|
306438
306629
|
const message = siteMessageRecord(ctx, site);
|
|
@@ -306462,38 +306653,38 @@ function normalizeMediaType(value) {
|
|
|
306462
306653
|
function siteMessageRecord(ctx, site) {
|
|
306463
306654
|
const doc = ctx.doc;
|
|
306464
306655
|
const matches = (message) => {
|
|
306465
|
-
return message !== null &&
|
|
306656
|
+
return message !== null && asRecord22(message.bindings)?.mqtt === site.bindings.mqtt;
|
|
306466
306657
|
};
|
|
306467
|
-
for (const rawCh of Object.values(
|
|
306468
|
-
const channel =
|
|
306658
|
+
for (const rawCh of Object.values(asRecord22(doc.channels) ?? {})) {
|
|
306659
|
+
const channel = asRecord22(rawCh);
|
|
306469
306660
|
if (!channel) continue;
|
|
306470
306661
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
306471
|
-
const op =
|
|
306472
|
-
const message =
|
|
306662
|
+
const op = asRecord22(channel[opKeyword]);
|
|
306663
|
+
const message = asRecord22(op?.message);
|
|
306473
306664
|
if (matches(message)) return message;
|
|
306474
306665
|
for (const entry of asArray15(message?.oneOf)) {
|
|
306475
|
-
const alt =
|
|
306666
|
+
const alt = asRecord22(entry);
|
|
306476
306667
|
if (matches(alt)) return alt;
|
|
306477
306668
|
}
|
|
306478
306669
|
}
|
|
306479
|
-
for (const rawMsg of Object.values(
|
|
306480
|
-
const message =
|
|
306670
|
+
for (const rawMsg of Object.values(asRecord22(channel.messages) ?? {})) {
|
|
306671
|
+
const message = asRecord22(rawMsg);
|
|
306481
306672
|
if (matches(message)) return message;
|
|
306482
306673
|
}
|
|
306483
306674
|
}
|
|
306484
|
-
for (const rawMsg of Object.values(
|
|
306485
|
-
const message =
|
|
306675
|
+
for (const rawMsg of Object.values(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
306676
|
+
const message = asRecord22(rawMsg);
|
|
306486
306677
|
if (matches(message)) return message;
|
|
306487
306678
|
}
|
|
306488
306679
|
return null;
|
|
306489
306680
|
}
|
|
306490
306681
|
function lintHttpBindings(ctx) {
|
|
306491
306682
|
for (const site of ctx.sites) {
|
|
306492
|
-
const binding =
|
|
306683
|
+
const binding = asRecord22(site.bindings.http);
|
|
306493
306684
|
if (!binding) continue;
|
|
306494
306685
|
if (site.scope === "operation" && binding.query !== void 0) {
|
|
306495
|
-
const schema =
|
|
306496
|
-
const properties =
|
|
306686
|
+
const schema = asRecord22(binding.query);
|
|
306687
|
+
const properties = asRecord22(schema?.properties);
|
|
306497
306688
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
306498
306689
|
ctx.warnings.push(
|
|
306499
306690
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding query must be an object schema with properties (http binding README)"
|
|
@@ -306508,8 +306699,8 @@ function lintHttpBindings(ctx) {
|
|
|
306508
306699
|
}
|
|
306509
306700
|
}
|
|
306510
306701
|
if (site.scope === "message" && binding.headers !== void 0) {
|
|
306511
|
-
const schema =
|
|
306512
|
-
const properties =
|
|
306702
|
+
const schema = asRecord22(binding.headers);
|
|
306703
|
+
const properties = asRecord22(schema?.properties);
|
|
306513
306704
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
306514
306705
|
ctx.warnings.push(
|
|
306515
306706
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding headers must be an object schema with properties (http binding README)"
|
|
@@ -306545,19 +306736,19 @@ var HTTP_PROTOCOL_HEADER_DENYLIST = /* @__PURE__ */ new Set([
|
|
|
306545
306736
|
function collectMessages2(ctx) {
|
|
306546
306737
|
const out = [];
|
|
306547
306738
|
const doc = ctx.doc;
|
|
306548
|
-
for (const [chName, rawCh] of Object.entries(
|
|
306549
|
-
const channel =
|
|
306739
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
306740
|
+
const channel = asRecord22(rawCh);
|
|
306550
306741
|
if (!channel) continue;
|
|
306551
306742
|
const siblingList = [];
|
|
306552
306743
|
const push = (label, raw) => {
|
|
306553
|
-
const message =
|
|
306744
|
+
const message = asRecord22(raw);
|
|
306554
306745
|
if (!message) return;
|
|
306555
306746
|
siblingList.push(message);
|
|
306556
306747
|
out.push({ label, message, channelMessages: siblingList });
|
|
306557
306748
|
};
|
|
306558
306749
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
306559
|
-
const op =
|
|
306560
|
-
const message =
|
|
306750
|
+
const op = asRecord22(channel[opKeyword]);
|
|
306751
|
+
const message = asRecord22(op?.message);
|
|
306561
306752
|
if (!message) continue;
|
|
306562
306753
|
const alternatives = asArray15(message.oneOf);
|
|
306563
306754
|
if (alternatives.length > 0) {
|
|
@@ -306566,12 +306757,12 @@ function collectMessages2(ctx) {
|
|
|
306566
306757
|
push("channel " + chName + " " + opKeyword + " message", message);
|
|
306567
306758
|
}
|
|
306568
306759
|
}
|
|
306569
|
-
for (const [msgName, rawMsg] of Object.entries(
|
|
306760
|
+
for (const [msgName, rawMsg] of Object.entries(asRecord22(channel.messages) ?? {})) {
|
|
306570
306761
|
push("channel " + chName + " message " + msgName, rawMsg);
|
|
306571
306762
|
}
|
|
306572
306763
|
}
|
|
306573
|
-
for (const [name, raw] of Object.entries(
|
|
306574
|
-
const message =
|
|
306764
|
+
for (const [name, raw] of Object.entries(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
306765
|
+
const message = asRecord22(raw);
|
|
306575
306766
|
if (message) out.push({ label: "components.messages " + name, message, channelMessages: null });
|
|
306576
306767
|
}
|
|
306577
306768
|
return out;
|
|
@@ -306580,7 +306771,7 @@ function effectiveMessageId(message) {
|
|
|
306580
306771
|
if (typeof message.messageId === "string") return message.messageId;
|
|
306581
306772
|
let fromTraits;
|
|
306582
306773
|
for (const entry of asArray15(message.traits)) {
|
|
306583
|
-
const trait =
|
|
306774
|
+
const trait = asRecord22(entry);
|
|
306584
306775
|
if (trait && typeof trait.messageId === "string") fromTraits = trait.messageId;
|
|
306585
306776
|
}
|
|
306586
306777
|
return fromTraits;
|
|
@@ -306594,7 +306785,7 @@ function lintMessages(ctx) {
|
|
|
306594
306785
|
const validatorFor = (message) => {
|
|
306595
306786
|
if (validatorCache.has(message)) return validatorCache.get(message) ?? null;
|
|
306596
306787
|
let validate4 = null;
|
|
306597
|
-
const payload =
|
|
306788
|
+
const payload = asRecord22(message.payload);
|
|
306598
306789
|
if (payload) {
|
|
306599
306790
|
const packed = packSchema(ctx.doc, payload, "3.0", "response");
|
|
306600
306791
|
if (!packed.unsupported) {
|
|
@@ -306614,10 +306805,10 @@ function lintMessages(ctx) {
|
|
|
306614
306805
|
}
|
|
306615
306806
|
if (owner === void 0) idOwners.set(id, label);
|
|
306616
306807
|
}
|
|
306617
|
-
const headers =
|
|
306808
|
+
const headers = asRecord22(message.headers);
|
|
306618
306809
|
if (headers) {
|
|
306619
306810
|
compileBindingSchema(ctx, label + " headers", headers);
|
|
306620
|
-
const properties =
|
|
306811
|
+
const properties = asRecord22(headers.properties) ?? {};
|
|
306621
306812
|
for (const name of Object.keys(properties)) {
|
|
306622
306813
|
if (!HTTP_TOKEN_RE.test(name)) {
|
|
306623
306814
|
warnings.push("ASYNCAPI_BINDING_HEADER_NAME_INVALID: " + label + " headers property " + JSON.stringify(name) + " is not a valid RFC 9110 token");
|
|
@@ -306639,7 +306830,7 @@ function lintMessages(ctx) {
|
|
|
306639
306830
|
return compileSchemaValidator(packed.schema);
|
|
306640
306831
|
})() : null;
|
|
306641
306832
|
asArray15(message.examples).forEach((entry, i) => {
|
|
306642
|
-
const example =
|
|
306833
|
+
const example = asRecord22(entry);
|
|
306643
306834
|
if (!example) return;
|
|
306644
306835
|
if (example.payload === void 0 && example.headers !== void 0) {
|
|
306645
306836
|
if (headerValidate) {
|
|
@@ -306666,7 +306857,7 @@ function lintMessages(ctx) {
|
|
|
306666
306857
|
const traits = asArray15(message.traits);
|
|
306667
306858
|
const traitKeyValues = /* @__PURE__ */ new Map();
|
|
306668
306859
|
traits.forEach((entry, i) => {
|
|
306669
|
-
const trait =
|
|
306860
|
+
const trait = asRecord22(entry);
|
|
306670
306861
|
if (!trait) return;
|
|
306671
306862
|
if (trait.traits !== void 0) {
|
|
306672
306863
|
warnings.push("ASYNCAPI_TRAIT_FORBIDDEN_FIELD: " + label + " trait #" + i + ' declares "traits"; a Message Trait Object cannot itself carry traits (AsyncAPI Message Trait Object)');
|
|
@@ -306683,14 +306874,14 @@ function lintMessages(ctx) {
|
|
|
306683
306874
|
}
|
|
306684
306875
|
});
|
|
306685
306876
|
}
|
|
306686
|
-
for (const [chName, rawCh] of Object.entries(
|
|
306687
|
-
const channel =
|
|
306877
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(ctx.doc.channels) ?? {})) {
|
|
306878
|
+
const channel = asRecord22(rawCh);
|
|
306688
306879
|
if (!channel) continue;
|
|
306689
306880
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
306690
|
-
const op =
|
|
306881
|
+
const op = asRecord22(channel[opKeyword]);
|
|
306691
306882
|
if (!op) continue;
|
|
306692
306883
|
asArray15(op.traits).forEach((entry, i) => {
|
|
306693
|
-
const trait =
|
|
306884
|
+
const trait = asRecord22(entry);
|
|
306694
306885
|
if (!trait) return;
|
|
306695
306886
|
for (const forbidden of ["message", "traits"]) {
|
|
306696
306887
|
if (trait[forbidden] !== void 0) {
|
|
@@ -306700,13 +306891,13 @@ function lintMessages(ctx) {
|
|
|
306700
306891
|
});
|
|
306701
306892
|
}
|
|
306702
306893
|
}
|
|
306703
|
-
const channelsRecord =
|
|
306704
|
-
const channelValues = Object.values(channelsRecord).map(
|
|
306705
|
-
for (const [opName, rawOp] of Object.entries(
|
|
306706
|
-
const op =
|
|
306894
|
+
const channelsRecord = asRecord22(ctx.doc.channels) ?? {};
|
|
306895
|
+
const channelValues = Object.values(channelsRecord).map(asRecord22).filter((c) => c !== null);
|
|
306896
|
+
for (const [opName, rawOp] of Object.entries(asRecord22(ctx.doc.operations) ?? {})) {
|
|
306897
|
+
const op = asRecord22(rawOp);
|
|
306707
306898
|
if (!op) continue;
|
|
306708
306899
|
asArray15(op.traits).forEach((entry, i) => {
|
|
306709
|
-
const trait =
|
|
306900
|
+
const trait = asRecord22(entry);
|
|
306710
306901
|
if (!trait) return;
|
|
306711
306902
|
for (const forbidden of ["action", "channel", "traits"]) {
|
|
306712
306903
|
if (trait[forbidden] !== void 0) {
|
|
@@ -306714,13 +306905,13 @@ function lintMessages(ctx) {
|
|
|
306714
306905
|
}
|
|
306715
306906
|
}
|
|
306716
306907
|
});
|
|
306717
|
-
const opChannel =
|
|
306908
|
+
const opChannel = asRecord22(op.channel);
|
|
306718
306909
|
if (opChannel && channelValues.length > 0 && !channelValues.includes(opChannel)) {
|
|
306719
306910
|
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)");
|
|
306720
306911
|
}
|
|
306721
306912
|
if (opChannel) {
|
|
306722
|
-
const channelMessages = Object.values(
|
|
306723
|
-
const opMessages = asArray15(op.messages).map(
|
|
306913
|
+
const channelMessages = Object.values(asRecord22(opChannel.messages) ?? {}).map(asRecord22).filter((m) => m !== null);
|
|
306914
|
+
const opMessages = asArray15(op.messages).map(asRecord22).filter((m) => m !== null);
|
|
306724
306915
|
for (const opMessage of opMessages) {
|
|
306725
306916
|
const inChannel = channelMessages.some((cm) => cm === opMessage || JSON.stringify(cm) === JSON.stringify(opMessage));
|
|
306726
306917
|
if (!inChannel) {
|
|
@@ -306728,16 +306919,16 @@ function lintMessages(ctx) {
|
|
|
306728
306919
|
}
|
|
306729
306920
|
}
|
|
306730
306921
|
}
|
|
306731
|
-
const reply =
|
|
306922
|
+
const reply = asRecord22(op.reply);
|
|
306732
306923
|
if (reply) {
|
|
306733
|
-
const replyChannel =
|
|
306734
|
-
const replyAddress =
|
|
306924
|
+
const replyChannel = asRecord22(reply.channel);
|
|
306925
|
+
const replyAddress = asRecord22(reply.address);
|
|
306735
306926
|
if (replyAddress && replyChannel && typeof replyChannel.address === "string" && replyChannel.address.length > 0) {
|
|
306736
306927
|
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)");
|
|
306737
306928
|
}
|
|
306738
306929
|
if (replyChannel) {
|
|
306739
|
-
const replyChannelMessages = Object.values(
|
|
306740
|
-
const replyMessages = asArray15(reply.messages).map(
|
|
306930
|
+
const replyChannelMessages = Object.values(asRecord22(replyChannel.messages) ?? {}).map(asRecord22).filter((m) => m !== null);
|
|
306931
|
+
const replyMessages = asArray15(reply.messages).map(asRecord22).filter((m) => m !== null);
|
|
306741
306932
|
for (const replyMessage of replyMessages) {
|
|
306742
306933
|
const inChannel = replyChannelMessages.some((cm) => cm === replyMessage || JSON.stringify(cm) === JSON.stringify(replyMessage));
|
|
306743
306934
|
if (!inChannel) {
|
|
@@ -306749,8 +306940,8 @@ function lintMessages(ctx) {
|
|
|
306749
306940
|
}
|
|
306750
306941
|
}
|
|
306751
306942
|
function hasWsSurface(ctx) {
|
|
306752
|
-
for (const raw of Object.values(
|
|
306753
|
-
const server =
|
|
306943
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
306944
|
+
const server = asRecord22(raw);
|
|
306754
306945
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
306755
306946
|
if (SERVER_PROTOCOL_FAMILY[protocol] === "ws") return true;
|
|
306756
306947
|
}
|
|
@@ -306761,11 +306952,11 @@ var API_KEY_LOCATIONS_V2 = /* @__PURE__ */ new Set(["user", "password"]);
|
|
|
306761
306952
|
var SYNTHESIZABLE_SCHEME_TYPES = /* @__PURE__ */ new Set(["http", "httpApiKey", "apiKey", "userPassword"]);
|
|
306762
306953
|
function lintSecuritySchemes2(ctx) {
|
|
306763
306954
|
const { warnings } = ctx;
|
|
306764
|
-
const schemes =
|
|
306955
|
+
const schemes = asRecord22(asRecord22(ctx.doc.components)?.securitySchemes) ?? {};
|
|
306765
306956
|
const oauthLikeNames = /* @__PURE__ */ new Set();
|
|
306766
306957
|
const unsatisfiable = [];
|
|
306767
306958
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
306768
|
-
const scheme =
|
|
306959
|
+
const scheme = asRecord22(raw);
|
|
306769
306960
|
if (!scheme) continue;
|
|
306770
306961
|
const type = typeof scheme.type === "string" ? scheme.type : "";
|
|
306771
306962
|
if (type === "oauth2" || type === "openIdConnect") oauthLikeNames.add(name);
|
|
@@ -306785,9 +306976,9 @@ function lintSecuritySchemes2(ctx) {
|
|
|
306785
306976
|
}
|
|
306786
306977
|
}
|
|
306787
306978
|
if (type === "oauth2") {
|
|
306788
|
-
const flows =
|
|
306979
|
+
const flows = asRecord22(scheme.flows) ?? {};
|
|
306789
306980
|
for (const [flowName, rawFlow] of Object.entries(flows)) {
|
|
306790
|
-
const flow =
|
|
306981
|
+
const flow = asRecord22(rawFlow);
|
|
306791
306982
|
if (!flow) continue;
|
|
306792
306983
|
for (const field of ["authorizationUrl", "tokenUrl", "refreshUrl"]) {
|
|
306793
306984
|
const url = flow[field];
|
|
@@ -306804,11 +306995,11 @@ function lintSecuritySchemes2(ctx) {
|
|
|
306804
306995
|
if (unsatisfiable.length > 0) {
|
|
306805
306996
|
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");
|
|
306806
306997
|
}
|
|
306807
|
-
for (const [serverName, raw] of Object.entries(
|
|
306808
|
-
const server =
|
|
306998
|
+
for (const [serverName, raw] of Object.entries(asRecord22(ctx.doc.servers) ?? {})) {
|
|
306999
|
+
const server = asRecord22(raw);
|
|
306809
307000
|
if (!server) continue;
|
|
306810
307001
|
asArray15(server.security).forEach((entry, i) => {
|
|
306811
|
-
const requirement =
|
|
307002
|
+
const requirement = asRecord22(entry);
|
|
306812
307003
|
if (!requirement) return;
|
|
306813
307004
|
for (const [schemeName, value] of Object.entries(requirement)) {
|
|
306814
307005
|
if (!Array.isArray(value)) {
|
|
@@ -306818,7 +307009,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
306818
307009
|
if (value.some((scope) => typeof scope !== "string")) {
|
|
306819
307010
|
warnings.push("ASYNCAPI_SECURITY_REQUIREMENT_INVALID: server " + serverName + " security requirement #" + i + " scopes for " + schemeName + " must be strings (AsyncAPI Security Requirement Object)");
|
|
306820
307011
|
}
|
|
306821
|
-
if (value.length > 0 && !oauthLikeNames.has(schemeName) &&
|
|
307012
|
+
if (value.length > 0 && !oauthLikeNames.has(schemeName) && asRecord22(schemes[schemeName])) {
|
|
306822
307013
|
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)");
|
|
306823
307014
|
}
|
|
306824
307015
|
}
|
|
@@ -306828,7 +307019,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
306828
307019
|
function lintSocketIo(ctx) {
|
|
306829
307020
|
if (!ctx.socketIo) return;
|
|
306830
307021
|
const { warnings, doc } = ctx;
|
|
306831
|
-
const xSocketIo =
|
|
307022
|
+
const xSocketIo = asRecord22(doc["x-socketio"]) ?? {};
|
|
306832
307023
|
const declaredVersion = xSocketIo.version ?? xSocketIo.eio ?? xSocketIo.EIO;
|
|
306833
307024
|
if (declaredVersion !== void 0 && String(declaredVersion) !== "4") {
|
|
306834
307025
|
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");
|
|
@@ -306837,8 +307028,8 @@ function lintSocketIo(ctx) {
|
|
|
306837
307028
|
if (typeof path8 === "string" && path8 !== "/socket.io/" && path8 !== "/socket.io") {
|
|
306838
307029
|
warnings.push("ASYNCAPI_SOCKETIO_PATH_UNSUPPORTED: x-socketio declares path " + JSON.stringify(path8) + " but generated Socket.IO items connect on the default /socket.io/ path");
|
|
306839
307030
|
}
|
|
306840
|
-
for (const [chName, rawCh] of Object.entries(
|
|
306841
|
-
const channel =
|
|
307031
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
307032
|
+
const channel = asRecord22(rawCh);
|
|
306842
307033
|
if (!channel) continue;
|
|
306843
307034
|
const address = ctx.isV3 ? typeof channel.address === "string" ? channel.address : "" : chName;
|
|
306844
307035
|
if (address && address !== "/" && !address.startsWith("/")) {
|
|
@@ -306846,10 +307037,10 @@ function lintSocketIo(ctx) {
|
|
|
306846
307037
|
} else if (address && address !== "/") {
|
|
306847
307038
|
warnings.push("ASYNCAPI_SOCKETIO_NAMESPACE_NOT_ROUTED: channel " + chName + " implies Socket.IO namespace " + JSON.stringify(address) + " but generated items connect to the root namespace");
|
|
306848
307039
|
}
|
|
306849
|
-
const wsBinding =
|
|
306850
|
-
const queryProps =
|
|
307040
|
+
const wsBinding = asRecord22(asRecord22(channel.bindings)?.ws);
|
|
307041
|
+
const queryProps = asRecord22(asRecord22(wsBinding?.query)?.properties) ?? {};
|
|
306851
307042
|
for (const [propName2, rawProp] of Object.entries(queryProps)) {
|
|
306852
|
-
const prop =
|
|
307043
|
+
const prop = asRecord22(rawProp);
|
|
306853
307044
|
if (!prop) continue;
|
|
306854
307045
|
const declared = schemaDeclaredValues(prop).map(String);
|
|
306855
307046
|
if (propName2 === "EIO" && declared.some((v) => v !== "4")) {
|
|
@@ -306869,7 +307060,7 @@ function lintSocketIo(ctx) {
|
|
|
306869
307060
|
if (message.contentKind === "binary") {
|
|
306870
307061
|
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");
|
|
306871
307062
|
}
|
|
306872
|
-
const ack =
|
|
307063
|
+
const ack = asRecord22(message.ackSchema);
|
|
306873
307064
|
if (ack) {
|
|
306874
307065
|
const declaredType = Array.isArray(ack.type) ? ack.type.map(String) : ack.type !== void 0 ? [String(ack.type)] : [];
|
|
306875
307066
|
if (declaredType.length > 0 && !declaredType.includes("array")) {
|
|
@@ -306880,7 +307071,7 @@ function lintSocketIo(ctx) {
|
|
|
306880
307071
|
}
|
|
306881
307072
|
}
|
|
306882
307073
|
function lintAsyncApiBindingSurfaces(index) {
|
|
306883
|
-
const doc =
|
|
307074
|
+
const doc = asRecord22(index.documentJson);
|
|
306884
307075
|
if (!doc) return [];
|
|
306885
307076
|
const ctx = {
|
|
306886
307077
|
index,
|
|
@@ -306902,7 +307093,7 @@ function lintAsyncApiBindingSurfaces(index) {
|
|
|
306902
307093
|
lintSocketIo(ctx);
|
|
306903
307094
|
for (const site of ctx.sites) {
|
|
306904
307095
|
if (site.scope !== "channel") continue;
|
|
306905
|
-
const wsBinding =
|
|
307096
|
+
const wsBinding = asRecord22(site.bindings.ws);
|
|
306906
307097
|
if (wsBinding) lintWsChannelBinding(ctx, site.label, wsBinding);
|
|
306907
307098
|
}
|
|
306908
307099
|
return ctx.warnings;
|
|
@@ -306914,7 +307105,7 @@ var ASYNCAPI_INSTRUMENT_LIMITS = {
|
|
|
306914
307105
|
};
|
|
306915
307106
|
var MESSAGE_NODE_TYPES = /* @__PURE__ */ new Set(["ws-raw-message", "ws-socketio-message", "mqtt-message"]);
|
|
306916
307107
|
var BASE64_RE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
306917
|
-
function
|
|
307108
|
+
function asRecord23(value) {
|
|
306918
307109
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
306919
307110
|
return value;
|
|
306920
307111
|
}
|
|
@@ -306922,7 +307113,7 @@ function asArray16(value) {
|
|
|
306922
307113
|
return Array.isArray(value) ? value : [];
|
|
306923
307114
|
}
|
|
306924
307115
|
function schemaAllowsStringInstance(schema) {
|
|
306925
|
-
const record =
|
|
307116
|
+
const record = asRecord23(schema);
|
|
306926
307117
|
if (!record) return false;
|
|
306927
307118
|
const declared = record.type;
|
|
306928
307119
|
const types2 = Array.isArray(declared) ? declared.map(String) : declared !== void 0 ? [String(declared)] : [];
|
|
@@ -307015,18 +307206,18 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
307015
307206
|
if (binding.messageExpiryInterval !== void 0 && !isNonNegativeInteger(binding.messageExpiryInterval)) bad("messageExpiryInterval", "must be a non-negative integer (seconds)");
|
|
307016
307207
|
if (binding.cleanSession !== void 0 && typeof binding.cleanSession !== "boolean") bad("cleanSession", "must be a boolean");
|
|
307017
307208
|
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)");
|
|
307018
|
-
if (binding.sessionExpiryInterval !== void 0 && !isIntegerInRange(binding.sessionExpiryInterval, 0, 4294967295) &&
|
|
307019
|
-
if (binding.maximumPacketSize !== void 0 && !isIntegerInRange(binding.maximumPacketSize, 1, 268435455) &&
|
|
307209
|
+
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");
|
|
307210
|
+
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");
|
|
307020
307211
|
if (binding.payloadFormatIndicator !== void 0 && binding.payloadFormatIndicator !== 0 && binding.payloadFormatIndicator !== 1) bad("payloadFormatIndicator", "must be 0 (unspecified bytes) or 1 (UTF-8)");
|
|
307021
307212
|
if (binding.contentType !== void 0 && typeof binding.contentType !== "string") bad("contentType", "must be a string");
|
|
307022
307213
|
if (typeof binding.responseTopic === "string") {
|
|
307023
307214
|
const violation = mqttTopicViolation(binding.responseTopic, false);
|
|
307024
307215
|
if (violation) warnings.push(`ASYNCAPI_MQTT_TOPIC_INVALID: channel ${channelId} ${scope} binding responseTopic "${binding.responseTopic}" ${violation}`);
|
|
307025
|
-
} else if (binding.responseTopic !== void 0 &&
|
|
307216
|
+
} else if (binding.responseTopic !== void 0 && asRecord23(binding.responseTopic) === null) {
|
|
307026
307217
|
bad("responseTopic", "must be a string or a schema object");
|
|
307027
307218
|
}
|
|
307028
307219
|
if (binding.correlationData !== void 0) {
|
|
307029
|
-
const correlationData =
|
|
307220
|
+
const correlationData = asRecord23(binding.correlationData);
|
|
307030
307221
|
if (!correlationData) {
|
|
307031
307222
|
bad("correlationData", "must be a Schema Object describing the binary correlation data");
|
|
307032
307223
|
} else if (correlationData.type !== "string" || correlationData.format !== "byte" && correlationData.format !== "binary") {
|
|
@@ -307035,7 +307226,7 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
307035
307226
|
);
|
|
307036
307227
|
}
|
|
307037
307228
|
}
|
|
307038
|
-
const lastWill =
|
|
307229
|
+
const lastWill = asRecord23(binding.lastWill);
|
|
307039
307230
|
if (lastWill) {
|
|
307040
307231
|
if (typeof lastWill.topic === "string") {
|
|
307041
307232
|
const violation = mqttTopicViolation(lastWill.topic, false);
|
|
@@ -307050,14 +307241,14 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
307050
307241
|
}
|
|
307051
307242
|
}
|
|
307052
307243
|
function channelHasPublishDirection(documentJson, channelId) {
|
|
307053
|
-
const channel =
|
|
307244
|
+
const channel = asRecord23(asRecord23(documentJson.channels)?.[channelId]);
|
|
307054
307245
|
if (channel?.publish !== void 0) return true;
|
|
307055
307246
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
307056
|
-
const operations =
|
|
307247
|
+
const operations = asRecord23(documentJson.operations) ?? {};
|
|
307057
307248
|
for (const operationRaw of Object.values(operations)) {
|
|
307058
|
-
const operation =
|
|
307249
|
+
const operation = asRecord23(operationRaw);
|
|
307059
307250
|
if (!operation || operation.action !== "send") continue;
|
|
307060
|
-
const opChannel =
|
|
307251
|
+
const opChannel = asRecord23(operation.channel);
|
|
307061
307252
|
if (!opChannel) continue;
|
|
307062
307253
|
if (channel && opChannel === channel) return true;
|
|
307063
307254
|
const uid = opChannel["x-parser-unique-object-id"];
|
|
@@ -307110,7 +307301,7 @@ function collectMessageNodeIds(node, ids, path8) {
|
|
|
307110
307301
|
}
|
|
307111
307302
|
const children4 = node.children !== void 0 ? asArray16(node.children) : asArray16(node.item);
|
|
307112
307303
|
children4.forEach((child3, i) => {
|
|
307113
|
-
const record =
|
|
307304
|
+
const record = asRecord23(child3);
|
|
307114
307305
|
if (record) collectMessageNodeIds(record, ids, `${path8}/${i}`);
|
|
307115
307306
|
});
|
|
307116
307307
|
}
|
|
@@ -307153,7 +307344,7 @@ function validateWsBinding(channel, warnings) {
|
|
|
307153
307344
|
for (const key of ["query", "headers"]) {
|
|
307154
307345
|
const schema = binding[key];
|
|
307155
307346
|
if (schema === void 0) continue;
|
|
307156
|
-
const record =
|
|
307347
|
+
const record = asRecord23(schema);
|
|
307157
307348
|
if (!record || record.type !== void 0 && record.type !== "object") {
|
|
307158
307349
|
warnings.push(`ASYNCAPI_WS_BINDING_INVALID: channel ${channel.id} ws binding ${key} must be a Schema Object of type object`);
|
|
307159
307350
|
}
|
|
@@ -307189,7 +307380,7 @@ function instrumentAsyncApiCollection(collection, index) {
|
|
|
307189
307380
|
const expected = index.channels.reduce((sum, channel) => sum + channel.messages.length, 0);
|
|
307190
307381
|
const ids = [];
|
|
307191
307382
|
asArray16(collection.item).forEach((entry, i) => {
|
|
307192
|
-
const record =
|
|
307383
|
+
const record = asRecord23(entry);
|
|
307193
307384
|
if (record) collectMessageNodeIds(record, ids, `item/${i}`);
|
|
307194
307385
|
});
|
|
307195
307386
|
const unique = new Set(ids).size;
|
|
@@ -307965,7 +308156,7 @@ var validateRegistryServerSchema = (() => {
|
|
|
307965
308156
|
}
|
|
307966
308157
|
}
|
|
307967
308158
|
})();
|
|
307968
|
-
function
|
|
308159
|
+
function asRecord24(value) {
|
|
307969
308160
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
307970
308161
|
return value;
|
|
307971
308162
|
}
|
|
@@ -307980,7 +308171,7 @@ function registrySchemaKey(key) {
|
|
|
307980
308171
|
}
|
|
307981
308172
|
function normalizeRegistrySchemaValue(value) {
|
|
307982
308173
|
if (Array.isArray(value)) return value.map((entry) => normalizeRegistrySchemaValue(entry));
|
|
307983
|
-
const record =
|
|
308174
|
+
const record = asRecord24(value);
|
|
307984
308175
|
if (!record) return value;
|
|
307985
308176
|
const out = {};
|
|
307986
308177
|
for (const [key, entry] of Object.entries(record)) {
|
|
@@ -307996,7 +308187,7 @@ function normalizeRegistryPackageForSchema(pkg) {
|
|
|
307996
308187
|
}
|
|
307997
308188
|
function normalizeRegistryManifestForSchema(record) {
|
|
307998
308189
|
const out = normalizeRegistrySchemaValue(record);
|
|
307999
|
-
if (Array.isArray(record.packages)) out.packages = record.packages.map((entry) => normalizeRegistryPackageForSchema(
|
|
308190
|
+
if (Array.isArray(record.packages)) out.packages = record.packages.map((entry) => normalizeRegistryPackageForSchema(asRecord24(entry) ?? {}));
|
|
308000
308191
|
return out;
|
|
308001
308192
|
}
|
|
308002
308193
|
function isRegistrySchemaDocument(record) {
|
|
@@ -308058,7 +308249,7 @@ function validateUriTemplate(value) {
|
|
|
308058
308249
|
return { variables: [...variables] };
|
|
308059
308250
|
}
|
|
308060
308251
|
function sampleFromSchema2(schema, depth) {
|
|
308061
|
-
const record =
|
|
308252
|
+
const record = asRecord24(schema);
|
|
308062
308253
|
if (!record) return record === null ? null : {};
|
|
308063
308254
|
if (record.example !== void 0) return record.example;
|
|
308064
308255
|
if (record.default !== void 0) return record.default;
|
|
@@ -308074,7 +308265,7 @@ function sampleFromSchema2(schema, depth) {
|
|
|
308074
308265
|
switch (type) {
|
|
308075
308266
|
case "object":
|
|
308076
308267
|
case void 0: {
|
|
308077
|
-
const properties =
|
|
308268
|
+
const properties = asRecord24(record.properties);
|
|
308078
308269
|
if (!properties) return {};
|
|
308079
308270
|
const required = new Set(asArray17(record.required));
|
|
308080
308271
|
const out = {};
|
|
@@ -308114,10 +308305,10 @@ function registryInputValue(name, input) {
|
|
|
308114
308305
|
}
|
|
308115
308306
|
function registryVariableValues(variables) {
|
|
308116
308307
|
const out = {};
|
|
308117
|
-
const record =
|
|
308308
|
+
const record = asRecord24(variables);
|
|
308118
308309
|
if (!record) return out;
|
|
308119
308310
|
for (const [name, input] of Object.entries(record)) {
|
|
308120
|
-
const value =
|
|
308311
|
+
const value = asRecord24(input);
|
|
308121
308312
|
if (value) out[name] = registryInputValue(name, value);
|
|
308122
308313
|
}
|
|
308123
308314
|
return out;
|
|
@@ -308130,7 +308321,7 @@ function resolveRegistryVariables(value, variables, context, warnings) {
|
|
|
308130
308321
|
});
|
|
308131
308322
|
}
|
|
308132
308323
|
function registryHeaderKeyValues(headers, variables = {}, warnings = [], context = "remote header") {
|
|
308133
|
-
return asArray17(headers).map((entry) =>
|
|
308324
|
+
return asArray17(headers).map((entry) => asRecord24(entry)).filter((entry) => entry !== null && typeof entry.name === "string" && entry.name !== "").map((entry) => {
|
|
308134
308325
|
const name = String(entry.name);
|
|
308135
308326
|
const value = registryInputValue(name, entry);
|
|
308136
308327
|
const resolvedValue = resolveRegistryVariables(value, variables, `${context} ${name}`, warnings);
|
|
@@ -308138,7 +308329,7 @@ function registryHeaderKeyValues(headers, variables = {}, warnings = [], context
|
|
|
308138
308329
|
});
|
|
308139
308330
|
}
|
|
308140
308331
|
function registryEnvKeyValues(variables) {
|
|
308141
|
-
return asArray17(variables).map((entry) =>
|
|
308332
|
+
return asArray17(variables).map((entry) => asRecord24(entry)).filter((entry) => entry !== null && typeof entry.name === "string" && entry.name !== "").map((entry) => {
|
|
308142
308333
|
const name = String(entry.name);
|
|
308143
308334
|
const secret = pickValue(entry, "isSecret", "is_secret") === true;
|
|
308144
308335
|
const value = typeof entry.value === "string" && entry.value && !secret ? entry.value : `{{${name}}}`;
|
|
@@ -308148,7 +308339,7 @@ function registryEnvKeyValues(variables) {
|
|
|
308148
308339
|
function stringArguments(values) {
|
|
308149
308340
|
return asArray17(values).map((entry) => {
|
|
308150
308341
|
if (typeof entry === "string") return entry;
|
|
308151
|
-
const record =
|
|
308342
|
+
const record = asRecord24(entry);
|
|
308152
308343
|
if (!record) return "";
|
|
308153
308344
|
if (typeof record.name === "string" && record.name) {
|
|
308154
308345
|
return typeof record.value === "string" && record.value ? `${record.name}=${record.value}` : String(record.name);
|
|
@@ -308185,11 +308376,11 @@ function hasModernPackageShape(pkg) {
|
|
|
308185
308376
|
return ["registryType", "runtimeHint", "runtimeArguments", "packageArguments", "environmentVariables"].some((key) => hasOwn(pkg, key));
|
|
308186
308377
|
}
|
|
308187
308378
|
function packageDescriptor(pkg, id, warnings) {
|
|
308188
|
-
if (pkg.transport !== void 0 &&
|
|
308379
|
+
if (pkg.transport !== void 0 && asRecord24(pkg.transport) === null) {
|
|
308189
308380
|
warnings.push(`MCP_PACKAGE_TRANSPORT_INVALID: server ${id} package transport must be an object when present; the package is skipped`);
|
|
308190
308381
|
return null;
|
|
308191
308382
|
}
|
|
308192
|
-
const transport =
|
|
308383
|
+
const transport = asRecord24(pkg.transport);
|
|
308193
308384
|
const transportType = typeof transport?.type === "string" ? String(transport.type).toLowerCase() : "";
|
|
308194
308385
|
if (transport) {
|
|
308195
308386
|
if (!transportType) {
|
|
@@ -308235,11 +308426,11 @@ function clientConfigDescriptor(id, entry) {
|
|
|
308235
308426
|
`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`
|
|
308236
308427
|
);
|
|
308237
308428
|
}
|
|
308238
|
-
const headers = Object.entries(
|
|
308429
|
+
const headers = Object.entries(asRecord24(entry.headers) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
308239
308430
|
return { id, transport: "sse", url, headers, env: [], warnings };
|
|
308240
308431
|
}
|
|
308241
308432
|
const command = [typeof entry.command === "string" ? entry.command : "", ...stringArguments(entry.args)].filter(Boolean).join(" ");
|
|
308242
|
-
const env = Object.entries(
|
|
308433
|
+
const env = Object.entries(asRecord24(entry.env) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
308243
308434
|
return { id, transport: "stdio", headers: [], command, env, warnings: [] };
|
|
308244
308435
|
}
|
|
308245
308436
|
function toolDescriptor(tool, warnings) {
|
|
@@ -308248,7 +308439,7 @@ function toolDescriptor(tool, warnings) {
|
|
|
308248
308439
|
warnings.push("MCP_TOOL_NAME_MISSING: a tools[] entry has no name; it is skipped and generates no tools/call template");
|
|
308249
308440
|
return null;
|
|
308250
308441
|
}
|
|
308251
|
-
const inputSchema =
|
|
308442
|
+
const inputSchema = asRecord24(tool.inputSchema) ?? void 0;
|
|
308252
308443
|
const toolWarnings = [];
|
|
308253
308444
|
if (!inputSchema) {
|
|
308254
308445
|
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`);
|
|
@@ -308257,8 +308448,8 @@ function toolDescriptor(tool, warnings) {
|
|
|
308257
308448
|
name,
|
|
308258
308449
|
description: typeof tool.description === "string" ? tool.description : void 0,
|
|
308259
308450
|
inputSchema,
|
|
308260
|
-
outputSchema:
|
|
308261
|
-
annotations:
|
|
308451
|
+
outputSchema: asRecord24(tool.outputSchema) ?? void 0,
|
|
308452
|
+
annotations: asRecord24(tool.annotations) ?? void 0,
|
|
308262
308453
|
sampleArguments: inputSchema ? sampleFromSchema2(inputSchema, 0) : {},
|
|
308263
308454
|
warnings: toolWarnings
|
|
308264
308455
|
};
|
|
@@ -308287,7 +308478,7 @@ function resourceDescriptor(resource, warnings) {
|
|
|
308287
308478
|
if (resource.mimeType !== void 0 && typeof resource.mimeType !== "string") {
|
|
308288
308479
|
resourceWarnings.push(`MCP_RESOURCE_FIELD_INVALID: resource ${name} mimeType must be a string when present`);
|
|
308289
308480
|
}
|
|
308290
|
-
if (resource.annotations !== void 0 && !
|
|
308481
|
+
if (resource.annotations !== void 0 && !asRecord24(resource.annotations)) {
|
|
308291
308482
|
resourceWarnings.push(`MCP_RESOURCE_ANNOTATIONS_INVALID: resource ${name} annotations must be an object when present`);
|
|
308292
308483
|
}
|
|
308293
308484
|
return {
|
|
@@ -308296,8 +308487,8 @@ function resourceDescriptor(resource, warnings) {
|
|
|
308296
308487
|
description: asOptionalString(resource.description),
|
|
308297
308488
|
uri,
|
|
308298
308489
|
mimeType: asOptionalString(resource.mimeType),
|
|
308299
|
-
meta:
|
|
308300
|
-
annotations:
|
|
308490
|
+
meta: asRecord24(resource._meta) ?? void 0,
|
|
308491
|
+
annotations: asRecord24(resource.annotations) ?? void 0,
|
|
308301
308492
|
warnings: resourceWarnings
|
|
308302
308493
|
};
|
|
308303
308494
|
}
|
|
@@ -308326,7 +308517,7 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
308326
308517
|
if (template.mimeType !== void 0 && typeof template.mimeType !== "string") {
|
|
308327
308518
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_FIELD_INVALID: resource template ${name} mimeType must be a string when present`);
|
|
308328
308519
|
}
|
|
308329
|
-
if (template.annotations !== void 0 && !
|
|
308520
|
+
if (template.annotations !== void 0 && !asRecord24(template.annotations)) {
|
|
308330
308521
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_ANNOTATIONS_INVALID: resource template ${name} annotations must be an object when present`);
|
|
308331
308522
|
}
|
|
308332
308523
|
return {
|
|
@@ -308335,14 +308526,14 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
308335
308526
|
description: asOptionalString(template.description),
|
|
308336
308527
|
uriTemplate,
|
|
308337
308528
|
mimeType: asOptionalString(template.mimeType),
|
|
308338
|
-
meta:
|
|
308339
|
-
annotations:
|
|
308529
|
+
meta: asRecord24(template._meta) ?? void 0,
|
|
308530
|
+
annotations: asRecord24(template.annotations) ?? void 0,
|
|
308340
308531
|
variables: inspectedTemplate.variables,
|
|
308341
308532
|
warnings: templateWarnings
|
|
308342
308533
|
};
|
|
308343
308534
|
}
|
|
308344
308535
|
function promptArgumentDescriptor(promptName, argument, warnings, index) {
|
|
308345
|
-
const record =
|
|
308536
|
+
const record = asRecord24(argument);
|
|
308346
308537
|
if (!record) {
|
|
308347
308538
|
warnings.push(`MCP_PROMPT_ARGUMENT_INVALID: prompt ${promptName} argument[${index}] must be an object`);
|
|
308348
308539
|
return null;
|
|
@@ -308381,7 +308572,7 @@ function promptDescriptor(prompt, warnings) {
|
|
|
308381
308572
|
if (prompt.arguments !== void 0 && !Array.isArray(prompt.arguments)) {
|
|
308382
308573
|
promptWarnings.push(`MCP_PROMPT_ARGUMENTS_INVALID: prompt ${name} arguments must be an array when present`);
|
|
308383
308574
|
}
|
|
308384
|
-
if (prompt.annotations !== void 0 && !
|
|
308575
|
+
if (prompt.annotations !== void 0 && !asRecord24(prompt.annotations)) {
|
|
308385
308576
|
promptWarnings.push(`MCP_PROMPT_ANNOTATIONS_INVALID: prompt ${name} annotations must be an object when present`);
|
|
308386
308577
|
}
|
|
308387
308578
|
const seenArgumentNames = /* @__PURE__ */ new Set();
|
|
@@ -308400,8 +308591,8 @@ function promptDescriptor(prompt, warnings) {
|
|
|
308400
308591
|
name,
|
|
308401
308592
|
title: asOptionalString(prompt.title),
|
|
308402
308593
|
description: asOptionalString(prompt.description),
|
|
308403
|
-
meta:
|
|
308404
|
-
annotations:
|
|
308594
|
+
meta: asRecord24(prompt._meta) ?? void 0,
|
|
308595
|
+
annotations: asRecord24(prompt.annotations) ?? void 0,
|
|
308405
308596
|
arguments: argumentsList,
|
|
308406
308597
|
warnings: promptWarnings
|
|
308407
308598
|
};
|
|
@@ -308416,17 +308607,17 @@ function parseMcpServerSpec(content) {
|
|
|
308416
308607
|
} catch (error) {
|
|
308417
308608
|
throw new Error(`MCP_PARSE_FAILED: MCP server description is not valid JSON: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
308418
308609
|
}
|
|
308419
|
-
const documentJson =
|
|
308610
|
+
const documentJson = asRecord24(parsed);
|
|
308420
308611
|
if (!documentJson) {
|
|
308421
308612
|
throw new Error("MCP_PARSE_FAILED: MCP server description must be a JSON object");
|
|
308422
308613
|
}
|
|
308423
308614
|
const warnings = [];
|
|
308424
308615
|
const servers = [];
|
|
308425
308616
|
if (isRegistrySchemaDocument(documentJson)) warnings.push(...registrySchemaWarnings(documentJson));
|
|
308426
|
-
const mcpServers =
|
|
308617
|
+
const mcpServers = asRecord24(documentJson.mcpServers);
|
|
308427
308618
|
if (mcpServers) {
|
|
308428
308619
|
for (const [id, entry] of Object.entries(mcpServers)) {
|
|
308429
|
-
const record =
|
|
308620
|
+
const record = asRecord24(entry);
|
|
308430
308621
|
if (!record) {
|
|
308431
308622
|
warnings.push(`MCP_SERVER_ENTRY_INVALID: mcpServers.${id} is not an object; it is skipped`);
|
|
308432
308623
|
continue;
|
|
@@ -308435,8 +308626,8 @@ function parseMcpServerSpec(content) {
|
|
|
308435
308626
|
}
|
|
308436
308627
|
}
|
|
308437
308628
|
const registryName = typeof documentJson.name === "string" ? documentJson.name : "";
|
|
308438
|
-
const remotes = asArray17(documentJson.remotes).map((entry) =>
|
|
308439
|
-
const packages = asArray17(documentJson.packages).map((entry) =>
|
|
308629
|
+
const remotes = asArray17(documentJson.remotes).map((entry) => asRecord24(entry)).filter((entry) => entry !== null);
|
|
308630
|
+
const packages = asArray17(documentJson.packages).map((entry) => asRecord24(entry)).filter((entry) => entry !== null);
|
|
308440
308631
|
if (!mcpServers && (remotes.length > 0 || packages.length > 0)) {
|
|
308441
308632
|
const multi = remotes.length + packages.length > 1;
|
|
308442
308633
|
remotes.forEach((remote, i) => {
|
|
@@ -308451,7 +308642,7 @@ function parseMcpServerSpec(content) {
|
|
|
308451
308642
|
if (servers.length === 0) {
|
|
308452
308643
|
throw new Error("MCP_NO_SERVERS: MCP description defines no servers (no mcpServers entries, remotes, or packages); contract generation requires at least one server");
|
|
308453
308644
|
}
|
|
308454
|
-
const toolsRaw = asArray17(documentJson.tools).map((entry) =>
|
|
308645
|
+
const toolsRaw = asArray17(documentJson.tools).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((tool) => toolDescriptor(tool, warnings)).filter((tool) => tool !== null);
|
|
308455
308646
|
const seenToolNames = /* @__PURE__ */ new Set();
|
|
308456
308647
|
const tools = [];
|
|
308457
308648
|
for (const tool of toolsRaw) {
|
|
@@ -308463,7 +308654,7 @@ function parseMcpServerSpec(content) {
|
|
|
308463
308654
|
tools.push(tool);
|
|
308464
308655
|
}
|
|
308465
308656
|
tools.sort((a, b) => a.name.localeCompare(b.name));
|
|
308466
|
-
const resourcesRaw = asArray17(documentJson.resources).map((entry) =>
|
|
308657
|
+
const resourcesRaw = asArray17(documentJson.resources).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((resource) => resourceDescriptor(resource, warnings)).filter((resource) => resource !== null);
|
|
308467
308658
|
const seenResourceNames = /* @__PURE__ */ new Set();
|
|
308468
308659
|
const resources = [];
|
|
308469
308660
|
for (const resource of resourcesRaw) {
|
|
@@ -308475,7 +308666,7 @@ function parseMcpServerSpec(content) {
|
|
|
308475
308666
|
resources.push(resource);
|
|
308476
308667
|
}
|
|
308477
308668
|
resources.sort((a, b) => a.name.localeCompare(b.name));
|
|
308478
|
-
const resourceTemplatesRaw = asArray17(documentJson.resourceTemplates).map((entry) =>
|
|
308669
|
+
const resourceTemplatesRaw = asArray17(documentJson.resourceTemplates).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((template) => resourceTemplateDescriptor(template, warnings)).filter((template) => template !== null);
|
|
308479
308670
|
const seenTemplateNames = /* @__PURE__ */ new Set();
|
|
308480
308671
|
const resourceTemplates = [];
|
|
308481
308672
|
for (const template of resourceTemplatesRaw) {
|
|
@@ -308487,7 +308678,7 @@ function parseMcpServerSpec(content) {
|
|
|
308487
308678
|
resourceTemplates.push(template);
|
|
308488
308679
|
}
|
|
308489
308680
|
resourceTemplates.sort((a, b) => a.name.localeCompare(b.name));
|
|
308490
|
-
const promptsRaw = asArray17(documentJson.prompts).map((entry) =>
|
|
308681
|
+
const promptsRaw = asArray17(documentJson.prompts).map((entry) => asRecord24(entry)).filter((entry) => entry !== null).map((prompt) => promptDescriptor(prompt, warnings)).filter((prompt) => prompt !== null);
|
|
308491
308682
|
const seenPromptNames = /* @__PURE__ */ new Set();
|
|
308492
308683
|
const prompts = [];
|
|
308493
308684
|
for (const prompt of promptsRaw) {
|
|
@@ -308499,10 +308690,10 @@ function parseMcpServerSpec(content) {
|
|
|
308499
308690
|
prompts.push(prompt);
|
|
308500
308691
|
}
|
|
308501
308692
|
prompts.sort((a, b) => a.name.localeCompare(b.name));
|
|
308502
|
-
const versionDetail =
|
|
308693
|
+
const versionDetail = asRecord24(documentJson.version_detail);
|
|
308503
308694
|
const version = typeof documentJson.version === "string" ? documentJson.version : typeof versionDetail?.version === "string" ? String(versionDetail.version) : void 0;
|
|
308504
308695
|
servers.sort((a, b) => a.id.localeCompare(b.id));
|
|
308505
|
-
const capabilities =
|
|
308696
|
+
const capabilities = asRecord24(documentJson.capabilities);
|
|
308506
308697
|
if (documentJson.capabilities !== void 0 && !capabilities) {
|
|
308507
308698
|
warnings.push(`MCP_CAPABILITIES_INVALID: top-level capabilities must be an object when present; got ${JSON.stringify(documentJson.capabilities)}`);
|
|
308508
308699
|
}
|
|
@@ -309239,7 +309430,7 @@ function oldSessionPingScript() {
|
|
|
309239
309430
|
|
|
309240
309431
|
// src/lib/protocols/mcp/mcp-collection-builder.ts
|
|
309241
309432
|
var MCP_TOOLS_LIST_PAGINATION_PROBE_COUNT = 5;
|
|
309242
|
-
function
|
|
309433
|
+
function asRecord25(value) {
|
|
309243
309434
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
309244
309435
|
return value;
|
|
309245
309436
|
}
|
|
@@ -309294,7 +309485,7 @@ function promptsListMessage() {
|
|
|
309294
309485
|
return jsonRpc(9, "prompts/list", {});
|
|
309295
309486
|
}
|
|
309296
309487
|
function toolArguments(tool) {
|
|
309297
|
-
return
|
|
309488
|
+
return asRecord25(tool.sampleArguments) ?? {};
|
|
309298
309489
|
}
|
|
309299
309490
|
function promptArguments(prompt) {
|
|
309300
309491
|
const out = {};
|
|
@@ -309598,7 +309789,7 @@ var MIME_TYPE_RE = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\/[A-Za-z0-9][A-Za-z0-9!#$&
|
|
|
309598
309789
|
var TOOL_FIELDS_2025_06_18 = /* @__PURE__ */ new Set(["name", "title", "description", "inputSchema", "outputSchema", "annotations", "_meta"]);
|
|
309599
309790
|
var JSON_RPC_STANDARD_ERROR_CODES = /* @__PURE__ */ new Set([-32700, -32600, -32601, -32602, -32603]);
|
|
309600
309791
|
var MCP_PROTOCOL_VERSIONS = /* @__PURE__ */ new Set(["2024-11-05", "2025-03-26", "2025-06-18", "2025-11-25"]);
|
|
309601
|
-
function
|
|
309792
|
+
function asRecord26(value) {
|
|
309602
309793
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
309603
309794
|
return value;
|
|
309604
309795
|
}
|
|
@@ -309614,7 +309805,7 @@ function isStrictBase64(value) {
|
|
|
309614
309805
|
}
|
|
309615
309806
|
}
|
|
309616
309807
|
function walkDocument(value, path8, visit4) {
|
|
309617
|
-
const record =
|
|
309808
|
+
const record = asRecord26(value);
|
|
309618
309809
|
if (record) {
|
|
309619
309810
|
visit4(record, path8);
|
|
309620
309811
|
for (const [key, child3] of Object.entries(record)) walkDocument(child3, `${path8}.${key}`, visit4);
|
|
@@ -309627,10 +309818,10 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
309627
309818
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type must be a string`);
|
|
309628
309819
|
return;
|
|
309629
309820
|
}
|
|
309630
|
-
if (block2.annotations !== void 0 &&
|
|
309821
|
+
if (block2.annotations !== void 0 && asRecord26(block2.annotations) === null) {
|
|
309631
309822
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} annotations must be an object when present`);
|
|
309632
309823
|
}
|
|
309633
|
-
if (block2._meta !== void 0 &&
|
|
309824
|
+
if (block2._meta !== void 0 && asRecord26(block2._meta) === null) {
|
|
309634
309825
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} _meta must be an object when present`);
|
|
309635
309826
|
}
|
|
309636
309827
|
if (block2.type === "text") {
|
|
@@ -309643,7 +309834,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
309643
309834
|
return;
|
|
309644
309835
|
}
|
|
309645
309836
|
if (block2.type === "resource") {
|
|
309646
|
-
const resource =
|
|
309837
|
+
const resource = asRecord26(block2.resource);
|
|
309647
309838
|
if (!resource) {
|
|
309648
309839
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} resource content block must carry a resource object`);
|
|
309649
309840
|
return;
|
|
@@ -309657,7 +309848,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
309657
309848
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type "${block2.type}" is not a known MCP 2025-06-18 content discriminator`);
|
|
309658
309849
|
}
|
|
309659
309850
|
function validateStaticResultFixture(record, path8, warnings) {
|
|
309660
|
-
const result =
|
|
309851
|
+
const result = asRecord26(record.result);
|
|
309661
309852
|
if (!result) return;
|
|
309662
309853
|
for (const key of ["tools", "resources", "prompts"]) {
|
|
309663
309854
|
if (result[key] !== void 0 && !Array.isArray(result[key])) warnings.push(`MCP_STATIC_PAGINATION_RESULT_INVALID: ${path8}.${key} must be an array in static list-result fixtures`);
|
|
@@ -309667,8 +309858,8 @@ function validateStaticResultFixture(record, path8, warnings) {
|
|
|
309667
309858
|
}
|
|
309668
309859
|
if (result.protocolVersion !== void 0 || result.capabilities !== void 0 || result.serverInfo !== void 0) {
|
|
309669
309860
|
if (typeof result.protocolVersion !== "string" || !MCP_PROTOCOL_VERSIONS.has(result.protocolVersion)) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path8}.protocolVersion must be a supported MCP protocol version`);
|
|
309670
|
-
if (
|
|
309671
|
-
const serverInfo =
|
|
309861
|
+
if (asRecord26(result.capabilities) === null) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path8}.capabilities must be an object`);
|
|
309862
|
+
const serverInfo = asRecord26(result.serverInfo);
|
|
309672
309863
|
if (!serverInfo) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path8}.serverInfo must be an object`);
|
|
309673
309864
|
else {
|
|
309674
309865
|
if (typeof serverInfo.name !== "string" || !serverInfo.name) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path8}.serverInfo.name must be a non-empty string`);
|
|
@@ -309678,7 +309869,7 @@ function validateStaticResultFixture(record, path8, warnings) {
|
|
|
309678
309869
|
}
|
|
309679
309870
|
function validateStaticJsonRpcFixtures(index, warnings) {
|
|
309680
309871
|
walkDocument(index.documentJson, "$", (record, path8) => {
|
|
309681
|
-
const error =
|
|
309872
|
+
const error = asRecord26(record.error);
|
|
309682
309873
|
if (record.jsonrpc === "2.0" && error) {
|
|
309683
309874
|
if (typeof error.code !== "number" || Math.floor(error.code) !== error.code) warnings.push(`MCP_STATIC_ERROR_CODE_INVALID: ${path8}.error.code must be an integer JSON-RPC error code`);
|
|
309684
309875
|
else if (error.code >= -32768 && error.code <= -32e3 && !JSON_RPC_STANDARD_ERROR_CODES.has(error.code) && !(error.code >= -32099 && error.code <= -32e3)) warnings.push(`MCP_STATIC_ERROR_CODE_INVALID: ${path8}.error.code ${error.code} is inside the reserved JSON-RPC range but is not a standard or server-error code`);
|
|
@@ -309687,19 +309878,19 @@ function validateStaticJsonRpcFixtures(index, warnings) {
|
|
|
309687
309878
|
validateStaticResultFixture(record, path8, warnings);
|
|
309688
309879
|
if (Array.isArray(record.content)) {
|
|
309689
309880
|
record.content.forEach((entry, i) => {
|
|
309690
|
-
const block2 =
|
|
309881
|
+
const block2 = asRecord26(entry);
|
|
309691
309882
|
if (block2) validateStaticContentBlock(block2, `${path8}.content[${i}]`, warnings);
|
|
309692
309883
|
});
|
|
309693
309884
|
}
|
|
309694
309885
|
if (Array.isArray(record.messages)) {
|
|
309695
309886
|
record.messages.forEach((entry, i) => {
|
|
309696
|
-
const message =
|
|
309887
|
+
const message = asRecord26(entry);
|
|
309697
309888
|
if (!message) {
|
|
309698
309889
|
warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path8}.messages[${i}] must be an object`);
|
|
309699
309890
|
return;
|
|
309700
309891
|
}
|
|
309701
309892
|
if (message.role !== "user" && message.role !== "assistant") warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path8}.messages[${i}].role must be user or assistant`);
|
|
309702
|
-
const content =
|
|
309893
|
+
const content = asRecord26(message.content);
|
|
309703
309894
|
if (!content) warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path8}.messages[${i}].content must be a content block object`);
|
|
309704
309895
|
else validateStaticContentBlock(content, `${path8}.messages[${i}].content`, warnings);
|
|
309705
309896
|
});
|
|
@@ -309713,10 +309904,10 @@ function walkManifest(value, path8, warnings) {
|
|
|
309713
309904
|
return;
|
|
309714
309905
|
}
|
|
309715
309906
|
const record = value;
|
|
309716
|
-
if (Object.prototype.hasOwnProperty.call(record, "_meta") &&
|
|
309907
|
+
if (Object.prototype.hasOwnProperty.call(record, "_meta") && asRecord26(record._meta) === null) {
|
|
309717
309908
|
warnings.push(`MCP_META_OBJECT_INVALID: ${path8}._meta must be an object when present (MCP 2025-06-18 BaseMetadata)`);
|
|
309718
309909
|
}
|
|
309719
|
-
const meta =
|
|
309910
|
+
const meta = asRecord26(record._meta);
|
|
309720
309911
|
if (meta) {
|
|
309721
309912
|
for (const key of Object.keys(meta)) {
|
|
309722
309913
|
if (!META_KEY_RE.test(key)) {
|
|
@@ -309735,7 +309926,7 @@ function walkManifest(value, path8, warnings) {
|
|
|
309735
309926
|
}
|
|
309736
309927
|
function validateManifestDocument(index, warnings) {
|
|
309737
309928
|
walkManifest(index.documentJson, "$", warnings);
|
|
309738
|
-
const tools = asArray18(index.documentJson.tools).map((entry) =>
|
|
309929
|
+
const tools = asArray18(index.documentJson.tools).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
309739
309930
|
const seen = /* @__PURE__ */ new Set();
|
|
309740
309931
|
for (const tool of tools) {
|
|
309741
309932
|
const name = typeof tool.name === "string" ? tool.name : "<unnamed>";
|
|
@@ -309754,7 +309945,7 @@ function validateManifestDocument(index, warnings) {
|
|
|
309754
309945
|
warnings.push(`MCP_TOOL_FIELD_UNKNOWN_2025_06_18: tool ${name} field "${field}" is not part of the MCP 2025-06-18 Tool object`);
|
|
309755
309946
|
}
|
|
309756
309947
|
}
|
|
309757
|
-
const annotations =
|
|
309948
|
+
const annotations = asRecord26(tool.annotations);
|
|
309758
309949
|
if (typeof tool.title === "string" && typeof annotations?.title === "string") {
|
|
309759
309950
|
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`);
|
|
309760
309951
|
}
|
|
@@ -309775,7 +309966,7 @@ function validateCapabilities(index, warnings) {
|
|
|
309775
309966
|
shaped[name] = null;
|
|
309776
309967
|
continue;
|
|
309777
309968
|
}
|
|
309778
|
-
const record =
|
|
309969
|
+
const record = asRecord26(value);
|
|
309779
309970
|
if (!record) {
|
|
309780
309971
|
warnings.push(`MCP_CAPABILITY_SHAPE_INVALID: capabilities.${name} must be an object when present; got ${JSON.stringify(value)}`);
|
|
309781
309972
|
shaped[name] = null;
|
|
@@ -309831,7 +310022,7 @@ function itemServerScope(itemTitle) {
|
|
|
309831
310022
|
return separator === -1 ? itemTitle : itemTitle.slice(0, separator);
|
|
309832
310023
|
}
|
|
309833
310024
|
function assertRecordValue(value, reason, fail2) {
|
|
309834
|
-
const record =
|
|
310025
|
+
const record = asRecord26(value);
|
|
309835
310026
|
if (!record) fail2(reason);
|
|
309836
310027
|
return record;
|
|
309837
310028
|
}
|
|
@@ -309853,7 +310044,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
309853
310044
|
} catch {
|
|
309854
310045
|
return fail2("message is not valid JSON");
|
|
309855
310046
|
}
|
|
309856
|
-
const record =
|
|
310047
|
+
const record = asRecord26(parsed);
|
|
309857
310048
|
if (!record) return fail2("message is not a JSON object");
|
|
309858
310049
|
if (record.jsonrpc !== "2.0") return fail2('jsonrpc must be the string "2.0"');
|
|
309859
310050
|
if (typeof record.method !== "string" || !record.method) return fail2("method must be a non-empty string");
|
|
@@ -309865,7 +310056,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
309865
310056
|
} else {
|
|
309866
310057
|
return fail2("id must be a string or number");
|
|
309867
310058
|
}
|
|
309868
|
-
if (record.params !== void 0 &&
|
|
310059
|
+
if (record.params !== void 0 && asRecord26(record.params) === null) return fail2("params must be an object when present");
|
|
309869
310060
|
switch (record.method) {
|
|
309870
310061
|
case "notifications/initialized":
|
|
309871
310062
|
assertOptionalObjectParams(record, "notifications/initialized", fail2);
|
|
@@ -309898,14 +310089,14 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
309898
310089
|
case "prompts/get": {
|
|
309899
310090
|
const params = assertObjectParams(record, "prompts/get", fail2);
|
|
309900
310091
|
if (typeof params.name !== "string" || !params.name) fail2("prompts/get params.name must be a non-empty string");
|
|
309901
|
-
if (params.arguments !== void 0 &&
|
|
310092
|
+
if (params.arguments !== void 0 && asRecord26(params.arguments) === null) fail2("prompts/get params.arguments must be an object when present");
|
|
309902
310093
|
break;
|
|
309903
310094
|
}
|
|
309904
310095
|
case "tools/call": {
|
|
309905
310096
|
const params = assertObjectParams(record, "tools/call", fail2);
|
|
309906
310097
|
if (typeof params.name !== "string" || !params.name) fail2("tools/call params.name must be a non-empty string");
|
|
309907
|
-
if (params.arguments !== void 0 &&
|
|
309908
|
-
if (params._meta !== void 0 &&
|
|
310098
|
+
if (params.arguments !== void 0 && asRecord26(params.arguments) === null) fail2("tools/call params.arguments must be an object when present");
|
|
310099
|
+
if (params._meta !== void 0 && asRecord26(params._meta) === null) fail2("tools/call params._meta must be an object when present");
|
|
309909
310100
|
break;
|
|
309910
310101
|
}
|
|
309911
310102
|
case "ping":
|
|
@@ -310006,7 +310197,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
310006
310197
|
validateAnnotatedDeclarations(index, warnings);
|
|
310007
310198
|
validateStaticJsonRpcFixtures(index, warnings);
|
|
310008
310199
|
for (const tool of index.tools) warnings.push(...toolsCallScript(index, tool).warnings);
|
|
310009
|
-
const items = asArray18(collection.item).map((entry) =>
|
|
310200
|
+
const items = asArray18(collection.item).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
310010
310201
|
const ids = [];
|
|
310011
310202
|
const httpIds = [];
|
|
310012
310203
|
const requestIdsByServer = /* @__PURE__ */ new Set();
|
|
@@ -310014,7 +310205,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
310014
310205
|
if (String(item.type) === "mcp-request") {
|
|
310015
310206
|
ids.push(typeof item.id === "string" && item.id ? item.id : `#${ids.length}`);
|
|
310016
310207
|
const itemTitle = String(item.title ?? item.id ?? "mcp-request");
|
|
310017
|
-
const request = assertJsonRpcRequest(
|
|
310208
|
+
const request = assertJsonRpcRequest(asRecord26(item.payload)?.message, itemTitle);
|
|
310018
310209
|
if (request.id !== void 0) {
|
|
310019
310210
|
const scopedId = `${itemServerScope(itemTitle)}\0${typeof request.id === "number" ? `n:${request.id}` : `s:${request.id}`}`;
|
|
310020
310211
|
if (requestIdsByServer.has(scopedId)) {
|