@framers/agentos-ext-github 0.7.0 → 0.9.0

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.
@@ -1,13 +1,70 @@
1
1
  /**
2
2
  * @fileoverview A repository's documentation as account sources, read through a GitHub App's installation: each
3
- * repository read by its id, its tree read once a commit within a request budget, the documentation kept by a filter,
4
- * each file read as raw bytes under a cap, and a push compared by the tree at its `after` commit. A selection, an item
5
- * or a call it cannot answer whole is refused before any request.
3
+ * repository read by its id at its default branch or at a named branch or commit, whole or within a folder, its tree
4
+ * read once a commit within a request budget, the documentation kept by a filter, each file read as raw bytes under a
5
+ * cap, a push compared by the tree at its `after` commit, and a link's ref settled as a branch (where its name holds a
6
+ * slash), a tag or a commit. A selection, an item or a call it cannot answer whole is refused before any request.
6
7
  * @module agentos-ext-github/documents/GitHubDocumentsConnector
7
8
  */
8
9
  import { ReadCapExceeded, } from '@framers/agentos-ext-account-sources';
9
- import { GITHUB_API_BASE, GitHubApiError, githubFetch, GitHubNoAnswer, githubSend, objectOf, repositoryPath, stringIn } from '../app/http.js';
10
- import { DEFAULT_MAX_FILE_BYTES, extensionOf, pathFilter, readTree, SKIPPED_FOLDERS } from './tree.js';
10
+ import { arrayOf, GITHUB_API_BASE, GitHubApiError, githubFetch, GitHubNoAnswer, githubSend, objectOf, repositoryPath, stringIn } from '../app/http.js';
11
+ import { DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_FILES, extensionOf, pathFilter, pathOf, readTree, SKIPPED_FOLDERS, withinPath, } from './tree.js';
12
+ /** A commit as a link or a caller names it: 40 hexadecimal characters, in either case. */
13
+ const COMMIT = /^[0-9a-f]{40}$/i;
14
+ /** A commit named by its first characters, as git shortens it: 4 to 39 hexadecimal characters, in either case. */
15
+ const SHORT_COMMIT = /^[0-9a-f]{4,39}$/i;
16
+ /** GitHub's media type for a commit's sha alone (https://docs.github.com/en/rest/commits/commits#get-a-commit). */
17
+ const COMMIT_SHA_MEDIA_TYPE = 'application/vnd.github.sha';
18
+ /** The most bytes read of a commit's sha alone: 40 characters, and room to spare. */
19
+ const COMMIT_SHA_BYTES = 1_024;
20
+ /** The most annotated tags followed from a tag to the commit it names: a tag of a tag is rare. */
21
+ const MAX_TAG_DEPTH = 8;
22
+ /** The characters no branch name holds, beside the control characters and the space (`git check-ref-format`). */
23
+ const NOT_IN_BRANCH = '~^:?*[\\';
24
+ /**
25
+ * True for a name git takes as a branch's (https://git-scm.com/docs/git-check-ref-format, with `--branch`): no part
26
+ * empty, starting with a dot or ending in `.lock`; no `..`, `@{`, control character, space, `~`, `^`, `:`, `?`, `*`,
27
+ * `[` or `\`; not ending with a dot, and neither `@` nor `HEAD`, nor starting with a dash.
28
+ */
29
+ function isBranchName(name) {
30
+ if (name === '' || name === '@' || name === 'HEAD' || name.startsWith('-') || name.endsWith('.'))
31
+ return false;
32
+ if (name.includes('..') || name.includes('@{'))
33
+ return false;
34
+ for (let index = 0; index < name.length; index += 1) {
35
+ const code = name.charCodeAt(index);
36
+ if (code <= 0x20 || code === 0x7f || NOT_IN_BRANCH.includes(name[index]))
37
+ return false;
38
+ }
39
+ return name.split('/').every((part) => part !== '' && !part.startsWith('.') && !part.endsWith('.lock'));
40
+ }
41
+ /**
42
+ * True for a text that may begin a ref's name by git's rules (https://git-scm.com/docs/git-check-ref-format): no
43
+ * control character, space, `~`, `^`, `:`, `?`, `*`, `[` or `\`, no `..` or `@{`, not starting with a dot and not
44
+ * ending in `.lock`. A part of a longer name may end with a dot, and a tag's may start with a dash, which a branch's
45
+ * whole name may not: `isBranchName` reads those.
46
+ */
47
+ function mayBeginRef(segment) {
48
+ if (segment.includes('..') || segment.includes('@{') || segment.startsWith('.') || segment.endsWith('.lock'))
49
+ return false;
50
+ for (let index = 0; index < segment.length; index += 1) {
51
+ const code = segment.charCodeAt(index);
52
+ if (code <= 0x20 || code === 0x7f || NOT_IN_BRANCH.includes(segment[index]))
53
+ return false;
54
+ }
55
+ return true;
56
+ }
57
+ /**
58
+ * The branch or the commit a caller's `at` names, a commit in lower case. Anything else throws a `TypeError` that
59
+ * quotes none of it, before any request.
60
+ */
61
+ function followedOf(at) {
62
+ if (typeof at === 'string' && COMMIT.test(at))
63
+ return { commit: at.toLowerCase() };
64
+ if (typeof at === 'string' && isBranchName(at))
65
+ return { branch: at };
66
+ throw new TypeError('at is a branch name or a commit of 40 hexadecimal characters');
67
+ }
11
68
  /** The files answered as bytes with their media type; every other kept file is answered as text. */
