@postman-cse/onboarding-bootstrap 2.9.1 → 2.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action.cjs +671 -467
- package/dist/cli.cjs +722 -468
- package/dist/index.cjs +671 -467
- package/package.json +5 -3
package/dist/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
|
}
|
|
@@ -262575,7 +262617,8 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
262575
262617
|
service: "collection",
|
|
262576
262618
|
method: "patch",
|
|
262577
262619
|
path: `/v3/collections/${this.bareModelId(collectionId)}`,
|
|
262578
|
-
|
|
262620
|
+
// Replacing a generated collection's name with the same value is idempotent.
|
|
262621
|
+
retry: "safe",
|
|
262579
262622
|
body: [{ op: "replace", path: "/name", value: name }]
|
|
262580
262623
|
});
|
|
262581
262624
|
}
|
|
@@ -262774,15 +262817,32 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
262774
262817
|
}
|
|
262775
262818
|
// --- collection v3 mutation + tagging (live-proven 2026-06-30; see docs/REST-to-gateway.md) ---
|
|
262776
262819
|
//
|
|
262777
|
-
// These retire bootstrap's last asset-op PMAK dependencies.
|
|
262778
|
-
//
|
|
262779
|
-
//
|
|
262780
|
-
//
|
|
262781
|
-
|
|
262820
|
+
// These retire bootstrap's last asset-op PMAK dependencies. Collection ROOT
|
|
262821
|
+
// routes (GET/PATCH/DELETE `/v3/collections/:id`) accept the bare model id.
|
|
262822
|
+
// Collection ITEMS routes (`/v3/collections/:id/items/...`) must use the FULL
|
|
262823
|
+
// public uid (`<owner>-<uuid>`): bare model ids are flaky on org-mode squads
|
|
262824
|
+
// (live-proven 2026-07-14 on team 172912 / Northwind — immediate post-generation
|
|
262825
|
+
// `GET .../items/` returns 403 FORBIDDEN with bare id, 200 with full uid).
|
|
262826
|
+
// The tagging service is distinct and takes the FULL uid.
|
|
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
|
+
*/
|
|
262782
262834
|
bareModelId(uid) {
|
|
262783
262835
|
const u = String(uid ?? "").trim();
|
|
262836
|
+
if (BOOTSTRAP_BARE_UUID_RE.test(u)) return u;
|
|
262784
262837
|
return u.includes("-") ? u.slice(u.indexOf("-") + 1) : u;
|
|
262785
262838
|
}
|
|
262839
|
+
/**
|
|
262840
|
+
* Collection id for ITEMS routes. Prefer the full public uid; fall back to the
|
|
262841
|
+
* trimmed input when the caller already has a bare/model id.
|
|
262842
|
+
*/
|
|
262843
|
+
collectionItemsId(uid) {
|
|
262844
|
+
return String(uid ?? "").trim();
|
|
262845
|
+
}
|
|
262786
262846
|
/**
|
|
262787
262847
|
* PATCH a freshly-created item's `/scripts`, tolerating the two transient
|
|
262788
262848
|
* failures this immediate-after-create write is prone to on the shared gateway:
|
|
@@ -262841,9 +262901,9 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
262841
262901
|
/**
|
|
262842
262902
|
* Inject smoke-test assertions into every leaf request of a spec-generated
|
|
262843
262903
|
* collection, over the v3 collection-items surface (no PMAK):
|
|
262844
|
-
* 1. `GET /v3/collections/:cid/items/` (
|
|
262904
|
+
* 1. `GET /v3/collections/:cid/items/` (FULL public uid, trailing slash) — flat list.
|
|
262845
262905
|
* 2. for each `http-request` leaf, `PATCH /v3/collections/:cid/items/:itemId`
|
|
262846
|
-
* (full uid for `:itemId`, `X-Entity-Type: http-request` header) with a
|
|
262906
|
+
* (full uid for `:cid` and `:itemId`, `X-Entity-Type: http-request` header) with a
|
|
262847
262907
|
* JSON-Patch that sets `/scripts` to the canonical v3 shape
|
|
262848
262908
|
* (`[{type:'afterResponse', code, language}]`). The v3 surface persists test
|
|
262849
262909
|
* scripts under `scripts`, NOT `events`: a `/events` patch returns 200 but is
|
|
@@ -262856,7 +262916,7 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
262856
262916
|
*/
|
|
262857
262917
|
async injectTests(collectionUid, type) {
|
|
262858
262918
|
void type;
|
|
262859
|
-
const cid = this.
|
|
262919
|
+
const cid = this.collectionItemsId(collectionUid);
|
|
262860
262920
|
const listed = await this.gateway.requestJson({
|
|
262861
262921
|
service: "collection",
|
|
262862
262922
|
method: "get",
|
|
@@ -263027,7 +263087,7 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
263027
263087
|
* Inject the deterministic OpenAPI contract assertions into every generated
|
|
263028
263088
|
* request of a spec-generated collection, entirely over the v3 collection
|
|
263029
263089
|
* surface (no PMAK, no v2.1.0 read/PUT):
|
|
263030
|
-
* 1. `GET /v3/collections/:cid/items/` — flat item list (
|
|
263090
|
+
* 1. `GET /v3/collections/:cid/items/` — flat item list (FULL public uid for `:cid`).
|
|
263031
263091
|
* 2. `GET /v3/collections/:cid/items/:itemId` (`X-Entity-Type: http-request`)
|
|
263032
263092
|
* — the full v3 IR record (method/url/headers/body) the matcher needs.
|
|
263033
263093
|
* 3. `planContractItemScripts` matches each request to its OpenAPI operation
|
|
@@ -263038,7 +263098,7 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
263038
263098
|
* Returns the non-fatal instrumentation warnings for the caller to surface.
|
|
263039
263099
|
*/
|
|
263040
263100
|
async injectContractTests(collectionUid, index) {
|
|
263041
|
-
const cid = this.
|
|
263101
|
+
const cid = this.collectionItemsId(collectionUid);
|
|
263042
263102
|
const listed = await this.gateway.requestJson({
|
|
263043
263103
|
service: "collection",
|
|
263044
263104
|
method: "get",
|
|
@@ -263384,12 +263444,61 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
263384
263444
|
ops.push({ op: "remove", path: "/scripts" });
|
|
263385
263445
|
}
|
|
263386
263446
|
if (ops.length === 0) return;
|
|
263387
|
-
|
|
263388
|
-
|
|
263389
|
-
|
|
263390
|
-
|
|
263391
|
-
|
|
263392
|
-
|
|
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;
|
|
263393
263502
|
}
|
|
263394
263503
|
/**
|
|
263395
263504
|
* Create a curated local v2.1.0 or collection v3 payload through the gateway v3 write
|
|
@@ -263438,11 +263547,12 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
263438
263547
|
if (!rawId) {
|
|
263439
263548
|
throw new Error("Collection create did not return an id");
|
|
263440
263549
|
}
|
|
263441
|
-
const
|
|
263550
|
+
const itemsCid = this.collectionItemsId(rawId);
|
|
263551
|
+
const rootCid = this.bareModelId(rawId);
|
|
263442
263552
|
await options.onRootCreated?.(rawId);
|
|
263443
263553
|
try {
|
|
263444
|
-
await this.createItemTree(
|
|
263445
|
-
await this.applyCollectionLevelSettings(
|
|
263554
|
+
await this.createItemTree(itemsCid, asItemArray(v3.items), itemsCid);
|
|
263555
|
+
await this.applyCollectionLevelSettings(rootCid, v3, { rename: true });
|
|
263446
263556
|
} catch (error) {
|
|
263447
263557
|
if (options.onRootCreated) throw error;
|
|
263448
263558
|
let cleanupError;
|
|
@@ -263469,22 +263579,23 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
263469
263579
|
* from the converted v3 IR and reapply name/auth/variables.
|
|
263470
263580
|
*/
|
|
263471
263581
|
async updateCollection(collectionUid, collection) {
|
|
263472
|
-
const
|
|
263582
|
+
const itemsCid = this.collectionItemsId(collectionUid);
|
|
263583
|
+
const rootCid = this.bareModelId(collectionUid);
|
|
263473
263584
|
const v3 = this.normalizeCollectionForWrite(collection);
|
|
263474
|
-
const existingItems = await this.listCollectionItems(
|
|
263585
|
+
const existingItems = await this.listCollectionItems(itemsCid);
|
|
263475
263586
|
for (const item of existingItems) {
|
|
263476
263587
|
const itemId = String(item.id).trim();
|
|
263477
263588
|
try {
|
|
263478
263589
|
await this.gateway.requestJson({
|
|
263479
263590
|
service: "collection",
|
|
263480
263591
|
method: "delete",
|
|
263481
|
-
path: `/v3/collections/${
|
|
263592
|
+
path: `/v3/collections/${itemsCid}/items/${itemId}`,
|
|
263482
263593
|
retry: "none",
|
|
263483
263594
|
headers: { "X-Entity-Type": String(item.$kind ?? "http-request") }
|
|
263484
263595
|
});
|
|
263485
263596
|
} catch (error) {
|
|
263486
263597
|
if (isAmbiguousTransportError(error)) {
|
|
263487
|
-
const stillPresent = (await this.listCollectionItems(
|
|
263598
|
+
const stillPresent = (await this.listCollectionItems(itemsCid)).some(
|
|
263488
263599
|
(candidate) => String(candidate.id ?? "").trim() === itemId
|
|
263489
263600
|
);
|
|
263490
263601
|
if (!stillPresent) continue;
|
|
@@ -263495,14 +263606,14 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
263495
263606
|
}
|
|
263496
263607
|
}
|
|
263497
263608
|
}
|
|
263498
|
-
const remainingItems = await this.listCollectionItems(
|
|
263609
|
+
const remainingItems = await this.listCollectionItems(itemsCid);
|
|
263499
263610
|
if (remainingItems.length > 0) {
|
|
263500
263611
|
throw new Error(
|
|
263501
263612
|
`Collection delete verification failed: ${remainingItems.length} old items remain`
|
|
263502
263613
|
);
|
|
263503
263614
|
}
|
|
263504
|
-
await this.createItemTree(
|
|
263505
|
-
await this.applyCollectionLevelSettings(
|
|
263615
|
+
await this.createItemTree(itemsCid, asItemArray(v3.items), itemsCid);
|
|
263616
|
+
await this.applyCollectionLevelSettings(rootCid, v3, { rename: true, reconcileRemovals: true });
|
|
263506
263617
|
}
|
|
263507
263618
|
};
|
|
263508
263619
|
|
|
@@ -263510,6 +263621,36 @@ var PostmanGatewayAssetsClient = class _PostmanGatewayAssetsClient {
|
|
|
263510
263621
|
function isExpiredAuthError(status, body2) {
|
|
263511
263622
|
return status === 401 || body2.includes("UNAUTHENTICATED") || body2.includes("authenticationError");
|
|
263512
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
|
+
}
|
|
263513
263654
|
function isTransientGatewayError(status, body2) {
|
|
263514
263655
|
if (status === 502 || status === 503 || status === 504) return true;
|
|
263515
263656
|
if (status >= 500 && (body2.includes("ESOCKETTIMEDOUT") || body2.includes("ETIMEDOUT") || body2.includes("ECONNRESET") || body2.includes("serverError") || body2.includes("downstream"))) {
|
|
@@ -263529,6 +263670,7 @@ var AccessTokenGatewayClient = class {
|
|
|
263529
263670
|
secretMasker;
|
|
263530
263671
|
maxRetries;
|
|
263531
263672
|
retryBaseDelayMs;
|
|
263673
|
+
requestTimeoutMs;
|
|
263532
263674
|
sleepImpl;
|
|
263533
263675
|
constructor(options) {
|
|
263534
263676
|
this.tokenProvider = options.tokenProvider;
|
|
@@ -263541,6 +263683,7 @@ var AccessTokenGatewayClient = class {
|
|
|
263541
263683
|
this.secretMasker = options.secretMasker ?? createSecretMasker([this.tokenProvider.current()]);
|
|
263542
263684
|
this.maxRetries = options.maxRetries ?? 3;
|
|
263543
263685
|
this.retryBaseDelayMs = options.retryBaseDelayMs ?? 400;
|
|
263686
|
+
this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
263544
263687
|
this.sleepImpl = options.sleepImpl ?? defaultSleep;
|
|
263545
263688
|
}
|
|
263546
263689
|
configureTeamContext(teamId, orgMode) {
|
|
@@ -263560,45 +263703,83 @@ var AccessTokenGatewayClient = class {
|
|
|
263560
263703
|
}
|
|
263561
263704
|
async send(request) {
|
|
263562
263705
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
263563
|
-
|
|
263564
|
-
|
|
263565
|
-
|
|
263566
|
-
|
|
263567
|
-
|
|
263568
|
-
|
|
263569
|
-
|
|
263570
|
-
|
|
263571
|
-
|
|
263572
|
-
|
|
263573
|
-
|
|
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
|
+
}
|
|
263574
263724
|
}
|
|
263575
263725
|
/**
|
|
263576
263726
|
* Send a gateway request, refreshing the token once on an auth failure and
|
|
263577
|
-
* retrying transient
|
|
263578
|
-
*
|
|
263579
|
-
*
|
|
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.
|
|
263580
263734
|
*/
|
|
263581
263735
|
async request(request) {
|
|
263582
263736
|
if (!this.tokenProvider.current() && this.tokenProvider.canRefresh()) {
|
|
263583
263737
|
await this.tokenProvider.refresh();
|
|
263584
263738
|
}
|
|
263739
|
+
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
263585
263740
|
let attempt = 0;
|
|
263586
263741
|
for (; ; ) {
|
|
263587
|
-
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
|
+
}
|
|
263588
263754
|
if (response.ok) {
|
|
263589
|
-
|
|
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);
|
|
263590
263767
|
}
|
|
263591
263768
|
const body2 = await response.text().catch(() => "");
|
|
263592
263769
|
if (isExpiredAuthError(response.status, body2) && this.tokenProvider.canRefresh()) {
|
|
263593
263770
|
await this.tokenProvider.refresh();
|
|
263594
263771
|
response = await this.send(request);
|
|
263595
263772
|
if (response.ok) {
|
|
263596
|
-
|
|
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);
|
|
263597
263779
|
}
|
|
263598
263780
|
const retryBody = await response.text().catch(() => "");
|
|
263599
263781
|
throw this.toHttpError(request, response, retryBody);
|
|
263600
263782
|
}
|
|
263601
|
-
const retryMode = request.retry ?? (request.method === "get" ? "safe" : "none");
|
|
263602
263783
|
if (retryMode === "safe" && isTransientGatewayError(response.status, body2) && attempt < this.maxRetries) {
|
|
263603
263784
|
const delay = this.retryBaseDelayMs * 2 ** attempt;
|
|
263604
263785
|
attempt += 1;
|
|
@@ -263608,6 +263789,18 @@ var AccessTokenGatewayClient = class {
|
|
|
263608
263789
|
throw this.toHttpError(request, response, body2);
|
|
263609
263790
|
}
|
|
263610
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
|
+
}
|
|
263611
263804
|
/** Send a gateway request and parse the JSON body, or null when empty. */
|
|
263612
263805
|
async requestJson(request) {
|
|
263613
263806
|
const response = await this.request(request);
|
|
@@ -263632,6 +263825,17 @@ var AccessTokenGatewayClient = class {
|
|
|
263632
263825
|
secretValues: [this.tokenProvider.current()]
|
|
263633
263826
|
});
|
|
263634
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
|
+
}
|
|
263635
263839
|
};
|
|
263636
263840
|
|
|
263637
263841
|
// src/lib/postman/token-provider.ts
|
|
@@ -279949,7 +280153,7 @@ function compileErrors(result) {
|
|
|
279949
280153
|
|
|
279950
280154
|
// src/lib/spec/openapi-loader.ts
|
|
279951
280155
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
279952
|
-
function
|
|
280156
|
+
function asRecord10(value) {
|
|
279953
280157
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
279954
280158
|
return value;
|
|
279955
280159
|
}
|
|
@@ -279964,7 +280168,7 @@ function parseOpenApiDocument(content) {
|
|
|
279964
280168
|
throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content is not valid JSON or YAML");
|
|
279965
280169
|
}
|
|
279966
280170
|
}
|
|
279967
|
-
const doc =
|
|
280171
|
+
const doc = asRecord10(parsed);
|
|
279968
280172
|
if (!doc) throw new Error("CONTRACT_SPEC_PARSE_FAILED: Spec content must be a JSON or YAML object");
|
|
279969
280173
|
return doc;
|
|
279970
280174
|
}
|
|
@@ -279992,7 +280196,7 @@ function collectExternalRefs(node, baseUrl, refs) {
|
|
|
279992
280196
|
node.forEach((entry) => collectExternalRefs(entry, baseUrl, refs));
|
|
279993
280197
|
return;
|
|
279994
280198
|
}
|
|
279995
|
-
const record =
|
|
280199
|
+
const record = asRecord10(node);
|
|
279996
280200
|
if (!record) return;
|
|
279997
280201
|
const ref = typeof record.$ref === "string" ? record.$ref : "";
|
|
279998
280202
|
if (ref && !ref.startsWith("#")) {
|
|
@@ -292588,7 +292792,7 @@ function buildGraphQLCollection(index, opts = {}) {
|
|
|
292588
292792
|
}
|
|
292589
292793
|
|
|
292590
292794
|
// src/lib/protocols/graphql/schema-lints.ts
|
|
292591
|
-
function
|
|
292795
|
+
function asRecord11(value) {
|
|
292592
292796
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
292593
292797
|
return value;
|
|
292594
292798
|
}
|
|
@@ -292599,7 +292803,7 @@ var BUILT_IN_SCALAR_NAMES = new Set(specifiedScalarTypes.map((scalar) => scalar.
|
|
|
292599
292803
|
var VALID_TYPE_KINDS = /* @__PURE__ */ new Set(["SCALAR", "OBJECT", "INTERFACE", "UNION", "ENUM", "INPUT_OBJECT", "LIST", "NON_NULL"]);
|
|
292600
292804
|
var VALID_DIRECTIVE_LOCATIONS = new Set(Object.values(DirectiveLocation));
|
|
292601
292805
|
function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
292602
|
-
const current =
|
|
292806
|
+
const current = asRecord11(ref);
|
|
292603
292807
|
if (!current || depth > 32 || typeof current.kind !== "string") return null;
|
|
292604
292808
|
if (current.kind === "NON_NULL") {
|
|
292605
292809
|
const inner = renderIntrospectionTypeRef(current.ofType, depth + 1);
|
|
@@ -292612,12 +292816,12 @@ function renderIntrospectionTypeRef(ref, depth = 0) {
|
|
|
292612
292816
|
return typeof current.name === "string" && current.name.length > 0 ? current.name : null;
|
|
292613
292817
|
}
|
|
292614
292818
|
function readIntrospectionDirectiveShape(value) {
|
|
292615
|
-
const directive =
|
|
292819
|
+
const directive = asRecord11(value);
|
|
292616
292820
|
if (!directive || typeof directive.isRepeatable !== "boolean") return null;
|
|
292617
292821
|
return {
|
|
292618
292822
|
isRepeatable: directive.isRepeatable,
|
|
292619
292823
|
locations: asArray5(directive.locations).filter((entry) => typeof entry === "string"),
|
|
292620
|
-
args: asArray5(directive.args).map(
|
|
292824
|
+
args: asArray5(directive.args).map(asRecord11).filter((entry) => entry !== null && typeof entry.name === "string").map((arg) => ({
|
|
292621
292825
|
name: arg.name,
|
|
292622
292826
|
type: renderIntrospectionTypeRef(arg.type),
|
|
292623
292827
|
defaultValue: Object.prototype.hasOwnProperty.call(arg, "defaultValue") ? arg.defaultValue : void 0
|
|
@@ -292627,10 +292831,10 @@ function readIntrospectionDirectiveShape(value) {
|
|
|
292627
292831
|
var BUILT_IN_INTROSPECTION_DIRECTIVE_SHAPES = (() => {
|
|
292628
292832
|
const shapes = /* @__PURE__ */ new Map();
|
|
292629
292833
|
const reference = introspectionFromSchema(buildSchema("type Query { _: Boolean }"));
|
|
292630
|
-
const schemaRecord =
|
|
292834
|
+
const schemaRecord = asRecord11(asRecord11(reference)?.__schema);
|
|
292631
292835
|
if (!schemaRecord) return shapes;
|
|
292632
292836
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
292633
|
-
const directive =
|
|
292837
|
+
const directive = asRecord11(entry);
|
|
292634
292838
|
if (!directive || typeof directive.name !== "string") continue;
|
|
292635
292839
|
const shape = readIntrospectionDirectiveShape(directive);
|
|
292636
292840
|
if (shape) shapes.set(directive.name, shape);
|
|
@@ -292726,11 +292930,11 @@ function lintDirectiveDefinitions(schema) {
|
|
|
292726
292930
|
const warnings = [];
|
|
292727
292931
|
const builtIn = new Set(specifiedDirectives.map((directive) => directive.name));
|
|
292728
292932
|
const usesDirective = (astNode, name) => {
|
|
292729
|
-
const record =
|
|
292933
|
+
const record = asRecord11(astNode);
|
|
292730
292934
|
if (!record) return false;
|
|
292731
292935
|
return asArray5(record.directives).some((entry) => {
|
|
292732
|
-
const applied =
|
|
292733
|
-
const appliedName = applied ?
|
|
292936
|
+
const applied = asRecord11(entry);
|
|
292937
|
+
const appliedName = applied ? asRecord11(applied.name) : null;
|
|
292734
292938
|
return Boolean(appliedName && appliedName.value === name);
|
|
292735
292939
|
});
|
|
292736
292940
|
};
|
|
@@ -292740,7 +292944,7 @@ function lintDirectiveDefinitions(schema) {
|
|
|
292740
292944
|
warnings.push("GQL_DIRECTIVE_NAME_RESERVED: directive @" + directive.name + ' must not begin with "__" (GraphQL spec 3.13)');
|
|
292741
292945
|
}
|
|
292742
292946
|
let selfReferenced = false;
|
|
292743
|
-
const ownAst =
|
|
292947
|
+
const ownAst = asRecord11(directive.astNode);
|
|
292744
292948
|
if (ownAst) {
|
|
292745
292949
|
for (const argNode of asArray5(ownAst.arguments)) {
|
|
292746
292950
|
if (usesDirective(argNode, directive.name)) selfReferenced = true;
|
|
@@ -292884,10 +293088,10 @@ function lintSdlDocument(sdl) {
|
|
|
292884
293088
|
return warnings;
|
|
292885
293089
|
}
|
|
292886
293090
|
function lintTypeRefChain(ref, context, warnings) {
|
|
292887
|
-
let current =
|
|
293091
|
+
let current = asRecord11(ref);
|
|
292888
293092
|
let depth = 0;
|
|
292889
293093
|
while (current && depth < 32) {
|
|
292890
|
-
const ofType =
|
|
293094
|
+
const ofType = asRecord11(current.ofType);
|
|
292891
293095
|
if (current.kind === "NON_NULL" && ofType && ofType.kind === "NON_NULL") {
|
|
292892
293096
|
warnings.push("GQL_INTROSPECTION_NONNULL_NESTED: " + context + " wraps NON_NULL directly inside NON_NULL, which the type system forbids (GraphQL spec 3.12)");
|
|
292893
293097
|
return;
|
|
@@ -292898,7 +293102,7 @@ function lintTypeRefChain(ref, context, warnings) {
|
|
|
292898
293102
|
}
|
|
292899
293103
|
function lintDeprecationFlags(entries, context, warnings) {
|
|
292900
293104
|
for (const entry of entries) {
|
|
292901
|
-
const record =
|
|
293105
|
+
const record = asRecord11(entry);
|
|
292902
293106
|
if (!record) continue;
|
|
292903
293107
|
const label = context + "." + (typeof record.name === "string" ? record.name : "<unnamed>");
|
|
292904
293108
|
if (record.isDeprecated !== void 0 && typeof record.isDeprecated !== "boolean") {
|
|
@@ -292919,7 +293123,7 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
292919
293123
|
const warnings = [];
|
|
292920
293124
|
const directives = /* @__PURE__ */ new Map();
|
|
292921
293125
|
for (const entry of asArray5(schemaRecord.directives)) {
|
|
292922
|
-
const directive =
|
|
293126
|
+
const directive = asRecord11(entry);
|
|
292923
293127
|
if (directive && typeof directive.name === "string" && !directives.has(directive.name)) {
|
|
292924
293128
|
directives.set(directive.name, directive);
|
|
292925
293129
|
}
|
|
@@ -292973,13 +293177,13 @@ function lintIntrospectionBuiltInDirectiveShapes(schemaRecord) {
|
|
|
292973
293177
|
}
|
|
292974
293178
|
function lintIntrospectionJson(introspection) {
|
|
292975
293179
|
const warnings = [];
|
|
292976
|
-
const root =
|
|
292977
|
-
const dataRecord = root ?
|
|
292978
|
-
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;
|
|
292979
293183
|
if (!schemaRecord) return warnings;
|
|
292980
293184
|
const typeCounts = /* @__PURE__ */ new Map();
|
|
292981
293185
|
for (const entry of asArray5(schemaRecord.types)) {
|
|
292982
|
-
const type =
|
|
293186
|
+
const type = asRecord11(entry);
|
|
292983
293187
|
if (!type) continue;
|
|
292984
293188
|
const name = typeof type.name === "string" ? type.name : "<unnamed>";
|
|
292985
293189
|
typeCounts.set(name, (typeCounts.get(name) ?? 0) + 1);
|
|
@@ -292987,7 +293191,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
292987
293191
|
warnings.push("GQL_INTROSPECTION_KIND_INVALID: type " + name + " declares unknown __TypeKind '" + type.kind + "'");
|
|
292988
293192
|
}
|
|
292989
293193
|
for (const memberEntry of asArray5(type.possibleTypes)) {
|
|
292990
|
-
const member =
|
|
293194
|
+
const member = asRecord11(memberEntry);
|
|
292991
293195
|
if (member && member.kind !== void 0 && member.kind !== "OBJECT") {
|
|
292992
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)");
|
|
292993
293197
|
}
|
|
@@ -292995,18 +293199,18 @@ function lintIntrospectionJson(introspection) {
|
|
|
292995
293199
|
lintDeprecationFlags(asArray5(type.fields), name + ".fields", warnings);
|
|
292996
293200
|
lintDeprecationFlags(asArray5(type.enumValues), name + ".enumValues", warnings);
|
|
292997
293201
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
292998
|
-
const field =
|
|
293202
|
+
const field = asRecord11(fieldEntry);
|
|
292999
293203
|
if (!field) continue;
|
|
293000
293204
|
const fieldLabel = name + "." + String(field.name ?? "<unnamed>");
|
|
293001
293205
|
lintTypeRefChain(field.type, fieldLabel, warnings);
|
|
293002
293206
|
for (const argEntry of asArray5(field.args)) {
|
|
293003
|
-
const arg =
|
|
293207
|
+
const arg = asRecord11(argEntry);
|
|
293004
293208
|
if (arg) lintTypeRefChain(arg.type, fieldLabel + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
293005
293209
|
}
|
|
293006
293210
|
lintDeprecationFlags(asArray5(field.args), fieldLabel + ".args", warnings);
|
|
293007
293211
|
}
|
|
293008
293212
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
293009
|
-
const input =
|
|
293213
|
+
const input = asRecord11(inputEntry);
|
|
293010
293214
|
if (input) lintTypeRefChain(input.type, name + "." + String(input.name ?? "<unnamed>"), warnings);
|
|
293011
293215
|
}
|
|
293012
293216
|
lintDeprecationFlags(asArray5(type.inputFields), name + ".inputFields", warnings);
|
|
@@ -293018,7 +293222,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
293018
293222
|
}
|
|
293019
293223
|
const directiveNameCounts = /* @__PURE__ */ new Map();
|
|
293020
293224
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
293021
|
-
const directive =
|
|
293225
|
+
const directive = asRecord11(directiveEntry);
|
|
293022
293226
|
if (!directive) continue;
|
|
293023
293227
|
if (typeof directive.name !== "string" || directive.name.length === 0) {
|
|
293024
293228
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: a __schema.directives entry is missing its name");
|
|
@@ -293034,7 +293238,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
293034
293238
|
warnings.push("GQL_INTROSPECTION_DIRECTIVE_INVALID: directive @" + directive.name + " isRepeatable must be a boolean (__Directive contract)");
|
|
293035
293239
|
}
|
|
293036
293240
|
for (const argEntry of asArray5(directive.args)) {
|
|
293037
|
-
const arg =
|
|
293241
|
+
const arg = asRecord11(argEntry);
|
|
293038
293242
|
if (arg) lintTypeRefChain(arg.type, "@" + directive.name + "(" + String(arg.name ?? "<unnamed>") + ":)", warnings);
|
|
293039
293243
|
}
|
|
293040
293244
|
lintDeprecationFlags(asArray5(directive.args), "@" + directive.name + ".args", warnings);
|
|
@@ -293053,7 +293257,7 @@ function lintIntrospectionJson(introspection) {
|
|
|
293053
293257
|
return warnings;
|
|
293054
293258
|
}
|
|
293055
293259
|
function introspectionTypeEntries(schemaRecord) {
|
|
293056
|
-
return asArray5(schemaRecord.types).map(
|
|
293260
|
+
return asArray5(schemaRecord.types).map(asRecord11).filter((entry) => entry !== null);
|
|
293057
293261
|
}
|
|
293058
293262
|
function introspectionTypesByName(entries) {
|
|
293059
293263
|
const byName = /* @__PURE__ */ new Map();
|
|
@@ -293064,7 +293268,7 @@ function introspectionTypesByName(entries) {
|
|
|
293064
293268
|
}
|
|
293065
293269
|
function describeIntrospectionRootRecord(value) {
|
|
293066
293270
|
if (value === void 0 || value === null) return "<missing>";
|
|
293067
|
-
const record =
|
|
293271
|
+
const record = asRecord11(value);
|
|
293068
293272
|
if (!record) return "<invalid>";
|
|
293069
293273
|
return typeof record.name === "string" && record.name.length > 0 ? record.name : "<unnamed>";
|
|
293070
293274
|
}
|
|
@@ -293084,7 +293288,7 @@ function lintIntrospectionRootMap(schemaRecord) {
|
|
|
293084
293288
|
}
|
|
293085
293289
|
continue;
|
|
293086
293290
|
}
|
|
293087
|
-
const record =
|
|
293291
|
+
const record = asRecord11(value);
|
|
293088
293292
|
if (!record || typeof record.name !== "string" || record.name.length === 0) {
|
|
293089
293293
|
warnings.push("GQL_INTROSPECTION_ROOT_INVALID: __schema." + rootKind + "Type must name the " + rootKind + " root operation type (GraphQL spec 3.3). Root map: " + rootMap);
|
|
293090
293294
|
continue;
|
|
@@ -293144,13 +293348,13 @@ function lintIntrospectionTypeMatrix(schemaRecord) {
|
|
|
293144
293348
|
return warnings;
|
|
293145
293349
|
}
|
|
293146
293350
|
function namedTypeRefName(ref) {
|
|
293147
|
-
let current =
|
|
293351
|
+
let current = asRecord11(ref);
|
|
293148
293352
|
let depth = 0;
|
|
293149
293353
|
while (current && depth < 32) {
|
|
293150
293354
|
if (current.kind !== "LIST" && current.kind !== "NON_NULL") {
|
|
293151
293355
|
return typeof current.name === "string" ? current.name : null;
|
|
293152
293356
|
}
|
|
293153
|
-
current =
|
|
293357
|
+
current = asRecord11(current.ofType);
|
|
293154
293358
|
depth += 1;
|
|
293155
293359
|
}
|
|
293156
293360
|
return null;
|
|
@@ -293164,31 +293368,31 @@ function lintIntrospectionReferenceGraph(schemaRecord) {
|
|
|
293164
293368
|
if (name) referenced.add(name);
|
|
293165
293369
|
};
|
|
293166
293370
|
for (const rootKind of ["query", "mutation", "subscription"]) {
|
|
293167
|
-
const record =
|
|
293371
|
+
const record = asRecord11(schemaRecord[rootKind + "Type"]);
|
|
293168
293372
|
if (record && typeof record.name === "string") referenced.add(record.name);
|
|
293169
293373
|
}
|
|
293170
293374
|
for (const type of entries) {
|
|
293171
293375
|
for (const entry of asArray5(type.interfaces)) addRef(namedTypeRefName(entry));
|
|
293172
293376
|
for (const entry of asArray5(type.possibleTypes)) addRef(namedTypeRefName(entry));
|
|
293173
293377
|
for (const fieldEntry of asArray5(type.fields)) {
|
|
293174
|
-
const field =
|
|
293378
|
+
const field = asRecord11(fieldEntry);
|
|
293175
293379
|
if (!field) continue;
|
|
293176
293380
|
addRef(namedTypeRefName(field.type));
|
|
293177
293381
|
for (const argEntry of asArray5(field.args)) {
|
|
293178
|
-
const arg =
|
|
293382
|
+
const arg = asRecord11(argEntry);
|
|
293179
293383
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
293180
293384
|
}
|
|
293181
293385
|
}
|
|
293182
293386
|
for (const inputEntry of asArray5(type.inputFields)) {
|
|
293183
|
-
const input =
|
|
293387
|
+
const input = asRecord11(inputEntry);
|
|
293184
293388
|
if (input) addRef(namedTypeRefName(input.type));
|
|
293185
293389
|
}
|
|
293186
293390
|
}
|
|
293187
293391
|
for (const directiveEntry of asArray5(schemaRecord.directives)) {
|
|
293188
|
-
const directive =
|
|
293392
|
+
const directive = asRecord11(directiveEntry);
|
|
293189
293393
|
if (!directive) continue;
|
|
293190
293394
|
for (const argEntry of asArray5(directive.args)) {
|
|
293191
|
-
const arg =
|
|
293395
|
+
const arg = asRecord11(argEntry);
|
|
293192
293396
|
if (arg) addRef(namedTypeRefName(arg.type));
|
|
293193
293397
|
}
|
|
293194
293398
|
}
|
|
@@ -293209,7 +293413,7 @@ function lintIntrospectionAbstractConsistency(schemaRecord) {
|
|
|
293209
293413
|
const entries = introspectionTypeEntries(schemaRecord);
|
|
293210
293414
|
const byName = introspectionTypesByName(entries);
|
|
293211
293415
|
const names = (value) => asArray5(value).map((entry) => {
|
|
293212
|
-
const record =
|
|
293416
|
+
const record = asRecord11(entry);
|
|
293213
293417
|
return record && typeof record.name === "string" ? record.name : "";
|
|
293214
293418
|
}).filter((name) => name.length > 0);
|
|
293215
293419
|
for (const type of entries) {
|
|
@@ -293238,7 +293442,7 @@ function lintIntrospectionDeprecationProvenance(schemaRecord) {
|
|
|
293238
293442
|
let flagged = 0;
|
|
293239
293443
|
for (const type of introspectionTypeEntries(schemaRecord)) {
|
|
293240
293444
|
for (const entry of [...asArray5(type.fields), ...asArray5(type.enumValues)]) {
|
|
293241
|
-
const record =
|
|
293445
|
+
const record = asRecord11(entry);
|
|
293242
293446
|
if (!record) continue;
|
|
293243
293447
|
entries += 1;
|
|
293244
293448
|
if (record.isDeprecated !== void 0) flagged += 1;
|
|
@@ -293264,7 +293468,7 @@ function lintGeneratedDocument(schema, operationId, documentText) {
|
|
|
293264
293468
|
}
|
|
293265
293469
|
|
|
293266
293470
|
// src/lib/protocols/graphql/parser.ts
|
|
293267
|
-
function
|
|
293471
|
+
function asRecord12(value) {
|
|
293268
293472
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
293269
293473
|
return value;
|
|
293270
293474
|
}
|
|
@@ -293382,14 +293586,14 @@ function collectRootOperations(rootType, kind, schema, shapes) {
|
|
|
293382
293586
|
});
|
|
293383
293587
|
}
|
|
293384
293588
|
function looksLikeIntrospection2(value) {
|
|
293385
|
-
const record =
|
|
293589
|
+
const record = asRecord12(value);
|
|
293386
293590
|
if (!record) return false;
|
|
293387
|
-
if (
|
|
293388
|
-
const data =
|
|
293389
|
-
return Boolean(data &&
|
|
293591
|
+
if (asRecord12(record.__schema)) return true;
|
|
293592
|
+
const data = asRecord12(record.data);
|
|
293593
|
+
return Boolean(data && asRecord12(data.__schema));
|
|
293390
293594
|
}
|
|
293391
293595
|
function buildSchemaFromIntrospection(value) {
|
|
293392
|
-
const introspection =
|
|
293596
|
+
const introspection = asRecord12(value.__schema) ? value : asRecord12(value.data);
|
|
293393
293597
|
return buildClientSchema(introspection);
|
|
293394
293598
|
}
|
|
293395
293599
|
function selectIntrospectionRootWarnings(warnings) {
|
|
@@ -293412,7 +293616,7 @@ function parseGraphQLSchema(content, opts = {}) {
|
|
|
293412
293616
|
if (parsedJson !== void 0 && looksLikeIntrospection2(parsedJson)) {
|
|
293413
293617
|
introspectionWarnings = lintIntrospectionJson(parsedJson);
|
|
293414
293618
|
try {
|
|
293415
|
-
schema = buildSchemaFromIntrospection(
|
|
293619
|
+
schema = buildSchemaFromIntrospection(asRecord12(parsedJson));
|
|
293416
293620
|
} catch (error) {
|
|
293417
293621
|
const rootWarnings = selectIntrospectionRootWarnings(introspectionWarnings);
|
|
293418
293622
|
const rootDiagnostics = rootWarnings.length > 0 ? " " + rootWarnings.join(" ") : "";
|
|
@@ -293529,7 +293733,7 @@ function collectDeprecatedSelectionWarnings(schema, operation, index) {
|
|
|
293529
293733
|
}
|
|
293530
293734
|
|
|
293531
293735
|
// src/lib/protocols/graphql/instrumenter.ts
|
|
293532
|
-
function
|
|
293736
|
+
function asRecord13(value) {
|
|
293533
293737
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
293534
293738
|
return value;
|
|
293535
293739
|
}
|
|
@@ -294039,24 +294243,24 @@ function buildProbeScript(probeId, index, warnings) {
|
|
|
294039
294243
|
];
|
|
294040
294244
|
}
|
|
294041
294245
|
function isGraphQLHttpRequest(item) {
|
|
294042
|
-
const request =
|
|
294246
|
+
const request = asRecord13(item.request);
|
|
294043
294247
|
if (!request) return false;
|
|
294044
|
-
const body2 =
|
|
294248
|
+
const body2 = asRecord13(request.body);
|
|
294045
294249
|
return body2?.mode === "graphql";
|
|
294046
294250
|
}
|
|
294047
294251
|
function injectItem(item, index, covered, warnings) {
|
|
294048
294252
|
const children4 = asArray6(item.item);
|
|
294049
294253
|
if (children4.length > 0) {
|
|
294050
294254
|
for (const child3 of children4) {
|
|
294051
|
-
const childRecord =
|
|
294255
|
+
const childRecord = asRecord13(child3);
|
|
294052
294256
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
294053
294257
|
}
|
|
294054
294258
|
return;
|
|
294055
294259
|
}
|
|
294056
294260
|
const itemId = String(item.id ?? "");
|
|
294057
|
-
if (itemId.startsWith("__gql_probe_") &&
|
|
294261
|
+
if (itemId.startsWith("__gql_probe_") && asRecord13(item.request)) {
|
|
294058
294262
|
const exec = buildProbeScript(itemId, index, warnings);
|
|
294059
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
294263
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
294060
294264
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec } }];
|
|
294061
294265
|
return;
|
|
294062
294266
|
}
|
|
@@ -294072,7 +294276,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
294072
294276
|
" pm.expect.fail(contractMappingError);",
|
|
294073
294277
|
"});"
|
|
294074
294278
|
];
|
|
294075
|
-
const priorEvents = asArray6(item.event).filter((entry) =>
|
|
294279
|
+
const priorEvents = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
294076
294280
|
item.event = [...priorEvents, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
294077
294281
|
return;
|
|
294078
294282
|
}
|
|
@@ -294088,7 +294292,7 @@ function injectItem(item, index, covered, warnings) {
|
|
|
294088
294292
|
`GQL_SCRIPT_SIZE_EXCEEDED: generated test script for '${operation.id}' exceeded ${GRAPHQL_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`
|
|
294089
294293
|
);
|
|
294090
294294
|
}
|
|
294091
|
-
const events = asArray6(item.event).filter((entry) =>
|
|
294295
|
+
const events = asArray6(item.event).filter((entry) => asRecord13(entry)?.listen !== "test");
|
|
294092
294296
|
item.event = [
|
|
294093
294297
|
...events,
|
|
294094
294298
|
{ listen: "test", script: { type: "text/javascript", exec } }
|
|
@@ -294099,7 +294303,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
294099
294303
|
const warnings = [...index.warnings];
|
|
294100
294304
|
const covered = /* @__PURE__ */ new Set();
|
|
294101
294305
|
for (const child3 of asArray6(collection.item)) {
|
|
294102
|
-
const childRecord =
|
|
294306
|
+
const childRecord = asRecord13(child3);
|
|
294103
294307
|
if (childRecord) injectItem(childRecord, index, covered, warnings);
|
|
294104
294308
|
}
|
|
294105
294309
|
const missing = index.operations.filter((operation) => !covered.has(operation.id));
|
|
@@ -294113,7 +294317,7 @@ function instrumentGraphQLCollection(collection, index) {
|
|
|
294113
294317
|
|
|
294114
294318
|
// src/lib/protocols/grpc/proto-parser.ts
|
|
294115
294319
|
var protobufjs = __toESM(require_protobufjs(), 1);
|
|
294116
|
-
function
|
|
294320
|
+
function asRecord14(value) {
|
|
294117
294321
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294118
294322
|
return value;
|
|
294119
294323
|
}
|
|
@@ -294413,7 +294617,7 @@ function upperCamelCase(name) {
|
|
|
294413
294617
|
function lintMessage(message, warnings, proto3) {
|
|
294414
294618
|
const fullName = stripLeadingDot(message.fullName);
|
|
294415
294619
|
const { ranges: reservedRanges } = lintReserved(message.reserved, `message ${fullName}`, { lo: 1, hi: FIELD_NUMBER_MAX, label: "field-number" }, warnings);
|
|
294416
|
-
lintOptionSet(
|
|
294620
|
+
lintOptionSet(asRecord14(message.options), "message", fullName, warnings);
|
|
294417
294621
|
const jsonNames = /* @__PURE__ */ new Map();
|
|
294418
294622
|
for (const field of asArray7(message.fieldsArray)) {
|
|
294419
294623
|
const id = field.id;
|
|
@@ -294434,7 +294638,7 @@ function lintMessage(message, warnings, proto3) {
|
|
|
294434
294638
|
}
|
|
294435
294639
|
jsonNames.set(jsonName, String(field.name));
|
|
294436
294640
|
}
|
|
294437
|
-
if (
|
|
294641
|
+
if (asRecord14(message.options)?.deprecated === true) {
|
|
294438
294642
|
warnings.push(`GRPC_DEPRECATED: message ${fullName} is marked deprecated`);
|
|
294439
294643
|
}
|
|
294440
294644
|
const nestedNames = new Set(asArray7(message.nestedArray).map((child3) => child3.name));
|
|
@@ -294463,13 +294667,13 @@ function lintMessage(message, warnings, proto3) {
|
|
|
294463
294667
|
for (const child3 of asArray7(message.nestedArray)) {
|
|
294464
294668
|
declare(child3.name, isEnum(child3) ? "nested enum" : "nested type");
|
|
294465
294669
|
if (isEnum(child3)) {
|
|
294466
|
-
for (const valueName of Object.keys(
|
|
294670
|
+
for (const valueName of Object.keys(asRecord14(child3.values) ?? {})) declare(valueName, `enum value of ${child3.name}`);
|
|
294467
294671
|
}
|
|
294468
294672
|
}
|
|
294469
294673
|
}
|
|
294470
294674
|
function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
294471
294675
|
const fullName = stripLeadingDot(enumObj.fullName);
|
|
294472
|
-
const entries = Object.entries(
|
|
294676
|
+
const entries = Object.entries(asRecord14(enumObj.values) ?? {});
|
|
294473
294677
|
const { ranges: reservedRanges, names: reservedNames } = lintReserved(
|
|
294474
294678
|
enumObj.reserved,
|
|
294475
294679
|
`enum ${fullName}`,
|
|
@@ -294497,7 +294701,7 @@ function lintEnum(enumObj, warnings, proto3, conventions) {
|
|
|
294497
294701
|
warnings.push(`GRPC_ENUM_ZERO_NAME_CONVENTION: enum ${fullName} zero value ${zero[0]} is conventionally named *_UNSPECIFIED (buf/AIP enum conventions)`);
|
|
294498
294702
|
}
|
|
294499
294703
|
}
|
|
294500
|
-
if (
|
|
294704
|
+
if (asRecord14(enumObj.options)?.deprecated === true) {
|
|
294501
294705
|
warnings.push(`GRPC_DEPRECATED: enum ${fullName} is marked deprecated`);
|
|
294502
294706
|
}
|
|
294503
294707
|
}
|
|
@@ -294582,7 +294786,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
294582
294786
|
for (const verb of HTTP_RULE_VERBS) {
|
|
294583
294787
|
if (typeof rule[verb] === "string") patterns.push({ verb, path: rule[verb] });
|
|
294584
294788
|
}
|
|
294585
|
-
const custom =
|
|
294789
|
+
const custom = asRecord14(rule.custom);
|
|
294586
294790
|
if (custom && typeof custom.path === "string") patterns.push({ verb: String(custom.kind ?? "custom"), path: custom.path });
|
|
294587
294791
|
if (patterns.length === 0) {
|
|
294588
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)`);
|
|
@@ -294644,7 +294848,7 @@ function lintHttpRule(rule, requestFields, responseFieldNames, warnings, operati
|
|
|
294644
294848
|
return;
|
|
294645
294849
|
}
|
|
294646
294850
|
for (const binding of bindingList) {
|
|
294647
|
-
const record =
|
|
294851
|
+
const record = asRecord14(binding);
|
|
294648
294852
|
if (record) lintHttpRule(record, requestFields, responseFieldNames, warnings, operationId, true);
|
|
294649
294853
|
}
|
|
294650
294854
|
}
|
|
@@ -294672,10 +294876,10 @@ function lintMethodOptions(method, operationId, warnings) {
|
|
|
294672
294876
|
const requestFields = httpFieldInfo(method.resolvedRequestType);
|
|
294673
294877
|
const responseFieldNames = method.resolvedResponseType ? new Set(asArray7(method.resolvedResponseType.fieldsArray).map((field) => String(field.name))) : null;
|
|
294674
294878
|
for (const entry of asArray7(method.parsedOptions)) {
|
|
294675
|
-
const http =
|
|
294879
|
+
const http = asRecord14(asRecord14(entry)?.["(google.api.http)"]);
|
|
294676
294880
|
if (http) lintHttpRule(http, requestFields, responseFieldNames, warnings, operationId, false);
|
|
294677
294881
|
}
|
|
294678
|
-
if (
|
|
294882
|
+
if (asRecord14(method.options)?.deprecated === true) {
|
|
294679
294883
|
warnings.push(`GRPC_DEPRECATED: rpc ${operationId} is marked deprecated`);
|
|
294680
294884
|
}
|
|
294681
294885
|
}
|
|
@@ -294780,7 +294984,7 @@ function parseProtoSchema(content, deps) {
|
|
|
294780
294984
|
}
|
|
294781
294985
|
const enumIndex = {};
|
|
294782
294986
|
for (const enumObj of enums) {
|
|
294783
|
-
const values = Object.keys(
|
|
294987
|
+
const values = Object.keys(asRecord14(enumObj.values) ?? {}).sort();
|
|
294784
294988
|
enumIndex[stripLeadingDot(enumObj.fullName)] = values;
|
|
294785
294989
|
lintEnum(enumObj, warnings, proto3, conventions);
|
|
294786
294990
|
}
|
|
@@ -294909,7 +295113,7 @@ var GRPC_INSTRUMENT_LIMITS = {
|
|
|
294909
295113
|
maxTestScriptBytes: 9e5,
|
|
294910
295114
|
maxCollectionUpdateBytes: 4e6
|
|
294911
295115
|
};
|
|
294912
|
-
function
|
|
295116
|
+
function asRecord15(value) {
|
|
294913
295117
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
294914
295118
|
return value;
|
|
294915
295119
|
}
|
|
@@ -295506,7 +295710,7 @@ function createMappingFailureScript2(message) {
|
|
|
295506
295710
|
];
|
|
295507
295711
|
}
|
|
295508
295712
|
function methodPathOf(item) {
|
|
295509
|
-
const payload =
|
|
295713
|
+
const payload = asRecord15(item.payload);
|
|
295510
295714
|
const value = payload?.methodPath;
|
|
295511
295715
|
return typeof value === "string" ? value : "";
|
|
295512
295716
|
}
|
|
@@ -295721,7 +295925,7 @@ function matchesFormatValue(format3, value) {
|
|
|
295721
295925
|
}
|
|
295722
295926
|
function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
295723
295927
|
if (!shape) return;
|
|
295724
|
-
const message =
|
|
295928
|
+
const message = asRecord15(asRecord15(item.payload)?.message);
|
|
295725
295929
|
const raw = typeof message?.content === "string" ? message.content : "";
|
|
295726
295930
|
if (!raw.trim()) return;
|
|
295727
295931
|
if (/\{\{[^}]+\}\}|<[a-zA-Z]/.test(raw)) return;
|
|
@@ -295732,7 +295936,7 @@ function staticRequestCheck(item, shape, methodPath2, warnings) {
|
|
|
295732
295936
|
warnings.push(`PROTO_REQUEST_BODY_INVALID_JSON: ${methodPath2} generated request message content is not valid JSON and is not validated`);
|
|
295733
295937
|
return;
|
|
295734
295938
|
}
|
|
295735
|
-
const record =
|
|
295939
|
+
const record = asRecord15(body2);
|
|
295736
295940
|
if (!record) return;
|
|
295737
295941
|
for (const field of shape.fields) {
|
|
295738
295942
|
const key = Object.prototype.hasOwnProperty.call(record, field.jsonName) ? field.jsonName : Object.prototype.hasOwnProperty.call(record, field.name) ? field.name : void 0;
|
|
@@ -295792,16 +295996,16 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
295792
295996
|
if (scriptBytes > GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes) {
|
|
295793
295997
|
throw new Error(`PROTO_SCRIPT_SIZE_EXCEEDED: generated test script for ${methodPath2} exceeded ${GRPC_INSTRUMENT_LIMITS.maxTestScriptBytes} bytes`);
|
|
295794
295998
|
}
|
|
295795
|
-
const events = asArray8(item.event).filter((entry) =>
|
|
295999
|
+
const events = asArray8(item.event).filter((entry) => asRecord15(entry)?.listen !== "test");
|
|
295796
296000
|
item.event = [...events, { listen: "test", script: { type: "text/javascript", exec: script } }];
|
|
295797
296001
|
}
|
|
295798
296002
|
for (const child3 of asArray8(item.item)) {
|
|
295799
|
-
const childRecord =
|
|
296003
|
+
const childRecord = asRecord15(child3);
|
|
295800
296004
|
if (childRecord) inject(childRecord);
|
|
295801
296005
|
}
|
|
295802
296006
|
};
|
|
295803
296007
|
for (const entry of asArray8(collection.item)) {
|
|
295804
|
-
const item =
|
|
296008
|
+
const item = asRecord15(entry);
|
|
295805
296009
|
if (item) inject(item);
|
|
295806
296010
|
}
|
|
295807
296011
|
const missing = index.operations.filter((operation) => !covered.has(operation.methodPath));
|
|
@@ -295816,7 +296020,7 @@ function instrumentGrpcCollection(collection, index) {
|
|
|
295816
296020
|
}
|
|
295817
296021
|
|
|
295818
296022
|
// src/lib/protocols/grpc/service-config.ts
|
|
295819
|
-
function
|
|
296023
|
+
function asRecord16(value) {
|
|
295820
296024
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
295821
296025
|
return value;
|
|
295822
296026
|
}
|
|
@@ -295975,7 +296179,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
295975
296179
|
return;
|
|
295976
296180
|
}
|
|
295977
296181
|
for (const entry of entries) {
|
|
295978
|
-
const record =
|
|
296182
|
+
const record = asRecord16(entry);
|
|
295979
296183
|
const keys = record ? Object.keys(record) : [];
|
|
295980
296184
|
if (!record || keys.length !== 1) {
|
|
295981
296185
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: each ${label} entry must be an object with exactly one policy key (service_config.proto)`);
|
|
@@ -295986,7 +296190,7 @@ function lintLoadBalancingEntries(entries, label, warnings, depth) {
|
|
|
295986
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)`);
|
|
295987
296191
|
continue;
|
|
295988
296192
|
}
|
|
295989
|
-
const config =
|
|
296193
|
+
const config = asRecord16(record[policy]);
|
|
295990
296194
|
if (!config) {
|
|
295991
296195
|
warnings.push(`GRPC_SERVICE_CONFIG_LB_INVALID: ${label} policy "${policy}" config must be a JSON object (service_config.proto)`);
|
|
295992
296196
|
continue;
|
|
@@ -296111,7 +296315,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
296111
296315
|
const declaredServices = new Set(index.operations.map((operation) => operation.serviceFullName));
|
|
296112
296316
|
const seenApis = /* @__PURE__ */ new Set();
|
|
296113
296317
|
asArray9(config.apis).forEach((entry, i) => {
|
|
296114
|
-
const record =
|
|
296318
|
+
const record = asRecord16(entry);
|
|
296115
296319
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
296116
296320
|
if (!name) {
|
|
296117
296321
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: apis[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -296128,7 +296332,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
296128
296332
|
const lintTypeList = (listKey, resolves, kind) => {
|
|
296129
296333
|
const seen = /* @__PURE__ */ new Set();
|
|
296130
296334
|
asArray9(config[listKey]).forEach((entry, i) => {
|
|
296131
|
-
const record =
|
|
296335
|
+
const record = asRecord16(entry);
|
|
296132
296336
|
const name = record && typeof record.name === "string" ? record.name : null;
|
|
296133
296337
|
if (!name) {
|
|
296134
296338
|
warnings.push(`GRPC_GOOGLE_API_CONFIG_INVALID: ${listKey}[${i}] must be an object with a string name (google.api.Service)`);
|
|
@@ -296156,7 +296360,7 @@ function lintGoogleApiServiceConfig(config, index, warnings) {
|
|
|
296156
296360
|
};
|
|
296157
296361
|
lintTypeList("types", (name) => index.messages[name] !== void 0, "message");
|
|
296158
296362
|
lintTypeList("enums", (name) => index.enums[name] !== void 0, "enum");
|
|
296159
|
-
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));
|
|
296160
296364
|
if (declaredDetails.length > 0 && !declaredDetails.includes("google.rpc.ErrorInfo")) {
|
|
296161
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");
|
|
296162
296366
|
}
|
|
@@ -296184,7 +296388,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
296184
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");
|
|
296185
296389
|
}
|
|
296186
296390
|
if (config.healthCheckConfig !== void 0) {
|
|
296187
|
-
const health =
|
|
296391
|
+
const health = asRecord16(config.healthCheckConfig);
|
|
296188
296392
|
if (!health) {
|
|
296189
296393
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: healthCheckConfig must be an object (service_config.proto)");
|
|
296190
296394
|
} else {
|
|
@@ -296198,7 +296402,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
296198
296402
|
}
|
|
296199
296403
|
}
|
|
296200
296404
|
}
|
|
296201
|
-
const throttling =
|
|
296405
|
+
const throttling = asRecord16(config.retryThrottling);
|
|
296202
296406
|
if (config.retryThrottling !== void 0) {
|
|
296203
296407
|
const maxTokens = throttling?.maxTokens;
|
|
296204
296408
|
const tokenRatio = throttling?.tokenRatio;
|
|
@@ -296235,7 +296439,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
296235
296439
|
const where = `methodConfig[${i}]`;
|
|
296236
296440
|
const meta = { targets: /* @__PURE__ */ new Set(), unresolved: false, retry: false, hedge: false, selectorCount: 0 };
|
|
296237
296441
|
entryMeta.push(meta);
|
|
296238
|
-
const methodConfig =
|
|
296442
|
+
const methodConfig = asRecord16(entry);
|
|
296239
296443
|
if (!methodConfig) {
|
|
296240
296444
|
warnings.push(`GRPC_SERVICE_CONFIG_INVALID: ${where} must be an object (service_config.proto)`);
|
|
296241
296445
|
return;
|
|
@@ -296253,7 +296457,7 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
296253
296457
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name must be a non-empty list of {service, method} selectors (service_config.proto)`);
|
|
296254
296458
|
} else {
|
|
296255
296459
|
names.forEach((nameEntry, j) => {
|
|
296256
|
-
const selector =
|
|
296460
|
+
const selector = asRecord16(nameEntry);
|
|
296257
296461
|
if (!selector) {
|
|
296258
296462
|
warnings.push(`GRPC_SERVICE_CONFIG_NAME_INVALID: ${where}.name[${j}] must be an object (service_config.proto)`);
|
|
296259
296463
|
return;
|
|
@@ -296296,8 +296500,8 @@ function lintServiceConfigObject(config, index, warnings) {
|
|
|
296296
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])}`);
|
|
296297
296501
|
}
|
|
296298
296502
|
}
|
|
296299
|
-
const retryPolicy =
|
|
296300
|
-
const hedgingPolicy =
|
|
296503
|
+
const retryPolicy = asRecord16(methodConfig.retryPolicy);
|
|
296504
|
+
const hedgingPolicy = asRecord16(methodConfig.hedgingPolicy);
|
|
296301
296505
|
meta.retry = methodConfig.retryPolicy !== void 0;
|
|
296302
296506
|
meta.hedge = methodConfig.hedgingPolicy !== void 0;
|
|
296303
296507
|
if (methodConfig.retryPolicy !== void 0 && methodConfig.hedgingPolicy !== void 0) {
|
|
@@ -296365,7 +296569,7 @@ ${warnings.join("\n")}`);
|
|
|
296365
296569
|
if (Array.isArray(parsed)) {
|
|
296366
296570
|
parsed.forEach((entry, i) => {
|
|
296367
296571
|
const where = `grpc_config[${i}]`;
|
|
296368
|
-
const choice =
|
|
296572
|
+
const choice = asRecord16(entry);
|
|
296369
296573
|
if (!choice) {
|
|
296370
296574
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where} must be an object (gRFC A2 choice list)`);
|
|
296371
296575
|
return;
|
|
@@ -296384,7 +296588,7 @@ ${warnings.join("\n")}`);
|
|
|
296384
296588
|
if (choice.percentage !== void 0 && !(typeof choice.percentage === "number" && choice.percentage >= 0 && choice.percentage <= 100)) {
|
|
296385
296589
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.percentage must be a number in [0, 100] (gRFC A2)`);
|
|
296386
296590
|
}
|
|
296387
|
-
const embedded =
|
|
296591
|
+
const embedded = asRecord16(choice.serviceConfig);
|
|
296388
296592
|
if (!embedded) {
|
|
296389
296593
|
warnings.push(`GRPC_SERVICE_CONFIG_CHOICE_INVALID: ${where}.serviceConfig must be a JSON object (gRFC A2)`);
|
|
296390
296594
|
return;
|
|
@@ -296393,7 +296597,7 @@ ${warnings.join("\n")}`);
|
|
|
296393
296597
|
});
|
|
296394
296598
|
return finish();
|
|
296395
296599
|
}
|
|
296396
|
-
const config =
|
|
296600
|
+
const config = asRecord16(parsed);
|
|
296397
296601
|
if (!config) {
|
|
296398
296602
|
warnings.push("GRPC_SERVICE_CONFIG_INVALID: service config must be a JSON object (service_config.proto)");
|
|
296399
296603
|
return finish();
|
|
@@ -302651,7 +302855,7 @@ function lintWsdl20Services(services, interfaces, bindings, warnings) {
|
|
|
302651
302855
|
|
|
302652
302856
|
// src/lib/protocols/soap/xsd-index.ts
|
|
302653
302857
|
var XSD_NS = "http://www.w3.org/2001/XMLSchema";
|
|
302654
|
-
function
|
|
302858
|
+
function asRecord17(value) {
|
|
302655
302859
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
302656
302860
|
return value;
|
|
302657
302861
|
}
|
|
@@ -302687,7 +302891,7 @@ function children2(record, local2) {
|
|
|
302687
302891
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
302688
302892
|
if (localName(key) !== local2) continue;
|
|
302689
302893
|
for (const entry of asArray10(record[key])) {
|
|
302690
|
-
const rec =
|
|
302894
|
+
const rec = asRecord17(entry);
|
|
302691
302895
|
if (rec) out.push(rec);
|
|
302692
302896
|
}
|
|
302693
302897
|
}
|
|
@@ -302723,7 +302927,7 @@ function parseOccursMax(raw) {
|
|
|
302723
302927
|
return Number.isNaN(value) ? 1 : value;
|
|
302724
302928
|
}
|
|
302725
302929
|
function simpleTypeFacets(simpleType, scopes) {
|
|
302726
|
-
const restriction =
|
|
302930
|
+
const restriction = asRecord17(child(simpleType, "restriction"));
|
|
302727
302931
|
if (!restriction) return {};
|
|
302728
302932
|
const baseQName = attr2(restriction, "base");
|
|
302729
302933
|
const baseNs = baseQName ? namespaceForPrefix([...scopes, restriction], prefixOf(baseQName)) : "";
|
|
@@ -302750,7 +302954,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
302750
302954
|
if (!complexType) return void 0;
|
|
302751
302955
|
if (child(complexType, "complexContent") !== void 0 || child(complexType, "simpleContent") !== void 0) return void 0;
|
|
302752
302956
|
if (child(complexType, "choice") !== void 0 || child(complexType, "all") !== void 0 || child(complexType, "group") !== void 0) return void 0;
|
|
302753
|
-
const sequence =
|
|
302957
|
+
const sequence = asRecord17(child(complexType, "sequence"));
|
|
302754
302958
|
if (!sequence) return [];
|
|
302755
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;
|
|
302756
302960
|
const out = [];
|
|
@@ -302769,7 +302973,7 @@ function sequenceChildren(complexType, scopes, tns, simpleTypes) {
|
|
|
302769
302973
|
enumeration = sameSchema.enums;
|
|
302770
302974
|
}
|
|
302771
302975
|
}
|
|
302772
|
-
const inlineSimple =
|
|
302976
|
+
const inlineSimple = asRecord17(child(el, "simpleType"));
|
|
302773
302977
|
if (inlineSimple) {
|
|
302774
302978
|
const facets = simpleTypeFacets(inlineSimple, [...scopes, el]);
|
|
302775
302979
|
builtinType = facets.base ?? builtinType;
|
|
@@ -302814,7 +303018,7 @@ function buildXsdIndex(docNode) {
|
|
|
302814
303018
|
for (const el of children2(schema, "element")) {
|
|
302815
303019
|
const name = attr2(el, "name");
|
|
302816
303020
|
if (!name) continue;
|
|
302817
|
-
const inline =
|
|
303021
|
+
const inline = asRecord17(child(el, "complexType"));
|
|
302818
303022
|
const typeQName = attr2(el, "type");
|
|
302819
303023
|
const named = typeQName && namespaceForPrefix([...scopes, el], prefixOf(typeQName)) !== XSD_NS ? complexTypes.get(localName(typeQName)) ?? null : null;
|
|
302820
303024
|
index.elements.set(tns + "|" + name, {
|
|
@@ -302841,7 +303045,7 @@ function lookupXsdElement(index, namespace, name) {
|
|
|
302841
303045
|
}
|
|
302842
303046
|
|
|
302843
303047
|
// src/lib/protocols/soap/parser.ts
|
|
302844
|
-
function
|
|
303048
|
+
function asRecord18(value) {
|
|
302845
303049
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
302846
303050
|
return value;
|
|
302847
303051
|
}
|
|
@@ -302888,7 +303092,7 @@ function children3(record, local2) {
|
|
|
302888
303092
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
302889
303093
|
if (localName2(key) !== local2) continue;
|
|
302890
303094
|
for (const entry of asArray11(record[key])) {
|
|
302891
|
-
const rec =
|
|
303095
|
+
const rec = asRecord18(entry);
|
|
302892
303096
|
if (rec) out.push(rec);
|
|
302893
303097
|
}
|
|
302894
303098
|
}
|
|
@@ -302992,7 +303196,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
302992
303196
|
else if (ns === SOAP11_BINDING_NS) soapVersion = "1.1";
|
|
302993
303197
|
else continue;
|
|
302994
303198
|
for (const marker of asArray11(binding[key])) {
|
|
302995
|
-
const style = attr3(
|
|
303199
|
+
const style = attr3(asRecord18(marker), "style");
|
|
302996
303200
|
if (style) bindingStyle = style;
|
|
302997
303201
|
}
|
|
302998
303202
|
}
|
|
@@ -303005,7 +303209,7 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
303005
303209
|
for (const key of Object.keys(operation)) {
|
|
303006
303210
|
if (localName2(key) !== "operation") continue;
|
|
303007
303211
|
for (const marker of asArray11(operation[key])) {
|
|
303008
|
-
const rec =
|
|
303212
|
+
const rec = asRecord18(marker);
|
|
303009
303213
|
const action = attr3(rec, "soapAction");
|
|
303010
303214
|
if (action) soapAction = action;
|
|
303011
303215
|
const style2 = attr3(rec, "style");
|
|
@@ -303018,8 +303222,8 @@ function parseSoapBindings11(definitions, messages, warnings) {
|
|
|
303018
303222
|
warnings.push(`SOAP_BINDING_STYLE_UNPARSEABLE: binding ${bindingName} operation ${opName} declares style "${styleRaw}" (expected document|rpc); style-specific assertions are skipped`);
|
|
303019
303223
|
style = void 0;
|
|
303020
303224
|
}
|
|
303021
|
-
const inputDirection =
|
|
303022
|
-
const outputDirection =
|
|
303225
|
+
const inputDirection = asRecord18(child2(operation, "input"));
|
|
303226
|
+
const outputDirection = asRecord18(child2(operation, "output"));
|
|
303023
303227
|
const inputBody = bodyMarker(inputDirection);
|
|
303024
303228
|
const outputBody = bodyMarker(outputDirection);
|
|
303025
303229
|
const useRaw = attr3(outputBody, "use") || attr3(inputBody, "use");
|
|
@@ -303099,8 +303303,8 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
303099
303303
|
return children3(portType, "operation").map((operation) => {
|
|
303100
303304
|
const name = attr3(operation, "name");
|
|
303101
303305
|
const opWarnings = [];
|
|
303102
|
-
const inputRecord =
|
|
303103
|
-
const outputRecord =
|
|
303306
|
+
const inputRecord = asRecord18(child2(operation, "input"));
|
|
303307
|
+
const outputRecord = asRecord18(child2(operation, "output"));
|
|
303104
303308
|
const inputRef = localName2(attr3(inputRecord, "message"));
|
|
303105
303309
|
const outputRef = localName2(attr3(outputRecord, "message"));
|
|
303106
303310
|
const input = inputRef ? messages.get(inputRef) : void 0;
|
|
@@ -303154,7 +303358,7 @@ function parseServices11(definitions, messages, bindings, warnings) {
|
|
|
303154
303358
|
const seenPortTypes = /* @__PURE__ */ new Set();
|
|
303155
303359
|
for (const port of ports) {
|
|
303156
303360
|
const bindingName = localName2(attr3(port, "binding"));
|
|
303157
|
-
const address =
|
|
303361
|
+
const address = asRecord18(child2(port, "address"));
|
|
303158
303362
|
const location2 = attr3(address, "location");
|
|
303159
303363
|
if (location2 && !endpoint) endpoint = location2;
|
|
303160
303364
|
const portTypeName = bindingToPortType.get(bindingName);
|
|
@@ -303243,8 +303447,8 @@ function parseServices20(description, warnings) {
|
|
|
303243
303447
|
const buildOperations = (iface, binding) => children3(iface, "operation").map((operation) => {
|
|
303244
303448
|
const name = attr3(operation, "name");
|
|
303245
303449
|
const opWarnings = [];
|
|
303246
|
-
const inputRecord =
|
|
303247
|
-
const outputRecord =
|
|
303450
|
+
const inputRecord = asRecord18(child2(operation, "input"));
|
|
303451
|
+
const outputRecord = asRecord18(child2(operation, "output"));
|
|
303248
303452
|
const inputElement = attr3(inputRecord, "element");
|
|
303249
303453
|
const outputElement = attr3(outputRecord, "element");
|
|
303250
303454
|
const outLocal = outputElement.startsWith("#") ? "" : localName2(outputElement);
|
|
@@ -303292,9 +303496,9 @@ function parseServices20(description, warnings) {
|
|
|
303292
303496
|
for (const ep of children3(service, "endpoint")) {
|
|
303293
303497
|
let address = attr3(ep, "address");
|
|
303294
303498
|
if (!address) {
|
|
303295
|
-
const epr =
|
|
303499
|
+
const epr = asRecord18(child2(ep, "EndpointReference"));
|
|
303296
303500
|
const addressNode = child2(epr, "Address");
|
|
303297
|
-
const addressRecord =
|
|
303501
|
+
const addressRecord = asRecord18(addressNode);
|
|
303298
303502
|
address = addressRecord ? asString2(addressRecord["#text"]) : asString2(addressNode);
|
|
303299
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`);
|
|
303300
303504
|
}
|
|
@@ -303315,7 +303519,7 @@ function parseServices20(description, warnings) {
|
|
|
303315
303519
|
return services;
|
|
303316
303520
|
}
|
|
303317
303521
|
function detectAddressing(node) {
|
|
303318
|
-
const record =
|
|
303522
|
+
const record = asRecord18(node);
|
|
303319
303523
|
if (!record) return false;
|
|
303320
303524
|
for (const key of Object.keys(record)) {
|
|
303321
303525
|
if (key.startsWith("@_") || key === "#text") continue;
|
|
@@ -303382,7 +303586,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
303382
303586
|
const ns = namespaceForPrefix2([definitions, binding], prefixOf2(key));
|
|
303383
303587
|
if (ns !== SOAP11_BINDING_NS && ns !== SOAP12_BINDING_NS) continue;
|
|
303384
303588
|
for (const entry of asArray11(binding[key])) {
|
|
303385
|
-
const marker =
|
|
303589
|
+
const marker = asRecord18(entry);
|
|
303386
303590
|
if (!marker) continue;
|
|
303387
303591
|
const style = attr3(marker, "style");
|
|
303388
303592
|
if (style) bindingStyle = style;
|
|
@@ -303410,14 +303614,14 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
303410
303614
|
for (const key of Object.keys(operation)) {
|
|
303411
303615
|
if (localName2(key) !== "operation") continue;
|
|
303412
303616
|
for (const entry of asArray11(operation[key])) {
|
|
303413
|
-
const style = attr3(
|
|
303617
|
+
const style = attr3(asRecord18(entry), "style");
|
|
303414
303618
|
if (style) styleRaw = style;
|
|
303415
303619
|
}
|
|
303416
303620
|
}
|
|
303417
303621
|
const effStyle = styleRaw === "rpc" ? "rpc" : "document";
|
|
303418
303622
|
styles.add(effStyle);
|
|
303419
|
-
const inputDirection =
|
|
303420
|
-
const outputDirection =
|
|
303623
|
+
const inputDirection = asRecord18(child2(operation, "input"));
|
|
303624
|
+
const outputDirection = asRecord18(child2(operation, "output"));
|
|
303421
303625
|
const inputBody = bodyMarker(inputDirection);
|
|
303422
303626
|
const outputBody = bodyMarker(outputDirection);
|
|
303423
303627
|
for (const [direction, body2] of [["input", inputBody], ["output", outputBody]]) {
|
|
@@ -303442,8 +303646,8 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
303442
303646
|
}
|
|
303443
303647
|
}
|
|
303444
303648
|
const portTypeOp = portTypeOps.get(opName);
|
|
303445
|
-
const inputMessage = portTypeOp ? messages.get(localName2(attr3(
|
|
303446
|
-
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;
|
|
303447
303651
|
if (portTypeOp) {
|
|
303448
303652
|
const bindingHasOutput = child2(operation, "output") !== void 0;
|
|
303449
303653
|
const portTypeHasOutput = child2(portTypeOp, "output") !== void 0;
|
|
@@ -303503,7 +303707,7 @@ function lintWsdl112(definitions, messages, warnings) {
|
|
|
303503
303707
|
for (const service of children3(definitions, "service")) {
|
|
303504
303708
|
for (const port of children3(service, "port")) {
|
|
303505
303709
|
const portName = attr3(port, "name");
|
|
303506
|
-
const location2 = attr3(
|
|
303710
|
+
const location2 = attr3(asRecord18(child2(port, "address")), "location");
|
|
303507
303711
|
if (!location2) continue;
|
|
303508
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`);
|
|
303509
303713
|
const prior = addressLocations.get(location2);
|
|
@@ -303522,13 +303726,13 @@ function parseWsdl(content, opts) {
|
|
|
303522
303726
|
const parser = createParser();
|
|
303523
303727
|
let root;
|
|
303524
303728
|
try {
|
|
303525
|
-
root =
|
|
303729
|
+
root = asRecord18(parser.parse(text));
|
|
303526
303730
|
} catch (error) {
|
|
303527
303731
|
throw new Error(`SOAP_WSDL_PARSE_ERROR: ${error.message}`, { cause: error });
|
|
303528
303732
|
}
|
|
303529
303733
|
if (!root) throw new Error("SOAP_WSDL_PARSE_ERROR: document did not parse to an element");
|
|
303530
|
-
const definitions =
|
|
303531
|
-
const description =
|
|
303734
|
+
const definitions = asRecord18(child2(root, "definitions"));
|
|
303735
|
+
const description = asRecord18(child2(root, "description"));
|
|
303532
303736
|
if (!definitions && !description) {
|
|
303533
303737
|
throw new Error("SOAP_WSDL_ROOT_INVALID: expected a WSDL <definitions> (1.1) or <description> (2.0) root element");
|
|
303534
303738
|
}
|
|
@@ -303988,7 +304192,7 @@ function xsdPayloadLines(operation, index) {
|
|
|
303988
304192
|
}
|
|
303989
304193
|
|
|
303990
304194
|
// src/lib/protocols/soap/instrumenter.ts
|
|
303991
|
-
function
|
|
304195
|
+
function asRecord19(value) {
|
|
303992
304196
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
303993
304197
|
return value;
|
|
303994
304198
|
}
|
|
@@ -304670,12 +304874,12 @@ function forEachHttpRequest(node, visit4) {
|
|
|
304670
304874
|
const children4 = asArray12(node.item);
|
|
304671
304875
|
if (children4.length > 0) {
|
|
304672
304876
|
for (const child3 of children4) {
|
|
304673
|
-
const record =
|
|
304877
|
+
const record = asRecord19(child3);
|
|
304674
304878
|
if (record) forEachHttpRequest(record, visit4);
|
|
304675
304879
|
}
|
|
304676
304880
|
return;
|
|
304677
304881
|
}
|
|
304678
|
-
if (
|
|
304882
|
+
if (asRecord19(node.request)) visit4(node);
|
|
304679
304883
|
}
|
|
304680
304884
|
function instrumentSoapCollection(collection, index) {
|
|
304681
304885
|
const warnings = [...index.warnings];
|
|
@@ -304700,7 +304904,7 @@ function instrumentSoapCollection(collection, index) {
|
|
|
304700
304904
|
' pm.expect(code, "unsupported media types map to HTTP 415 (SOAP 1.2 Part 2 section 7)").to.eql(415);',
|
|
304701
304905
|
"});"
|
|
304702
304906
|
];
|
|
304703
|
-
const existingEvents = asArray12(item.event).map((entry) =>
|
|
304907
|
+
const existingEvents = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
304704
304908
|
item.event = [...existingEvents, { listen: "test", script: { type: "text/javascript", exec: probeExec } }];
|
|
304705
304909
|
return;
|
|
304706
304910
|
}
|
|
@@ -304714,13 +304918,13 @@ function instrumentSoapCollection(collection, index) {
|
|
|
304714
304918
|
" pm.expect.fail(contractMappingError);",
|
|
304715
304919
|
"});"
|
|
304716
304920
|
];
|
|
304717
|
-
const existing2 = asArray12(item.event).map((entry) =>
|
|
304921
|
+
const existing2 = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
304718
304922
|
item.event = [...existing2, { listen: "test", script: { type: "text/javascript", exec: failExec } }];
|
|
304719
304923
|
return;
|
|
304720
304924
|
}
|
|
304721
304925
|
covered.add(operation.name);
|
|
304722
304926
|
const exec = createSoapScript(operation, warnings, { declaresAddressing: index.declaresAddressing, targetNamespace: index.targetNamespace, schemaIndex: index.schemaIndex }).split("\n");
|
|
304723
|
-
const existing = asArray12(item.event).map((entry) =>
|
|
304927
|
+
const existing = asArray12(item.event).map((entry) => asRecord19(entry)).filter((entry) => Boolean(entry) && entry.listen !== "test");
|
|
304724
304928
|
item.event = [
|
|
304725
304929
|
...existing,
|
|
304726
304930
|
{ listen: "test", script: { type: "text/javascript", exec } }
|
|
@@ -304739,7 +304943,7 @@ var SOCKETIO_PROTOCOLS = /* @__PURE__ */ new Set(["socketio", "socket.io", "sio"
|
|
|
304739
304943
|
var MQTT_PROTOCOLS = /* @__PURE__ */ new Set(["mqtt", "mqtts", "secure-mqtt", "mqtt5"]);
|
|
304740
304944
|
var DEFAULT_SOCKETIO_PATH = "/socket.io";
|
|
304741
304945
|
var SAMPLE_MAX_DEPTH = 5;
|
|
304742
|
-
function
|
|
304946
|
+
function asRecord20(value) {
|
|
304743
304947
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
304744
304948
|
return value;
|
|
304745
304949
|
}
|
|
@@ -304762,7 +304966,7 @@ function contentKindFor(contentType2) {
|
|
|
304762
304966
|
return "binary";
|
|
304763
304967
|
}
|
|
304764
304968
|
function sampleFromSchema(schema, depth) {
|
|
304765
|
-
const record =
|
|
304969
|
+
const record = asRecord20(schema);
|
|
304766
304970
|
if (!record) return record === null ? null : {};
|
|
304767
304971
|
if (record.example !== void 0) return record.example;
|
|
304768
304972
|
if (record.default !== void 0) return record.default;
|
|
@@ -304778,7 +304982,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
304778
304982
|
switch (type) {
|
|
304779
304983
|
case "object":
|
|
304780
304984
|
case void 0: {
|
|
304781
|
-
const properties =
|
|
304985
|
+
const properties = asRecord20(record.properties);
|
|
304782
304986
|
if (!properties) return {};
|
|
304783
304987
|
const required = new Set(asArray13(record.required));
|
|
304784
304988
|
const out = {};
|
|
@@ -304807,7 +305011,7 @@ function sampleFromSchema(schema, depth) {
|
|
|
304807
305011
|
}
|
|
304808
305012
|
}
|
|
304809
305013
|
function bindingKeyValues(bindingSchema) {
|
|
304810
|
-
const properties =
|
|
305014
|
+
const properties = asRecord20(asRecord20(bindingSchema)?.properties);
|
|
304811
305015
|
if (!properties) return [];
|
|
304812
305016
|
return Object.keys(properties).sort().map((key) => ({ key, value: "" }));
|
|
304813
305017
|
}
|
|
@@ -304821,8 +305025,8 @@ function detectTransport(channel, servers, messagesRaw, documentJson, warnings)
|
|
|
304821
305025
|
const protocolSocketio = servers.some((server) => SOCKETIO_PROTOCOLS.has(server.protocol().toLowerCase()));
|
|
304822
305026
|
if (protocolSocketio) return "socketio";
|
|
304823
305027
|
const channelJson = channel.json();
|
|
304824
|
-
const hasAck = messagesRaw.some((message) =>
|
|
304825
|
-
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;
|
|
304826
305030
|
if (hasAck || hasSocketioExt) {
|
|
304827
305031
|
warnings.push(
|
|
304828
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`
|
|
@@ -304837,7 +305041,7 @@ function wsBindingKeyValues(channel) {
|
|
|
304837
305041
|
return protocol === "ws" || protocol === "wss" || protocol === "websockets";
|
|
304838
305042
|
});
|
|
304839
305043
|
if (!wsBinding) return { headers: [], queryParams: [] };
|
|
304840
|
-
const value =
|
|
305044
|
+
const value = asRecord20(wsBinding.value()) ?? {};
|
|
304841
305045
|
return {
|
|
304842
305046
|
headers: bindingKeyValues(value.headers),
|
|
304843
305047
|
queryParams: bindingKeyValues(value.query),
|
|
@@ -304848,33 +305052,33 @@ function collectMqttInfo(channel, servers, messagesRaw, documentJson) {
|
|
|
304848
305052
|
const channelJson = channel.json();
|
|
304849
305053
|
const operationBindings = [];
|
|
304850
305054
|
for (const operationKey of ["publish", "subscribe"]) {
|
|
304851
|
-
const binding =
|
|
305055
|
+
const binding = asRecord20(asRecord20(asRecord20(channelJson[operationKey])?.bindings)?.mqtt);
|
|
304852
305056
|
if (binding) operationBindings.push(binding);
|
|
304853
305057
|
}
|
|
304854
305058
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
304855
|
-
const operations =
|
|
305059
|
+
const operations = asRecord20(documentJson.operations) ?? {};
|
|
304856
305060
|
for (const operation of Object.values(operations)) {
|
|
304857
|
-
const operationRecord =
|
|
305061
|
+
const operationRecord = asRecord20(operation);
|
|
304858
305062
|
if (!operationRecord) continue;
|
|
304859
|
-
const ref = String(
|
|
305063
|
+
const ref = String(asRecord20(operationRecord.channel)?.$ref ?? "");
|
|
304860
305064
|
const lastSegment = ref.includes("/") ? unescapePointer(ref.slice(ref.lastIndexOf("/") + 1)) : "";
|
|
304861
305065
|
if (lastSegment !== channel.id()) continue;
|
|
304862
|
-
const binding =
|
|
305066
|
+
const binding = asRecord20(asRecord20(operationRecord.bindings)?.mqtt);
|
|
304863
305067
|
if (binding) operationBindings.push(binding);
|
|
304864
305068
|
}
|
|
304865
305069
|
const serverBindings = [];
|
|
304866
305070
|
let protocolVersion = 4;
|
|
304867
305071
|
for (const server of servers) {
|
|
304868
|
-
const serverJson =
|
|
305072
|
+
const serverJson = asRecord20(server.json()) ?? {};
|
|
304869
305073
|
if (String(serverJson.protocolVersion ?? "") === "5" || server.protocol().toLowerCase() === "mqtt5") {
|
|
304870
305074
|
protocolVersion = 5;
|
|
304871
305075
|
}
|
|
304872
|
-
const binding =
|
|
305076
|
+
const binding = asRecord20(asRecord20(serverJson.bindings)?.mqtt);
|
|
304873
305077
|
if (binding) serverBindings.push(binding);
|
|
304874
305078
|
}
|
|
304875
305079
|
const messageBindings = [];
|
|
304876
305080
|
for (const message of messagesRaw) {
|
|
304877
|
-
const binding =
|
|
305081
|
+
const binding = asRecord20(asRecord20(asRecord20(message.json())?.bindings)?.mqtt);
|
|
304878
305082
|
if (binding) messageBindings.push({ messageId: message.id() || message.name() || "message", binding });
|
|
304879
305083
|
}
|
|
304880
305084
|
return { operationBindings, serverBindings, messageBindings, protocolVersion };
|
|
@@ -304891,7 +305095,7 @@ function buildReplySchemaByMessageId(document2) {
|
|
|
304891
305095
|
}
|
|
304892
305096
|
if (!reply) continue;
|
|
304893
305097
|
const replyMessage = reply.messages().all().find((message) => message.hasPayload());
|
|
304894
|
-
const replySchema = replyMessage ?
|
|
305098
|
+
const replySchema = replyMessage ? asRecord20(replyMessage.payload()?.json()) ?? void 0 : void 0;
|
|
304895
305099
|
if (!replySchema) continue;
|
|
304896
305100
|
for (const requestMessage of operation.messages().all()) {
|
|
304897
305101
|
const id = requestMessage.id();
|
|
@@ -304906,16 +305110,16 @@ function messageDescriptor2(message, warnings, channelId, defaultContentType, re
|
|
|
304906
305110
|
const title = message.title() || message.name() || id;
|
|
304907
305111
|
const contentType2 = message.contentType() || defaultContentType || "application/json";
|
|
304908
305112
|
const contentKind = contentKindFor(contentType2);
|
|
304909
|
-
const payloadSchema = message.hasPayload() ?
|
|
305113
|
+
const payloadSchema = message.hasPayload() ? asRecord20(message.payload()?.json()) ?? void 0 : void 0;
|
|
304910
305114
|
if (!payloadSchema) {
|
|
304911
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`);
|
|
304912
305116
|
}
|
|
304913
|
-
const rawMessage =
|
|
304914
|
-
const xAckSchema =
|
|
305117
|
+
const rawMessage = asRecord20(message.json()) ?? {};
|
|
305118
|
+
const xAckSchema = asRecord20(rawMessage["x-ack"]) ?? void 0;
|
|
304915
305119
|
const replySchema = replyByMessageId.get(message.id());
|
|
304916
305120
|
const ackSchema = xAckSchema ?? replySchema;
|
|
304917
305121
|
const ackSource = xAckSchema ? "x-ack" : replySchema ? "reply" : void 0;
|
|
304918
|
-
const correlationRaw =
|
|
305122
|
+
const correlationRaw = asRecord20(rawMessage.correlationId)?.location;
|
|
304919
305123
|
const correlationLocation = typeof correlationRaw === "string" ? correlationRaw : void 0;
|
|
304920
305124
|
const examples = message.examples().all().filter((example) => example.hasPayload());
|
|
304921
305125
|
const hasExample = examples.length > 0;
|
|
@@ -304951,7 +305155,7 @@ function channelDescriptor(channel, document2, documentJson, defaultContentType,
|
|
|
304951
305155
|
const servers = resolveServers(channel, document2);
|
|
304952
305156
|
const messagesRaw = channel.messages().all();
|
|
304953
305157
|
const transport = detectTransport(channel, servers, messagesRaw, documentJson, warnings);
|
|
304954
|
-
const parameterNames = Object.keys(
|
|
305158
|
+
const parameterNames = Object.keys(asRecord20(channel.json().parameters) ?? {}).sort();
|
|
304955
305159
|
const serverUrl = servers.find((server) => server.url())?.url() || options.endpointUrl?.trim() || "";
|
|
304956
305160
|
if (!serverUrl) {
|
|
304957
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`);
|
|
@@ -305393,7 +305597,7 @@ var SCHEMES_BY_FAMILY = {
|
|
|
305393
305597
|
http: /* @__PURE__ */ new Set(["http", "https"]),
|
|
305394
305598
|
amqp: /* @__PURE__ */ new Set(["amqp", "amqps"])
|
|
305395
305599
|
};
|
|
305396
|
-
function
|
|
305600
|
+
function asRecord21(value) {
|
|
305397
305601
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
305398
305602
|
return value;
|
|
305399
305603
|
}
|
|
@@ -305412,7 +305616,7 @@ function parsesAsUrl(value) {
|
|
|
305412
305616
|
}
|
|
305413
305617
|
}
|
|
305414
305618
|
function checkExternalDocs(label, raw, warnings) {
|
|
305415
|
-
const externalDocs =
|
|
305619
|
+
const externalDocs = asRecord21(raw);
|
|
305416
305620
|
if (!externalDocs) return;
|
|
305417
305621
|
const url = externalDocs.url;
|
|
305418
305622
|
if (typeof url !== "string" || !parsesAsUrl(url)) {
|
|
@@ -305426,7 +305630,7 @@ function lintTagsAndExternalDocs(label, node, warnings) {
|
|
|
305426
305630
|
const seen = /* @__PURE__ */ new Set();
|
|
305427
305631
|
const reported = /* @__PURE__ */ new Set();
|
|
305428
305632
|
tags.forEach((entry, i) => {
|
|
305429
|
-
const tag =
|
|
305633
|
+
const tag = asRecord21(entry);
|
|
305430
305634
|
const name = typeof tag?.name === "string" ? tag.name : void 0;
|
|
305431
305635
|
if (name !== void 0) {
|
|
305432
305636
|
if (seen.has(name) && !reported.has(name)) {
|
|
@@ -305462,7 +305666,7 @@ function lintSchemaFormat(label, value, warnings) {
|
|
|
305462
305666
|
}
|
|
305463
305667
|
function lintTraits(label, traitsRaw, warnings) {
|
|
305464
305668
|
asArray14(traitsRaw).forEach((entry, i) => {
|
|
305465
|
-
const trait =
|
|
305669
|
+
const trait = asRecord21(entry);
|
|
305466
305670
|
if (trait && trait.payload !== void 0) {
|
|
305467
305671
|
warnings.push(
|
|
305468
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`
|
|
@@ -305471,7 +305675,7 @@ function lintTraits(label, traitsRaw, warnings) {
|
|
|
305471
305675
|
});
|
|
305472
305676
|
}
|
|
305473
305677
|
function lintParameter(label, raw, warnings) {
|
|
305474
|
-
const parameter =
|
|
305678
|
+
const parameter = asRecord21(raw);
|
|
305475
305679
|
if (!parameter) return;
|
|
305476
305680
|
const enumValues = asArray14(parameter.enum);
|
|
305477
305681
|
if (enumValues.length > 0) {
|
|
@@ -305491,9 +305695,9 @@ function lintParameter(label, raw, warnings) {
|
|
|
305491
305695
|
}
|
|
305492
305696
|
}
|
|
305493
305697
|
function lintSecurityRequirements(documentJson, is3, label, securityRaw, warnings) {
|
|
305494
|
-
const declared =
|
|
305698
|
+
const declared = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
305495
305699
|
for (const entry of asArray14(securityRaw)) {
|
|
305496
|
-
const requirement =
|
|
305700
|
+
const requirement = asRecord21(entry);
|
|
305497
305701
|
if (!requirement) continue;
|
|
305498
305702
|
if (is3) {
|
|
305499
305703
|
const type = String(requirement.type ?? "");
|
|
@@ -305506,7 +305710,7 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
305506
305710
|
continue;
|
|
305507
305711
|
}
|
|
305508
305712
|
for (const [schemeName, scopesRaw] of Object.entries(requirement)) {
|
|
305509
|
-
const scheme =
|
|
305713
|
+
const scheme = asRecord21(declared[schemeName]);
|
|
305510
305714
|
if (!scheme) {
|
|
305511
305715
|
warnings.push(
|
|
305512
305716
|
`ASYNCAPI_SECURITY_REQUIREMENT_UNDECLARED: ${label} security requirement references scheme ${JSON.stringify(schemeName)}, which is not declared in components.securitySchemes`
|
|
@@ -305523,9 +305727,9 @@ function lintSecurityRequirements(documentJson, is3, label, securityRaw, warning
|
|
|
305523
305727
|
}
|
|
305524
305728
|
}
|
|
305525
305729
|
function lintSecuritySchemes(documentJson, warnings) {
|
|
305526
|
-
const schemes =
|
|
305730
|
+
const schemes = asRecord21(asRecord21(documentJson.components)?.securitySchemes) ?? {};
|
|
305527
305731
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
305528
|
-
const scheme =
|
|
305732
|
+
const scheme = asRecord21(raw);
|
|
305529
305733
|
if (!scheme) continue;
|
|
305530
305734
|
const type = scheme.type;
|
|
305531
305735
|
if (typeof type !== "string" || !ASYNCAPI_SECURITY_SCHEME_TYPES.has(type)) {
|
|
@@ -305547,9 +305751,9 @@ function lintSecuritySchemes(documentJson, warnings) {
|
|
|
305547
305751
|
}
|
|
305548
305752
|
}
|
|
305549
305753
|
function lintComponentKeys(documentJson, warnings) {
|
|
305550
|
-
const components =
|
|
305754
|
+
const components = asRecord21(documentJson.components) ?? {};
|
|
305551
305755
|
for (const [sectionName, sectionRaw] of Object.entries(components)) {
|
|
305552
|
-
const section =
|
|
305756
|
+
const section = asRecord21(sectionRaw);
|
|
305553
305757
|
if (!section) continue;
|
|
305554
305758
|
for (const key of Object.keys(section)) {
|
|
305555
305759
|
if (!COMPONENT_KEY_RE.test(key)) {
|
|
@@ -305561,7 +305765,7 @@ function lintComponentKeys(documentJson, warnings) {
|
|
|
305561
305765
|
}
|
|
305562
305766
|
}
|
|
305563
305767
|
function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
305564
|
-
const variables =
|
|
305768
|
+
const variables = asRecord21(variablesRaw) ?? {};
|
|
305565
305769
|
const used = /* @__PURE__ */ new Set();
|
|
305566
305770
|
for (const match of template.matchAll(/\{([^{}]+)\}/g)) {
|
|
305567
305771
|
used.add(match[1]);
|
|
@@ -305575,7 +305779,7 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
305575
305779
|
if (!used.has(name)) {
|
|
305576
305780
|
warnings.push(`ASYNCAPI_SERVER_VARIABLE_UNUSED: ${serverLabel} declares variable ${name} that never appears in the server url/host/pathname`);
|
|
305577
305781
|
}
|
|
305578
|
-
const variable =
|
|
305782
|
+
const variable = asRecord21(raw);
|
|
305579
305783
|
if (!variable) continue;
|
|
305580
305784
|
if (variable.default === void 0) {
|
|
305581
305785
|
warnings.push(
|
|
@@ -305596,10 +305800,10 @@ function lintServerVariables(serverLabel, template, variablesRaw, warnings) {
|
|
|
305596
305800
|
}
|
|
305597
305801
|
}
|
|
305598
305802
|
function lintServers(documentJson, is3, warnings) {
|
|
305599
|
-
const servers =
|
|
305803
|
+
const servers = asRecord21(documentJson.servers) ?? {};
|
|
305600
305804
|
let httpProtocolSeen = false;
|
|
305601
305805
|
for (const [name, raw] of Object.entries(servers)) {
|
|
305602
|
-
const server =
|
|
305806
|
+
const server = asRecord21(raw);
|
|
305603
305807
|
if (!server) continue;
|
|
305604
305808
|
const label = `server ${name}`;
|
|
305605
305809
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : void 0;
|
|
@@ -305642,9 +305846,9 @@ function lintServers(documentJson, is3, warnings) {
|
|
|
305642
305846
|
}
|
|
305643
305847
|
}
|
|
305644
305848
|
function lintBindings(label, bindingsRaw, warnings) {
|
|
305645
|
-
const bindings =
|
|
305849
|
+
const bindings = asRecord21(bindingsRaw);
|
|
305646
305850
|
if (!bindings) return;
|
|
305647
|
-
const kafka =
|
|
305851
|
+
const kafka = asRecord21(bindings.kafka);
|
|
305648
305852
|
if (kafka) {
|
|
305649
305853
|
if (typeof kafka.topic === "string" && (kafka.topic === "." || kafka.topic === ".." || !KAFKA_TOPIC_NAME_RE.test(kafka.topic))) {
|
|
305650
305854
|
warnings.push(
|
|
@@ -305659,15 +305863,15 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
305659
305863
|
}
|
|
305660
305864
|
}
|
|
305661
305865
|
}
|
|
305662
|
-
const amqp =
|
|
305866
|
+
const amqp = asRecord21(bindings.amqp);
|
|
305663
305867
|
if (amqp) {
|
|
305664
|
-
const queue =
|
|
305868
|
+
const queue = asRecord21(amqp.queue);
|
|
305665
305869
|
if (queue && typeof queue.name === "string" && queue.name.length > 255) {
|
|
305666
305870
|
warnings.push(
|
|
305667
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)`
|
|
305668
305872
|
);
|
|
305669
305873
|
}
|
|
305670
|
-
const exchange =
|
|
305874
|
+
const exchange = asRecord21(amqp.exchange);
|
|
305671
305875
|
if (exchange && exchange.type !== void 0 && !AMQP_EXCHANGE_TYPES.has(String(exchange.type))) {
|
|
305672
305876
|
warnings.push(
|
|
305673
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)`
|
|
@@ -305684,7 +305888,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
305684
305888
|
);
|
|
305685
305889
|
}
|
|
305686
305890
|
}
|
|
305687
|
-
const http =
|
|
305891
|
+
const http = asRecord21(bindings.http);
|
|
305688
305892
|
if (http) {
|
|
305689
305893
|
if (http.method !== void 0 && (typeof http.method !== "string" || !HTTP_BINDING_METHODS.has(http.method))) {
|
|
305690
305894
|
warnings.push(
|
|
@@ -305697,7 +305901,7 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
305697
305901
|
);
|
|
305698
305902
|
}
|
|
305699
305903
|
}
|
|
305700
|
-
const ws =
|
|
305904
|
+
const ws = asRecord21(bindings.ws) ?? asRecord21(bindings.websockets);
|
|
305701
305905
|
if (ws && typeof ws.subprotocol === "string" && !IANA_WEBSOCKET_SUBPROTOCOLS.has(ws.subprotocol)) {
|
|
305702
305906
|
warnings.push(
|
|
305703
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)`
|
|
@@ -305705,11 +305909,11 @@ function lintBindings(label, bindingsRaw, warnings) {
|
|
|
305705
305909
|
}
|
|
305706
305910
|
}
|
|
305707
305911
|
function effectiveSchema(label, slot, raw, warnings) {
|
|
305708
|
-
const node =
|
|
305912
|
+
const node = asRecord21(raw);
|
|
305709
305913
|
if (!node) return void 0;
|
|
305710
305914
|
if (typeof node.schemaFormat === "string" && node.schema !== void 0) {
|
|
305711
305915
|
lintSchemaFormat(`${label} ${slot}`, node.schemaFormat, warnings);
|
|
305712
|
-
return
|
|
305916
|
+
return asRecord21(node.schema) ?? void 0;
|
|
305713
305917
|
}
|
|
305714
305918
|
return node;
|
|
305715
305919
|
}
|
|
@@ -305740,7 +305944,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
305740
305944
|
const examples = asArray14(message.examples);
|
|
305741
305945
|
if (!is3) {
|
|
305742
305946
|
examples.forEach((entry, i) => {
|
|
305743
|
-
const example =
|
|
305947
|
+
const example = asRecord21(entry);
|
|
305744
305948
|
if (!example) return;
|
|
305745
305949
|
for (const key of Object.keys(example)) {
|
|
305746
305950
|
if (!MESSAGE_EXAMPLE_KEYS.has(key) && !key.startsWith("x-")) {
|
|
@@ -305751,7 +305955,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
305751
305955
|
}
|
|
305752
305956
|
});
|
|
305753
305957
|
}
|
|
305754
|
-
if (headersSchema && examples.some((entry) =>
|
|
305958
|
+
if (headersSchema && examples.some((entry) => asRecord21(entry)?.headers !== void 0)) {
|
|
305755
305959
|
const packed = packSchema(documentJson, headersSchema, "3.0", "response");
|
|
305756
305960
|
const validate4 = packed.unsupported ? null : compileSchemaValidator(packed.schema);
|
|
305757
305961
|
if (!validate4) {
|
|
@@ -305760,7 +305964,7 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
305760
305964
|
);
|
|
305761
305965
|
} else {
|
|
305762
305966
|
examples.forEach((entry, i) => {
|
|
305763
|
-
const example =
|
|
305967
|
+
const example = asRecord21(entry);
|
|
305764
305968
|
if (!example || example.headers === void 0) return;
|
|
305765
305969
|
if (!validate4(example.headers)) {
|
|
305766
305970
|
warnings.push(
|
|
@@ -305775,23 +305979,23 @@ function lintMessage2(documentJson, label, message, is3, minor, state, warnings)
|
|
|
305775
305979
|
lintTagsAndExternalDocs(label, message, warnings);
|
|
305776
305980
|
}
|
|
305777
305981
|
function messagesOfOperation2x(op) {
|
|
305778
|
-
const root =
|
|
305982
|
+
const root = asRecord21(op.message);
|
|
305779
305983
|
if (!root) return [];
|
|
305780
|
-
const oneOf = asArray14(root.oneOf).map((entry) =>
|
|
305984
|
+
const oneOf = asArray14(root.oneOf).map((entry) => asRecord21(entry)).filter((entry) => entry !== null);
|
|
305781
305985
|
return oneOf.length > 0 ? oneOf : [root];
|
|
305782
305986
|
}
|
|
305783
305987
|
function lintChannels(documentJson, is3, minor, warnings) {
|
|
305784
|
-
const channels =
|
|
305988
|
+
const channels = asRecord21(documentJson.channels) ?? {};
|
|
305785
305989
|
const state = { seen: /* @__PURE__ */ new WeakSet(), messageIds: /* @__PURE__ */ new Map() };
|
|
305786
305990
|
const operationIds = /* @__PURE__ */ new Map();
|
|
305787
305991
|
const addresses = /* @__PURE__ */ new Map();
|
|
305788
305992
|
for (const [channelKey, channelRaw] of Object.entries(channels)) {
|
|
305789
|
-
const channel =
|
|
305993
|
+
const channel = asRecord21(channelRaw);
|
|
305790
305994
|
if (!channel) continue;
|
|
305791
305995
|
const channelLabel = `channel ${channelKey}`;
|
|
305792
305996
|
lintBindings(channelLabel, channel.bindings, warnings);
|
|
305793
305997
|
lintTagsAndExternalDocs(channelLabel, channel, warnings);
|
|
305794
|
-
const parameters =
|
|
305998
|
+
const parameters = asRecord21(channel.parameters) ?? {};
|
|
305795
305999
|
for (const [parameterName, parameterRaw] of Object.entries(parameters)) {
|
|
305796
306000
|
lintParameter(`${channelLabel} parameter ${parameterName}`, parameterRaw, warnings);
|
|
305797
306001
|
}
|
|
@@ -305804,15 +306008,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
305804
306008
|
addresses.set(channel.address, channelKey);
|
|
305805
306009
|
}
|
|
305806
306010
|
}
|
|
305807
|
-
const messages =
|
|
306011
|
+
const messages = asRecord21(channel.messages) ?? {};
|
|
305808
306012
|
for (const [messageKey, messageRaw] of Object.entries(messages)) {
|
|
305809
|
-
const message =
|
|
306013
|
+
const message = asRecord21(messageRaw);
|
|
305810
306014
|
if (message) lintMessage2(documentJson, `message ${messageKey} on channel ${channelKey}`, message, is3, minor, state, warnings);
|
|
305811
306015
|
}
|
|
305812
306016
|
continue;
|
|
305813
306017
|
}
|
|
305814
306018
|
for (const opKey of ["publish", "subscribe"]) {
|
|
305815
|
-
const op =
|
|
306019
|
+
const op = asRecord21(channel[opKey]);
|
|
305816
306020
|
if (!op) continue;
|
|
305817
306021
|
const opLabel = `${opKey} operation on channel ${channelKey}`;
|
|
305818
306022
|
if (typeof op.operationId === "string") {
|
|
@@ -305835,15 +306039,15 @@ function lintChannels(documentJson, is3, minor, warnings) {
|
|
|
305835
306039
|
}
|
|
305836
306040
|
}
|
|
305837
306041
|
function lintOperations3(documentJson, warnings) {
|
|
305838
|
-
const operations =
|
|
306042
|
+
const operations = asRecord21(documentJson.operations) ?? {};
|
|
305839
306043
|
for (const [operationKey, operationRaw] of Object.entries(operations)) {
|
|
305840
|
-
const operation =
|
|
306044
|
+
const operation = asRecord21(operationRaw);
|
|
305841
306045
|
if (!operation) continue;
|
|
305842
306046
|
const label = `operation ${operationKey}`;
|
|
305843
306047
|
if (operation.action !== "send" && operation.action !== "receive") {
|
|
305844
306048
|
warnings.push(`ASYNCAPI_OPERATION_ACTION_INVALID: ${label} action ${JSON.stringify(operation.action)} must be "send" or "receive" (AsyncAPI 3.0 Operation Object)`);
|
|
305845
306049
|
}
|
|
305846
|
-
const replyAddress =
|
|
306050
|
+
const replyAddress = asRecord21(asRecord21(operation.reply)?.address);
|
|
305847
306051
|
if (replyAddress && typeof replyAddress.location === "string" && !isAsyncApiRuntimeExpression(replyAddress.location)) {
|
|
305848
306052
|
warnings.push(
|
|
305849
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>)`
|
|
@@ -305867,7 +306071,7 @@ function resolveLocalPointer(root, ref) {
|
|
|
305867
306071
|
if (!Number.isInteger(idx) || idx < 0 || idx >= node.length) return false;
|
|
305868
306072
|
node = node[idx];
|
|
305869
306073
|
} else {
|
|
305870
|
-
const record =
|
|
306074
|
+
const record = asRecord21(node);
|
|
305871
306075
|
if (!record || !(key in record)) return false;
|
|
305872
306076
|
node = record[key];
|
|
305873
306077
|
}
|
|
@@ -305911,13 +306115,13 @@ function lintAsyncApiDocument(index) {
|
|
|
305911
306115
|
lintChannels(documentJson, is3, minor, warnings);
|
|
305912
306116
|
if (is3) lintOperations3(documentJson, warnings);
|
|
305913
306117
|
lintTagsAndExternalDocs("document", documentJson, warnings);
|
|
305914
|
-
const info =
|
|
306118
|
+
const info = asRecord21(documentJson.info);
|
|
305915
306119
|
if (info) lintTagsAndExternalDocs("info", info, warnings);
|
|
305916
306120
|
return warnings;
|
|
305917
306121
|
}
|
|
305918
306122
|
|
|
305919
306123
|
// src/lib/protocols/asyncapi/asyncapi-binding-lints.ts
|
|
305920
|
-
function
|
|
306124
|
+
function asRecord22(value) {
|
|
305921
306125
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
305922
306126
|
return value;
|
|
305923
306127
|
}
|
|
@@ -306012,46 +306216,46 @@ function pushSite(ctx, site) {
|
|
|
306012
306216
|
if (site) ctx.sites.push(site);
|
|
306013
306217
|
}
|
|
306014
306218
|
function siteOf(scope, label, raw, direction) {
|
|
306015
|
-
const bindings =
|
|
306219
|
+
const bindings = asRecord22(raw);
|
|
306016
306220
|
if (!bindings) return null;
|
|
306017
306221
|
return { scope, label, bindings, direction };
|
|
306018
306222
|
}
|
|
306019
306223
|
function collectSites(ctx) {
|
|
306020
306224
|
const { doc } = ctx;
|
|
306021
|
-
const servers =
|
|
306225
|
+
const servers = asRecord22(doc.servers) ?? {};
|
|
306022
306226
|
for (const [name, raw] of Object.entries(servers)) {
|
|
306023
|
-
const server =
|
|
306227
|
+
const server = asRecord22(raw);
|
|
306024
306228
|
if (server) pushSite(ctx, siteOf("server", "server " + name, server.bindings));
|
|
306025
306229
|
}
|
|
306026
|
-
const channels =
|
|
306230
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
306027
306231
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
306028
|
-
const channel =
|
|
306232
|
+
const channel = asRecord22(rawCh);
|
|
306029
306233
|
if (!channel) continue;
|
|
306030
306234
|
pushSite(ctx, siteOf("channel", "channel " + chName, channel.bindings));
|
|
306031
306235
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
306032
|
-
const op =
|
|
306236
|
+
const op = asRecord22(channel[opKeyword]);
|
|
306033
306237
|
if (!op) continue;
|
|
306034
306238
|
const direction = opKeyword === "publish" ? "send" : "receive";
|
|
306035
306239
|
pushSite(ctx, siteOf("operation", "channel " + chName + " " + opKeyword, op.bindings, direction));
|
|
306036
|
-
const message =
|
|
306240
|
+
const message = asRecord22(op.message);
|
|
306037
306241
|
if (message) collectMessageSites(ctx, "channel " + chName + " " + opKeyword + " message", message, direction);
|
|
306038
306242
|
}
|
|
306039
|
-
const chMessages =
|
|
306243
|
+
const chMessages = asRecord22(channel.messages);
|
|
306040
306244
|
if (chMessages) {
|
|
306041
306245
|
for (const [msgName, rawMsg] of Object.entries(chMessages)) {
|
|
306042
|
-
const message =
|
|
306246
|
+
const message = asRecord22(rawMsg);
|
|
306043
306247
|
if (message) collectMessageSites(ctx, "channel " + chName + " message " + msgName, message, void 0);
|
|
306044
306248
|
}
|
|
306045
306249
|
}
|
|
306046
306250
|
}
|
|
306047
|
-
const operations =
|
|
306251
|
+
const operations = asRecord22(doc.operations) ?? {};
|
|
306048
306252
|
for (const [opName, rawOp] of Object.entries(operations)) {
|
|
306049
|
-
const op =
|
|
306253
|
+
const op = asRecord22(rawOp);
|
|
306050
306254
|
if (!op) continue;
|
|
306051
306255
|
const direction = op.action === "send" ? "send" : op.action === "receive" ? "receive" : void 0;
|
|
306052
306256
|
pushSite(ctx, siteOf("operation", "operation " + opName, op.bindings, direction));
|
|
306053
306257
|
}
|
|
306054
|
-
const components =
|
|
306258
|
+
const components = asRecord22(doc.components) ?? {};
|
|
306055
306259
|
const componentScopes = [
|
|
306056
306260
|
["serverBindings", "server"],
|
|
306057
306261
|
["channelBindings", "channel"],
|
|
@@ -306059,21 +306263,21 @@ function collectSites(ctx) {
|
|
|
306059
306263
|
["messageBindings", "message"]
|
|
306060
306264
|
];
|
|
306061
306265
|
for (const [key, scope] of componentScopes) {
|
|
306062
|
-
const group =
|
|
306266
|
+
const group = asRecord22(components[key]) ?? {};
|
|
306063
306267
|
for (const [name, raw] of Object.entries(group)) {
|
|
306064
306268
|
pushSite(ctx, siteOf(scope, "components." + key + " " + name, raw));
|
|
306065
306269
|
}
|
|
306066
306270
|
}
|
|
306067
|
-
const compMessages =
|
|
306271
|
+
const compMessages = asRecord22(components.messages) ?? {};
|
|
306068
306272
|
for (const [name, raw] of Object.entries(compMessages)) {
|
|
306069
|
-
const message =
|
|
306273
|
+
const message = asRecord22(raw);
|
|
306070
306274
|
if (message) collectMessageSites(ctx, "components.messages " + name, message, void 0);
|
|
306071
306275
|
}
|
|
306072
306276
|
}
|
|
306073
306277
|
function collectMessageSites(ctx, label, message, direction) {
|
|
306074
306278
|
pushSite(ctx, siteOf("message", label, message.bindings, direction));
|
|
306075
306279
|
for (const entry of asArray15(message.oneOf)) {
|
|
306076
|
-
const alt =
|
|
306280
|
+
const alt = asRecord22(entry);
|
|
306077
306281
|
if (alt) pushSite(ctx, siteOf("message", label + " oneOf alternative", alt.bindings, direction));
|
|
306078
306282
|
}
|
|
306079
306283
|
}
|
|
@@ -306098,7 +306302,7 @@ function lintBindingSites(ctx) {
|
|
|
306098
306302
|
}
|
|
306099
306303
|
const family = BINDING_KEY_FAMILY[key];
|
|
306100
306304
|
if (family) familiesSeen.set(family, site.label + " bindings." + key);
|
|
306101
|
-
const binding =
|
|
306305
|
+
const binding = asRecord22(site.bindings[key]);
|
|
306102
306306
|
if (!binding) continue;
|
|
306103
306307
|
if (key === "mqtt5") {
|
|
306104
306308
|
warnings.push(
|
|
@@ -306141,8 +306345,8 @@ function lintBindingSites(ctx) {
|
|
|
306141
306345
|
}
|
|
306142
306346
|
}
|
|
306143
306347
|
const serverFamilies = /* @__PURE__ */ new Set();
|
|
306144
|
-
for (const raw of Object.values(
|
|
306145
|
-
const server =
|
|
306348
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
306349
|
+
const server = asRecord22(raw);
|
|
306146
306350
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
306147
306351
|
const family = SERVER_PROTOCOL_FAMILY[protocol];
|
|
306148
306352
|
if (family) serverFamilies.add(family);
|
|
@@ -306158,7 +306362,7 @@ function lintBindingSites(ctx) {
|
|
|
306158
306362
|
}
|
|
306159
306363
|
}
|
|
306160
306364
|
function compileBindingSchema(ctx, label, schema) {
|
|
306161
|
-
const record =
|
|
306365
|
+
const record = asRecord22(schema);
|
|
306162
306366
|
if (!record) return null;
|
|
306163
306367
|
const packed = packSchema(ctx.doc, record, "3.0", "response");
|
|
306164
306368
|
if (packed.unsupported) {
|
|
@@ -306192,9 +306396,9 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
306192
306396
|
for (const part of ["query", "headers"]) {
|
|
306193
306397
|
const schemaRaw = binding[part];
|
|
306194
306398
|
if (schemaRaw === void 0) continue;
|
|
306195
|
-
const schema =
|
|
306399
|
+
const schema = asRecord22(schemaRaw);
|
|
306196
306400
|
if (!schema) continue;
|
|
306197
|
-
const properties =
|
|
306401
|
+
const properties = asRecord22(schema.properties);
|
|
306198
306402
|
if (!properties || Object.keys(properties).length === 0) {
|
|
306199
306403
|
warnings.push(
|
|
306200
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)"
|
|
@@ -306211,7 +306415,7 @@ function lintWsChannelBinding(ctx, label, binding) {
|
|
|
306211
306415
|
}
|
|
306212
306416
|
if (part !== "headers") continue;
|
|
306213
306417
|
const lower = name.toLowerCase();
|
|
306214
|
-
const prop =
|
|
306418
|
+
const prop = asRecord22(rawProp) ?? {};
|
|
306215
306419
|
if (WS_RUNTIME_OWNED_HEADERS.has(lower)) {
|
|
306216
306420
|
const detail = required.has(lower) ? "is required by the binding but" : "";
|
|
306217
306421
|
warnings.push(
|
|
@@ -306262,10 +306466,10 @@ function substituteTemplates(value) {
|
|
|
306262
306466
|
}
|
|
306263
306467
|
function lintChannelAddresses(ctx) {
|
|
306264
306468
|
const { doc, warnings } = ctx;
|
|
306265
|
-
const channels =
|
|
306469
|
+
const channels = asRecord22(doc.channels) ?? {};
|
|
306266
306470
|
const wsServers = [];
|
|
306267
|
-
for (const [name, raw] of Object.entries(
|
|
306268
|
-
const server =
|
|
306471
|
+
for (const [name, raw] of Object.entries(asRecord22(doc.servers) ?? {})) {
|
|
306472
|
+
const server = asRecord22(raw);
|
|
306269
306473
|
if (!server) continue;
|
|
306270
306474
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
306271
306475
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "ws") continue;
|
|
@@ -306273,7 +306477,7 @@ function lintChannelAddresses(ctx) {
|
|
|
306273
306477
|
if (url) wsServers.push({ name, base: url });
|
|
306274
306478
|
}
|
|
306275
306479
|
for (const [chName, rawCh] of Object.entries(channels)) {
|
|
306276
|
-
const channel =
|
|
306480
|
+
const channel = asRecord22(rawCh);
|
|
306277
306481
|
if (!channel) continue;
|
|
306278
306482
|
const address = ctx.isV3 ? channel.address : chName;
|
|
306279
306483
|
if (typeof address !== "string" || address.length === 0) continue;
|
|
@@ -306310,8 +306514,8 @@ function lintChannelAddresses(ctx) {
|
|
|
306310
306514
|
}
|
|
306311
306515
|
}
|
|
306312
306516
|
function collectMqttServerVersions(ctx) {
|
|
306313
|
-
for (const raw of Object.values(
|
|
306314
|
-
const server =
|
|
306517
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
306518
|
+
const server = asRecord22(raw);
|
|
306315
306519
|
if (!server) continue;
|
|
306316
306520
|
const protocol = typeof server.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
306317
306521
|
if (SERVER_PROTOCOL_FAMILY[protocol] !== "mqtt") continue;
|
|
@@ -306332,7 +306536,7 @@ function lintMqttBindings(ctx) {
|
|
|
306332
306536
|
const { warnings } = ctx;
|
|
306333
306537
|
const only3x = ctx.mqttVersions.size > 0 && !ctx.mqttVersions.has(5) && !ctx.mqttVersions.has(0);
|
|
306334
306538
|
for (const site of ctx.sites) {
|
|
306335
|
-
const binding =
|
|
306539
|
+
const binding = asRecord22(site.bindings.mqtt);
|
|
306336
306540
|
if (!binding) continue;
|
|
306337
306541
|
if (only3x) {
|
|
306338
306542
|
const gated = MQTT5_ONLY_FIELDS[site.scope];
|
|
@@ -306348,7 +306552,7 @@ function lintMqttBindings(ctx) {
|
|
|
306348
306552
|
}
|
|
306349
306553
|
if (site.scope === "server") {
|
|
306350
306554
|
const clientId = binding.clientId;
|
|
306351
|
-
if (clientId !== void 0 && typeof clientId !== "string" && !
|
|
306555
|
+
if (clientId !== void 0 && typeof clientId !== "string" && !asRecord22(clientId)) {
|
|
306352
306556
|
warnings.push("ASYNCAPI_MQTT_CLIENT_ID_INVALID: " + site.label + " mqtt binding clientId must be a string or schema object (mqtt binding README)");
|
|
306353
306557
|
}
|
|
306354
306558
|
if (typeof clientId === "string") {
|
|
@@ -306361,12 +306565,12 @@ function lintMqttBindings(ctx) {
|
|
|
306361
306565
|
if (clientId === "" && only3x && binding.cleanSession !== true) {
|
|
306362
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)");
|
|
306363
306567
|
}
|
|
306364
|
-
} else if (
|
|
306568
|
+
} else if (asRecord22(clientId)) {
|
|
306365
306569
|
compileBindingSchema(ctx, site.label + " mqtt binding clientId", clientId);
|
|
306366
306570
|
}
|
|
306367
306571
|
const lastWill = binding.lastWill;
|
|
306368
306572
|
if (lastWill !== void 0) {
|
|
306369
|
-
const will =
|
|
306573
|
+
const will = asRecord22(lastWill);
|
|
306370
306574
|
if (!will) {
|
|
306371
306575
|
warnings.push("ASYNCAPI_MQTT_LAST_WILL_INVALID: " + site.label + " mqtt binding lastWill must be an object (mqtt binding README)");
|
|
306372
306576
|
} else {
|
|
@@ -306383,7 +306587,7 @@ function lintMqttBindings(ctx) {
|
|
|
306383
306587
|
}
|
|
306384
306588
|
for (const [field, max] of [["sessionExpiryInterval", 4294967295], ["maximumPacketSize", 268435455]]) {
|
|
306385
306589
|
const value = binding[field];
|
|
306386
|
-
if (
|
|
306590
|
+
if (asRecord22(value)) compileBindingSchema(ctx, site.label + " mqtt binding " + field, value);
|
|
306387
306591
|
else if (typeof value === "number" && value > max) {
|
|
306388
306592
|
warnings.push("ASYNCAPI_MQTT_VALUE_OUT_OF_RANGE: " + site.label + " mqtt binding " + field + " " + value + " exceeds the MQTT wire ceiling " + max);
|
|
306389
306593
|
}
|
|
@@ -306391,7 +306595,7 @@ function lintMqttBindings(ctx) {
|
|
|
306391
306595
|
}
|
|
306392
306596
|
if (site.scope === "operation") {
|
|
306393
306597
|
const expiry = binding.messageExpiryInterval;
|
|
306394
|
-
if (
|
|
306598
|
+
if (asRecord22(expiry)) compileBindingSchema(ctx, site.label + " mqtt binding messageExpiryInterval", expiry);
|
|
306395
306599
|
else if (typeof expiry === "number" && expiry > 4294967295) {
|
|
306396
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)");
|
|
306397
306601
|
}
|
|
@@ -306411,15 +306615,15 @@ function lintMqttBindings(ctx) {
|
|
|
306411
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)");
|
|
306412
306616
|
}
|
|
306413
306617
|
const correlationData = binding.correlationData;
|
|
306414
|
-
if (
|
|
306618
|
+
if (asRecord22(correlationData)) {
|
|
306415
306619
|
compileBindingSchema(ctx, site.label + " mqtt binding correlationData", correlationData);
|
|
306416
|
-
const maxLength =
|
|
306620
|
+
const maxLength = asRecord22(correlationData)?.maxLength;
|
|
306417
306621
|
if (typeof maxLength === "number" && maxLength > 65535) {
|
|
306418
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)");
|
|
306419
306623
|
}
|
|
306420
306624
|
}
|
|
306421
306625
|
const responseTopic = binding.responseTopic;
|
|
306422
|
-
if (
|
|
306626
|
+
if (asRecord22(responseTopic)) compileBindingSchema(ctx, site.label + " mqtt binding responseTopic", responseTopic);
|
|
306423
306627
|
const pfi = binding.payloadFormatIndicator;
|
|
306424
306628
|
if (pfi === 1) {
|
|
306425
306629
|
const message = siteMessageRecord(ctx, site);
|
|
@@ -306449,38 +306653,38 @@ function normalizeMediaType(value) {
|
|
|
306449
306653
|
function siteMessageRecord(ctx, site) {
|
|
306450
306654
|
const doc = ctx.doc;
|
|
306451
306655
|
const matches = (message) => {
|
|
306452
|
-
return message !== null &&
|
|
306656
|
+
return message !== null && asRecord22(message.bindings)?.mqtt === site.bindings.mqtt;
|
|
306453
306657
|
};
|
|
306454
|
-
for (const rawCh of Object.values(
|
|
306455
|
-
const channel =
|
|
306658
|
+
for (const rawCh of Object.values(asRecord22(doc.channels) ?? {})) {
|
|
306659
|
+
const channel = asRecord22(rawCh);
|
|
306456
306660
|
if (!channel) continue;
|
|
306457
306661
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
306458
|
-
const op =
|
|
306459
|
-
const message =
|
|
306662
|
+
const op = asRecord22(channel[opKeyword]);
|
|
306663
|
+
const message = asRecord22(op?.message);
|
|
306460
306664
|
if (matches(message)) return message;
|
|
306461
306665
|
for (const entry of asArray15(message?.oneOf)) {
|
|
306462
|
-
const alt =
|
|
306666
|
+
const alt = asRecord22(entry);
|
|
306463
306667
|
if (matches(alt)) return alt;
|
|
306464
306668
|
}
|
|
306465
306669
|
}
|
|
306466
|
-
for (const rawMsg of Object.values(
|
|
306467
|
-
const message =
|
|
306670
|
+
for (const rawMsg of Object.values(asRecord22(channel.messages) ?? {})) {
|
|
306671
|
+
const message = asRecord22(rawMsg);
|
|
306468
306672
|
if (matches(message)) return message;
|
|
306469
306673
|
}
|
|
306470
306674
|
}
|
|
306471
|
-
for (const rawMsg of Object.values(
|
|
306472
|
-
const message =
|
|
306675
|
+
for (const rawMsg of Object.values(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
306676
|
+
const message = asRecord22(rawMsg);
|
|
306473
306677
|
if (matches(message)) return message;
|
|
306474
306678
|
}
|
|
306475
306679
|
return null;
|
|
306476
306680
|
}
|
|
306477
306681
|
function lintHttpBindings(ctx) {
|
|
306478
306682
|
for (const site of ctx.sites) {
|
|
306479
|
-
const binding =
|
|
306683
|
+
const binding = asRecord22(site.bindings.http);
|
|
306480
306684
|
if (!binding) continue;
|
|
306481
306685
|
if (site.scope === "operation" && binding.query !== void 0) {
|
|
306482
|
-
const schema =
|
|
306483
|
-
const properties =
|
|
306686
|
+
const schema = asRecord22(binding.query);
|
|
306687
|
+
const properties = asRecord22(schema?.properties);
|
|
306484
306688
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
306485
306689
|
ctx.warnings.push(
|
|
306486
306690
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding query must be an object schema with properties (http binding README)"
|
|
@@ -306495,8 +306699,8 @@ function lintHttpBindings(ctx) {
|
|
|
306495
306699
|
}
|
|
306496
306700
|
}
|
|
306497
306701
|
if (site.scope === "message" && binding.headers !== void 0) {
|
|
306498
|
-
const schema =
|
|
306499
|
-
const properties =
|
|
306702
|
+
const schema = asRecord22(binding.headers);
|
|
306703
|
+
const properties = asRecord22(schema?.properties);
|
|
306500
306704
|
if (!schema || !properties || Object.keys(properties).length === 0) {
|
|
306501
306705
|
ctx.warnings.push(
|
|
306502
306706
|
"ASYNCAPI_HTTP_BINDING_SCHEMA_NO_PROPERTIES: " + site.label + " http binding headers must be an object schema with properties (http binding README)"
|
|
@@ -306532,19 +306736,19 @@ var HTTP_PROTOCOL_HEADER_DENYLIST = /* @__PURE__ */ new Set([
|
|
|
306532
306736
|
function collectMessages2(ctx) {
|
|
306533
306737
|
const out = [];
|
|
306534
306738
|
const doc = ctx.doc;
|
|
306535
|
-
for (const [chName, rawCh] of Object.entries(
|
|
306536
|
-
const channel =
|
|
306739
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
306740
|
+
const channel = asRecord22(rawCh);
|
|
306537
306741
|
if (!channel) continue;
|
|
306538
306742
|
const siblingList = [];
|
|
306539
306743
|
const push = (label, raw) => {
|
|
306540
|
-
const message =
|
|
306744
|
+
const message = asRecord22(raw);
|
|
306541
306745
|
if (!message) return;
|
|
306542
306746
|
siblingList.push(message);
|
|
306543
306747
|
out.push({ label, message, channelMessages: siblingList });
|
|
306544
306748
|
};
|
|
306545
306749
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
306546
|
-
const op =
|
|
306547
|
-
const message =
|
|
306750
|
+
const op = asRecord22(channel[opKeyword]);
|
|
306751
|
+
const message = asRecord22(op?.message);
|
|
306548
306752
|
if (!message) continue;
|
|
306549
306753
|
const alternatives = asArray15(message.oneOf);
|
|
306550
306754
|
if (alternatives.length > 0) {
|
|
@@ -306553,12 +306757,12 @@ function collectMessages2(ctx) {
|
|
|
306553
306757
|
push("channel " + chName + " " + opKeyword + " message", message);
|
|
306554
306758
|
}
|
|
306555
306759
|
}
|
|
306556
|
-
for (const [msgName, rawMsg] of Object.entries(
|
|
306760
|
+
for (const [msgName, rawMsg] of Object.entries(asRecord22(channel.messages) ?? {})) {
|
|
306557
306761
|
push("channel " + chName + " message " + msgName, rawMsg);
|
|
306558
306762
|
}
|
|
306559
306763
|
}
|
|
306560
|
-
for (const [name, raw] of Object.entries(
|
|
306561
|
-
const message =
|
|
306764
|
+
for (const [name, raw] of Object.entries(asRecord22(asRecord22(doc.components)?.messages) ?? {})) {
|
|
306765
|
+
const message = asRecord22(raw);
|
|
306562
306766
|
if (message) out.push({ label: "components.messages " + name, message, channelMessages: null });
|
|
306563
306767
|
}
|
|
306564
306768
|
return out;
|
|
@@ -306567,7 +306771,7 @@ function effectiveMessageId(message) {
|
|
|
306567
306771
|
if (typeof message.messageId === "string") return message.messageId;
|
|
306568
306772
|
let fromTraits;
|
|
306569
306773
|
for (const entry of asArray15(message.traits)) {
|
|
306570
|
-
const trait =
|
|
306774
|
+
const trait = asRecord22(entry);
|
|
306571
306775
|
if (trait && typeof trait.messageId === "string") fromTraits = trait.messageId;
|
|
306572
306776
|
}
|
|
306573
306777
|
return fromTraits;
|
|
@@ -306581,7 +306785,7 @@ function lintMessages(ctx) {
|
|
|
306581
306785
|
const validatorFor = (message) => {
|
|
306582
306786
|
if (validatorCache.has(message)) return validatorCache.get(message) ?? null;
|
|
306583
306787
|
let validate4 = null;
|
|
306584
|
-
const payload =
|
|
306788
|
+
const payload = asRecord22(message.payload);
|
|
306585
306789
|
if (payload) {
|
|
306586
306790
|
const packed = packSchema(ctx.doc, payload, "3.0", "response");
|
|
306587
306791
|
if (!packed.unsupported) {
|
|
@@ -306601,10 +306805,10 @@ function lintMessages(ctx) {
|
|
|
306601
306805
|
}
|
|
306602
306806
|
if (owner === void 0) idOwners.set(id, label);
|
|
306603
306807
|
}
|
|
306604
|
-
const headers =
|
|
306808
|
+
const headers = asRecord22(message.headers);
|
|
306605
306809
|
if (headers) {
|
|
306606
306810
|
compileBindingSchema(ctx, label + " headers", headers);
|
|
306607
|
-
const properties =
|
|
306811
|
+
const properties = asRecord22(headers.properties) ?? {};
|
|
306608
306812
|
for (const name of Object.keys(properties)) {
|
|
306609
306813
|
if (!HTTP_TOKEN_RE.test(name)) {
|
|
306610
306814
|
warnings.push("ASYNCAPI_BINDING_HEADER_NAME_INVALID: " + label + " headers property " + JSON.stringify(name) + " is not a valid RFC 9110 token");
|
|
@@ -306626,7 +306830,7 @@ function lintMessages(ctx) {
|
|
|
306626
306830
|
return compileSchemaValidator(packed.schema);
|
|
306627
306831
|
})() : null;
|
|
306628
306832
|
asArray15(message.examples).forEach((entry, i) => {
|
|
306629
|
-
const example =
|
|
306833
|
+
const example = asRecord22(entry);
|
|
306630
306834
|
if (!example) return;
|
|
306631
306835
|
if (example.payload === void 0 && example.headers !== void 0) {
|
|
306632
306836
|
if (headerValidate) {
|
|
@@ -306653,7 +306857,7 @@ function lintMessages(ctx) {
|
|
|
306653
306857
|
const traits = asArray15(message.traits);
|
|
306654
306858
|
const traitKeyValues = /* @__PURE__ */ new Map();
|
|
306655
306859
|
traits.forEach((entry, i) => {
|
|
306656
|
-
const trait =
|
|
306860
|
+
const trait = asRecord22(entry);
|
|
306657
306861
|
if (!trait) return;
|
|
306658
306862
|
if (trait.traits !== void 0) {
|
|
306659
306863
|
warnings.push("ASYNCAPI_TRAIT_FORBIDDEN_FIELD: " + label + " trait #" + i + ' declares "traits"; a Message Trait Object cannot itself carry traits (AsyncAPI Message Trait Object)');
|
|
@@ -306670,14 +306874,14 @@ function lintMessages(ctx) {
|
|
|
306670
306874
|
}
|
|
306671
306875
|
});
|
|
306672
306876
|
}
|
|
306673
|
-
for (const [chName, rawCh] of Object.entries(
|
|
306674
|
-
const channel =
|
|
306877
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(ctx.doc.channels) ?? {})) {
|
|
306878
|
+
const channel = asRecord22(rawCh);
|
|
306675
306879
|
if (!channel) continue;
|
|
306676
306880
|
for (const opKeyword of ["publish", "subscribe"]) {
|
|
306677
|
-
const op =
|
|
306881
|
+
const op = asRecord22(channel[opKeyword]);
|
|
306678
306882
|
if (!op) continue;
|
|
306679
306883
|
asArray15(op.traits).forEach((entry, i) => {
|
|
306680
|
-
const trait =
|
|
306884
|
+
const trait = asRecord22(entry);
|
|
306681
306885
|
if (!trait) return;
|
|
306682
306886
|
for (const forbidden of ["message", "traits"]) {
|
|
306683
306887
|
if (trait[forbidden] !== void 0) {
|
|
@@ -306687,13 +306891,13 @@ function lintMessages(ctx) {
|
|
|
306687
306891
|
});
|
|
306688
306892
|
}
|
|
306689
306893
|
}
|
|
306690
|
-
const channelsRecord =
|
|
306691
|
-
const channelValues = Object.values(channelsRecord).map(
|
|
306692
|
-
for (const [opName, rawOp] of Object.entries(
|
|
306693
|
-
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);
|
|
306694
306898
|
if (!op) continue;
|
|
306695
306899
|
asArray15(op.traits).forEach((entry, i) => {
|
|
306696
|
-
const trait =
|
|
306900
|
+
const trait = asRecord22(entry);
|
|
306697
306901
|
if (!trait) return;
|
|
306698
306902
|
for (const forbidden of ["action", "channel", "traits"]) {
|
|
306699
306903
|
if (trait[forbidden] !== void 0) {
|
|
@@ -306701,13 +306905,13 @@ function lintMessages(ctx) {
|
|
|
306701
306905
|
}
|
|
306702
306906
|
}
|
|
306703
306907
|
});
|
|
306704
|
-
const opChannel =
|
|
306908
|
+
const opChannel = asRecord22(op.channel);
|
|
306705
306909
|
if (opChannel && channelValues.length > 0 && !channelValues.includes(opChannel)) {
|
|
306706
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)");
|
|
306707
306911
|
}
|
|
306708
306912
|
if (opChannel) {
|
|
306709
|
-
const channelMessages = Object.values(
|
|
306710
|
-
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);
|
|
306711
306915
|
for (const opMessage of opMessages) {
|
|
306712
306916
|
const inChannel = channelMessages.some((cm) => cm === opMessage || JSON.stringify(cm) === JSON.stringify(opMessage));
|
|
306713
306917
|
if (!inChannel) {
|
|
@@ -306715,16 +306919,16 @@ function lintMessages(ctx) {
|
|
|
306715
306919
|
}
|
|
306716
306920
|
}
|
|
306717
306921
|
}
|
|
306718
|
-
const reply =
|
|
306922
|
+
const reply = asRecord22(op.reply);
|
|
306719
306923
|
if (reply) {
|
|
306720
|
-
const replyChannel =
|
|
306721
|
-
const replyAddress =
|
|
306924
|
+
const replyChannel = asRecord22(reply.channel);
|
|
306925
|
+
const replyAddress = asRecord22(reply.address);
|
|
306722
306926
|
if (replyAddress && replyChannel && typeof replyChannel.address === "string" && replyChannel.address.length > 0) {
|
|
306723
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)");
|
|
306724
306928
|
}
|
|
306725
306929
|
if (replyChannel) {
|
|
306726
|
-
const replyChannelMessages = Object.values(
|
|
306727
|
-
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);
|
|
306728
306932
|
for (const replyMessage of replyMessages) {
|
|
306729
306933
|
const inChannel = replyChannelMessages.some((cm) => cm === replyMessage || JSON.stringify(cm) === JSON.stringify(replyMessage));
|
|
306730
306934
|
if (!inChannel) {
|
|
@@ -306736,8 +306940,8 @@ function lintMessages(ctx) {
|
|
|
306736
306940
|
}
|
|
306737
306941
|
}
|
|
306738
306942
|
function hasWsSurface(ctx) {
|
|
306739
|
-
for (const raw of Object.values(
|
|
306740
|
-
const server =
|
|
306943
|
+
for (const raw of Object.values(asRecord22(ctx.doc.servers) ?? {})) {
|
|
306944
|
+
const server = asRecord22(raw);
|
|
306741
306945
|
const protocol = typeof server?.protocol === "string" ? server.protocol.toLowerCase() : "";
|
|
306742
306946
|
if (SERVER_PROTOCOL_FAMILY[protocol] === "ws") return true;
|
|
306743
306947
|
}
|
|
@@ -306748,11 +306952,11 @@ var API_KEY_LOCATIONS_V2 = /* @__PURE__ */ new Set(["user", "password"]);
|
|
|
306748
306952
|
var SYNTHESIZABLE_SCHEME_TYPES = /* @__PURE__ */ new Set(["http", "httpApiKey", "apiKey", "userPassword"]);
|
|
306749
306953
|
function lintSecuritySchemes2(ctx) {
|
|
306750
306954
|
const { warnings } = ctx;
|
|
306751
|
-
const schemes =
|
|
306955
|
+
const schemes = asRecord22(asRecord22(ctx.doc.components)?.securitySchemes) ?? {};
|
|
306752
306956
|
const oauthLikeNames = /* @__PURE__ */ new Set();
|
|
306753
306957
|
const unsatisfiable = [];
|
|
306754
306958
|
for (const [name, raw] of Object.entries(schemes)) {
|
|
306755
|
-
const scheme =
|
|
306959
|
+
const scheme = asRecord22(raw);
|
|
306756
306960
|
if (!scheme) continue;
|
|
306757
306961
|
const type = typeof scheme.type === "string" ? scheme.type : "";
|
|
306758
306962
|
if (type === "oauth2" || type === "openIdConnect") oauthLikeNames.add(name);
|
|
@@ -306772,9 +306976,9 @@ function lintSecuritySchemes2(ctx) {
|
|
|
306772
306976
|
}
|
|
306773
306977
|
}
|
|
306774
306978
|
if (type === "oauth2") {
|
|
306775
|
-
const flows =
|
|
306979
|
+
const flows = asRecord22(scheme.flows) ?? {};
|
|
306776
306980
|
for (const [flowName, rawFlow] of Object.entries(flows)) {
|
|
306777
|
-
const flow =
|
|
306981
|
+
const flow = asRecord22(rawFlow);
|
|
306778
306982
|
if (!flow) continue;
|
|
306779
306983
|
for (const field of ["authorizationUrl", "tokenUrl", "refreshUrl"]) {
|
|
306780
306984
|
const url = flow[field];
|
|
@@ -306791,11 +306995,11 @@ function lintSecuritySchemes2(ctx) {
|
|
|
306791
306995
|
if (unsatisfiable.length > 0) {
|
|
306792
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");
|
|
306793
306997
|
}
|
|
306794
|
-
for (const [serverName, raw] of Object.entries(
|
|
306795
|
-
const server =
|
|
306998
|
+
for (const [serverName, raw] of Object.entries(asRecord22(ctx.doc.servers) ?? {})) {
|
|
306999
|
+
const server = asRecord22(raw);
|
|
306796
307000
|
if (!server) continue;
|
|
306797
307001
|
asArray15(server.security).forEach((entry, i) => {
|
|
306798
|
-
const requirement =
|
|
307002
|
+
const requirement = asRecord22(entry);
|
|
306799
307003
|
if (!requirement) return;
|
|
306800
307004
|
for (const [schemeName, value] of Object.entries(requirement)) {
|
|
306801
307005
|
if (!Array.isArray(value)) {
|
|
@@ -306805,7 +307009,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
306805
307009
|
if (value.some((scope) => typeof scope !== "string")) {
|
|
306806
307010
|
warnings.push("ASYNCAPI_SECURITY_REQUIREMENT_INVALID: server " + serverName + " security requirement #" + i + " scopes for " + schemeName + " must be strings (AsyncAPI Security Requirement Object)");
|
|
306807
307011
|
}
|
|
306808
|
-
if (value.length > 0 && !oauthLikeNames.has(schemeName) &&
|
|
307012
|
+
if (value.length > 0 && !oauthLikeNames.has(schemeName) && asRecord22(schemes[schemeName])) {
|
|
306809
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)");
|
|
306810
307014
|
}
|
|
306811
307015
|
}
|
|
@@ -306815,7 +307019,7 @@ function lintSecuritySchemes2(ctx) {
|
|
|
306815
307019
|
function lintSocketIo(ctx) {
|
|
306816
307020
|
if (!ctx.socketIo) return;
|
|
306817
307021
|
const { warnings, doc } = ctx;
|
|
306818
|
-
const xSocketIo =
|
|
307022
|
+
const xSocketIo = asRecord22(doc["x-socketio"]) ?? {};
|
|
306819
307023
|
const declaredVersion = xSocketIo.version ?? xSocketIo.eio ?? xSocketIo.EIO;
|
|
306820
307024
|
if (declaredVersion !== void 0 && String(declaredVersion) !== "4") {
|
|
306821
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");
|
|
@@ -306824,8 +307028,8 @@ function lintSocketIo(ctx) {
|
|
|
306824
307028
|
if (typeof path8 === "string" && path8 !== "/socket.io/" && path8 !== "/socket.io") {
|
|
306825
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");
|
|
306826
307030
|
}
|
|
306827
|
-
for (const [chName, rawCh] of Object.entries(
|
|
306828
|
-
const channel =
|
|
307031
|
+
for (const [chName, rawCh] of Object.entries(asRecord22(doc.channels) ?? {})) {
|
|
307032
|
+
const channel = asRecord22(rawCh);
|
|
306829
307033
|
if (!channel) continue;
|
|
306830
307034
|
const address = ctx.isV3 ? typeof channel.address === "string" ? channel.address : "" : chName;
|
|
306831
307035
|
if (address && address !== "/" && !address.startsWith("/")) {
|
|
@@ -306833,10 +307037,10 @@ function lintSocketIo(ctx) {
|
|
|
306833
307037
|
} else if (address && address !== "/") {
|
|
306834
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");
|
|
306835
307039
|
}
|
|
306836
|
-
const wsBinding =
|
|
306837
|
-
const queryProps =
|
|
307040
|
+
const wsBinding = asRecord22(asRecord22(channel.bindings)?.ws);
|
|
307041
|
+
const queryProps = asRecord22(asRecord22(wsBinding?.query)?.properties) ?? {};
|
|
306838
307042
|
for (const [propName2, rawProp] of Object.entries(queryProps)) {
|
|
306839
|
-
const prop =
|
|
307043
|
+
const prop = asRecord22(rawProp);
|
|
306840
307044
|
if (!prop) continue;
|
|
306841
307045
|
const declared = schemaDeclaredValues(prop).map(String);
|
|
306842
307046
|
if (propName2 === "EIO" && declared.some((v) => v !== "4")) {
|
|
@@ -306856,7 +307060,7 @@ function lintSocketIo(ctx) {
|
|
|
306856
307060
|
if (message.contentKind === "binary") {
|
|
306857
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");
|
|
306858
307062
|
}
|
|
306859
|
-
const ack =
|
|
307063
|
+
const ack = asRecord22(message.ackSchema);
|
|
306860
307064
|
if (ack) {
|
|
306861
307065
|
const declaredType = Array.isArray(ack.type) ? ack.type.map(String) : ack.type !== void 0 ? [String(ack.type)] : [];
|
|
306862
307066
|
if (declaredType.length > 0 && !declaredType.includes("array")) {
|
|
@@ -306867,7 +307071,7 @@ function lintSocketIo(ctx) {
|
|
|
306867
307071
|
}
|
|
306868
307072
|
}
|
|
306869
307073
|
function lintAsyncApiBindingSurfaces(index) {
|
|
306870
|
-
const doc =
|
|
307074
|
+
const doc = asRecord22(index.documentJson);
|
|
306871
307075
|
if (!doc) return [];
|
|
306872
307076
|
const ctx = {
|
|
306873
307077
|
index,
|
|
@@ -306889,7 +307093,7 @@ function lintAsyncApiBindingSurfaces(index) {
|
|
|
306889
307093
|
lintSocketIo(ctx);
|
|
306890
307094
|
for (const site of ctx.sites) {
|
|
306891
307095
|
if (site.scope !== "channel") continue;
|
|
306892
|
-
const wsBinding =
|
|
307096
|
+
const wsBinding = asRecord22(site.bindings.ws);
|
|
306893
307097
|
if (wsBinding) lintWsChannelBinding(ctx, site.label, wsBinding);
|
|
306894
307098
|
}
|
|
306895
307099
|
return ctx.warnings;
|
|
@@ -306901,7 +307105,7 @@ var ASYNCAPI_INSTRUMENT_LIMITS = {
|
|
|
306901
307105
|
};
|
|
306902
307106
|
var MESSAGE_NODE_TYPES = /* @__PURE__ */ new Set(["ws-raw-message", "ws-socketio-message", "mqtt-message"]);
|
|
306903
307107
|
var BASE64_RE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
306904
|
-
function
|
|
307108
|
+
function asRecord23(value) {
|
|
306905
307109
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
306906
307110
|
return value;
|
|
306907
307111
|
}
|
|
@@ -306909,7 +307113,7 @@ function asArray16(value) {
|
|
|
306909
307113
|
return Array.isArray(value) ? value : [];
|
|
306910
307114
|
}
|
|
306911
307115
|
function schemaAllowsStringInstance(schema) {
|
|
306912
|
-
const record =
|
|
307116
|
+
const record = asRecord23(schema);
|
|
306913
307117
|
if (!record) return false;
|
|
306914
307118
|
const declared = record.type;
|
|
306915
307119
|
const types2 = Array.isArray(declared) ? declared.map(String) : declared !== void 0 ? [String(declared)] : [];
|
|
@@ -307002,18 +307206,18 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
307002
307206
|
if (binding.messageExpiryInterval !== void 0 && !isNonNegativeInteger(binding.messageExpiryInterval)) bad("messageExpiryInterval", "must be a non-negative integer (seconds)");
|
|
307003
307207
|
if (binding.cleanSession !== void 0 && typeof binding.cleanSession !== "boolean") bad("cleanSession", "must be a boolean");
|
|
307004
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)");
|
|
307005
|
-
if (binding.sessionExpiryInterval !== void 0 && !isIntegerInRange(binding.sessionExpiryInterval, 0, 4294967295) &&
|
|
307006
|
-
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");
|
|
307007
307211
|
if (binding.payloadFormatIndicator !== void 0 && binding.payloadFormatIndicator !== 0 && binding.payloadFormatIndicator !== 1) bad("payloadFormatIndicator", "must be 0 (unspecified bytes) or 1 (UTF-8)");
|
|
307008
307212
|
if (binding.contentType !== void 0 && typeof binding.contentType !== "string") bad("contentType", "must be a string");
|
|
307009
307213
|
if (typeof binding.responseTopic === "string") {
|
|
307010
307214
|
const violation = mqttTopicViolation(binding.responseTopic, false);
|
|
307011
307215
|
if (violation) warnings.push(`ASYNCAPI_MQTT_TOPIC_INVALID: channel ${channelId} ${scope} binding responseTopic "${binding.responseTopic}" ${violation}`);
|
|
307012
|
-
} else if (binding.responseTopic !== void 0 &&
|
|
307216
|
+
} else if (binding.responseTopic !== void 0 && asRecord23(binding.responseTopic) === null) {
|
|
307013
307217
|
bad("responseTopic", "must be a string or a schema object");
|
|
307014
307218
|
}
|
|
307015
307219
|
if (binding.correlationData !== void 0) {
|
|
307016
|
-
const correlationData =
|
|
307220
|
+
const correlationData = asRecord23(binding.correlationData);
|
|
307017
307221
|
if (!correlationData) {
|
|
307018
307222
|
bad("correlationData", "must be a Schema Object describing the binary correlation data");
|
|
307019
307223
|
} else if (correlationData.type !== "string" || correlationData.format !== "byte" && correlationData.format !== "binary") {
|
|
@@ -307022,7 +307226,7 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
307022
307226
|
);
|
|
307023
307227
|
}
|
|
307024
307228
|
}
|
|
307025
|
-
const lastWill =
|
|
307229
|
+
const lastWill = asRecord23(binding.lastWill);
|
|
307026
307230
|
if (lastWill) {
|
|
307027
307231
|
if (typeof lastWill.topic === "string") {
|
|
307028
307232
|
const violation = mqttTopicViolation(lastWill.topic, false);
|
|
@@ -307037,14 +307241,14 @@ function checkMqttBindingValues(binding, scope, channelId, warnings) {
|
|
|
307037
307241
|
}
|
|
307038
307242
|
}
|
|
307039
307243
|
function channelHasPublishDirection(documentJson, channelId) {
|
|
307040
|
-
const channel =
|
|
307244
|
+
const channel = asRecord23(asRecord23(documentJson.channels)?.[channelId]);
|
|
307041
307245
|
if (channel?.publish !== void 0) return true;
|
|
307042
307246
|
const unescapePointer = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
307043
|
-
const operations =
|
|
307247
|
+
const operations = asRecord23(documentJson.operations) ?? {};
|
|
307044
307248
|
for (const operationRaw of Object.values(operations)) {
|
|
307045
|
-
const operation =
|
|
307249
|
+
const operation = asRecord23(operationRaw);
|
|
307046
307250
|
if (!operation || operation.action !== "send") continue;
|
|
307047
|
-
const opChannel =
|
|
307251
|
+
const opChannel = asRecord23(operation.channel);
|
|
307048
307252
|
if (!opChannel) continue;
|
|
307049
307253
|
if (channel && opChannel === channel) return true;
|
|
307050
307254
|
const uid = opChannel["x-parser-unique-object-id"];
|
|
@@ -307097,7 +307301,7 @@ function collectMessageNodeIds(node, ids, path8) {
|
|
|
307097
307301
|
}
|
|
307098
307302
|
const children4 = node.children !== void 0 ? asArray16(node.children) : asArray16(node.item);
|
|
307099
307303
|
children4.forEach((child3, i) => {
|
|
307100
|
-
const record =
|
|
307304
|
+
const record = asRecord23(child3);
|
|
307101
307305
|
if (record) collectMessageNodeIds(record, ids, `${path8}/${i}`);
|
|
307102
307306
|
});
|
|
307103
307307
|
}
|
|
@@ -307140,7 +307344,7 @@ function validateWsBinding(channel, warnings) {
|
|
|
307140
307344
|
for (const key of ["query", "headers"]) {
|
|
307141
307345
|
const schema = binding[key];
|
|
307142
307346
|
if (schema === void 0) continue;
|
|
307143
|
-
const record =
|
|
307347
|
+
const record = asRecord23(schema);
|
|
307144
307348
|
if (!record || record.type !== void 0 && record.type !== "object") {
|
|
307145
307349
|
warnings.push(`ASYNCAPI_WS_BINDING_INVALID: channel ${channel.id} ws binding ${key} must be a Schema Object of type object`);
|
|
307146
307350
|
}
|
|
@@ -307176,7 +307380,7 @@ function instrumentAsyncApiCollection(collection, index) {
|
|
|
307176
307380
|
const expected = index.channels.reduce((sum, channel) => sum + channel.messages.length, 0);
|
|
307177
307381
|
const ids = [];
|
|
307178
307382
|
asArray16(collection.item).forEach((entry, i) => {
|
|
307179
|
-
const record =
|
|
307383
|
+
const record = asRecord23(entry);
|
|
307180
307384
|
if (record) collectMessageNodeIds(record, ids, `item/${i}`);
|
|
307181
307385
|
});
|
|
307182
307386
|
const unique = new Set(ids).size;
|
|
@@ -307952,7 +308156,7 @@ var validateRegistryServerSchema = (() => {
|
|
|
307952
308156
|
}
|
|
307953
308157
|
}
|
|
307954
308158
|
})();
|
|
307955
|
-
function
|
|
308159
|
+
function asRecord24(value) {
|
|
307956
308160
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
307957
308161
|
return value;
|
|
307958
308162
|
}
|
|
@@ -307967,7 +308171,7 @@ function registrySchemaKey(key) {
|
|
|
307967
308171
|
}
|
|
307968
308172
|
function normalizeRegistrySchemaValue(value) {
|
|
307969
308173
|
if (Array.isArray(value)) return value.map((entry) => normalizeRegistrySchemaValue(entry));
|
|
307970
|
-
const record =
|
|
308174
|
+
const record = asRecord24(value);
|
|
307971
308175
|
if (!record) return value;
|
|
307972
308176
|
const out = {};
|
|
307973
308177
|
for (const [key, entry] of Object.entries(record)) {
|
|
@@ -307983,7 +308187,7 @@ function normalizeRegistryPackageForSchema(pkg) {
|
|
|
307983
308187
|
}
|
|
307984
308188
|
function normalizeRegistryManifestForSchema(record) {
|
|
307985
308189
|
const out = normalizeRegistrySchemaValue(record);
|
|
307986
|
-
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) ?? {}));
|
|
307987
308191
|
return out;
|
|
307988
308192
|
}
|
|
307989
308193
|
function isRegistrySchemaDocument(record) {
|
|
@@ -308045,7 +308249,7 @@ function validateUriTemplate(value) {
|
|
|
308045
308249
|
return { variables: [...variables] };
|
|
308046
308250
|
}
|
|
308047
308251
|
function sampleFromSchema2(schema, depth) {
|
|
308048
|
-
const record =
|
|
308252
|
+
const record = asRecord24(schema);
|
|
308049
308253
|
if (!record) return record === null ? null : {};
|
|
308050
308254
|
if (record.example !== void 0) return record.example;
|
|
308051
308255
|
if (record.default !== void 0) return record.default;
|
|
@@ -308061,7 +308265,7 @@ function sampleFromSchema2(schema, depth) {
|
|
|
308061
308265
|
switch (type) {
|
|
308062
308266
|
case "object":
|
|
308063
308267
|
case void 0: {
|
|
308064
|
-
const properties =
|
|
308268
|
+
const properties = asRecord24(record.properties);
|
|
308065
308269
|
if (!properties) return {};
|
|
308066
308270
|
const required = new Set(asArray17(record.required));
|
|
308067
308271
|
const out = {};
|
|
@@ -308101,10 +308305,10 @@ function registryInputValue(name, input) {
|
|
|
308101
308305
|
}
|
|
308102
308306
|
function registryVariableValues(variables) {
|
|
308103
308307
|
const out = {};
|
|
308104
|
-
const record =
|
|
308308
|
+
const record = asRecord24(variables);
|
|
308105
308309
|
if (!record) return out;
|
|
308106
308310
|
for (const [name, input] of Object.entries(record)) {
|
|
308107
|
-
const value =
|
|
308311
|
+
const value = asRecord24(input);
|
|
308108
308312
|
if (value) out[name] = registryInputValue(name, value);
|
|
308109
308313
|
}
|
|
308110
308314
|
return out;
|
|
@@ -308117,7 +308321,7 @@ function resolveRegistryVariables(value, variables, context, warnings) {
|
|
|
308117
308321
|
});
|
|
308118
308322
|
}
|
|
308119
308323
|
function registryHeaderKeyValues(headers, variables = {}, warnings = [], context = "remote header") {
|
|
308120
|
-
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) => {
|
|
308121
308325
|
const name = String(entry.name);
|
|
308122
308326
|
const value = registryInputValue(name, entry);
|
|
308123
308327
|
const resolvedValue = resolveRegistryVariables(value, variables, `${context} ${name}`, warnings);
|
|
@@ -308125,7 +308329,7 @@ function registryHeaderKeyValues(headers, variables = {}, warnings = [], context
|
|
|
308125
308329
|
});
|
|
308126
308330
|
}
|
|
308127
308331
|
function registryEnvKeyValues(variables) {
|
|
308128
|
-
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) => {
|
|
308129
308333
|
const name = String(entry.name);
|
|
308130
308334
|
const secret = pickValue(entry, "isSecret", "is_secret") === true;
|
|
308131
308335
|
const value = typeof entry.value === "string" && entry.value && !secret ? entry.value : `{{${name}}}`;
|
|
@@ -308135,7 +308339,7 @@ function registryEnvKeyValues(variables) {
|
|
|
308135
308339
|
function stringArguments(values) {
|
|
308136
308340
|
return asArray17(values).map((entry) => {
|
|
308137
308341
|
if (typeof entry === "string") return entry;
|
|
308138
|
-
const record =
|
|
308342
|
+
const record = asRecord24(entry);
|
|
308139
308343
|
if (!record) return "";
|
|
308140
308344
|
if (typeof record.name === "string" && record.name) {
|
|
308141
308345
|
return typeof record.value === "string" && record.value ? `${record.name}=${record.value}` : String(record.name);
|
|
@@ -308172,11 +308376,11 @@ function hasModernPackageShape(pkg) {
|
|
|
308172
308376
|
return ["registryType", "runtimeHint", "runtimeArguments", "packageArguments", "environmentVariables"].some((key) => hasOwn(pkg, key));
|
|
308173
308377
|
}
|
|
308174
308378
|
function packageDescriptor(pkg, id, warnings) {
|
|
308175
|
-
if (pkg.transport !== void 0 &&
|
|
308379
|
+
if (pkg.transport !== void 0 && asRecord24(pkg.transport) === null) {
|
|
308176
308380
|
warnings.push(`MCP_PACKAGE_TRANSPORT_INVALID: server ${id} package transport must be an object when present; the package is skipped`);
|
|
308177
308381
|
return null;
|
|
308178
308382
|
}
|
|
308179
|
-
const transport =
|
|
308383
|
+
const transport = asRecord24(pkg.transport);
|
|
308180
308384
|
const transportType = typeof transport?.type === "string" ? String(transport.type).toLowerCase() : "";
|
|
308181
308385
|
if (transport) {
|
|
308182
308386
|
if (!transportType) {
|
|
@@ -308222,11 +308426,11 @@ function clientConfigDescriptor(id, entry) {
|
|
|
308222
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`
|
|
308223
308427
|
);
|
|
308224
308428
|
}
|
|
308225
|
-
const headers = Object.entries(
|
|
308429
|
+
const headers = Object.entries(asRecord24(entry.headers) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
308226
308430
|
return { id, transport: "sse", url, headers, env: [], warnings };
|
|
308227
308431
|
}
|
|
308228
308432
|
const command = [typeof entry.command === "string" ? entry.command : "", ...stringArguments(entry.args)].filter(Boolean).join(" ");
|
|
308229
|
-
const env = Object.entries(
|
|
308433
|
+
const env = Object.entries(asRecord24(entry.env) ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => ({ key, value: String(value) }));
|
|
308230
308434
|
return { id, transport: "stdio", headers: [], command, env, warnings: [] };
|
|
308231
308435
|
}
|
|
308232
308436
|
function toolDescriptor(tool, warnings) {
|
|
@@ -308235,7 +308439,7 @@ function toolDescriptor(tool, warnings) {
|
|
|
308235
308439
|
warnings.push("MCP_TOOL_NAME_MISSING: a tools[] entry has no name; it is skipped and generates no tools/call template");
|
|
308236
308440
|
return null;
|
|
308237
308441
|
}
|
|
308238
|
-
const inputSchema =
|
|
308442
|
+
const inputSchema = asRecord24(tool.inputSchema) ?? void 0;
|
|
308239
308443
|
const toolWarnings = [];
|
|
308240
308444
|
if (!inputSchema) {
|
|
308241
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`);
|
|
@@ -308244,8 +308448,8 @@ function toolDescriptor(tool, warnings) {
|
|
|
308244
308448
|
name,
|
|
308245
308449
|
description: typeof tool.description === "string" ? tool.description : void 0,
|
|
308246
308450
|
inputSchema,
|
|
308247
|
-
outputSchema:
|
|
308248
|
-
annotations:
|
|
308451
|
+
outputSchema: asRecord24(tool.outputSchema) ?? void 0,
|
|
308452
|
+
annotations: asRecord24(tool.annotations) ?? void 0,
|
|
308249
308453
|
sampleArguments: inputSchema ? sampleFromSchema2(inputSchema, 0) : {},
|
|
308250
308454
|
warnings: toolWarnings
|
|
308251
308455
|
};
|
|
@@ -308274,7 +308478,7 @@ function resourceDescriptor(resource, warnings) {
|
|
|
308274
308478
|
if (resource.mimeType !== void 0 && typeof resource.mimeType !== "string") {
|
|
308275
308479
|
resourceWarnings.push(`MCP_RESOURCE_FIELD_INVALID: resource ${name} mimeType must be a string when present`);
|
|
308276
308480
|
}
|
|
308277
|
-
if (resource.annotations !== void 0 && !
|
|
308481
|
+
if (resource.annotations !== void 0 && !asRecord24(resource.annotations)) {
|
|
308278
308482
|
resourceWarnings.push(`MCP_RESOURCE_ANNOTATIONS_INVALID: resource ${name} annotations must be an object when present`);
|
|
308279
308483
|
}
|
|
308280
308484
|
return {
|
|
@@ -308283,8 +308487,8 @@ function resourceDescriptor(resource, warnings) {
|
|
|
308283
308487
|
description: asOptionalString(resource.description),
|
|
308284
308488
|
uri,
|
|
308285
308489
|
mimeType: asOptionalString(resource.mimeType),
|
|
308286
|
-
meta:
|
|
308287
|
-
annotations:
|
|
308490
|
+
meta: asRecord24(resource._meta) ?? void 0,
|
|
308491
|
+
annotations: asRecord24(resource.annotations) ?? void 0,
|
|
308288
308492
|
warnings: resourceWarnings
|
|
308289
308493
|
};
|
|
308290
308494
|
}
|
|
@@ -308313,7 +308517,7 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
308313
308517
|
if (template.mimeType !== void 0 && typeof template.mimeType !== "string") {
|
|
308314
308518
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_FIELD_INVALID: resource template ${name} mimeType must be a string when present`);
|
|
308315
308519
|
}
|
|
308316
|
-
if (template.annotations !== void 0 && !
|
|
308520
|
+
if (template.annotations !== void 0 && !asRecord24(template.annotations)) {
|
|
308317
308521
|
templateWarnings.push(`MCP_RESOURCE_TEMPLATE_ANNOTATIONS_INVALID: resource template ${name} annotations must be an object when present`);
|
|
308318
308522
|
}
|
|
308319
308523
|
return {
|
|
@@ -308322,14 +308526,14 @@ function resourceTemplateDescriptor(template, warnings) {
|
|
|
308322
308526
|
description: asOptionalString(template.description),
|
|
308323
308527
|
uriTemplate,
|
|
308324
308528
|
mimeType: asOptionalString(template.mimeType),
|
|
308325
|
-
meta:
|
|
308326
|
-
annotations:
|
|
308529
|
+
meta: asRecord24(template._meta) ?? void 0,
|
|
308530
|
+
annotations: asRecord24(template.annotations) ?? void 0,
|
|
308327
308531
|
variables: inspectedTemplate.variables,
|
|
308328
308532
|
warnings: templateWarnings
|
|
308329
308533
|
};
|
|
308330
308534
|
}
|
|
308331
308535
|
function promptArgumentDescriptor(promptName, argument, warnings, index) {
|
|
308332
|
-
const record =
|
|
308536
|
+
const record = asRecord24(argument);
|
|
308333
308537
|
if (!record) {
|
|
308334
308538
|
warnings.push(`MCP_PROMPT_ARGUMENT_INVALID: prompt ${promptName} argument[${index}] must be an object`);
|
|
308335
308539
|
return null;
|
|
@@ -308368,7 +308572,7 @@ function promptDescriptor(prompt, warnings) {
|
|
|
308368
308572
|
if (prompt.arguments !== void 0 && !Array.isArray(prompt.arguments)) {
|
|
308369
308573
|
promptWarnings.push(`MCP_PROMPT_ARGUMENTS_INVALID: prompt ${name} arguments must be an array when present`);
|
|
308370
308574
|
}
|
|
308371
|
-
if (prompt.annotations !== void 0 && !
|
|
308575
|
+
if (prompt.annotations !== void 0 && !asRecord24(prompt.annotations)) {
|
|
308372
308576
|
promptWarnings.push(`MCP_PROMPT_ANNOTATIONS_INVALID: prompt ${name} annotations must be an object when present`);
|
|
308373
308577
|
}
|
|
308374
308578
|
const seenArgumentNames = /* @__PURE__ */ new Set();
|
|
@@ -308387,8 +308591,8 @@ function promptDescriptor(prompt, warnings) {
|
|
|
308387
308591
|
name,
|
|
308388
308592
|
title: asOptionalString(prompt.title),
|
|
308389
308593
|
description: asOptionalString(prompt.description),
|
|
308390
|
-
meta:
|
|
308391
|
-
annotations:
|
|
308594
|
+
meta: asRecord24(prompt._meta) ?? void 0,
|
|
308595
|
+
annotations: asRecord24(prompt.annotations) ?? void 0,
|
|
308392
308596
|
arguments: argumentsList,
|
|
308393
308597
|
warnings: promptWarnings
|
|
308394
308598
|
};
|
|
@@ -308403,17 +308607,17 @@ function parseMcpServerSpec(content) {
|
|
|
308403
308607
|
} catch (error) {
|
|
308404
308608
|
throw new Error(`MCP_PARSE_FAILED: MCP server description is not valid JSON: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
308405
308609
|
}
|
|
308406
|
-
const documentJson =
|
|
308610
|
+
const documentJson = asRecord24(parsed);
|
|
308407
308611
|
if (!documentJson) {
|
|
308408
308612
|
throw new Error("MCP_PARSE_FAILED: MCP server description must be a JSON object");
|
|
308409
308613
|
}
|
|
308410
308614
|
const warnings = [];
|
|
308411
308615
|
const servers = [];
|
|
308412
308616
|
if (isRegistrySchemaDocument(documentJson)) warnings.push(...registrySchemaWarnings(documentJson));
|
|
308413
|
-
const mcpServers =
|
|
308617
|
+
const mcpServers = asRecord24(documentJson.mcpServers);
|
|
308414
308618
|
if (mcpServers) {
|
|
308415
308619
|
for (const [id, entry] of Object.entries(mcpServers)) {
|
|
308416
|
-
const record =
|
|
308620
|
+
const record = asRecord24(entry);
|
|
308417
308621
|
if (!record) {
|
|
308418
308622
|
warnings.push(`MCP_SERVER_ENTRY_INVALID: mcpServers.${id} is not an object; it is skipped`);
|
|
308419
308623
|
continue;
|
|
@@ -308422,8 +308626,8 @@ function parseMcpServerSpec(content) {
|
|
|
308422
308626
|
}
|
|
308423
308627
|
}
|
|
308424
308628
|
const registryName = typeof documentJson.name === "string" ? documentJson.name : "";
|
|
308425
|
-
const remotes = asArray17(documentJson.remotes).map((entry) =>
|
|
308426
|
-
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);
|
|
308427
308631
|
if (!mcpServers && (remotes.length > 0 || packages.length > 0)) {
|
|
308428
308632
|
const multi = remotes.length + packages.length > 1;
|
|
308429
308633
|
remotes.forEach((remote, i) => {
|
|
@@ -308438,7 +308642,7 @@ function parseMcpServerSpec(content) {
|
|
|
308438
308642
|
if (servers.length === 0) {
|
|
308439
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");
|
|
308440
308644
|
}
|
|
308441
|
-
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);
|
|
308442
308646
|
const seenToolNames = /* @__PURE__ */ new Set();
|
|
308443
308647
|
const tools = [];
|
|
308444
308648
|
for (const tool of toolsRaw) {
|
|
@@ -308450,7 +308654,7 @@ function parseMcpServerSpec(content) {
|
|
|
308450
308654
|
tools.push(tool);
|
|
308451
308655
|
}
|
|
308452
308656
|
tools.sort((a, b) => a.name.localeCompare(b.name));
|
|
308453
|
-
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);
|
|
308454
308658
|
const seenResourceNames = /* @__PURE__ */ new Set();
|
|
308455
308659
|
const resources = [];
|
|
308456
308660
|
for (const resource of resourcesRaw) {
|
|
@@ -308462,7 +308666,7 @@ function parseMcpServerSpec(content) {
|
|
|
308462
308666
|
resources.push(resource);
|
|
308463
308667
|
}
|
|
308464
308668
|
resources.sort((a, b) => a.name.localeCompare(b.name));
|
|
308465
|
-
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);
|
|
308466
308670
|
const seenTemplateNames = /* @__PURE__ */ new Set();
|
|
308467
308671
|
const resourceTemplates = [];
|
|
308468
308672
|
for (const template of resourceTemplatesRaw) {
|
|
@@ -308474,7 +308678,7 @@ function parseMcpServerSpec(content) {
|
|
|
308474
308678
|
resourceTemplates.push(template);
|
|
308475
308679
|
}
|
|
308476
308680
|
resourceTemplates.sort((a, b) => a.name.localeCompare(b.name));
|
|
308477
|
-
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);
|
|
308478
308682
|
const seenPromptNames = /* @__PURE__ */ new Set();
|
|
308479
308683
|
const prompts = [];
|
|
308480
308684
|
for (const prompt of promptsRaw) {
|
|
@@ -308486,10 +308690,10 @@ function parseMcpServerSpec(content) {
|
|
|
308486
308690
|
prompts.push(prompt);
|
|
308487
308691
|
}
|
|
308488
308692
|
prompts.sort((a, b) => a.name.localeCompare(b.name));
|
|
308489
|
-
const versionDetail =
|
|
308693
|
+
const versionDetail = asRecord24(documentJson.version_detail);
|
|
308490
308694
|
const version = typeof documentJson.version === "string" ? documentJson.version : typeof versionDetail?.version === "string" ? String(versionDetail.version) : void 0;
|
|
308491
308695
|
servers.sort((a, b) => a.id.localeCompare(b.id));
|
|
308492
|
-
const capabilities =
|
|
308696
|
+
const capabilities = asRecord24(documentJson.capabilities);
|
|
308493
308697
|
if (documentJson.capabilities !== void 0 && !capabilities) {
|
|
308494
308698
|
warnings.push(`MCP_CAPABILITIES_INVALID: top-level capabilities must be an object when present; got ${JSON.stringify(documentJson.capabilities)}`);
|
|
308495
308699
|
}
|
|
@@ -309226,7 +309430,7 @@ function oldSessionPingScript() {
|
|
|
309226
309430
|
|
|
309227
309431
|
// src/lib/protocols/mcp/mcp-collection-builder.ts
|
|
309228
309432
|
var MCP_TOOLS_LIST_PAGINATION_PROBE_COUNT = 5;
|
|
309229
|
-
function
|
|
309433
|
+
function asRecord25(value) {
|
|
309230
309434
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
309231
309435
|
return value;
|
|
309232
309436
|
}
|
|
@@ -309281,7 +309485,7 @@ function promptsListMessage() {
|
|
|
309281
309485
|
return jsonRpc(9, "prompts/list", {});
|
|
309282
309486
|
}
|
|
309283
309487
|
function toolArguments(tool) {
|
|
309284
|
-
return
|
|
309488
|
+
return asRecord25(tool.sampleArguments) ?? {};
|
|
309285
309489
|
}
|
|
309286
309490
|
function promptArguments(prompt) {
|
|
309287
309491
|
const out = {};
|
|
@@ -309585,7 +309789,7 @@ var MIME_TYPE_RE = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\/[A-Za-z0-9][A-Za-z0-9!#$&
|
|
|
309585
309789
|
var TOOL_FIELDS_2025_06_18 = /* @__PURE__ */ new Set(["name", "title", "description", "inputSchema", "outputSchema", "annotations", "_meta"]);
|
|
309586
309790
|
var JSON_RPC_STANDARD_ERROR_CODES = /* @__PURE__ */ new Set([-32700, -32600, -32601, -32602, -32603]);
|
|
309587
309791
|
var MCP_PROTOCOL_VERSIONS = /* @__PURE__ */ new Set(["2024-11-05", "2025-03-26", "2025-06-18", "2025-11-25"]);
|
|
309588
|
-
function
|
|
309792
|
+
function asRecord26(value) {
|
|
309589
309793
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
309590
309794
|
return value;
|
|
309591
309795
|
}
|
|
@@ -309601,7 +309805,7 @@ function isStrictBase64(value) {
|
|
|
309601
309805
|
}
|
|
309602
309806
|
}
|
|
309603
309807
|
function walkDocument(value, path8, visit4) {
|
|
309604
|
-
const record =
|
|
309808
|
+
const record = asRecord26(value);
|
|
309605
309809
|
if (record) {
|
|
309606
309810
|
visit4(record, path8);
|
|
309607
309811
|
for (const [key, child3] of Object.entries(record)) walkDocument(child3, `${path8}.${key}`, visit4);
|
|
@@ -309614,10 +309818,10 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
309614
309818
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type must be a string`);
|
|
309615
309819
|
return;
|
|
309616
309820
|
}
|
|
309617
|
-
if (block2.annotations !== void 0 &&
|
|
309821
|
+
if (block2.annotations !== void 0 && asRecord26(block2.annotations) === null) {
|
|
309618
309822
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} annotations must be an object when present`);
|
|
309619
309823
|
}
|
|
309620
|
-
if (block2._meta !== void 0 &&
|
|
309824
|
+
if (block2._meta !== void 0 && asRecord26(block2._meta) === null) {
|
|
309621
309825
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} _meta must be an object when present`);
|
|
309622
309826
|
}
|
|
309623
309827
|
if (block2.type === "text") {
|
|
@@ -309630,7 +309834,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
309630
309834
|
return;
|
|
309631
309835
|
}
|
|
309632
309836
|
if (block2.type === "resource") {
|
|
309633
|
-
const resource =
|
|
309837
|
+
const resource = asRecord26(block2.resource);
|
|
309634
309838
|
if (!resource) {
|
|
309635
309839
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} resource content block must carry a resource object`);
|
|
309636
309840
|
return;
|
|
@@ -309644,7 +309848,7 @@ function validateStaticContentBlock(block2, label, warnings) {
|
|
|
309644
309848
|
warnings.push(`MCP_STATIC_CONTENT_BLOCK_INVALID: ${label} content block type "${block2.type}" is not a known MCP 2025-06-18 content discriminator`);
|
|
309645
309849
|
}
|
|
309646
309850
|
function validateStaticResultFixture(record, path8, warnings) {
|
|
309647
|
-
const result =
|
|
309851
|
+
const result = asRecord26(record.result);
|
|
309648
309852
|
if (!result) return;
|
|
309649
309853
|
for (const key of ["tools", "resources", "prompts"]) {
|
|
309650
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`);
|
|
@@ -309654,8 +309858,8 @@ function validateStaticResultFixture(record, path8, warnings) {
|
|
|
309654
309858
|
}
|
|
309655
309859
|
if (result.protocolVersion !== void 0 || result.capabilities !== void 0 || result.serverInfo !== void 0) {
|
|
309656
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`);
|
|
309657
|
-
if (
|
|
309658
|
-
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);
|
|
309659
309863
|
if (!serverInfo) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path8}.serverInfo must be an object`);
|
|
309660
309864
|
else {
|
|
309661
309865
|
if (typeof serverInfo.name !== "string" || !serverInfo.name) warnings.push(`MCP_STATIC_INITIALIZE_RESULT_INVALID: ${path8}.serverInfo.name must be a non-empty string`);
|
|
@@ -309665,7 +309869,7 @@ function validateStaticResultFixture(record, path8, warnings) {
|
|
|
309665
309869
|
}
|
|
309666
309870
|
function validateStaticJsonRpcFixtures(index, warnings) {
|
|
309667
309871
|
walkDocument(index.documentJson, "$", (record, path8) => {
|
|
309668
|
-
const error =
|
|
309872
|
+
const error = asRecord26(record.error);
|
|
309669
309873
|
if (record.jsonrpc === "2.0" && error) {
|
|
309670
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`);
|
|
309671
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`);
|
|
@@ -309674,19 +309878,19 @@ function validateStaticJsonRpcFixtures(index, warnings) {
|
|
|
309674
309878
|
validateStaticResultFixture(record, path8, warnings);
|
|
309675
309879
|
if (Array.isArray(record.content)) {
|
|
309676
309880
|
record.content.forEach((entry, i) => {
|
|
309677
|
-
const block2 =
|
|
309881
|
+
const block2 = asRecord26(entry);
|
|
309678
309882
|
if (block2) validateStaticContentBlock(block2, `${path8}.content[${i}]`, warnings);
|
|
309679
309883
|
});
|
|
309680
309884
|
}
|
|
309681
309885
|
if (Array.isArray(record.messages)) {
|
|
309682
309886
|
record.messages.forEach((entry, i) => {
|
|
309683
|
-
const message =
|
|
309887
|
+
const message = asRecord26(entry);
|
|
309684
309888
|
if (!message) {
|
|
309685
309889
|
warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path8}.messages[${i}] must be an object`);
|
|
309686
309890
|
return;
|
|
309687
309891
|
}
|
|
309688
309892
|
if (message.role !== "user" && message.role !== "assistant") warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path8}.messages[${i}].role must be user or assistant`);
|
|
309689
|
-
const content =
|
|
309893
|
+
const content = asRecord26(message.content);
|
|
309690
309894
|
if (!content) warnings.push(`MCP_STATIC_PROMPT_MESSAGE_INVALID: ${path8}.messages[${i}].content must be a content block object`);
|
|
309691
309895
|
else validateStaticContentBlock(content, `${path8}.messages[${i}].content`, warnings);
|
|
309692
309896
|
});
|
|
@@ -309700,10 +309904,10 @@ function walkManifest(value, path8, warnings) {
|
|
|
309700
309904
|
return;
|
|
309701
309905
|
}
|
|
309702
309906
|
const record = value;
|
|
309703
|
-
if (Object.prototype.hasOwnProperty.call(record, "_meta") &&
|
|
309907
|
+
if (Object.prototype.hasOwnProperty.call(record, "_meta") && asRecord26(record._meta) === null) {
|
|
309704
309908
|
warnings.push(`MCP_META_OBJECT_INVALID: ${path8}._meta must be an object when present (MCP 2025-06-18 BaseMetadata)`);
|
|
309705
309909
|
}
|
|
309706
|
-
const meta =
|
|
309910
|
+
const meta = asRecord26(record._meta);
|
|
309707
309911
|
if (meta) {
|
|
309708
309912
|
for (const key of Object.keys(meta)) {
|
|
309709
309913
|
if (!META_KEY_RE.test(key)) {
|
|
@@ -309722,7 +309926,7 @@ function walkManifest(value, path8, warnings) {
|
|
|
309722
309926
|
}
|
|
309723
309927
|
function validateManifestDocument(index, warnings) {
|
|
309724
309928
|
walkManifest(index.documentJson, "$", warnings);
|
|
309725
|
-
const tools = asArray18(index.documentJson.tools).map((entry) =>
|
|
309929
|
+
const tools = asArray18(index.documentJson.tools).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
309726
309930
|
const seen = /* @__PURE__ */ new Set();
|
|
309727
309931
|
for (const tool of tools) {
|
|
309728
309932
|
const name = typeof tool.name === "string" ? tool.name : "<unnamed>";
|
|
@@ -309741,7 +309945,7 @@ function validateManifestDocument(index, warnings) {
|
|
|
309741
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`);
|
|
309742
309946
|
}
|
|
309743
309947
|
}
|
|
309744
|
-
const annotations =
|
|
309948
|
+
const annotations = asRecord26(tool.annotations);
|
|
309745
309949
|
if (typeof tool.title === "string" && typeof annotations?.title === "string") {
|
|
309746
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`);
|
|
309747
309951
|
}
|
|
@@ -309762,7 +309966,7 @@ function validateCapabilities(index, warnings) {
|
|
|
309762
309966
|
shaped[name] = null;
|
|
309763
309967
|
continue;
|
|
309764
309968
|
}
|
|
309765
|
-
const record =
|
|
309969
|
+
const record = asRecord26(value);
|
|
309766
309970
|
if (!record) {
|
|
309767
309971
|
warnings.push(`MCP_CAPABILITY_SHAPE_INVALID: capabilities.${name} must be an object when present; got ${JSON.stringify(value)}`);
|
|
309768
309972
|
shaped[name] = null;
|
|
@@ -309818,7 +310022,7 @@ function itemServerScope(itemTitle) {
|
|
|
309818
310022
|
return separator === -1 ? itemTitle : itemTitle.slice(0, separator);
|
|
309819
310023
|
}
|
|
309820
310024
|
function assertRecordValue(value, reason, fail2) {
|
|
309821
|
-
const record =
|
|
310025
|
+
const record = asRecord26(value);
|
|
309822
310026
|
if (!record) fail2(reason);
|
|
309823
310027
|
return record;
|
|
309824
310028
|
}
|
|
@@ -309840,7 +310044,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
309840
310044
|
} catch {
|
|
309841
310045
|
return fail2("message is not valid JSON");
|
|
309842
310046
|
}
|
|
309843
|
-
const record =
|
|
310047
|
+
const record = asRecord26(parsed);
|
|
309844
310048
|
if (!record) return fail2("message is not a JSON object");
|
|
309845
310049
|
if (record.jsonrpc !== "2.0") return fail2('jsonrpc must be the string "2.0"');
|
|
309846
310050
|
if (typeof record.method !== "string" || !record.method) return fail2("method must be a non-empty string");
|
|
@@ -309852,7 +310056,7 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
309852
310056
|
} else {
|
|
309853
310057
|
return fail2("id must be a string or number");
|
|
309854
310058
|
}
|
|
309855
|
-
if (record.params !== void 0 &&
|
|
310059
|
+
if (record.params !== void 0 && asRecord26(record.params) === null) return fail2("params must be an object when present");
|
|
309856
310060
|
switch (record.method) {
|
|
309857
310061
|
case "notifications/initialized":
|
|
309858
310062
|
assertOptionalObjectParams(record, "notifications/initialized", fail2);
|
|
@@ -309885,14 +310089,14 @@ function assertJsonRpcRequest(message, itemTitle) {
|
|
|
309885
310089
|
case "prompts/get": {
|
|
309886
310090
|
const params = assertObjectParams(record, "prompts/get", fail2);
|
|
309887
310091
|
if (typeof params.name !== "string" || !params.name) fail2("prompts/get params.name must be a non-empty string");
|
|
309888
|
-
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");
|
|
309889
310093
|
break;
|
|
309890
310094
|
}
|
|
309891
310095
|
case "tools/call": {
|
|
309892
310096
|
const params = assertObjectParams(record, "tools/call", fail2);
|
|
309893
310097
|
if (typeof params.name !== "string" || !params.name) fail2("tools/call params.name must be a non-empty string");
|
|
309894
|
-
if (params.arguments !== void 0 &&
|
|
309895
|
-
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");
|
|
309896
310100
|
break;
|
|
309897
310101
|
}
|
|
309898
310102
|
case "ping":
|
|
@@ -309993,7 +310197,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
309993
310197
|
validateAnnotatedDeclarations(index, warnings);
|
|
309994
310198
|
validateStaticJsonRpcFixtures(index, warnings);
|
|
309995
310199
|
for (const tool of index.tools) warnings.push(...toolsCallScript(index, tool).warnings);
|
|
309996
|
-
const items = asArray18(collection.item).map((entry) =>
|
|
310200
|
+
const items = asArray18(collection.item).map((entry) => asRecord26(entry)).filter((entry) => entry !== null);
|
|
309997
310201
|
const ids = [];
|
|
309998
310202
|
const httpIds = [];
|
|
309999
310203
|
const requestIdsByServer = /* @__PURE__ */ new Set();
|
|
@@ -310001,7 +310205,7 @@ function instrumentMcpCollection(collection, index) {
|
|
|
310001
310205
|
if (String(item.type) === "mcp-request") {
|
|
310002
310206
|
ids.push(typeof item.id === "string" && item.id ? item.id : `#${ids.length}`);
|
|
310003
310207
|
const itemTitle = String(item.title ?? item.id ?? "mcp-request");
|
|
310004
|
-
const request = assertJsonRpcRequest(
|
|
310208
|
+
const request = assertJsonRpcRequest(asRecord26(item.payload)?.message, itemTitle);
|
|
310005
310209
|
if (request.id !== void 0) {
|
|
310006
310210
|
const scopedId = `${itemServerScope(itemTitle)}\0${typeof request.id === "number" ? `n:${request.id}` : `s:${request.id}`}`;
|
|
310007
310211
|
if (requestIdsByServer.has(scopedId)) {
|
|
@@ -311847,6 +312051,44 @@ function createBootstrapDependencies(inputs, factories, orgMode = false) {
|
|
|
311847
312051
|
}
|
|
311848
312052
|
|
|
311849
312053
|
// src/cli.ts
|
|
312054
|
+
var HELP_TEXT = `Usage: postman-bootstrap [options]
|
|
312055
|
+
|
|
312056
|
+
Bootstrap Postman workspaces, specs, and collections from OpenAPI.
|
|
312057
|
+
|
|
312058
|
+
Options:
|
|
312059
|
+
--help Show this help and exit
|
|
312060
|
+
--version Show version and exit
|
|
312061
|
+
--result-json <path> Write JSON result (default: postman-bootstrap-result.json)
|
|
312062
|
+
--dotenv-path <path> Optional dotenv output path
|
|
312063
|
+
--<input-name> <value> Action input as kebab-case flag (same names as action.yml)
|
|
312064
|
+
|
|
312065
|
+
Examples:
|
|
312066
|
+
postman-bootstrap --help
|
|
312067
|
+
postman-bootstrap --project-name demo --spec-path ./openapi.yaml ...
|
|
312068
|
+
`;
|
|
312069
|
+
function wantsHelp(argv) {
|
|
312070
|
+
return argv.includes("--help") || argv.includes("-h");
|
|
312071
|
+
}
|
|
312072
|
+
function wantsVersion(argv) {
|
|
312073
|
+
return argv.includes("--version") || argv.includes("-V");
|
|
312074
|
+
}
|
|
312075
|
+
function resolvePackageVersion() {
|
|
312076
|
+
const candidates = [];
|
|
312077
|
+
if (typeof __filename === "string" && __filename) {
|
|
312078
|
+
candidates.push(import_node_path5.default.join(import_node_path5.default.dirname(__filename), "..", "package.json"));
|
|
312079
|
+
}
|
|
312080
|
+
candidates.push(import_node_path5.default.join(process.cwd(), "package.json"));
|
|
312081
|
+
for (const packageJsonPath of candidates) {
|
|
312082
|
+
try {
|
|
312083
|
+
const packageJson = JSON.parse((0, import_node_fs6.readFileSync)(packageJsonPath, "utf8"));
|
|
312084
|
+
if (packageJson.name === "@postman-cse/onboarding-bootstrap" && packageJson.version) {
|
|
312085
|
+
return String(packageJson.version).trim();
|
|
312086
|
+
}
|
|
312087
|
+
} catch {
|
|
312088
|
+
}
|
|
312089
|
+
}
|
|
312090
|
+
return "0.0.0";
|
|
312091
|
+
}
|
|
311850
312092
|
var ConsoleReporter = class {
|
|
311851
312093
|
error(message) {
|
|
311852
312094
|
console.error(message);
|
|
@@ -312110,6 +312352,19 @@ function validateCliInputs(inputs) {
|
|
|
312110
312352
|
}
|
|
312111
312353
|
}
|
|
312112
312354
|
async function runCli(argv = process.argv.slice(2), runtime = {}) {
|
|
312355
|
+
const writeStdout = runtime.writeStdout ?? ((chunk) => process.stdout.write(chunk));
|
|
312356
|
+
if (wantsHelp(argv) && wantsVersion(argv)) {
|
|
312357
|
+
throw new Error("Cannot use --help and --version together");
|
|
312358
|
+
}
|
|
312359
|
+
if (wantsHelp(argv)) {
|
|
312360
|
+
writeStdout(HELP_TEXT);
|
|
312361
|
+
return;
|
|
312362
|
+
}
|
|
312363
|
+
if (wantsVersion(argv)) {
|
|
312364
|
+
writeStdout(`${resolvePackageVersion()}
|
|
312365
|
+
`);
|
|
312366
|
+
return;
|
|
312367
|
+
}
|
|
312113
312368
|
const env = runtime.env ?? process.env;
|
|
312114
312369
|
const config = parseCliArgs(argv, env);
|
|
312115
312370
|
const inputs = resolveInputs(config.inputEnv);
|
|
@@ -312138,7 +312393,6 @@ async function runCli(argv = process.argv.slice(2), runtime = {}) {
|
|
|
312138
312393
|
const result = await (runtime.executeBootstrap ?? runBootstrap)(inputs, dependencies);
|
|
312139
312394
|
await writeOptionalFile(config.resultJsonPath, JSON.stringify(result, null, 2));
|
|
312140
312395
|
await writeOptionalFile(config.dotenvPath, toDotenv(result));
|
|
312141
|
-
const writeStdout = runtime.writeStdout ?? ((chunk) => process.stdout.write(chunk));
|
|
312142
312396
|
writeStdout(`${JSON.stringify(result, null, 2)}
|
|
312143
312397
|
`);
|
|
312144
312398
|
}
|