@intrig/core 0.0.15-22 → 0.0.15-24
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/main.js +36 -39
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -7627,6 +7627,17 @@ var external_node_crypto_ = __webpack_require__(1273);
|
|
|
7627
7627
|
|
|
7628
7628
|
|
|
7629
7629
|
|
|
7630
|
+
// HTTP methods to process during normalization
|
|
7631
|
+
const HTTP_METHODS = [
|
|
7632
|
+
'get',
|
|
7633
|
+
'post',
|
|
7634
|
+
'put',
|
|
7635
|
+
'delete',
|
|
7636
|
+
'patch',
|
|
7637
|
+
'options',
|
|
7638
|
+
'head',
|
|
7639
|
+
'trace'
|
|
7640
|
+
];
|
|
7630
7641
|
// Utility to generate type names
|
|
7631
7642
|
function generateTypeName(operationOb, postFix) {
|
|
7632
7643
|
return [
|
|
@@ -7655,12 +7666,7 @@ function registerTags(spec) {
|
|
|
7655
7666
|
for (const pathItem of Object.values(paths)){
|
|
7656
7667
|
const pathItemObject = pathItem;
|
|
7657
7668
|
for (const [method, operation] of Object.entries(pathItemObject)){
|
|
7658
|
-
if (
|
|
7659
|
-
"get",
|
|
7660
|
-
"post",
|
|
7661
|
-
"put",
|
|
7662
|
-
"delete"
|
|
7663
|
-
].includes(method.toLowerCase())) {
|
|
7669
|
+
if (HTTP_METHODS.includes(method.toLowerCase())) {
|
|
7664
7670
|
const operationOb = operation;
|
|
7665
7671
|
operationOb.tags?.forEach((tag)=>{
|
|
7666
7672
|
draft.tags = draft.tags ?? [];
|
|
@@ -7682,12 +7688,7 @@ function generateOperationIds(spec) {
|
|
|
7682
7688
|
for (const [path, pathItem] of Object.entries(paths)){
|
|
7683
7689
|
const pathItemObject = pathItem;
|
|
7684
7690
|
for (const [method, operation] of Object.entries(pathItemObject)){
|
|
7685
|
-
if (
|
|
7686
|
-
"get",
|
|
7687
|
-
"post",
|
|
7688
|
-
"put",
|
|
7689
|
-
"delete"
|
|
7690
|
-
].includes(method.toLowerCase())) {
|
|
7691
|
+
if (HTTP_METHODS.includes(method.toLowerCase())) {
|
|
7691
7692
|
const operationOb = operation;
|
|
7692
7693
|
if (!operationOb.operationId) {
|
|
7693
7694
|
operationOb.operationId = camelCase(`${method.toLowerCase()}_${path.replace("/", "_")}`);
|
|
@@ -7705,12 +7706,7 @@ function normalizeParameters(spec) {
|
|
|
7705
7706
|
for (const pathItem of Object.values(paths)){
|
|
7706
7707
|
const pathItemObject = pathItem;
|
|
7707
7708
|
for (const [method, operation] of Object.entries(pathItemObject)){
|
|
7708
|
-
if (
|
|
7709
|
-
"get",
|
|
7710
|
-
"post",
|
|
7711
|
-
"put",
|
|
7712
|
-
"delete"
|
|
7713
|
-
].includes(method.toLowerCase())) {
|
|
7709
|
+
if (HTTP_METHODS.includes(method.toLowerCase())) {
|
|
7714
7710
|
const operationOb = operation;
|
|
7715
7711
|
if (operationOb.parameters) {
|
|
7716
7712
|
operationOb.parameters = operationOb.parameters.map(doDeref).map((a)=>a);
|
|
@@ -7739,12 +7735,7 @@ function normalizeRequestBodies(spec) {
|
|
|
7739
7735
|
for (const pathItem of Object.values(paths)){
|
|
7740
7736
|
const pathItemObject = pathItem;
|
|
7741
7737
|
for (const [method, operation] of Object.entries(pathItemObject)){
|
|
7742
|
-
if (
|
|
7743
|
-
"get",
|
|
7744
|
-
"post",
|
|
7745
|
-
"put",
|
|
7746
|
-
"delete"
|
|
7747
|
-
].includes(method.toLowerCase())) {
|
|
7738
|
+
if (HTTP_METHODS.includes(method.toLowerCase())) {
|
|
7748
7739
|
const operationOb = operation;
|
|
7749
7740
|
if (operationOb.requestBody) {
|
|
7750
7741
|
const requestBody = doDeref(operationOb.requestBody);
|
|
@@ -7780,12 +7771,7 @@ function normalizeCallbacks(spec) {
|
|
|
7780
7771
|
for (const pathItem of Object.values(paths)){
|
|
7781
7772
|
const pathItemObject = pathItem;
|
|
7782
7773
|
for (const [method, operation] of Object.entries(pathItemObject)){
|
|
7783
|
-
if (
|
|
7784
|
-
"get",
|
|
7785
|
-
"post",
|
|
7786
|
-
"put",
|
|
7787
|
-
"delete"
|
|
7788
|
-
].includes(method.toLowerCase())) {
|
|
7774
|
+
if (HTTP_METHODS.includes(method.toLowerCase())) {
|
|
7789
7775
|
const operationOb = operation;
|
|
7790
7776
|
if (operationOb.callbacks) {
|
|
7791
7777
|
operationOb.callbacks = Object.fromEntries(Object.entries(operationOb.callbacks).map(([k, v])=>[
|
|
@@ -7806,12 +7792,7 @@ function normalizeResponses(spec) {
|
|
|
7806
7792
|
for (const pathItem of Object.values(paths)){
|
|
7807
7793
|
const pathItemObject = pathItem;
|
|
7808
7794
|
for (const [method, operation] of Object.entries(pathItemObject)){
|
|
7809
|
-
if (
|
|
7810
|
-
"get",
|
|
7811
|
-
"post",
|
|
7812
|
-
"put",
|
|
7813
|
-
"delete"
|
|
7814
|
-
].includes(method.toLowerCase())) {
|
|
7795
|
+
if (HTTP_METHODS.includes(method.toLowerCase())) {
|
|
7815
7796
|
const operationOb = operation;
|
|
7816
7797
|
if (operationOb.responses) {
|
|
7817
7798
|
operationOb.responses = Object.fromEntries(Object.entries(operationOb.responses).map(([k, v])=>[
|
|
@@ -7950,6 +7931,22 @@ class ExtractRequestsService {
|
|
|
7950
7931
|
ref: isRef(param.schema) ? param.schema.$ref : undefined
|
|
7951
7932
|
};
|
|
7952
7933
|
});
|
|
7934
|
+
// Auto-detect path parameters from URL that are missing from parameters array
|
|
7935
|
+
// This handles incomplete swagger specs where {param} is in URL but not defined in parameters
|
|
7936
|
+
const pathParamRegex = /\{([^}]+)\}/g;
|
|
7937
|
+
let match;
|
|
7938
|
+
while((match = pathParamRegex.exec(path)) !== null){
|
|
7939
|
+
const paramName = match[1];
|
|
7940
|
+
const alreadyDefined = variables.some((v)=>v.name === paramName && v.in === 'path');
|
|
7941
|
+
if (!alreadyDefined) {
|
|
7942
|
+
this.logger.debug(`Auto-detected missing path parameter '${paramName}' from URL: ${path}`);
|
|
7943
|
+
variables.push({
|
|
7944
|
+
name: paramName,
|
|
7945
|
+
in: 'path',
|
|
7946
|
+
ref: undefined // No schema available, will use 'any' type
|
|
7947
|
+
});
|
|
7948
|
+
}
|
|
7949
|
+
}
|
|
7953
7950
|
let params = {
|
|
7954
7951
|
paths: [
|
|
7955
7952
|
operation.tags?.[0]
|
|
@@ -10602,7 +10599,7 @@ function search_service_ts_metadata(k, v) {
|
|
|
10602
10599
|
};
|
|
10603
10600
|
/**
|
|
10604
10601
|
* HTTP methods recognized for method-only search
|
|
10605
|
-
*/ const
|
|
10602
|
+
*/ const search_service_HTTP_METHODS = [
|
|
10606
10603
|
'GET',
|
|
10607
10604
|
'POST',
|
|
10608
10605
|
'PUT',
|
|
@@ -10980,7 +10977,7 @@ class SearchService {
|
|
|
10980
10977
|
}
|
|
10981
10978
|
// Handle HTTP method-only query (e.g., "GET", "POST")
|
|
10982
10979
|
const upperQuery = trimmed.toUpperCase();
|
|
10983
|
-
if (
|
|
10980
|
+
if (search_service_HTTP_METHODS.includes(upperQuery)) {
|
|
10984
10981
|
return this.countAllWithFilters({
|
|
10985
10982
|
...opts,
|
|
10986
10983
|
method: upperQuery
|
|
@@ -11010,7 +11007,7 @@ class SearchService {
|
|
|
11010
11007
|
}
|
|
11011
11008
|
// Handle HTTP method-only query (e.g., "GET", "POST")
|
|
11012
11009
|
const upperQuery = trimmed.toUpperCase();
|
|
11013
|
-
if (
|
|
11010
|
+
if (search_service_HTTP_METHODS.includes(upperQuery)) {
|
|
11014
11011
|
return this.listAllWithFilters({
|
|
11015
11012
|
...opts,
|
|
11016
11013
|
method: upperQuery
|