12
69
  const MEDIA_TYPES = {
13
70
  '.pdf': 'application/pdf',
@@ -64,6 +121,10 @@ function itemPathOf(id) {
64
121
  }
65
122
  return { repositoryId: repositoryIdOf(id.slice(0, colon)), path };
66
123
  }
124
+ /** True for an abort signal, as `listing` tells it from its options: a signal carries `aborted`, an options object does not. */
125
+ function isSignal(value) {
126
+ return typeof value.aborted === 'boolean';
127
+ }
67
128
  /**
68
129
  * Throws `GitHubNoAnswer` (`cancelled`) for a call whose signal is already aborted. Each call runs it first, before it
69
130
  * checks its inputs or makes any request, so an aborted call answers alike whatever its inputs, as the DOM standard
@@ -79,8 +140,15 @@ function notCancelled(signal) {
79
140
  * read. A repository id is a positive integer in decimal. A call whose signal is already aborted throws
80
141
  * `GitHubNoAnswer` (`cancelled`) before it checks anything else. What a call cannot answer whole then throws before any
81
142
  * request: a `TypeError` for an id that is not a repository id, a repository named twice, an item id that names no
82
- * file or a change set of other than one repository, and an `Error` for a repository outside the link. An
83
- * installation is removed by the app's own call (`uninstallInstallation`), never by a link's connector.
143
+ * file, a change set of other than one repository, an `at` that is neither a branch name nor a commit or that names
144
+ * other than one repository, a `path` with an empty, `.` or `..` segment or beside other than one repository, a link's
145
+ * text with an empty, `.` or `..` segment, and a link's ref that no ref name can begin with, and an `Error` for a
146
+ * repository outside the link. An installation is removed by the app's own call (`uninstallInstallation`), never by a
147
+ * link's connector.
148
+ *
149
+ * A listing and a comparison follow the default branch, or the branch or commit a selection's `at` names: a branch's
150
+ * head is read when the call is made, a commit is read as it is and never changes. A selection's `path` narrows them to
151
+ * a folder, or a file, before `maxFiles` counts the files.
84
152
  *
85
153
  * Every read addresses a linked repository by its id (`/repositories/<id>/...`, where GitHub's own redirects for a
86
154
  * renamed or moved repository lead), never by its name. A name can come to mean another repository (a renamed
@@ -128,45 +196,62 @@ export class GitHubDocumentsConnector {
128
196
  address(repository) {
129
197
  return `${this.apiBase}/${repositoryPath(repository.id)}`;
130
198
  }
131
- /** The head commit of a repository's default branch. */
132
- async head(repositoryId, signal) {
199
+ /** The head commit of a branch of a linked repository, its name encoded as one segment of the address. */
200
+ async branchHead(repository, branch, signal) {
201
+ const url = `${this.address(repository)}/branches/${encodeURIComponent(branch)}`;
202
+ const answer = objectOf(await githubFetch(this.fetchImpl, url, { token: await this.token(repository.id, signal), signal }), 'a branch');
203
+ return stringIn(objectOf(answer.commit, "a branch's commit"), 'sha', "a branch's commit");
204
+ }
205
+ async head(repositoryId, atOrSignal, laterSignal) {
206
+ const at = typeof atOrSignal === 'string' ? atOrSignal : undefined;
207
+ const signal = typeof atOrSignal === 'string' || atOrSignal === undefined ? laterSignal : atOrSignal;
133
208
  notCancelled(signal);
209
+ const followed = at === undefined ? undefined : followedOf(at);
134
210
  const repository = this.repository(repositoryId);
135
- const url = `${this.address(repository)}/branches/${encodeURIComponent(repository.defaultBranch)}`;
136
- const branch = objectOf(await githubFetch(this.fetchImpl, url, { token: await this.token(repositoryId, signal), signal }), 'a branch');
137
- return stringIn(objectOf(branch.commit, "a branch's commit"), 'sha', "a branch's commit");
211
+ if (followed !== undefined && 'commit' in followed)
212
+ return followed.commit;
213
+ return this.branchHead(repository, followed?.branch ?? repository.defaultBranch, signal);
138
214
  }
139
- /**
140
- * The documentation files of a repository at a commit: its tree read once within the request budget, never walking
141
- * a skipped folder, then filtered. A caller keeps it for that commit and hands it to `changesSince` with that commit
142
- * as `after`.
143
- */
144
- async listing(repositoryId, commit, signal) {
215
+ async listing(repositoryId, commit, signalOrOptions) {
216
+ const options = signalOrOptions === undefined || signalOrOptions === null || isSignal(signalOrOptions) ? { signal: signalOrOptions ?? undefined } : signalOrOptions;
217
+ const { signal } = options;
145
218
  notCancelled(signal);
219
+ const path = pathOf(options.path);
146
220
  const repository = this.repository(repositoryId);
147
221
  const tree = await readTree(this.fetchImpl, await this.token(repositoryId, signal), repository.id, commit, this.apiBase, {
148
222
  maxRequests: this.filter.maxTreeRequests,
149
223
  skipFolders: this.filter.skipFolders ?? SKIPPED_FOLDERS,
150
224
  signal,
151
225
  });
152
- return pathFilter(this.filter)(tree);
226
+ return pathFilter(this.filter)(withinPath(tree, path));
153
227
  }
154
228
  /**
155
- * The documentation of each selected repository (its id in `ids`) at its default branch's head. Every id is checked
156
- * before any repository is read, so a selection is listed whole or not at all: an id that is not a repository id, or
157
- * a repository named twice, throws a `TypeError`, and a repository outside the link an `Error`.
229
+ * The documentation of each selected repository (its id in `ids`) at its default branch's head, or of one repository
230
+ * at the branch or commit `at` names: the branch's head, or the commit itself with no branch read. With a `path`, the
231
+ * files of one repository at that folder or under it, or the one file it names, kept before `maxFiles` counts them.
232
+ * Every id, `at` and `path` are checked before any repository is read, so a selection is listed whole or not at all:
233
+ * an id that is not a repository id, a repository named twice, an `at` that is neither a branch name nor a commit, a
234
+ * `path` with an empty, `.` or `..` segment or that is not text, and an `at` or a `path` beside other than one
235
+ * repository throw a `TypeError`, and a repository outside the link an `Error`. A selection's other fields are
236
+ * `changesSince`'s, and a listing reads none of them.
158
237
  */
159
238
  async list(selection, signal) {
160
239
  notCancelled(signal);
161
240
  const ids = selection.ids.map((id) => repositoryIdOf(id));
162
241
  if (new Set(ids).size < ids.length)
163
242
  throw new TypeError('a selection names a repository more than once');
243
+ const followed = selection.at === undefined ? undefined : followedOf(selection.at);
244
+ if (followed !== undefined && ids.length !== 1)
245
+ throw new TypeError('a listing at a named branch or commit is of one repository');
246
+ const path = pathOf(selection.path);
247
+ if (path !== '' && ids.length !== 1)
248
+ throw new TypeError('a listing of a folder or a file is of one repository');
164
249
  for (const id of ids)
165
250
  this.repository(id);
166
251
  const items = [];
167
252
  for (const id of ids) {
168
- const commit = await this.head(id, signal);
169
- for (const blob of await this.listing(id, commit, signal)) {
253
+ const commit = followed === undefined ? await this.head(id, signal) : 'commit' in followed ? followed.commit : await this.head(id, followed.branch, signal);
254
+ for (const blob of await this.listing(id, commit, { path, signal })) {
170
255
  items.push({ id: `${id}:${blob.path}`, title: blob.path, size: blob.size, version: `${blob.sha}@${commit}` });
171
256
  }
172
257
  }
@@ -227,9 +312,20 @@ export class GitHubDocumentsConnector {
227
312
  * none) against the blobs read before (`cursor`: the JSON of each path's blob). A push's own commit lists are never
228
313
  * read, so a force push, or a push of more commits than its event lists, is read like any other. A cursor this
229
314
  * connector did not answer throws a `TypeError` before any request, whatever the push's branch, and so does a
230
- * selection of other than one repository, or a `listing` without the `after` commit it was read at: call it once
231
- * per repository, each with that repository's cursor. A push to another branch than the default answers no change
232
- * and the cursor it was given.
315
+ * selection of other than one repository, a `listing` without the `after` commit it was read at, or an `at` that is
316
+ * neither a branch name nor a commit: call it once per repository, each with that repository's cursor.
317
+ *
318
+ * The comparison follows the default branch, or the branch or commit `at` names. Without `after` it is made at the
319
+ * followed branch's head, or at the commit. A push to another branch than the one followed answers no change and the
320
+ * cursor it was given, and so does any push when `at` is a commit, which never changes; without a push, an `after`
321
+ * naming another commit than `at`'s throws a `TypeError` before any request.
322
+ *
323
+ * With a `path` the comparison is made within that folder, or of the one file it names: the listing at `after` keeps
324
+ * the files there before `maxFiles` counts them, so the folder's files are never answered gone for the files sorting
325
+ * before it, and a `listing` handed in is narrowed to the path (read it with `listing(repositoryId, after, { path })`
326
+ * so the count is the folder's). A listing handed in that holds `maxFiles` files may have been cut before the folder's
327
+ * files, so with a path the folder is read afresh instead of it. A cursor is compared under the path it was answered under: a path in it outside the
328
+ * one given is answered gone.
233
329
  */
234
330
  async changesSince(cursor, selection, signal) {
235
331
  notCancelled(signal);
@@ -242,12 +338,21 @@ export class GitHubDocumentsConnector {
242
338
  if (selection.listing !== undefined && selection.after === undefined) {
243
339
  throw new TypeError('a listing is compared only with the after commit it was read at');
244
340
  }
341
+ const named = selection.at === undefined ? undefined : followedOf(selection.at);
342
+ const folder = pathOf(selection.path);
245
343
  const repository = this.repository(id);
246
- if (selection.ref !== undefined && selection.ref !== `refs/heads/${repository.defaultBranch}`) {
344
+ const followed = named ?? { branch: repository.defaultBranch };
345
+ if (selection.ref !== undefined && ('commit' in followed || selection.ref !== `refs/heads/${followed.branch}`)) {
247
346
  return { changed: [], gone: [], cursor: cursor ?? '{}' };
248
347
  }
249
- const after = selection.after ?? (await this.head(id, signal));
250
- const blobs = selection.listing ?? (await this.listing(id, after, signal));
348
+ if ('commit' in followed && selection.after !== undefined && selection.after.toLowerCase() !== followed.commit) {
349
+ throw new TypeError('after names another commit than at');
350
+ }
351
+ const after = 'commit' in followed ? followed.commit : (selection.after ?? (await this.branchHead(repository, followed.branch, signal)));
352
+ // a listing at the file count may have been cut before the folder's files: narrowed, it would answer them gone
353
+ const handed = selection.listing;
354
+ const cut = handed !== undefined && folder !== '' && handed.length >= (this.filter.maxFiles ?? DEFAULT_MAX_FILES);
355
+ const blobs = handed === undefined || cut ? await this.listing(id, after, { path: folder, signal }) : withinPath(handed, folder);
251
356
  const now = new Map(blobs.map((blob) => [blob.path, blob.sha]));
252
357
  const changed = blobs
253
358
  .filter((blob) => before.get(blob.path) !== blob.sha)
@@ -255,6 +360,137 @@ export class GitHubDocumentsConnector {
255
360
  const gone = [...before.keys()].filter((path) => !now.has(path)).map((path) => ({ id: `${id}:${path}`, reason: 'removed' }));
256
361
  return { changed, gone, cursor: JSON.stringify(Object.fromEntries(now)) };
257
362
  }
363
+ /**
364
+ * The ref and the path of a folder's or a file's `<ref>/<path>` text (`parseGitHubLink`'s `refAndPath`), whose
365
+ * branch or tag name may hold a slash, answered with what the ref is (`kind`) and the name the text writes it by
366
+ * (`name`). A first segment of 40 hexadecimal characters is a commit, in lower case, and `HEAD` the default branch
367
+ * (git names no branch `HEAD`), each settled with no request. Otherwise, under an installation token narrowed to the
368
+ * repository, GitHub's matching references (https://docs.github.com/en/rest/git/refs#list-matching-references), which
369
+ * answer every reference whose name starts with the first segment, are read in turn until one settles it:
370
+ *
371
+ * 1. The branches (`/repositories/<id>/git/matching-refs/heads/<first segment>`) and the tags
372
+ * (`.../matching-refs/tags/<first segment>`): the longest name of either that is the text, or starts it at a slash,
373
+ * is the ref and the rest the path, a branch and a tag of one name settling as the branch. Git keeps a tag under a
374
+ * branch's name beside the branch (`release/2.0` beside `release`), and the longer name is the more of the link it
375
+ * names. The tags are not read when a branch's name is the whole text, since no name is longer. A tag is answered
376
+ * at the commit it names (`commit: true`), as GitHub serves a `/tree/<tag>/` address: a lightweight tag names it,
377
+ * and an annotated tag's object is read for it (https://docs.github.com/en/rest/git/tags#get-a-tag). A tag that
378
+ * names no commit is read as no tag, and the branch, if one matched, settles it.
379
+ * 2. A first segment of 4 to 39 hexadecimal characters, a short commit, through GitHub's commits under its sha media
380
+ * type (https://docs.github.com/en/rest/commits/commits#get-a-commit), which answers the whole commit, or 422 for
381
+ * a prefix no commit has or several have.
382
+ *
383
+ * A first segment neither settles is answered as a branch all the same, and a listing at it then throws GitHub's
384
+ * 404 as `GitHubApiError`; one that is no branch name by git's rules (such as `-x`, `@` or `end.`) throws a
385
+ * `TypeError` instead. A text with an empty, `.` or `..` segment, and one whose first segment no ref name can begin
386
+ * (a control character, a space, `~`, `^`, `:`, `?`, `*`, `[`, `\`, `..` or `@{`, a leading dot or a trailing
387
+ * `.lock`), throw a `TypeError` that quotes none of it, before any request; GitHub's refusal of a read, such as 409 for
388
+ * a repository with no commit, throws `GitHubApiError`.
389
+ */
390
+ async resolveRef(repositoryId, refAndPath, signal) {
391
+ notCancelled(signal);
392
+ if (typeof refAndPath !== 'string' || refAndPath.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')) {
393
+ throw new TypeError('a ref and a path have no empty, . or .. segment');
394
+ }
395
+ const repository = this.repository(repositoryId);
396
+ const first = refAndPath.split('/')[0];
397
+ const settled = (name, ref, kind) => ({
398
+ ref,
399
+ path: refAndPath.slice(name.length + 1),
400
+ commit: kind !== 'branch',
401
+ kind,
402
+ name,
403
+ });
404
+ if (COMMIT.test(first))
405
+ return settled(first, first.toLowerCase(), 'commit');
406
+ if (first === 'HEAD')
407
+ return settled(first, repository.defaultBranch, 'branch');
408
+ if (!mayBeginRef(first))
409
+ throw new TypeError('the ref of a link holds what no branch, tag or commit holds');
410
+ const token = await this.token(repository.id, signal);
411
+ const branch = await this.longestRef(repository, 'heads', first, refAndPath, token, signal);
412
+ // a tag names more of the text than the branch when its name is longer; a branch named by the whole text has no longer
413
+ const tag = branch !== null && branch.name === refAndPath ? null : await this.longestRef(repository, 'tags', first, refAndPath, token, signal);
414
+ const longer = tag !== null && (branch === null || tag.name.length > branch.name.length) ? tag : null;
415
+ const tagged = longer === null ? null : await this.tagCommit(repository, longer.fields, token, signal);
416
+ if (longer !== null && tagged !== null)
417
+ return settled(longer.name, tagged, 'tag');
418
+ if (branch !== null)
419
+ return settled(branch.name, branch.name, 'branch');
420
+ const commit = SHORT_COMMIT.test(first) ? await this.commitOf(repository, first, token, signal) : null;
421
+ if (commit !== null)
422
+ return settled(first, commit, 'commit');
423
+ if (!isBranchName(first))
424
+ throw new TypeError('the ref of a link names no branch, tag or commit of the repository');
425
+ return settled(first, first, 'branch');
426
+ }
427
+ /**
428
+ * The longest branch or tag (`space`) whose name is `text` or starts it at a slash, from GitHub's matching references
429
+ * for `first`, the text's first segment, with the reference's fields; null for none.
430
+ */
431
+ async longestRef(repository, space, first, text, token, signal) {
432
+ const url = `${this.address(repository)}/git/matching-refs/${space}/${encodeURIComponent(first)}`;
433
+ const references = arrayOf(await githubFetch(this.fetchImpl, url, { token, signal }), 'a list of references');
434
+ const prefix = `refs/${space}/`;
435
+ let found = null;
436
+ for (const reference of references) {
437
+ const fields = objectOf(reference, 'a reference');
438
+ const full = stringIn(fields, 'ref', 'a reference');
439
+ if (!full.startsWith(prefix))
440
+ continue;
441
+ const name = full.slice(prefix.length);
442
+ if ((found === null || name.length > found.name.length) && (text === name || text.startsWith(`${name}/`)))
443
+ found = { name, fields };
444
+ }
445
+ return found;
446
+ }
447
+ /**
448
+ * The commit a tag's reference names: a lightweight tag's own object, or the object an annotated tag names, read
449
+ * through GitHub's tags and followed through a tag of a tag up to {@link MAX_TAG_DEPTH}, in lower case. Null for a
450
+ * tag that names a tree or a blob, or a longer chain of tags.
451
+ */
452
+ async tagCommit(repository, reference, token, signal) {
453
+ let object = objectOf(reference.object, "a reference's object");
454
+ for (let depth = 0; stringIn(object, 'type', "a reference's object") === 'tag'; depth += 1) {
455
+ if (depth === MAX_TAG_DEPTH)
456
+ return null;
457
+ const url = `${this.address(repository)}/git/tags/${encodeURIComponent(stringIn(object, 'sha', "a reference's object"))}`;
458
+ object = objectOf(objectOf(await githubFetch(this.fetchImpl, url, { token, signal }), 'a tag').object, "a tag's object");
459
+ }
460
+ const sha = stringIn(object, 'sha', "a reference's object");
461
+ return stringIn(object, 'type', "a reference's object") === 'commit' && COMMIT.test(sha) ? sha.toLowerCase() : null;
462
+ }
463
+ /**
464
+ * The whole commit a short commit names, in lower case, through GitHub's commits under the sha media type, which
465
+ * answers the commit's sha alone; null when GitHub answers 422 or 404, as it does for a prefix no commit has or
466
+ * several have. An answer that is not a commit starting with the prefix throws.
467
+ */
468
+ async commitOf(repository, prefix, token, signal) {
469
+ const short = prefix.toLowerCase();
470
+ const url = `${this.address(repository)}/commits/${encodeURIComponent(short)}`;
471
+ let answer;
472
+ try {
473
+ answer = await githubSend(this.fetchImpl, url, { token, accept: COMMIT_SHA_MEDIA_TYPE, signal });
474
+ }
475
+ catch (error) {
476
+ if (error instanceof GitHubApiError && (error.status === 404 || error.status === 422))
477
+ return null;
478
+ throw error;
479
+ }
480
+ let bytes;
481
+ try {
482
+ bytes = await answer.bytes(COMMIT_SHA_BYTES);
483
+ }
484
+ catch (error) {
485
+ if (error instanceof ReadCapExceeded)
486
+ throw new Error('GitHub answered a commit that is not one');
487
+ throw error;
488
+ }
489
+ const commit = new TextDecoder().decode(bytes).trim().toLowerCase();
490
+ if (!COMMIT.test(commit) || !commit.startsWith(short))
491
+ throw new Error('GitHub answered a commit that is not one');
492
+ return commit;
493
+ }
258
494
  /** Nothing to end here: an installation is removed by the app's own call (`uninstallInstallation`). */
259
495
  async revoke() {
260
496
  // A link's connector holds no grant of its own; the app's installation outlives any one link.
@@ -1 +1 @@
1
- {"version":3,"file":"GitHubDocumentsConnector.js","sourceRoot":"","sources":["../../src/documents/GitHubDocumentsConnector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,eAAe,GAQhB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAqB,MAAM,gBAAgB,CAAC;AACjK,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAkC,MAAM,WAAW,CAAC;AAwBvI,oGAAoG;AACpG,MAAM,WAAW,GAAqC;IACpD,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,yEAAyE;IAClF,OAAO,EAAE,WAAW;IACpB,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF,+DAA+D;AAC/D,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3D,CAAC;AAED;;;GAGG;AACH,SAAS,OAAO,CAAC,MAAqB;IACpC,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,GAAG,EAAE,CAAC;IACtC,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CA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AAC,EAAE,CAAC;QAC/E,IAAI,MAAoB,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,CAAC,CAAC;QACnG,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,cAAc,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC;YACnG,MAAM,KAAK,CAAC;QACd,CAAC;QACD,IAAI,KAAiB,CAAC;QACtB,IAAI,CAAC;YACH,KAAK,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,eAAe;gBAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAClG,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACpE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QACnH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,uGAAuG;IACvG,KAAK,CAAC,MAAM;QACV,8FAA8F;IAChG,CAAC;CACF"}
@@ -1,14 +1,24 @@
1
1
  /**
2
2
  * @fileoverview The `./documents` entry: a GitHub App's installation mode (its JWT and installation tokens, the user's
3
3
  * web flow, what a user token reaches, the webhook signature and its deliveries read as typed events, the daily
4
- * reconcile, the uninstall) and `GitHubDocumentsConnector`, a repository's documentation as an account source. Every
5
- * call goes to GitHub's REST API over an injected `fetch`, under a deadline, its answer read under a cap.
4
+ * reconcile, the uninstall), `GitHubDocumentsConnector`, a repository's documentation as an account source at its
5
+ * default branch or at a named branch or commit, and `parseGitHubLink`, the GitHub addresses a person pastes, read
6
+ * without a request. Every call goes to GitHub's REST API over an injected `fetch`, under a deadline, its answer read
7
+ * under a cap.
6
8
  * @module agentos-ext-github/documents
7
9
  */
8
- /** The documentation connector and the shape of a push it compares. */
9
- export { GitHubDocumentsConnector, type GitHubChangesSelection, type LinkedRepository } from './GitHubDocumentsConnector.js';
10
- /** A repository's tree within a request budget, and the filter that keeps its documentation, and its code when asked. */
11
- export { readTree, pathFilter, extensionOf, isGeneratedCode, TreeTooLarge, type TreeTooLargeReason, DOCUMENT_EXTENSIONS, CODE_EXTENSIONS, GENERATED_CODE_ENDINGS, SKIPPED_FOLDERS, DEFAULT_MAX_FILES, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_TREE_REQUESTS, type ReadTreeOptions, type TreeBlob, type TreeFilter, } from './tree.js';
10
+ /**
11
+ * The documentation connector, the selections it lists and compares at a branch or a commit and within a folder, the
12
+ * options of a folder's listing, and the ref a link's text names, settled as a branch, a tag or a commit.
13
+ */
14
+ export { GitHubDocumentsConnector, type GitHubChangesSelection, type GitHubListingOptions, type GitHubListSelection, type LinkedRepository, type ResolvedRef, } from './GitHubDocumentsConnector.js';
15
+ /**
16
+ * A repository's tree within a request budget, the filter that keeps its documentation, and its code when asked, and
17
+ * the plan of every file with what becomes of it.
18
+ */
19
+ export { readTree, pathFilter, planTree, extensionOf, isGeneratedCode, TreeTooLarge, type TreeTooLargeReason, DOCUMENT_EXTENSIONS, CODE_EXTENSIONS, GENERATED_CODE_ENDINGS, IMAGE_EXTENSIONS, SKIPPED_FOLDERS, DEFAULT_MAX_FILES, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_TREE_REQUESTS, type PlannedBlob, type PlanSkipReason, type PlanTreeOptions, type ReadTreeOptions, type TreeBlob, type TreeFilter, } from './tree.js';
20
+ /** The GitHub addresses a person pastes, read without a request. */
21
+ export { parseGitHubLink, type GitHubLink } from './links.js';
12
22
  /** The app's JWT and installation tokens. */
13
23
  export { appJwt, GitHubAppCredential, type GitHubAppIdentity, type InstallationTokenOptions } from '../app/credential.js';
14
24
  /** The user's web flow on the auth module's redirect flow. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uEAAuE;AACvE,OAAO,EAAE,wBAAwB,EAAE,KAAK,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC7H,yHAAyH;AACzH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AACnB,6CAA6C;AAC7C,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAC1H,8DAA8D;AAC9D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B;;;GAGG;AACH,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC;AACjC,sCAAsC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,yEAAyE;AACzE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,mCAAmC,EACxC,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,OAAO,EACL,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,+BAA+B,CAAC;AACvC;;;GAGG;AACH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,WAAW,EACX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,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC"}
@@ -1,14 +1,24 @@
1
1
  /**
2
2
  * @fileoverview The `./documents` entry: a GitHub App's installation mode (its JWT and installation tokens, the user's
3
3
  * web flow, what a user token reaches, the webhook signature and its deliveries read as typed events, the daily
4
- * reconcile, the uninstall) and `GitHubDocumentsConnector`, a repository's documentation as an account source. Every
5
- * call goes to GitHub's REST API over an injected `fetch`, under a deadline, its answer read under a cap.
4
+ * reconcile, the uninstall), `GitHubDocumentsConnector`, a repository's documentation as an account source at its
5
+ * default branch or at a named branch or commit, and `parseGitHubLink`, the GitHub addresses a person pastes, read
6
+ * without a request. Every call goes to GitHub's REST API over an injected `fetch`, under a deadline, its answer read
7
+ * under a cap.
6
8
  * @module agentos-ext-github/documents
7
9
  */
8
- /** The documentation connector and the shape of a push it compares. */
9
- export { GitHubDocumentsConnector } from './GitHubDocumentsConnector.js';
10
- /** A repository's tree within a request budget, and the filter that keeps its documentation, and its code when asked. */
11
- export { readTree, pathFilter, extensionOf, isGeneratedCode, TreeTooLarge, DOCUMENT_EXTENSIONS, CODE_EXTENSIONS, GENERATED_CODE_ENDINGS, SKIPPED_FOLDERS, DEFAULT_MAX_FILES, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_TREE_REQUESTS, } from './tree.js';
10
+ /**
11
+ * The documentation connector, the selections it lists and compares at a branch or a commit and within a folder, the
12
+ * options of a folder's listing, and the ref a link's text names, settled as a branch, a tag or a commit.
13
+ */
14
+ export { GitHubDocumentsConnector, } from './GitHubDocumentsConnector.js';
15
+ /**
16
+ * A repository's tree within a request budget, the filter that keeps its documentation, and its code when asked, and
17
+ * the plan of every file with what becomes of it.
18
+ */
19
+ export { readTree, pathFilter, planTree, extensionOf, isGeneratedCode, TreeTooLarge, DOCUMENT_EXTENSIONS, CODE_EXTENSIONS, GENERATED_CODE_ENDINGS, IMAGE_EXTENSIONS, SKIPPED_FOLDERS, DEFAULT_MAX_FILES, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_TREE_REQUESTS, } from './tree.js';
20
+ /** The GitHub addresses a person pastes, read without a request. */
21
+ export { parseGitHubLink } from './links.js';
12
22
  /** The app's JWT and installation tokens. */
13
23
  export { appJwt, GitHubAppCredential } from '../app/credential.js';
14
24
  /** The user's web flow on the auth module's redirect flow. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uEAAuE;AACvE,OAAO,EAAE,wBAAwB,EAAsD,MAAM,+BAA+B,CAAC;AAC7H,yHAAyH;AACzH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EAEZ,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,GAI1B,MAAM,WAAW,CAAC;AACnB,6CAA6C;AAC7C,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAyD,MAAM,sBAAsB,CAAC;AAC1H,8DAA8D;AAC9D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GAIvB,MAAM,oBAAoB,CAAC;AAC5B;;;GAGG;AACH,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GAOrB,MAAM,yBAAyB,CAAC;AACjC,sCAAsC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,yEAAyE;AACzE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,GAc3B,MAAM,kBAAkB,CAAC;AAC1B,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,GASvB,MAAM,qBAAqB,CAAC;AAC7B;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,cAAc,GAIf,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,OAAO,EACL,wBAAwB,GAMzB,MAAM,+BAA+B,CAAC;AACvC;;;GAGG;AACH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,WAAW,EACX,eAAe,EACf,YAAY,EAEZ,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,GAO1B,MAAM,WAAW,CAAC;AACnB,oEAAoE;AACpE,OAAO,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AAC9D,6CAA6C;AAC7C,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAyD,MAAM,sBAAsB,CAAC;AAC1H,8DAA8D;AAC9D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GAIvB,MAAM,oBAAoB,CAAC;AAC5B;;;GAGG;AACH,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GAOrB,MAAM,yBAAyB,CAAC;AACjC,sCAAsC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,yEAAyE;AACzE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,GAc3B,MAAM,kBAAkB,CAAC;AAC1B,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,GASvB,MAAM,qBAAqB,CAAC;AAC7B;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,cAAc,GAIf,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @fileoverview The GitHub addresses a person pastes, read without a request: a repository, a folder or a file on
3
+ * github.com, and a file on raw.githubusercontent.com. Any other address on GitHub's hosts is refused, so no form of a
4
+ * GitHub address is read as another site's page; an address on any other host is not GitHub's. A text is read as the
5
+ * URL standard reads an address, so every form a browser opens as a GitHub address is answered as one.
6
+ * @module agentos-ext-github/documents/links
7
+ */
8
+ /**
9
+ * What a GitHub address names. A folder's and a file's ref and path are one text, `refAndPath`, since a branch name may
10
+ * hold a slash: `GitHubDocumentsConnector.resolveRef` settles where the ref ends. `raw` marks a file address that serves
11
+ * the file's bytes alone (`/raw/` on github.com, or raw.githubusercontent.com). A file's text can be a branch alone
12
+ * (`/blob/release/1.0` names the file `1.0` of `release`, or the branch `release/1.0` and no file); when `resolveRef`
13
+ * settles it with an empty path, the address names a ref and no file, which GitHub answers 404.
14
+ */
15
+ export type GitHubLink = {
16
+ kind: 'github_repository';
17
+ owner: string;
18
+ repo: string;
19
+ } | {
20
+ kind: 'github_folder';
21
+ owner: string;
22
+ repo: string;
23
+ refAndPath: string;
24
+ } | {
25
+ kind: 'github_file';
26
+ owner: string;
27
+ repo: string;
28
+ refAndPath: string;
29
+ raw: boolean;
30
+ } | {
31
+ kind: 'refused';
32
+ };
33
+ /**
34
+ * What a GitHub address names, read without a request. Null for an address whose host is not GitHub's, and for text
35
+ * that is no address; `refused` for an address on GitHub's hosts that names no repository, folder or file read here: an
36
+ * account, an issue, a pull request, a wiki, a release, a commit, a tag by its full name (`refs/tags/<tag>`), a gist,
37
+ * the API, an archive, GitHub's own pages, an address that carries credentials (with a scheme or without one:
38
+ * `<user>:<password>@github.com/...`), a host of GitHub Enterprise Cloud with data residency (`<subdomain>.ghe.com`),
39
+ * and a host other than github.com, www.github.com and raw.githubusercontent.com. The scheme (or its absence), a port,
40
+ * the dots that end a host, `.git`, a trailing slash, a query and a fragment are ignored, and so is the `git` user of
41
+ * an SSH address (`git@github.com:<owner>/<repo>.git`).
42
+ *
43
+ * The text is read as the URL standard reads an address: the C0 controls and spaces around it, and any other white
44
+ * space there, are dropped, and every tab and newline in it; after `http`, `https`, `ws`, `wss` and `ftp` any run of
45
+ * `/` and `\` stands before the host, none included (`https:github.com/<owner>/<repo>`,
46
+ * `https:\\github.com\<owner>\<repo>`), as a browser opens such an address; after `file`, two of them; after any
47
+ * other scheme, `//`. A backslash in the path is a slash.
48
+ *
49
+ * A folder's and a file's ref and path are answered as one text, each segment decoded, since a branch name may hold a
50
+ * slash; GitHub's form of a branch by its full name, `refs/heads/<branch>`, is read as the branch. A `/blob/` address
51
+ * whose text has no slash names a ref alone and is a folder, as GitHub shows it (its `/blob/<ref>` redirects to
52
+ * `/tree/<ref>`); one whose text has a slash is a file, which `resolveRef` may settle as a ref alone (an empty path).
53
+ *
54
+ * @param text The address as pasted; the controls and spaces around it are dropped.
55
+ * @throws TypeError when `text` is not a string.
56
+ */
57
+ export declare function parseGitHubLink(text: string): GitHubLink | null;
58
+ //# sourceMappingURL=links.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../src/documents/links.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC1E;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,CAAA;CAAE,GACtF;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAoNxB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAwB/D"}