norn-cli 1.3.16 → 1.3.18
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/AGENTS.md +72 -0
- package/CHANGELOG.md +34 -1
- package/README.md +4 -2
- package/dist/cli.js +135 -63
- package/out/assertionRunner.js +537 -0
- package/out/cli/colors.js +129 -0
- package/out/cli/formatters/assertion.js +75 -0
- package/out/cli/formatters/index.js +23 -0
- package/out/cli/formatters/response.js +106 -0
- package/out/cli/formatters/summary.js +187 -0
- package/out/cli/redaction.js +237 -0
- package/out/cli/reporters/html.js +634 -0
- package/out/cli/reporters/index.js +22 -0
- package/out/cli/reporters/junit.js +211 -0
- package/out/cli.js +926 -0
- package/out/codeLensProvider.js +254 -0
- package/out/compareContentProvider.js +85 -0
- package/out/completionProvider.js +1886 -0
- package/out/contractDecorationProvider.js +243 -0
- package/out/coverageCalculator.js +756 -0
- package/out/coveragePanel.js +542 -0
- package/out/diagnosticProvider.js +980 -0
- package/out/environmentProvider.js +373 -0
- package/out/extension.js +1025 -0
- package/out/httpClient.js +269 -0
- package/out/jsonFileReader.js +320 -0
- package/out/nornapiParser.js +326 -0
- package/out/parser.js +725 -0
- package/out/responsePanel.js +4674 -0
- package/out/schemaGenerator.js +393 -0
- package/out/scriptRunner.js +419 -0
- package/out/sequenceRunner.js +3046 -0
- package/out/swaggerParser.js +339 -0
- package/out/test/extension.test.js +48 -0
- package/out/testProvider.js +658 -0
- package/out/validationCache.js +245 -0
- package/package.json +1 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Validation Cache - Stores schema validation results for decorations and status tracking
|
|
4
|
+
* Results are persisted in .norn-cache/validation-results.json
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.loadCache = loadCache;
|
|
41
|
+
exports.saveValidationResult = saveValidationResult;
|
|
42
|
+
exports.getResultForAssertion = getResultForAssertion;
|
|
43
|
+
exports.getResultsForFile = getResultsForFile;
|
|
44
|
+
exports.clearResultsForFile = clearResultsForFile;
|
|
45
|
+
exports.clearAllResults = clearAllResults;
|
|
46
|
+
exports.markResultsAsStale = markResultsAsStale;
|
|
47
|
+
const fs = __importStar(require("fs"));
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
const vscode = __importStar(require("vscode"));
|
|
50
|
+
const CACHE_VERSION = 1;
|
|
51
|
+
const CACHE_FOLDER = '.norn-cache';
|
|
52
|
+
const CACHE_FILE = 'validation-results.json';
|
|
53
|
+
/**
|
|
54
|
+
* Get the workspace root folder
|
|
55
|
+
*/
|
|
56
|
+
function getWorkspaceRoot() {
|
|
57
|
+
const workspaceFolders = vscode.workspace.workspaceFolders;
|
|
58
|
+
if (workspaceFolders && workspaceFolders.length > 0) {
|
|
59
|
+
return workspaceFolders[0].uri.fsPath;
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get the path to the cache file
|
|
65
|
+
*/
|
|
66
|
+
function getCachePath() {
|
|
67
|
+
const root = getWorkspaceRoot();
|
|
68
|
+
if (!root) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
return path.join(root, CACHE_FOLDER, CACHE_FILE);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Ensure the cache directory exists
|
|
75
|
+
*/
|
|
76
|
+
function ensureCacheDir() {
|
|
77
|
+
const root = getWorkspaceRoot();
|
|
78
|
+
if (!root) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
const cacheDir = path.join(root, CACHE_FOLDER);
|
|
82
|
+
if (!fs.existsSync(cacheDir)) {
|
|
83
|
+
try {
|
|
84
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Load the validation cache from disk
|
|
94
|
+
*/
|
|
95
|
+
function loadCache() {
|
|
96
|
+
const cachePath = getCachePath();
|
|
97
|
+
if (!cachePath || !fs.existsSync(cachePath)) {
|
|
98
|
+
return { version: CACHE_VERSION, results: {} };
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const content = fs.readFileSync(cachePath, 'utf-8');
|
|
102
|
+
const data = JSON.parse(content);
|
|
103
|
+
// Handle version mismatch - clear cache
|
|
104
|
+
if (data.version !== CACHE_VERSION) {
|
|
105
|
+
return { version: CACHE_VERSION, results: {} };
|
|
106
|
+
}
|
|
107
|
+
return data;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return { version: CACHE_VERSION, results: {} };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Save the cache to disk
|
|
115
|
+
*/
|
|
116
|
+
function saveCache(cache) {
|
|
117
|
+
if (!ensureCacheDir()) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
const cachePath = getCachePath();
|
|
121
|
+
if (!cachePath) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
fs.writeFileSync(cachePath, JSON.stringify(cache, null, 2), 'utf-8');
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Generate a cache key from source file and line number
|
|
134
|
+
*/
|
|
135
|
+
function getCacheKey(sourceFile, line) {
|
|
136
|
+
// Normalize to workspace-relative path
|
|
137
|
+
const root = getWorkspaceRoot();
|
|
138
|
+
let relativePath = sourceFile;
|
|
139
|
+
if (root && sourceFile.startsWith(root)) {
|
|
140
|
+
relativePath = sourceFile.slice(root.length + 1);
|
|
141
|
+
}
|
|
142
|
+
return `${relativePath}:${line}`;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Save a validation result to the cache
|
|
146
|
+
*/
|
|
147
|
+
function saveValidationResult(result) {
|
|
148
|
+
const cache = loadCache();
|
|
149
|
+
const key = getCacheKey(result.sourceFile, result.assertionLine);
|
|
150
|
+
// Normalize paths
|
|
151
|
+
const root = getWorkspaceRoot();
|
|
152
|
+
if (root) {
|
|
153
|
+
if (result.sourceFile.startsWith(root)) {
|
|
154
|
+
result.sourceFile = result.sourceFile.slice(root.length + 1);
|
|
155
|
+
}
|
|
156
|
+
if (result.schemaPath.startsWith(root)) {
|
|
157
|
+
result.schemaPath = result.schemaPath.slice(root.length + 1);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
cache.results[key] = result;
|
|
161
|
+
saveCache(cache);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get validation result for a specific assertion
|
|
165
|
+
* @param sourceFile Absolute path to the .norn file
|
|
166
|
+
* @param line Line number (0-based)
|
|
167
|
+
*/
|
|
168
|
+
function getResultForAssertion(sourceFile, line) {
|
|
169
|
+
const cache = loadCache();
|
|
170
|
+
const key = getCacheKey(sourceFile, line);
|
|
171
|
+
return cache.results[key];
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get all validation results for a source file
|
|
175
|
+
* @param sourceFile Absolute path to the .norn file
|
|
176
|
+
*/
|
|
177
|
+
function getResultsForFile(sourceFile) {
|
|
178
|
+
const cache = loadCache();
|
|
179
|
+
const results = [];
|
|
180
|
+
// Normalize path for comparison
|
|
181
|
+
const root = getWorkspaceRoot();
|
|
182
|
+
let normalizedPath = sourceFile;
|
|
183
|
+
if (root && sourceFile.startsWith(root)) {
|
|
184
|
+
normalizedPath = sourceFile.slice(root.length + 1);
|
|
185
|
+
}
|
|
186
|
+
for (const [key, result] of Object.entries(cache.results)) {
|
|
187
|
+
const [filePath] = key.split(':');
|
|
188
|
+
if (filePath === normalizedPath) {
|
|
189
|
+
results.push(result);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return results;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Clear all cached results for a specific file
|
|
196
|
+
*/
|
|
197
|
+
function clearResultsForFile(sourceFile) {
|
|
198
|
+
const cache = loadCache();
|
|
199
|
+
// Normalize path for comparison
|
|
200
|
+
const root = getWorkspaceRoot();
|
|
201
|
+
let normalizedPath = sourceFile;
|
|
202
|
+
if (root && sourceFile.startsWith(root)) {
|
|
203
|
+
normalizedPath = sourceFile.slice(root.length + 1);
|
|
204
|
+
}
|
|
205
|
+
const keysToDelete = [];
|
|
206
|
+
for (const key of Object.keys(cache.results)) {
|
|
207
|
+
const [filePath] = key.split(':');
|
|
208
|
+
if (filePath === normalizedPath) {
|
|
209
|
+
keysToDelete.push(key);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
keysToDelete.forEach(key => delete cache.results[key]);
|
|
213
|
+
saveCache(cache);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Clear all cached results
|
|
217
|
+
*/
|
|
218
|
+
function clearAllResults() {
|
|
219
|
+
const cache = { version: CACHE_VERSION, results: {} };
|
|
220
|
+
saveCache(cache);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Mark all results for a file as stale (used when file changes)
|
|
224
|
+
*/
|
|
225
|
+
function markResultsAsStale(sourceFile) {
|
|
226
|
+
const cache = loadCache();
|
|
227
|
+
// Normalize path for comparison
|
|
228
|
+
const root = getWorkspaceRoot();
|
|
229
|
+
let normalizedPath = sourceFile;
|
|
230
|
+
if (root && sourceFile.startsWith(root)) {
|
|
231
|
+
normalizedPath = sourceFile.slice(root.length + 1);
|
|
232
|
+
}
|
|
233
|
+
let modified = false;
|
|
234
|
+
for (const [key, result] of Object.entries(cache.results)) {
|
|
235
|
+
const [filePath] = key.split(':');
|
|
236
|
+
if (filePath === normalizedPath && result.status !== 'stale') {
|
|
237
|
+
result.status = 'stale';
|
|
238
|
+
modified = true;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (modified) {
|
|
242
|
+
saveCache(cache);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=validationCache.js.map
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "norn-cli",
|
|
3
3
|
"displayName": "Norn - REST Client",
|
|
4
4
|
"description": "A powerful REST client for making HTTP requests with sequences, variables, scripts, and cookie support",
|
|
5
|
-
"version": "1.3.
|
|
5
|
+
"version": "1.3.18",
|
|
6
6
|
"publisher": "Norn-PeterKrustanov",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Peter Krastanov"
|