@mesadev/sdk 0.47.3 → 0.48.1
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/README.md +21 -25
- package/dist/api/access-token.d.ts +24 -41
- package/dist/api/access-token.d.ts.map +1 -1
- package/dist/api/access-token.js +119 -71
- package/dist/api/access-token.js.map +1 -1
- package/dist/api/client.d.ts +2 -2
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +3 -3
- package/dist/api/client.js.map +1 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +0 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/{signing-key.d.ts → private-key.d.ts} +1 -1
- package/dist/api/{signing-key.d.ts.map → private-key.d.ts.map} +1 -1
- package/dist/api/{signing-key.js → private-key.js} +1 -1
- package/dist/api/{signing-key.js.map → private-key.js.map} +1 -1
- package/dist/api/repo-tag-filter.d.ts +1 -1
- package/dist/api/repo-tag-filter.d.ts.map +1 -1
- package/dist/api/repo-tag-filter.js +3 -1
- package/dist/api/repo-tag-filter.js.map +1 -1
- package/dist/api/resources.d.ts +25 -66
- package/dist/api/resources.d.ts.map +1 -1
- package/dist/api/resources.js +24 -41
- package/dist/api/resources.js.map +1 -1
- package/dist/fs/grep-pattern.d.ts +28 -0
- package/dist/fs/grep-pattern.d.ts.map +1 -0
- package/dist/fs/grep-pattern.js +172 -0
- package/dist/fs/grep-pattern.js.map +1 -0
- package/dist/fs/index.d.ts +1 -1
- package/dist/fs/index.d.ts.map +1 -1
- package/dist/fs/index.js +1 -1
- package/dist/fs/index.js.map +1 -1
- package/dist/fs/layout.d.ts +7 -25
- package/dist/fs/layout.d.ts.map +1 -1
- package/dist/fs/layout.js +2 -40
- package/dist/fs/layout.js.map +1 -1
- package/dist/fs/mesa-file-system.d.ts +37 -36
- package/dist/fs/mesa-file-system.d.ts.map +1 -1
- package/dist/fs/mesa-file-system.js +74 -30
- package/dist/fs/mesa-file-system.js.map +1 -1
- package/dist/fs/native-loader.d.ts +3 -4
- package/dist/fs/native-loader.d.ts.map +1 -1
- package/dist/fs/native-loader.js.map +1 -1
- package/dist/fs/search-grep.d.ts +44 -0
- package/dist/fs/search-grep.d.ts.map +1 -0
- package/dist/fs/search-grep.js +208 -0
- package/dist/fs/search-grep.js.map +1 -0
- package/dist/fs/search-rg.d.ts +204 -0
- package/dist/fs/search-rg.d.ts.map +1 -0
- package/dist/fs/search-rg.js +502 -0
- package/dist/fs/search-rg.js.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/errors.d.ts +5 -2
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +10 -4
- package/dist/lib/errors.js.map +1 -1
- package/dist/mesa.d.ts +29 -97
- package/dist/mesa.d.ts.map +1 -1
- package/dist/mesa.js +75 -153
- package/dist/mesa.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/webhooks/schemas.d.ts +20 -20
- package/dist/webhooks/schemas.d.ts.map +1 -1
- package/dist/webhooks/schemas.js +8 -1
- package/dist/webhooks/schemas.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `rg` that searches next to the storage instead of walking the mount.
|
|
3
|
+
*
|
|
4
|
+
* just-bash's built-in `rg` reads the filesystem, which over a Mesa mount costs
|
|
5
|
+
* a round trip per directory. This one translates the same command line into a
|
|
6
|
+
* single repository search and formats the response the way ripgrep would.
|
|
7
|
+
*
|
|
8
|
+
* A path may span several repositories, because a layout can nest one mount
|
|
9
|
+
* inside another. Each becomes its own search, issued in parallel, with the
|
|
10
|
+
* parent excluding the subtrees its children shadow so no file is counted
|
|
11
|
+
* twice or attributed to the wrong repository.
|
|
12
|
+
*
|
|
13
|
+
* It only replaces the built-in when it can answer exactly what was asked. A
|
|
14
|
+
* flag it does not implement, or a path outside every mount, defers to the
|
|
15
|
+
* built-in, so the worst case is the behaviour that exists today rather than a
|
|
16
|
+
* wrong answer.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Searches issued at once for a single command.
|
|
20
|
+
*
|
|
21
|
+
* The server admits a small number of concurrent searches per task, so a
|
|
22
|
+
* layout with many nested repositories would otherwise let one `rg` fill the
|
|
23
|
+
* queue by itself and stall every other caller.
|
|
24
|
+
*/
|
|
25
|
+
export const MAX_PARALLEL_LEGS = 4;
|
|
26
|
+
/**
|
|
27
|
+
* Flatten a layout into the repository roots it presents, longest path first.
|
|
28
|
+
*
|
|
29
|
+
* A single declaration mounts at its key; an array mounts each element in a
|
|
30
|
+
* child directory named by its alias. Nested declarations shadow the parent at
|
|
31
|
+
* their own path, which is why the list is ordered longest-first: the deepest
|
|
32
|
+
* mount containing a path is the one that owns it.
|
|
33
|
+
*/
|
|
34
|
+
export function mountsFromLayout(layout) {
|
|
35
|
+
const mounts = [];
|
|
36
|
+
const visit = (base, entries) => {
|
|
37
|
+
for (const [key, entry] of Object.entries(entries)) {
|
|
38
|
+
const parent = joinPath(base, key);
|
|
39
|
+
const declarations = Array.isArray(entry) ? entry : [entry];
|
|
40
|
+
for (const declaration of declarations) {
|
|
41
|
+
// A lone declaration is the directory; siblings each get their own.
|
|
42
|
+
const path = Array.isArray(entry) ? joinPath(parent, declaration.alias ?? declaration.name) : parent;
|
|
43
|
+
mounts.push({
|
|
44
|
+
path,
|
|
45
|
+
repo: declaration.name,
|
|
46
|
+
bookmark: declaration.at?.bookmark,
|
|
47
|
+
changeId: declaration.at?.changeId,
|
|
48
|
+
});
|
|
49
|
+
if (declaration.subPaths)
|
|
50
|
+
visit(path, declaration.subPaths);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
visit('', layout);
|
|
55
|
+
return mounts.sort((a, b) => b.path.length - a.path.length);
|
|
56
|
+
}
|
|
57
|
+
function joinPath(base, segment) {
|
|
58
|
+
const trimmed = segment.replace(/^\/+|\/+$/g, '');
|
|
59
|
+
return trimmed === '' ? base || '/' : `${base}/${trimmed}`;
|
|
60
|
+
}
|
|
61
|
+
/** Absolute form of a path as typed on the command line. */
|
|
62
|
+
export function absolute(cwd, path) {
|
|
63
|
+
if (path.startsWith('/'))
|
|
64
|
+
return path.replace(/\/+$/, '') || '/';
|
|
65
|
+
const base = cwd.replace(/\/+$/, '');
|
|
66
|
+
const joined = path === '.' || path === '' ? base : `${base}/${path}`;
|
|
67
|
+
return joined.replace(/\/+$/, '') || '/';
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Split a target path into one search per repository it covers.
|
|
71
|
+
*
|
|
72
|
+
* The mount containing the target supplies the first leg, scoped to the part
|
|
73
|
+
* of the target below its root. Every mount nested under the target supplies
|
|
74
|
+
* another, searched whole. A parent excludes each nested mount's subtree,
|
|
75
|
+
* because in the mount namespace those paths show the child's content, not
|
|
76
|
+
* the parent's.
|
|
77
|
+
*/
|
|
78
|
+
/** Whether `child` sits strictly inside `parent`. The root contains everything. */
|
|
79
|
+
function isUnder(child, parent) {
|
|
80
|
+
return parent === '/' ? child !== '/' : child.startsWith(`${parent}/`);
|
|
81
|
+
}
|
|
82
|
+
export function resolveLegs(target, mounts) {
|
|
83
|
+
const owner = mounts.find((mount) => target === mount.path || isUnder(target, mount.path));
|
|
84
|
+
// A target above every mount — the namespace root, most obviously — belongs
|
|
85
|
+
// to no repository but still covers several, so it yields a leg for each
|
|
86
|
+
// rather than falling back to a walk of the whole mount.
|
|
87
|
+
const nested = mounts.filter((mount) => isUnder(mount.path, target));
|
|
88
|
+
if (!owner && nested.length === 0) {
|
|
89
|
+
return { unservable: `${target} is not inside a Mesa repository` };
|
|
90
|
+
}
|
|
91
|
+
const covered = owner ? [owner, ...nested] : nested;
|
|
92
|
+
return covered.map((mount) => ({
|
|
93
|
+
mount,
|
|
94
|
+
pathPrefix: mount === owner ? target.slice(owner.path.length).replace(/^\/+/, '') : '',
|
|
95
|
+
excludes: covered
|
|
96
|
+
.filter((other) => other !== mount && isUnder(other.path, mount.path))
|
|
97
|
+
.map((child) => `${child.path.slice(mount.path.length).replace(/^\/+/, '')}/**`),
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Translate a ripgrep command line into one search.
|
|
102
|
+
*
|
|
103
|
+
* The supported set is deliberately small. Anything else defers rather than
|
|
104
|
+
* approximating, because a flag that silently does nothing changes the answer.
|
|
105
|
+
*/
|
|
106
|
+
export function planSearch(args, cwd, mounts) {
|
|
107
|
+
args = expandShortFlags(args, 'eg');
|
|
108
|
+
let pattern;
|
|
109
|
+
const targets = [];
|
|
110
|
+
const globs = [];
|
|
111
|
+
let mode = 'lines';
|
|
112
|
+
// The built-in `rg` is smart-case by default, unlike ripgrep itself, and the
|
|
113
|
+
// served answer has to agree with the one the fallback would give.
|
|
114
|
+
let caseMode = 'smart';
|
|
115
|
+
let literal = false;
|
|
116
|
+
let word = false;
|
|
117
|
+
let hidden = false;
|
|
118
|
+
for (let i = 0; i < args.length; i++) {
|
|
119
|
+
const arg = args[i] ?? '';
|
|
120
|
+
if (arg === '--') {
|
|
121
|
+
// Everything after is positional, pattern first.
|
|
122
|
+
for (const rest of args.slice(i + 1)) {
|
|
123
|
+
if (pattern === undefined)
|
|
124
|
+
pattern = rest;
|
|
125
|
+
else
|
|
126
|
+
targets.push(rest);
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
if (!arg.startsWith('-') || arg === '-') {
|
|
131
|
+
if (pattern === undefined)
|
|
132
|
+
pattern = arg;
|
|
133
|
+
else
|
|
134
|
+
targets.push(arg);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
switch (arg) {
|
|
138
|
+
case '-i':
|
|
139
|
+
case '--ignore-case':
|
|
140
|
+
caseMode = 'insensitive';
|
|
141
|
+
break;
|
|
142
|
+
case '-s':
|
|
143
|
+
case '--case-sensitive':
|
|
144
|
+
caseMode = 'sensitive';
|
|
145
|
+
break;
|
|
146
|
+
case '-S':
|
|
147
|
+
case '--smart-case':
|
|
148
|
+
caseMode = 'smart';
|
|
149
|
+
break;
|
|
150
|
+
case '-F':
|
|
151
|
+
case '--fixed-strings':
|
|
152
|
+
literal = true;
|
|
153
|
+
break;
|
|
154
|
+
case '-w':
|
|
155
|
+
case '--word-regexp':
|
|
156
|
+
word = true;
|
|
157
|
+
break;
|
|
158
|
+
case '-c':
|
|
159
|
+
case '--count':
|
|
160
|
+
mode = 'count';
|
|
161
|
+
break;
|
|
162
|
+
case '-l':
|
|
163
|
+
case '--files-with-matches':
|
|
164
|
+
mode = 'files';
|
|
165
|
+
break;
|
|
166
|
+
case '--hidden':
|
|
167
|
+
hidden = true;
|
|
168
|
+
break;
|
|
169
|
+
case '-n':
|
|
170
|
+
case '--line-number':
|
|
171
|
+
// Line numbers are always available; this is the default shape.
|
|
172
|
+
break;
|
|
173
|
+
case '-g':
|
|
174
|
+
case '--glob': {
|
|
175
|
+
const glob = args[++i];
|
|
176
|
+
if (glob === undefined)
|
|
177
|
+
return { unservable: `${arg} requires a pattern` };
|
|
178
|
+
globs.push(glob);
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
default:
|
|
182
|
+
return { unservable: `${arg} is not supported by server-side search` };
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (pattern === undefined)
|
|
186
|
+
return { unservable: 'no pattern given' };
|
|
187
|
+
if (targets.length > 1)
|
|
188
|
+
return { unservable: 'more than one search path' };
|
|
189
|
+
const typed = targets[0] ?? '.';
|
|
190
|
+
const absoluteTarget = absolute(cwd, typed);
|
|
191
|
+
const legs = resolveLegs(absoluteTarget, mounts);
|
|
192
|
+
if ('unservable' in legs)
|
|
193
|
+
return legs;
|
|
194
|
+
return {
|
|
195
|
+
legs,
|
|
196
|
+
target: { typed, absolute: absoluteTarget },
|
|
197
|
+
hidden,
|
|
198
|
+
request: { pattern, mode, caseMode, literal, word, includeGlobs: globs, excludeGlobs: [] },
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Read a search as it arrives, one row per line.
|
|
203
|
+
*
|
|
204
|
+
* The endpoint answers only in newline-delimited JSON, so rows are parsed and
|
|
205
|
+
* handed on as they land rather than accumulating the whole response first.
|
|
206
|
+
*/
|
|
207
|
+
async function* searchEvents(url, config, doFetch) {
|
|
208
|
+
const response = await doFetch(url, { headers: { Authorization: `Bearer ${config.accessToken}` } });
|
|
209
|
+
if (!response.ok) {
|
|
210
|
+
throw new Error(`search returned ${response.status}`);
|
|
211
|
+
}
|
|
212
|
+
if (!response.body) {
|
|
213
|
+
throw new Error('search returned no body');
|
|
214
|
+
}
|
|
215
|
+
const decoder = new TextDecoder();
|
|
216
|
+
let pending = '';
|
|
217
|
+
for await (const chunk of response.body) {
|
|
218
|
+
pending += decoder.decode(chunk, { stream: true });
|
|
219
|
+
// A chunk boundary can fall mid-row, so only whole lines are parsed and
|
|
220
|
+
// the remainder waits for the next chunk.
|
|
221
|
+
let newline = pending.indexOf('\n');
|
|
222
|
+
while (newline >= 0) {
|
|
223
|
+
const line = pending.slice(0, newline).trim();
|
|
224
|
+
pending = pending.slice(newline + 1);
|
|
225
|
+
if (line !== '')
|
|
226
|
+
yield JSON.parse(line);
|
|
227
|
+
newline = pending.indexOf('\n');
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const last = pending.trim();
|
|
231
|
+
if (last !== '')
|
|
232
|
+
yield JSON.parse(last);
|
|
233
|
+
}
|
|
234
|
+
function buildUrl(config, request, leg) {
|
|
235
|
+
const params = new URLSearchParams({ q: request.pattern, mode: request.mode });
|
|
236
|
+
params.set('case', request.caseMode);
|
|
237
|
+
if (request.literal)
|
|
238
|
+
params.set('literal', 'true');
|
|
239
|
+
if (request.word)
|
|
240
|
+
params.set('word', 'true');
|
|
241
|
+
if (leg.pathPrefix)
|
|
242
|
+
params.set('path', leg.pathPrefix);
|
|
243
|
+
for (const glob of request.includeGlobs)
|
|
244
|
+
params.append('include', glob);
|
|
245
|
+
// Carve out what a nested mount covers, so the parent does not answer for
|
|
246
|
+
// paths the namespace shows as the child's.
|
|
247
|
+
for (const exclude of [...leg.excludes, ...request.excludeGlobs])
|
|
248
|
+
params.append('exclude', exclude);
|
|
249
|
+
// A layout may pin either, and the server defaults to the repo's bookmark.
|
|
250
|
+
if (leg.mount.changeId)
|
|
251
|
+
params.set('change_id', leg.mount.changeId);
|
|
252
|
+
else if (leg.mount.bookmark)
|
|
253
|
+
params.set('bookmark', leg.mount.bookmark);
|
|
254
|
+
return `${config.apiBaseUrl}/${config.org}/${leg.mount.repo}/search?${params}`;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Run one leg's search, yielding each matching file as its row arrives.
|
|
258
|
+
*
|
|
259
|
+
* Shared by both command overrides so there is a single place that knows how
|
|
260
|
+
* the endpoint is addressed and how its rows arrive.
|
|
261
|
+
*/
|
|
262
|
+
export async function* searchLeg(config, leg, request) {
|
|
263
|
+
const doFetch = config.fetch ?? globalThis.fetch;
|
|
264
|
+
for await (const event of searchEvents(buildUrl(config, request, leg), config, doFetch)) {
|
|
265
|
+
if (event.type === 'match')
|
|
266
|
+
yield event;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Whether the search target is a directory the endpoint can search under.
|
|
271
|
+
*
|
|
272
|
+
* The endpoint's path prefix names a directory, so a file operand or a missing
|
|
273
|
+
* path would come back empty where the built-in prints the file's matches or
|
|
274
|
+
* its own error. Either way the built-in has to answer.
|
|
275
|
+
*/
|
|
276
|
+
export async function isDirectory(ctx, path) {
|
|
277
|
+
try {
|
|
278
|
+
return (await ctx.fs.stat(path)).isDirectory;
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/** The part of a path below the directory the caller named. */
|
|
285
|
+
export function belowTarget(absolutePath, target) {
|
|
286
|
+
return absolutePath.slice(target.absolute.length).replace(/^\/+/, '');
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Name a file the way ripgrep would, given how the caller named the directory.
|
|
290
|
+
*
|
|
291
|
+
* `rg love sonnets` reports `sonnets/x.md`, `rg love /repo/sonnets` reports
|
|
292
|
+
* `/repo/sonnets/x.md`, and a bare `rg love` reports paths relative to the
|
|
293
|
+
* working directory.
|
|
294
|
+
*/
|
|
295
|
+
export function displayPath(suffix, target) {
|
|
296
|
+
if (target.typed === '.' || target.typed === '')
|
|
297
|
+
return suffix;
|
|
298
|
+
return `${target.typed.replace(/\/+$/, '')}/${suffix}`;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Whether ripgrep would have walked past this file without opening it.
|
|
302
|
+
*
|
|
303
|
+
* ripgrep skips dot-prefixed entries during traversal, but searches a path the
|
|
304
|
+
* caller named explicitly even when it is hidden. Only the part below the
|
|
305
|
+
* named directory is examined, so `rg foo .agents` still searches `.agents`.
|
|
306
|
+
*
|
|
307
|
+
* The search endpoint does not apply this rule — hiding dotfiles is a
|
|
308
|
+
* convention of the command-line tool, not of the repository — so `rg` applies
|
|
309
|
+
* it here instead.
|
|
310
|
+
*/
|
|
311
|
+
export function isHidden(suffix) {
|
|
312
|
+
return suffix.split('/').some((segment) => segment.startsWith('.'));
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Translate one `.gitignore` line into repository-root-relative exclude globs.
|
|
316
|
+
*
|
|
317
|
+
* `dir` is the directory holding the ignore file, so a nested file's rules
|
|
318
|
+
* stay scoped to its own subtree. A bare name matches at any depth below that
|
|
319
|
+
* directory and may name either a file or a directory, so it yields both forms.
|
|
320
|
+
*
|
|
321
|
+
* Returns nothing for blanks and comments, and `null` for a negation, which
|
|
322
|
+
* the exclude parameter cannot express: the server prefixes every exclude with
|
|
323
|
+
* `!` already, so a re-inclusion would arrive as a double negation.
|
|
324
|
+
*/
|
|
325
|
+
export function gitignoreLineToGlobs(line, dir) {
|
|
326
|
+
const pattern = line.trim();
|
|
327
|
+
if (pattern === '' || pattern.startsWith('#'))
|
|
328
|
+
return [];
|
|
329
|
+
if (pattern.startsWith('!'))
|
|
330
|
+
return null;
|
|
331
|
+
const under = (rest) => (dir === '' ? rest : `${dir}/${rest}`);
|
|
332
|
+
const directoryOnly = pattern.endsWith('/');
|
|
333
|
+
const body = (directoryOnly ? pattern.slice(0, -1) : pattern).replace(/^\/+/, '');
|
|
334
|
+
if (body === '')
|
|
335
|
+
return [];
|
|
336
|
+
// A slash anywhere but the end anchors the pattern to this directory;
|
|
337
|
+
// otherwise it matches a basename at any depth below it.
|
|
338
|
+
const anchored = pattern.startsWith('/') || pattern.slice(0, -1).includes('/');
|
|
339
|
+
const base = anchored ? under(body) : under(`**/${body}`);
|
|
340
|
+
return directoryOnly ? [`${base}/**`] : [`${base}`, `${base}/**`];
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Every ignore rule in a subtree, as exclude globs, or `null` when one of them
|
|
344
|
+
* cannot be expressed and the caller should fall back.
|
|
345
|
+
*
|
|
346
|
+
* The ignore files are read through the search endpoint rather than the mount:
|
|
347
|
+
* one request returns the contents of every `.gitignore` under the path, where
|
|
348
|
+
* walking the tree for them would cost the round trips this command exists to
|
|
349
|
+
* avoid.
|
|
350
|
+
*/
|
|
351
|
+
export function gitignoreExcludes(files) {
|
|
352
|
+
const globs = [];
|
|
353
|
+
for (const file of files) {
|
|
354
|
+
const dir = file.path.includes('/') ? file.path.slice(0, file.path.lastIndexOf('/')) : '';
|
|
355
|
+
for (const line of file.lines) {
|
|
356
|
+
const translated = gitignoreLineToGlobs(line, dir);
|
|
357
|
+
if (translated === null)
|
|
358
|
+
return null;
|
|
359
|
+
globs.push(...translated);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return globs;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Read every `.gitignore` under a leg and translate it into exclude globs.
|
|
366
|
+
*
|
|
367
|
+
* One search returns the contents of all of them: the pattern matches any
|
|
368
|
+
* non-empty line, and a glob without a slash matches a basename at any depth.
|
|
369
|
+
*/
|
|
370
|
+
async function ignoreExcludesFor(config, leg, doFetch) {
|
|
371
|
+
const params = new URLSearchParams({ q: '.', mode: 'lines', include: '.gitignore' });
|
|
372
|
+
if (leg.pathPrefix)
|
|
373
|
+
params.set('path', leg.pathPrefix);
|
|
374
|
+
if (leg.mount.changeId)
|
|
375
|
+
params.set('change_id', leg.mount.changeId);
|
|
376
|
+
else if (leg.mount.bookmark)
|
|
377
|
+
params.set('bookmark', leg.mount.bookmark);
|
|
378
|
+
const url = `${config.apiBaseUrl}/${config.org}/${leg.mount.repo}/search?${params}`;
|
|
379
|
+
const files = [];
|
|
380
|
+
for await (const event of searchEvents(url, config, doFetch)) {
|
|
381
|
+
if (event.type === 'match') {
|
|
382
|
+
files.push({ path: event.path, lines: event.lines.map((line) => line.text) });
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return gitignoreExcludes(files);
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Split clustered short flags into separate ones.
|
|
389
|
+
*
|
|
390
|
+
* `-rn` means `-r -n`, which is how people actually type these commands. The
|
|
391
|
+
* built-in clusters boolean flags only — `-re PATTERN` is an error there rather
|
|
392
|
+
* than a pattern flag — so a cluster naming any flag that takes a value is left
|
|
393
|
+
* whole, and the built-in gets to reject it in its own words.
|
|
394
|
+
*
|
|
395
|
+
* `valueFlags` is the set of short flags that consume the next argument.
|
|
396
|
+
*/
|
|
397
|
+
export function expandShortFlags(args, valueFlags) {
|
|
398
|
+
const expanded = [];
|
|
399
|
+
for (const [index, arg] of args.entries()) {
|
|
400
|
+
if (arg === '--') {
|
|
401
|
+
// Everything past this point is positional, clusters included.
|
|
402
|
+
expanded.push(...args.slice(index));
|
|
403
|
+
return expanded;
|
|
404
|
+
}
|
|
405
|
+
const isCluster = arg.length > 2 && arg.startsWith('-') && !arg.startsWith('--');
|
|
406
|
+
const letters = isCluster ? arg.slice(1) : '';
|
|
407
|
+
if (isCluster && ![...letters].some((letter) => valueFlags.includes(letter))) {
|
|
408
|
+
expanded.push(...[...letters].map((letter) => `-${letter}`));
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
expanded.push(arg);
|
|
412
|
+
}
|
|
413
|
+
return expanded;
|
|
414
|
+
}
|
|
415
|
+
/** Run `work` over `items`, at most `limit` at a time, preserving input order. */
|
|
416
|
+
export async function mapBounded(items, limit, work) {
|
|
417
|
+
const results = new Array(items.length);
|
|
418
|
+
let next = 0;
|
|
419
|
+
const runner = async () => {
|
|
420
|
+
while (next < items.length) {
|
|
421
|
+
const index = next++;
|
|
422
|
+
results[index] = await work(items[index]);
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, runner));
|
|
426
|
+
return results;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Render results the way ripgrep does, so a caller piping into `head` or
|
|
430
|
+
* `cut -d:` cannot tell the difference.
|
|
431
|
+
*
|
|
432
|
+
* Order is arrival order, which is what ripgrep itself produces: it searches
|
|
433
|
+
* in parallel and prints each file as it finishes, so two runs over the same
|
|
434
|
+
* tree need not agree. Sorting is `--sort path` there, and the manual is blunt
|
|
435
|
+
* about the price — it "forces ripgrep to abandon parallelism and run in a
|
|
436
|
+
* single thread". Imposing it here would have been a divergence dressed up as
|
|
437
|
+
* tidiness; `| sort` remains available to anyone who wants it.
|
|
438
|
+
*/
|
|
439
|
+
function format(matches, query) {
|
|
440
|
+
if (query.request.mode === 'files') {
|
|
441
|
+
return matches.map(({ path }) => `${path}\n`).join('');
|
|
442
|
+
}
|
|
443
|
+
if (query.request.mode === 'count') {
|
|
444
|
+
return matches.map(({ path, match }) => `${path}:${match.line_count}\n`).join('');
|
|
445
|
+
}
|
|
446
|
+
return matches
|
|
447
|
+
.flatMap(({ path, match }) => match.lines.map((line) => `${path}:${line.line_number}:${line.text}\n`))
|
|
448
|
+
.join('');
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Build the `rg` replacement.
|
|
452
|
+
*
|
|
453
|
+
* `fallback` runs the original command line through the built-in, and is called
|
|
454
|
+
* whenever this command cannot answer precisely.
|
|
455
|
+
*/
|
|
456
|
+
export function createSearchRg(config, fallback) {
|
|
457
|
+
const mounts = mountsFromLayout(config.layout);
|
|
458
|
+
const doFetch = config.fetch ?? globalThis.fetch;
|
|
459
|
+
return {
|
|
460
|
+
name: 'rg',
|
|
461
|
+
async execute(args, ctx) {
|
|
462
|
+
const plan = planSearch(args, ctx.cwd, mounts);
|
|
463
|
+
if ('unservable' in plan || !(await isDirectory(ctx, plan.target.absolute))) {
|
|
464
|
+
return fallback(args, ctx);
|
|
465
|
+
}
|
|
466
|
+
let responses;
|
|
467
|
+
try {
|
|
468
|
+
// Ignore rules first, so the server never fetches a blob the answer
|
|
469
|
+
// would have discarded. A repository with none costs one empty request.
|
|
470
|
+
const ignores = await mapBounded(plan.legs, MAX_PARALLEL_LEGS, (leg) => ignoreExcludesFor(config, leg, doFetch));
|
|
471
|
+
if (ignores.includes(null)) {
|
|
472
|
+
// A negation cannot be expressed as an exclude.
|
|
473
|
+
return fallback(args, ctx);
|
|
474
|
+
}
|
|
475
|
+
responses = await mapBounded(plan.legs, MAX_PARALLEL_LEGS, async (leg) => {
|
|
476
|
+
const extra = ignores[plan.legs.indexOf(leg)] ?? [];
|
|
477
|
+
const root = leg.mount.path === '/' ? '' : leg.mount.path;
|
|
478
|
+
const kept = [];
|
|
479
|
+
// Rows are filtered and reshaped as they arrive, so a file the answer
|
|
480
|
+
// will not mention is never held.
|
|
481
|
+
for await (const match of searchLeg(config, leg, { ...plan.request, excludeGlobs: extra })) {
|
|
482
|
+
const suffix = belowTarget(`${root}/${match.path}`, plan.target);
|
|
483
|
+
if (!plan.hidden && isHidden(suffix))
|
|
484
|
+
continue;
|
|
485
|
+
kept.push({ path: displayPath(suffix, plan.target), match });
|
|
486
|
+
}
|
|
487
|
+
return kept;
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
catch {
|
|
491
|
+
// Any leg failing makes the whole answer partial, and a partial `rg`
|
|
492
|
+
// result is a wrong one. The mount can still answer without us.
|
|
493
|
+
return fallback(args, ctx);
|
|
494
|
+
}
|
|
495
|
+
const matches = responses.flat();
|
|
496
|
+
const stdout = format(matches, plan);
|
|
497
|
+
// ripgrep's convention: 0 when something matched, 1 when nothing did.
|
|
498
|
+
return { stdout, stderr: '', exitCode: matches.length > 0 ? 0 : 1 };
|
|
499
|
+
},
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
//# sourceMappingURL=search-rg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-rg.js","sourceRoot":"","sources":["../../src/fs/search-rg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAwDH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAcnC;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,MAAM,MAAM,GAAY,EAAE,CAAC;IAE3B,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,OAAsC,EAAQ,EAAE;QAC3E,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACnD,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YACnC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YAC5D,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;gBACvC,oEAAoE;gBACpE,MAAM,IAAI,GAAG,KAAK,CAAC,O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AAE,IAAI,CAAC,MAAM,CAAC,CAAC;wBACjE,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC;4BAAE,SAAS;wBAC/C,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;oBAC/D,CAAC;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC,CAAC,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACP,qEAAqE;gBACrE,gEAAgE;gBAChE,OAAO,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC7B,CAAC;YAED,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;YACjC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACrC,sEAAsE;YACtE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export type { BashLogger, BashOptions, CommandName, CustomCommand, ExecResult, JavaScriptConfig, NetworkConfig, SecureFetch, } from 'just-bash';
|
|
2
2
|
export { Bash } from 'just-bash';
|
|
3
|
-
export { type RepoTagFilter, type RepoTagValueFilter
|
|
3
|
+
export { type RepoTagFilter, type RepoTagValueFilter } from './api/index.js';
|
|
4
4
|
export { VIRTUAL_ROOT_CHANGE_ID } from './constants.js';
|
|
5
|
-
export { type BookmarkCreateArgs, type BookmarkListArgs, type BookmarkOps, type BranchedRevision, type ChangeEditArgs, type ChangeInfo, type ChangeListArgs, type ChangeNewArgs, type ChangeOps, type ChangeResult, type CheckpointResult, type ChangeRevArgs, type Layout, type
|
|
5
|
+
export { type BookmarkCreateArgs, type BookmarkListArgs, type BookmarkOps, type BranchedRevision, type ChangeEditArgs, type ChangeInfo, type ChangeListArgs, type ChangeNewArgs, type ChangeOps, type ChangeResult, type CheckpointResult, type ChangeRevArgs, type Layout, type LogRecord, type MesaBashOptions, type MesaFileSystem, type MesaFileSystemConfig, MesaFileSystemSubscription, type MountMode, type MountRevisionProperties, repo, type Repo, type RepoConfig, type RepoOptions, type RepoSelectorInput, type RevisionIdentifier, type TelemetryConfig, type WatchEvent, type WatchEventHandler, } from './fs/index.js';
|
|
6
6
|
export * from './lib/errors.js';
|
|
7
|
-
export { type
|
|
7
|
+
export { type Author } from './api/access-token.js';
|
|
8
|
+
export { type AccessToken, type FilesystemDefinition, type FsMountRuntimeOptions, Mesa, type MesaOptions, } from './mesa.js';
|
|
8
9
|
export { type BookmarkCreatedPayload, BookmarkCreatedPayloadSchema, type BookmarkDeletedPayload, BookmarkDeletedPayloadSchema, type BookmarkMergedPayload, BookmarkMergedPayloadSchema, type BookmarkMovedPayload, BookmarkMovedPayloadSchema, type ChangeCreatedPayload, ChangeCreatedPayloadSchema, type ChangeEvolvedPayload, ChangeEvolvedPayloadSchema, type PushPayload, PushPayloadSchema, type RepoCreatedPayload, RepoCreatedPayloadSchema, type RepoDeletedPayload, RepoDeletedPayloadSchema, type RepoUpdatedPayload, RepoUpdatedPayloadSchema, type WebhookEvent, type WebhookEventName, type WebhookEventOf, WebhookEventSchema, type WebhookHandler, } from './webhooks/index.js';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,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AsB,EAC3B,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,KAAK,oBAAoB,EACzB,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,0BAA0B,EAC1B,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,wBAAwB,EACxB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,kBAAkB,EAClB,KAAK,cAAc,GACpB,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { Bash } from 'just-bash';
|
|
2
2
|
export {} from './api/index.js';
|
|
3
3
|
export { VIRTUAL_ROOT_CHANGE_ID } from './constants.js';
|
|
4
|
-
export {
|
|
4
|
+
export { MesaFileSystemSubscription, repo, } from './fs/index.js';
|
|
5
5
|
export * from './lib/errors.js';
|
|
6
|
-
export {
|
|
6
|
+
export {} from './api/access-token.js';
|
|
7
|
+
export { Mesa, } from './mesa.js';
|
|
7
8
|
export { BookmarkCreatedPayloadSchema, BookmarkDeletedPayloadSchema, BookmarkMergedPayloadSchema, BookmarkMovedPayloadSchema, ChangeCreatedPayloadSchema, ChangeEvolvedPayloadSchema, PushPayloadSchema, RepoCreatedPayloadSchema, RepoDeletedPayloadSchema, RepoUpdatedPayloadSchema, WebhookEventSchema, } from './webhooks/index.js';
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAA+C,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAsBL,0BAA0B,EAG1B,IAAI,GASL,MAAM,eAAe,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAe,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAIL,IAAI,GAEL,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,4BAA4B,EAE5B,4BAA4B,EAE5B,2BAA2B,EAE3B,0BAA0B,EAE1B,0BAA0B,EAE1B,0BAA0B,EAE1B,iBAAiB,EAEjB,wBAAwB,EAExB,wBAAwB,EAExB,wBAAwB,EAIxB,kBAAkB,GAEnB,MAAM,qBAAqB,CAAC"}
|
package/dist/lib/errors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type MesaErrorCode = 'INVALID_API_URL' | 'INVALID_OPTIONS' | '
|
|
1
|
+
export type MesaErrorCode = 'INVALID_API_URL' | 'INVALID_OPTIONS' | 'MISSING_ACCESS_TOKEN' | 'MISSING_PRIVATE_KEY' | 'MISSING_WEBHOOK_SECRET' | 'ORG_RESOLUTION_FAILED' | 'WEBHOOK_VERIFICATION_FAILED';
|
|
2
2
|
export declare class MesaError extends Error {
|
|
3
3
|
readonly code: MesaErrorCode;
|
|
4
4
|
constructor(code: MesaErrorCode, message: string, options?: ErrorOptions);
|
|
@@ -18,7 +18,10 @@ export declare class MesaApiError extends Error {
|
|
|
18
18
|
readonly status?: number;
|
|
19
19
|
constructor({ body, cause, code, headers, message, status }: MesaApiErrorOptions);
|
|
20
20
|
}
|
|
21
|
-
export declare class
|
|
21
|
+
export declare class MissingPrivateKeyError extends MesaError {
|
|
22
|
+
constructor(message?: string);
|
|
23
|
+
}
|
|
24
|
+
export declare class MissingAccessTokenError extends MesaError {
|
|
22
25
|
constructor(message?: string);
|
|
23
26
|
}
|
|
24
27
|
export declare class InvalidApiUrlError extends MesaError {
|
package/dist/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,iBAAiB,GACjB,iBAAiB,GACjB,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,iBAAiB,GACjB,iBAAiB,GACjB,sBAAsB,GACtB,qBAAqB,GACrB,wBAAwB,GACxB,uBAAuB,GACvB,6BAA6B,CAAC;AAElC,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;gBAEjB,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAKzE;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEb,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,mBAAmB;CAQjF;AAED,qBAAa,sBAAuB,SAAQ,SAAS;gBACvC,OAAO,SAAyB;CAI7C;AAED,qBAAa,uBAAwB,SAAQ,SAAS;gBACxC,OAAO,SAA0B;CAI9C;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,MAAM,EAAE,MAAM;CAI3B;AAED,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,qBAAa,4BAA6B,SAAQ,SAAS;gBAC7C,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,qBAAa,yBAA0B,SAAQ,SAAS;;CAKvD"}
|
package/dist/lib/errors.js
CHANGED
|
@@ -20,10 +20,16 @@ export class MesaApiError extends Error {
|
|
|
20
20
|
this.status = status;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
export class
|
|
24
|
-
constructor(message = 'Missing
|
|
25
|
-
super('
|
|
26
|
-
this.name = '
|
|
23
|
+
export class MissingPrivateKeyError extends MesaError {
|
|
24
|
+
constructor(message = 'Missing private key.') {
|
|
25
|
+
super('MISSING_PRIVATE_KEY', message);
|
|
26
|
+
this.name = 'MissingPrivateKeyError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class MissingAccessTokenError extends MesaError {
|
|
30
|
+
constructor(message = 'Missing access token.') {
|
|
31
|
+
super('MISSING_ACCESS_TOKEN', message);
|
|
32
|
+
this.name = 'MissingAccessTokenError';
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
export class InvalidApiUrlError extends MesaError {
|
package/dist/lib/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"err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