@cmflow/atlas 3.4.0-beta.21 → 3.4.0-beta.22

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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as defineExpressionRule, n as BackendSource, r as UserConfig, t as BackendProperty } from "./types-Af0_VOnh.mjs";
2
+ import { a as defineExpressionRule, n as BackendSource, r as UserConfig, t as BackendProperty } from "./types-D5fngFrb.mjs";
3
3
  //#region src/fn/defineConfig.d.ts
4
4
  declare function defineConfig(config: UserConfig): UserConfig;
5
5
  //#endregion
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { fileURLToPath as __atlasFileURLToPath } from "node:url";
2
2
  const __filename = __atlasFileURLToPath(import.meta.url);
3
3
  import { r as __toESM, t as __commonJSMin } from "./rolldown-runtime-CGR6nZuH.mjs";
4
4
  import { u as getUserConfig } from "./taskProgressService-CAC_RIoa.mjs";
5
- import { a as httpClient, i as loadOpenApiDocument, t as extractOpenApiBackendProperties } from "./propertyExtractionService-8BjqpPFa.mjs";
5
+ import { a as httpClient, i as loadOpenApiDocument, t as extractOpenApiBackendProperties } from "./propertyExtractionService-BLat-Hsf.mjs";
6
6
  import { t as defineExpressionRule } from "./defineExpressionRule-GhkeHHT8.mjs";
7
7
 
8
8
  //#region src/fn/defineConfig.ts
@@ -55,35 +55,26 @@ async function loadOpenApiDocument(url, timeoutMs) {
55
55
  }
56
56
 
57
57
  //#endregion
58
- //#region src/services/openapi/schemaService.ts
59
- function resolveOpenApiReference(value, swagger) {
60
- if (!value || typeof value !== "object" || typeof value.$ref !== "string" || !value.$ref.startsWith("#/")) return value;
61
- let current = swagger;
58
+ //#region src/services/openapi/utils/resolveOpenApiReference.ts
59
+ function resolveOpenApiReference(value, document) {
60
+ if (!value || typeof value !== "object" || !("$ref" in value) || typeof value.$ref !== "string" || !value.$ref.startsWith("#/")) return value;
61
+ let current = document;
62
62
  for (const segment of value.$ref.replace("#/", "").split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~"))) {
63
- current = current?.[segment];
64
- if (current === void 0) return value;
63
+ if (!current || typeof current !== "object") return value;
64
+ current = current[segment];
65
65
  }
66
- return current;
66
+ return current === void 0 ? value : current;
67
67
  }
68
68
 
69
69
  //#endregion
70
- //#region src/services/openapi/propertyExtractionService.ts
71
- function isSuccessStatusCode(statusCode) {
72
- return /^\d+$/.test(statusCode) && Number(statusCode) >= 200 && Number(statusCode) <= 299;
73
- }
74
- function selectPreferredSchema(content, swagger) {
75
- if (!content || typeof content !== "object") return;
76
- if (content["application/json"]?.schema) return resolveOpenApiReference(content["application/json"].schema, swagger);
77
- const firstSchema = Object.values(content).find((entry) => entry?.schema);
78
- return firstSchema ? resolveOpenApiReference(firstSchema.schema, swagger) : void 0;
79
- }
80
- function extractLeafProperties(schema, swagger, currentPath = "") {
81
- const resolvedSchema = resolveOpenApiReference(schema, swagger);
70
+ //#region src/services/openapi/utils/extractOpenApiLeafProperties.ts
71
+ function extractOpenApiLeafProperties(schema, document, currentPath = "") {
72
+ const resolvedSchema = resolveOpenApiReference(schema, document);
82
73
  if (!resolvedSchema || typeof resolvedSchema !== "object") return [];
83
- if (Array.isArray(resolvedSchema.allOf)) return resolvedSchema.allOf.flatMap((item) => extractLeafProperties(item, swagger, currentPath));
74
+ if (Array.isArray(resolvedSchema.allOf)) return resolvedSchema.allOf.flatMap((item) => extractOpenApiLeafProperties(item, document, currentPath));
84
75
  if (resolvedSchema.type === "array" || resolvedSchema.items) {
85
76
  const arrayPath = currentPath ? `${currentPath}[]` : "[]";
86
- return extractLeafProperties(resolvedSchema.items, swagger, arrayPath);
77
+ return extractOpenApiLeafProperties(resolvedSchema.items, document, arrayPath);
87
78
  }
88
79
  const properties = resolvedSchema.properties || {};
89
80
  if (!Object.keys(properties).length) return currentPath ? [{
@@ -92,23 +83,44 @@ function extractLeafProperties(schema, swagger, currentPath = "") {
92
83
  deprecated: resolvedSchema.deprecated
93
84
  }] : [];
94
85
  return Object.entries(properties).flatMap(([propertyName, propertySchema]) => {
95
- return extractLeafProperties(propertySchema, swagger, currentPath ? `${currentPath}.${propertyName}` : propertyName);
86
+ return extractOpenApiLeafProperties(propertySchema, document, currentPath ? `${currentPath}.${propertyName}` : propertyName);
96
87
  });
97
88
  }
98
- function mapInputType(inType) {
99
- if (inType === "query") return "QUERY";
100
- if (inType === "path") return "PATH";
101
- if (inType === "header") return "HEADER";
89
+
90
+ //#endregion
91
+ //#region src/services/openapi/utils/isSuccessStatusCode.ts
92
+ function isSuccessStatusCode(statusCode) {
93
+ return /^\d+$/.test(statusCode) && Number(statusCode) >= 200 && Number(statusCode) <= 299;
94
+ }
95
+
96
+ //#endregion
97
+ //#region src/services/openapi/utils/mapOpenApiParameterLocation.ts
98
+ function mapOpenApiParameterLocation(location) {
99
+ if (location === "query") return "QUERY";
100
+ if (location === "path") return "PATH";
101
+ if (location === "header") return "HEADER";
102
102
  return null;
103
103
  }
104
+
105
+ //#endregion
106
+ //#region src/services/openapi/utils/selectPreferredOpenApiSchema.ts
107
+ function selectPreferredOpenApiSchema(content, document) {
108
+ if (!content || typeof content !== "object") return;
109
+ if (content["application/json"]?.schema) return resolveOpenApiReference(content["application/json"].schema, document);
110
+ const firstSchema = Object.values(content).find((entry) => entry?.schema);
111
+ return firstSchema ? resolveOpenApiReference(firstSchema.schema, document) : void 0;
112
+ }
113
+
114
+ //#endregion
115
+ //#region src/services/openapi/propertyExtractionService.ts
104
116
  function extractOpenApiInputProperties(operation, swagger) {
105
117
  const map = /* @__PURE__ */ new Map();
106
118
  const parameters = Array.isArray(operation.parameters) ? operation.parameters : [];
107
119
  for (const rawParameter of parameters) {
108
120
  const parameter = resolveOpenApiReference(rawParameter, swagger);
109
- const inputType = mapInputType(parameter?.in);
121
+ const inputType = mapOpenApiParameterLocation(parameter?.in);
110
122
  if (!parameter || !inputType || !parameter.name) continue;
111
- const properties = extractLeafProperties(parameter.schema, swagger, parameter.name);
123
+ const properties = extractOpenApiLeafProperties(parameter.schema, swagger, parameter.name);
112
124
  const resolvedProperties = properties.length ? properties : [{
113
125
  path: parameter.name,
114
126
  description: parameter.description,
@@ -123,8 +135,8 @@ function extractOpenApiInputProperties(operation, swagger) {
123
135
  }
124
136
  const requestBody = resolveOpenApiReference(operation.requestBody, swagger);
125
137
  if (requestBody?.content) {
126
- const schema = selectPreferredSchema(requestBody.content, swagger);
127
- for (const property of extractLeafProperties(schema, swagger)) map.set(`BODY:${property.path}`, {
138
+ const schema = selectPreferredOpenApiSchema(requestBody.content, swagger);
139
+ for (const property of extractOpenApiLeafProperties(schema, swagger)) map.set(`BODY:${property.path}`, {
128
140
  path: property.path,
129
141
  description: property.description || requestBody.description,
130
142
  deprecated: property.deprecated ?? false,
@@ -139,8 +151,8 @@ function extractOpenApiOutputProperties(operation, swagger) {
139
151
  for (const [statusCode, rawResponse] of Object.entries(responses)) {
140
152
  if (!isSuccessStatusCode(statusCode)) continue;
141
153
  const response = resolveOpenApiReference(rawResponse, swagger);
142
- const schema = selectPreferredSchema(response?.content, swagger);
143
- for (const property of extractLeafProperties(schema, swagger)) map.set(property.path, {
154
+ const schema = selectPreferredOpenApiSchema(response?.content, swagger);
155
+ for (const property of extractOpenApiLeafProperties(schema, swagger)) map.set(property.path, {
144
156
  path: property.path,
145
157
  description: property.description || response?.description,
146
158
  deprecated: property.deprecated ?? false,
@@ -169,4 +181,4 @@ function extractOpenApiBackendProperties(swagger) {
169
181
 
170
182
  //#endregion
171
183
  export { httpClient as a, loadOpenApiDocument as i, extractOpenApiInputProperties as n, extractOpenApiOutputProperties as r, extractOpenApiBackendProperties as t };
172
- //# sourceMappingURL=propertyExtractionService-8BjqpPFa.mjs.map
184
+ //# sourceMappingURL=propertyExtractionService-BLat-Hsf.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propertyExtractionService-BLat-Hsf.mjs","names":[],"sources":["../src/services/http/httpClient.ts","../src/services/openapi/loadOpenApiDocument.ts","../src/services/openapi/utils/resolveOpenApiReference.ts","../src/services/openapi/utils/extractOpenApiLeafProperties.ts","../src/services/openapi/utils/isSuccessStatusCode.ts","../src/services/openapi/utils/mapOpenApiParameterLocation.ts","../src/services/openapi/utils/selectPreferredOpenApiSchema.ts","../src/services/openapi/propertyExtractionService.ts"],"sourcesContent":["class HttpClient {\n async fetch(url: string, init: RequestInit & { onProgress: (content: string) => void }): Promise<string | unknown>;\n async fetch(url: string, init?: RequestInit): Promise<Response>;\n async fetch(url: string, init?: RequestInit & { onProgress?: (content: string) => void }): Promise<Response | string | unknown> {\n const headers = { accept: \"application/json\", ...init?.headers };\n\n const response = await fetch(url, {\n ...init,\n headers\n });\n\n if (!response.ok) {\n throw new Error(`Unable to fetch ${url}: ${response.status} ${response.statusText}`);\n }\n\n if (init?.onProgress) {\n const reader = response.body?.getReader();\n\n if (!reader) {\n return response.json() as unknown;\n }\n\n const decoder = new TextDecoder();\n let content = \"\";\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n\n content += decoder.decode(value, { stream: true });\n\n init.onProgress(content);\n }\n\n return content + decoder.decode();\n }\n\n return response;\n }\n\n async get<T>(url: string, init?: RequestInit): Promise<T> {\n const response = await this.fetch(url, init);\n return response.json() as Promise<T>;\n }\n}\n\nexport const httpClient = new HttpClient();\n","import { httpClient } from \"../http/httpClient\";\nimport { taskProgressService } from \"../tasks/taskProgressService\";\n\nexport type OpenApiDocument = {\n info?: { version?: string };\n paths?: Record<string, Record<string, any>>;\n components?: Record<string, any>;\n};\n\nexport async function loadOpenApiDocument(url: string, timeoutMs?: number): Promise<OpenApiDocument> {\n try {\n const content = await httpClient.fetch(url, {\n signal: timeoutMs ? AbortSignal.timeout(timeoutMs) : undefined,\n onProgress(content) {\n taskProgressService.log(`Downloading (${(content.length / 1_048_576).toFixed(1)} MB)`);\n }\n });\n\n if (!content || typeof content === \"object\") {\n return content as OpenApiDocument;\n }\n\n taskProgressService.log(\"Parsing document\");\n\n return JSON.parse(content as string) as OpenApiDocument;\n } catch (error) {\n if (error instanceof Error && (error.name === \"AbortError\" || error.name === \"TimeoutError\")) {\n throw new Error(`OpenAPI download timed out after ${timeoutMs}ms: ${url}`);\n }\n\n throw new Error(`Unable to fetch OpenAPI document from ${url}: ${error instanceof Error ? error.message : String(error)}`);\n }\n}\n","export function resolveOpenApiReference(value: any, document: unknown): any {\n if (!value || typeof value !== \"object\" || !(\"$ref\" in value) || typeof value.$ref !== \"string\" || !value.$ref.startsWith(\"#/\")) {\n return value;\n }\n\n let current: unknown = document;\n\n for (const segment of value.$ref\n .replace(\"#/\", \"\")\n .split(\"/\")\n .map((part: string) => part.replace(/~1/g, \"/\").replace(/~0/g, \"~\"))) {\n if (!current || typeof current !== \"object\") {\n return value;\n }\n\n current = (current as Record<string, unknown>)[segment];\n }\n\n return current === undefined ? value : current;\n}\n","import type { OpenApiDocument } from \"../loadOpenApiDocument\";\nimport type { OpenApiLeafProperty } from \"../interfaces/OpenApiLeafProperty\";\nimport { resolveOpenApiReference } from \"./resolveOpenApiReference\";\n\nexport function extractOpenApiLeafProperties(schema: any, document: OpenApiDocument, currentPath = \"\"): OpenApiLeafProperty[] {\n const resolvedSchema = resolveOpenApiReference(schema, document);\n\n if (!resolvedSchema || typeof resolvedSchema !== \"object\") {\n return [];\n }\n\n if (Array.isArray(resolvedSchema.allOf)) {\n return resolvedSchema.allOf.flatMap((item: any) => extractOpenApiLeafProperties(item, document, currentPath));\n }\n\n if (resolvedSchema.type === \"array\" || resolvedSchema.items) {\n const arrayPath = currentPath ? `${currentPath}[]` : \"[]\";\n return extractOpenApiLeafProperties(resolvedSchema.items, document, arrayPath);\n }\n\n const properties = resolvedSchema.properties || {};\n\n if (!Object.keys(properties).length) {\n return currentPath ? [{ path: currentPath, description: resolvedSchema.description, deprecated: resolvedSchema.deprecated }] : [];\n }\n\n return Object.entries(properties).flatMap(([propertyName, propertySchema]: [string, any]) => {\n const nextPath = currentPath ? `${currentPath}.${propertyName}` : propertyName;\n return extractOpenApiLeafProperties(propertySchema, document, nextPath);\n });\n}\n","export function isSuccessStatusCode(statusCode: string): boolean {\n return /^\\d+$/.test(statusCode) && Number(statusCode) >= 200 && Number(statusCode) <= 299;\n}\n","export function mapOpenApiParameterLocation(location?: string): \"QUERY\" | \"PATH\" | \"HEADER\" | null {\n if (location === \"query\") {\n return \"QUERY\";\n }\n if (location === \"path\") {\n return \"PATH\";\n }\n if (location === \"header\") {\n return \"HEADER\";\n }\n return null;\n}\n","import { resolveOpenApiReference } from \"./resolveOpenApiReference\";\n\nexport function selectPreferredOpenApiSchema(content: any, document: unknown): any {\n if (!content || typeof content !== \"object\") {\n return undefined;\n }\n\n if (content[\"application/json\"]?.schema) {\n return resolveOpenApiReference(content[\"application/json\"].schema, document);\n }\n\n const firstSchema = Object.values(content).find((entry: any) => entry?.schema) as any;\n return firstSchema ? resolveOpenApiReference(firstSchema.schema, document) : undefined;\n}\n","import type { BackendProperty, ExtractedApiProperty } from \"../../models/types\";\nimport { extractOpenApiLeafProperties } from \"./utils/extractOpenApiLeafProperties\";\nimport { isSuccessStatusCode } from \"./utils/isSuccessStatusCode\";\nimport { mapOpenApiParameterLocation } from \"./utils/mapOpenApiParameterLocation\";\nimport { selectPreferredOpenApiSchema } from \"./utils/selectPreferredOpenApiSchema\";\nimport type { OpenApiDocument } from \"./loadOpenApiDocument\";\nimport { resolveOpenApiReference } from \"./schemaService\";\n\nexport function extractOpenApiInputProperties(operation: any, swagger: OpenApiDocument): ExtractedApiProperty[] {\n const map = new Map<string, ExtractedApiProperty>();\n const parameters = Array.isArray(operation.parameters) ? operation.parameters : [];\n\n for (const rawParameter of parameters) {\n const parameter = resolveOpenApiReference(rawParameter, swagger);\n const inputType = mapOpenApiParameterLocation(parameter?.in);\n if (!parameter || !inputType || !parameter.name) {\n continue;\n }\n\n const properties = extractOpenApiLeafProperties(parameter.schema, swagger, parameter.name);\n const resolvedProperties = properties.length\n ? properties\n : [\n {\n path: parameter.name,\n description: parameter.description,\n deprecated: parameter.deprecated\n }\n ];\n\n for (const property of resolvedProperties) {\n map.set(`${inputType}:${property.path}`, {\n path: property.path,\n description: property.description || parameter.description,\n deprecated: property.deprecated ?? parameter.deprecated ?? false,\n type: inputType\n });\n }\n }\n\n const requestBody = resolveOpenApiReference(operation.requestBody, swagger);\n if (requestBody?.content) {\n const schema = selectPreferredOpenApiSchema(requestBody.content, swagger);\n for (const property of extractOpenApiLeafProperties(schema, swagger)) {\n map.set(`BODY:${property.path}`, {\n path: property.path,\n description: property.description || requestBody.description,\n deprecated: property.deprecated ?? false,\n type: \"BODY\"\n });\n }\n }\n\n return [...map.values()];\n}\n\nexport function extractOpenApiOutputProperties(operation: any, swagger: OpenApiDocument): ExtractedApiProperty[] {\n const map = new Map<string, ExtractedApiProperty>();\n const responses = operation?.responses || {};\n\n for (const [statusCode, rawResponse] of Object.entries(responses)) {\n if (!isSuccessStatusCode(statusCode)) {\n continue;\n }\n\n const response = resolveOpenApiReference(rawResponse, swagger);\n const schema = selectPreferredOpenApiSchema(response?.content, swagger);\n for (const property of extractOpenApiLeafProperties(schema, swagger)) {\n map.set(property.path, {\n path: property.path,\n description: property.description || response?.description,\n deprecated: property.deprecated ?? false,\n type: \"RESPONSE_BODY\"\n });\n }\n }\n\n return [...map.values()];\n}\n\nexport function extractOpenApiBackendProperties(swagger: OpenApiDocument): BackendProperty[] {\n const properties = new Map<string, BackendProperty>();\n for (const [route, pathItem] of Object.entries(swagger.paths || {})) {\n for (const [rawMethod, operation] of Object.entries(pathItem || {})) {\n if (!/^(get|post|put|patch|delete|head|options)$/i.test(rawMethod)) {\n continue;\n }\n const method = rawMethod.toUpperCase();\n for (const property of [\n ...extractOpenApiInputProperties(operation, swagger),\n ...extractOpenApiOutputProperties(operation, swagger)\n ]) {\n const key = `${method}:${route}:${property.path}`;\n if (!properties.has(key)) {\n properties.set(key, {\n route,\n method,\n field: property.path,\n description: property.description\n });\n }\n }\n }\n }\n return [...properties.values()];\n}\n"],"mappings":";;;;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K,SAAS,GAC/D;EAEF,MAAM,SAAS,UAAU,YAAY;EACrC,KAAK,MAAM,YAAY,CACrB,GAAG,8BAA8B,WAAW,OAAO,GACnD,GAAG,+BAA+B,WAAW,OAAO,CACtD,GAAG;GACD,MAAM,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS;GAC3C,IAAI,CAAC,WAAW,IAAI,GAAG,GACrB,WAAW,IAAI,KAAK;IAClB;IACA;IACA,OAAO,SAAS;IAChB,aAAa,SAAS;GACxB,CAAC;EAEL;CACF;CAEF,OAAO,CAAC,GAAG,WAAW,OAAO,CAAC;AAChC"}
@@ -8054,11 +8054,31 @@ minimatch.Minimatch = Minimatch;
8054
8054
  minimatch.escape = escape;
8055
8055
  minimatch.unescape = unescape;
8056
8056
 
8057
+ //#endregion
8058
+ //#region src/utils/path/normalizeFilePath.ts
8059
+ function normalizeFilePath(filePath) {
8060
+ return filePath.replaceAll("\\", "/").replace(/^\.\//, "");
8061
+ }
8062
+
8063
+ //#endregion
8064
+ //#region src/utils/fs/normalizeAnalysisFilePath.ts
8065
+ function normalizeAnalysisFilePath(repoRoot, filePath) {
8066
+ const relativePath = path.relative(repoRoot, filePath);
8067
+ return relativePath.startsWith("..") || path.isAbsolute(relativePath) ? normalizeFilePath(filePath) : normalizeFilePath(relativePath);
8068
+ }
8069
+
8070
+ //#endregion
8071
+ //#region src/utils/fs/isExcludedAnalysisFile.ts
8072
+ function isExcludedAnalysisFile(repoRoot, filePath, excludedPatterns) {
8073
+ const normalizedPath = normalizeAnalysisFilePath(repoRoot, filePath);
8074
+ return excludedPatterns.some((pattern) => minimatch(normalizedPath, pattern, { dot: true }));
8075
+ }
8076
+
8057
8077
  //#endregion
8058
8078
  //#region src/services/analysisFileService.ts
8059
8079
  function shouldKeepAnalysisFile(filePath) {
8060
- const normalizedProjectPath = filePath.replaceAll(path.sep, "/").replace(/^.*?(app\/)/, "app/");
8061
- return !getUserConfig().analysis.excluded.some((pattern) => minimatch(normalizedProjectPath, pattern, { dot: true }));
8080
+ const config = getUserConfig();
8081
+ return !isExcludedAnalysisFile(config.repoRoot, filePath, config.analysis.excluded);
8062
8082
  }
8063
8083
  function filterAnalysisFiles(filePaths) {
8064
8084
  return filePaths.filter(shouldKeepAnalysisFile);
@@ -8083,7 +8103,7 @@ function inferBackendNameFromFile(sourceFile) {
8083
8103
  }
8084
8104
 
8085
8105
  //#endregion
8086
- //#region src/utils/resolveAliasPath.ts
8106
+ //#region src/utils/path/resolveAliasPath.ts
8087
8107
  function resolveAliasPath(moduleSpecifier, aliases, rootPath) {
8088
8108
  for (const [alias, target] of Object.entries(aliases)) {
8089
8109
  if (moduleSpecifier !== alias && !moduleSpecifier.startsWith(`${alias}/`)) continue;
@@ -8094,7 +8114,7 @@ function resolveAliasPath(moduleSpecifier, aliases, rootPath) {
8094
8114
  }
8095
8115
 
8096
8116
  //#endregion
8097
- //#region src/utils/tryResolveWithExtensions.ts
8117
+ //#region src/utils/fs/tryResolveWithExtensions.ts
8098
8118
  function tryResolveWithExtensions(basePath) {
8099
8119
  const ext = path.extname(basePath);
8100
8120
  const withoutExt = ext ? basePath.slice(0, -ext.length) : basePath;
@@ -8123,7 +8143,7 @@ function tryResolveWithExtensions(basePath) {
8123
8143
  }
8124
8144
 
8125
8145
  //#endregion
8126
- //#region src/utils/resolveModulePath.ts
8146
+ //#region src/utils/path/resolveModulePath.ts
8127
8147
  function resolveModulePath(sourceFilePath, moduleSpecifier, aliases, rootPath) {
8128
8148
  if (moduleSpecifier.startsWith(".")) return tryResolveWithExtensions(path.resolve(path.dirname(sourceFilePath), moduleSpecifier));
8129
8149
  const aliased = resolveAliasPath(moduleSpecifier, aliases, rootPath);
@@ -8131,17 +8151,7 @@ function resolveModulePath(sourceFilePath, moduleSpecifier, aliases, rootPath) {
8131
8151
  }
8132
8152
 
8133
8153
  //#endregion
8134
- //#region src/services/routeBackendTopologyService.ts
8135
- const backendTopologyWeights = {
8136
- local_call: 1,
8137
- imported_call: 2,
8138
- local_callback: 2,
8139
- imported_callback: 3
8140
- };
8141
- function normalizeSourcePath(cwd, filePath) {
8142
- const relative = path.relative(cwd, filePath);
8143
- return relative.startsWith("..") ? filePath : relative.replaceAll(path.sep, "/");
8144
- }
8154
+ //#region src/utils/path/isFilePath.ts
8145
8155
  function isFilePath(filePath) {
8146
8156
  try {
8147
8157
  return fs.statSync(filePath).isFile();
@@ -8149,6 +8159,28 @@ function isFilePath(filePath) {
8149
8159
  return false;
8150
8160
  }
8151
8161
  }
8162
+
8163
+ //#endregion
8164
+ //#region src/utils/path/normalizeSourcePath.ts
8165
+ function normalizeSourcePath(cwd, filePath) {
8166
+ const relative = path.relative(cwd, filePath);
8167
+ return relative.startsWith("..") ? filePath : relative.replaceAll(path.sep, "/");
8168
+ }
8169
+
8170
+ //#endregion
8171
+ //#region src/utils/route/matchesRouteSelector.ts
8172
+ function matchesRouteSelector(route, selector) {
8173
+ return route.method.toUpperCase() === selector.method.toUpperCase() && route.path === selector.path;
8174
+ }
8175
+
8176
+ //#endregion
8177
+ //#region src/services/routeBackendTopologyService.ts
8178
+ const backendTopologyWeights = {
8179
+ local_call: 1,
8180
+ imported_call: 2,
8181
+ local_callback: 2,
8182
+ imported_callback: 3
8183
+ };
8152
8184
  function callableLine(callable) {
8153
8185
  return callable.declaration?.getStartLineNumber() || 1;
8154
8186
  }
@@ -8583,8 +8615,8 @@ async function generateBackendTopologyArtifacts(params) {
8583
8615
  taskProgressService.log(`${routeFiles.length} route file${routeFiles.length === 1 ? "" : "s"} discovered`);
8584
8616
  taskProgressService.report("Extracting route declarations");
8585
8617
  const routes = routeFiles.flatMap((routeFile) => extractRouteDeclarations(project.addSourceFileAtPath(routeFile))).filter((route) => {
8586
- if (params.routeSelector) return route.method === params.routeSelector.method && route.path === params.routeSelector.path;
8587
- return !params.routeSelectors || params.routeSelectors.some((selector) => route.method === selector.method && route.path === selector.path);
8618
+ if (params.routeSelector) return matchesRouteSelector(route, params.routeSelector);
8619
+ return !params.routeSelectors || params.routeSelectors.some((selector) => matchesRouteSelector(route, selector));
8588
8620
  });
8589
8621
  if (params.routeSelector && !routes.length) throw new Error(`Route not found: ${params.routeSelector.method} ${params.routeSelector.path}`);
8590
8622
  params.onRoutesDiscovered?.(routes.length);
@@ -8724,5 +8756,5 @@ async function generateBackendTopologyArtifactsInWorkers(params) {
8724
8756
  }
8725
8757
 
8726
8758
  //#endregion
8727
- export { isKnownBackendType as a, globby as c, inferBackendNameFromFile as i, generateBackendTopologyArtifactsInWorkers as n, filterAnalysisFiles as o, resolveModulePath as r, shouldKeepAnalysisFile as s, generateBackendTopologyArtifacts as t };
8728
- //# sourceMappingURL=routeBackendTopologyService-CkOLUfcj.mjs.map
8759
+ export { inferBackendNameFromFile as a, shouldKeepAnalysisFile as c, resolveModulePath as i, normalizeFilePath as l, generateBackendTopologyArtifactsInWorkers as n, isKnownBackendType as o, matchesRouteSelector as r, filterAnalysisFiles as s, generateBackendTopologyArtifacts as t, globby as u };
8760
+ //# sourceMappingURL=routeBackendTopologyService-CQyRyoSN.mjs.map