@agent-teams/engineering-foundation 0.10.0 → 0.12.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.
- package/README.md +32 -0
- package/dist/cli-arguments.d.ts +5 -0
- package/dist/cli-arguments.d.ts.map +1 -1
- package/dist/cli-arguments.js +78 -15
- package/dist/cli-arguments.js.map +1 -1
- package/dist/cli.js +15 -1
- package/dist/cli.js.map +1 -1
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader.d.ts +9 -0
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader.js +53 -0
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-metadata-instance-validator.d.ts +9 -0
- package/dist/document-authoring/adapters/node/node-metadata-instance-validator.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-metadata-instance-validator.js +84 -0
- package/dist/document-authoring/adapters/node/node-metadata-instance-validator.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-owner-membership-reader.d.ts +10 -0
- package/dist/document-authoring/adapters/node/node-owner-membership-reader.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-owner-membership-reader.js +62 -0
- package/dist/document-authoring/adapters/node/node-owner-membership-reader.js.map +1 -0
- package/dist/document-authoring/adapters/node/read-document-authority-file.d.ts +12 -0
- package/dist/document-authoring/adapters/node/read-document-authority-file.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/read-document-authority-file.js +88 -0
- package/dist/document-authoring/adapters/node/read-document-authority-file.js.map +1 -0
- package/dist/document-authoring/application/model/document-catalog.d.ts +59 -0
- package/dist/document-authoring/application/model/document-catalog.d.ts.map +1 -0
- package/dist/document-authoring/application/model/document-catalog.js +2 -0
- package/dist/document-authoring/application/model/document-catalog.js.map +1 -0
- package/dist/document-authoring/application/model/document-find.d.ts +18 -0
- package/dist/document-authoring/application/model/document-find.d.ts.map +1 -0
- package/dist/document-authoring/application/model/document-find.js +2 -0
- package/dist/document-authoring/application/model/document-find.js.map +1 -0
- package/dist/document-authoring/application/policies/document-catalog-diagnostics.d.ts +8 -0
- package/dist/document-authoring/application/policies/document-catalog-diagnostics.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-catalog-diagnostics.js +44 -0
- package/dist/document-authoring/application/policies/document-catalog-diagnostics.js.map +1 -0
- package/dist/document-authoring/application/policies/document-catalog-fields.d.ts +18 -0
- package/dist/document-authoring/application/policies/document-catalog-fields.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-catalog-fields.js +62 -0
- package/dist/document-authoring/application/policies/document-catalog-fields.js.map +1 -0
- package/dist/document-authoring/application/policies/document-repository-path.d.ts +2 -0
- package/dist/document-authoring/application/policies/document-repository-path.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-repository-path.js +5 -0
- package/dist/document-authoring/application/policies/document-repository-path.js.map +1 -0
- package/dist/document-authoring/application/policies/inspect-catalog-document.d.ts +11 -0
- package/dist/document-authoring/application/policies/inspect-catalog-document.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/inspect-catalog-document.js +78 -0
- package/dist/document-authoring/application/policies/inspect-catalog-document.js.map +1 -0
- package/dist/document-authoring/application/ports/authoring-profile-reader.d.ts +27 -0
- package/dist/document-authoring/application/ports/authoring-profile-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/authoring-profile-reader.js +2 -0
- package/dist/document-authoring/application/ports/authoring-profile-reader.js.map +1 -0
- package/dist/document-authoring/application/ports/documentation-search-catalog-reader.d.ts +10 -0
- package/dist/document-authoring/application/ports/documentation-search-catalog-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/documentation-search-catalog-reader.js +2 -0
- package/dist/document-authoring/application/ports/documentation-search-catalog-reader.js.map +1 -0
- package/dist/document-authoring/application/ports/metadata-instance-validator.d.ts +17 -0
- package/dist/document-authoring/application/ports/metadata-instance-validator.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/metadata-instance-validator.js +2 -0
- package/dist/document-authoring/application/ports/metadata-instance-validator.js.map +1 -0
- package/dist/document-authoring/application/ports/owner-membership-reader.d.ts +14 -0
- package/dist/document-authoring/application/ports/owner-membership-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/owner-membership-reader.js +2 -0
- package/dist/document-authoring/application/ports/owner-membership-reader.js.map +1 -0
- package/dist/document-authoring/application/projections/document-catalog-projections.d.ts +3 -0
- package/dist/document-authoring/application/projections/document-catalog-projections.d.ts.map +1 -0
- package/dist/document-authoring/application/projections/document-catalog-projections.js +24 -0
- package/dist/document-authoring/application/projections/document-catalog-projections.js.map +1 -0
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts +23 -0
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.js +204 -0
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.js.map +1 -0
- package/dist/document-authoring/application/use-cases/find-documents.d.ts +14 -0
- package/dist/document-authoring/application/use-cases/find-documents.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/find-documents.js +95 -0
- package/dist/document-authoring/application/use-cases/find-documents.js.map +1 -0
- package/dist/document-authoring/document-catalog-error.d.ts +6 -0
- package/dist/document-authoring/document-catalog-error.d.ts.map +1 -0
- package/dist/document-authoring/document-catalog-error.js +9 -0
- package/dist/document-authoring/document-catalog-error.js.map +1 -0
- package/dist/document-authoring/find-command.d.ts +37 -0
- package/dist/document-authoring/find-command.d.ts.map +1 -0
- package/dist/document-authoring/find-command.js +180 -0
- package/dist/document-authoring/find-command.js.map +1 -0
- package/dist/document-authoring/index.d.ts +12 -0
- package/dist/document-authoring/index.d.ts.map +1 -0
- package/dist/document-authoring/index.js +27 -0
- package/dist/document-authoring/index.js.map +1 -0
- package/dist/document-command.d.ts +3 -0
- package/dist/document-command.d.ts.map +1 -0
- package/dist/document-command.js +44 -0
- package/dist/document-command.js.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.d.ts +3 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.d.ts.map +1 -1
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.js +18 -1
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.js.map +1 -1
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-tree-observer.d.ts.map +1 -1
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-tree-observer.js +29 -2
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-tree-observer.js.map +1 -1
- package/dist/documentation-observation/application/model/markdown-document.d.ts +1 -1
- package/dist/documentation-observation/application/model/markdown-document.d.ts.map +1 -1
- package/dist/documentation-observation/application/model/markdown-document.js.map +1 -1
- package/dist/documentation-observation/application/ports/markdown-repository.d.ts +1 -0
- package/dist/documentation-observation/application/ports/markdown-repository.d.ts.map +1 -1
- package/dist/package-self-check.d.ts +1 -1
- package/dist/package-self-check.d.ts.map +1 -1
- package/dist/package-self-check.js +37 -23
- package/dist/package-self-check.js.map +1 -1
- package/dist/public-api-surface.d.ts +1 -0
- package/dist/public-api-surface.d.ts.map +1 -1
- package/dist/public-api-surface.js +1 -0
- package/dist/public-api-surface.js.map +1 -1
- package/dist/schema-catalog.d.ts.map +1 -1
- package/dist/schema-catalog.js +12 -2
- package/dist/schema-catalog.js.map +1 -1
- package/dist/schema-ids.d.ts +1 -1
- package/dist/schema-ids.d.ts.map +1 -1
- package/dist/schema-ids.js +6 -0
- package/dist/schema-ids.js.map +1 -1
- package/package.json +11 -1
- package/schemas/document-authoring-profile/v1.schema.json +186 -0
- package/schemas/document-command-envelope/v1.schema.json +161 -0
- package/schemas/document-intent/v1.schema.json +60 -0
- package/schemas/document-plan/v1.schema.json +146 -0
- package/schemas/document-receipt/v1.schema.json +141 -0
- package/schemas/foundation-transaction-envelope/v2.schema.json +106 -0
- package/schemas/quality-executable-specification-catalog/v1.schema.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { compareBinaryStrings } from "../../../binary-string-comparator.js";
|
|
2
|
+
export function projectReferencedDocuments(snapshot, referencedIds) {
|
|
3
|
+
const byId = new Map(snapshot.documents.map((document) => [document.id, document]));
|
|
4
|
+
const identityCountById = new Map();
|
|
5
|
+
for (const identity of snapshot.identityProjection) {
|
|
6
|
+
identityCountById.set(identity.id, (identityCountById.get(identity.id) ?? 0) + 1);
|
|
7
|
+
}
|
|
8
|
+
const uniqueIds = [...new Set(referencedIds)].toSorted(compareBinaryStrings);
|
|
9
|
+
const documents = uniqueIds.flatMap((id) => {
|
|
10
|
+
const document = byId.get(id);
|
|
11
|
+
return document === undefined || identityCountById.get(id) !== 1
|
|
12
|
+
? []
|
|
13
|
+
: [{ id: document.id, path: document.repositoryPath }];
|
|
14
|
+
});
|
|
15
|
+
const missingIds = uniqueIds.filter((id) => !identityCountById.has(id));
|
|
16
|
+
const resolvedIds = new Set(documents.map((document) => document.id));
|
|
17
|
+
const unresolvedIds = uniqueIds.filter((id) => identityCountById.has(id) && !resolvedIds.has(id));
|
|
18
|
+
return Object.freeze({
|
|
19
|
+
documents: Object.freeze(documents.map((document) => Object.freeze(document))),
|
|
20
|
+
missingIds: Object.freeze(missingIds),
|
|
21
|
+
unresolvedIds: Object.freeze(unresolvedIds)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=document-catalog-projections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-catalog-projections.js","sourceRoot":"","sources":["../../../../src/document-authoring/application/projections/document-catalog-projections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAM5E,MAAM,UAAU,0BAA0B,CACxC,QAAsC,EACtC,aAAgC;IAEhC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,Q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M,CACpC,CAAC,EAAE,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAC1D,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9E,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;QACrC,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;KAC5C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { MarkdownRepository } from "../../../documentation-observation/application/ports/markdown-repository.js";
|
|
2
|
+
import type { DocumentationCatalogSnapshot, DocumentationSearchCatalogSnapshot } from "../model/document-catalog.js";
|
|
3
|
+
import type { DocumentationCatalogReadRequest, DocumentationSearchCatalogReader } from "../ports/documentation-search-catalog-reader.js";
|
|
4
|
+
import type { AuthoringProfileReader } from "../ports/authoring-profile-reader.js";
|
|
5
|
+
import type { MetadataInstanceValidator } from "../ports/metadata-instance-validator.js";
|
|
6
|
+
import type { OwnerMembershipReader } from "../ports/owner-membership-reader.js";
|
|
7
|
+
export interface BuildDocumentationCatalogRequest {
|
|
8
|
+
readonly consumerRoot: string;
|
|
9
|
+
readonly profilePath: string;
|
|
10
|
+
readonly signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
export declare class BuildDocumentationCatalog implements DocumentationSearchCatalogReader {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(dependencies: {
|
|
15
|
+
readonly metadata: MetadataInstanceValidator;
|
|
16
|
+
readonly owners: OwnerMembershipReader;
|
|
17
|
+
readonly profile: AuthoringProfileReader;
|
|
18
|
+
readonly repository: MarkdownRepository;
|
|
19
|
+
});
|
|
20
|
+
execute(request: BuildDocumentationCatalogRequest): Promise<DocumentationCatalogSnapshot>;
|
|
21
|
+
read(request: DocumentationCatalogReadRequest): Promise<DocumentationSearchCatalogSnapshot>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=build-documentation-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-documentation-catalog.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/application/use-cases/build-documentation-catalog.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6EAA6E,CAAC;AACtH,OAAO,KAAK,EAAkH,4BAA4B,EAAE,kCAAkC,EAA6B,MAAM,8BAA8B,CAAC;AAChQ,OAAO,KAAK,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AACzI,OAAO,KAAK,EACV,sBAAsB,EAGvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,yBAAyB,EAE1B,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EACV,qBAAqB,EAEtB,MAAM,qCAAqC,CAAC;AAW7C,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AA0TD,qBAAa,yBAA0B,YAAW,gCAAgC;;IAMhF,YAAY,YAAY,EAAE;QACxB,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;QAC7C,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;QACvC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;QACzC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;KACzC,EAKA;IAEK,OAAO,CAAC,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAE9F;IAEK,IAAI,CAAC,OAAO,EAAE,+BAA+B,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAehG;CACF"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { compareBinaryStrings } from "../../../binary-string-comparator.js";
|
|
2
|
+
import {} from "../../../documentation-observation/application/model/markdown-document.js";
|
|
3
|
+
import { DocumentCatalogError } from "../../document-catalog-error.js";
|
|
4
|
+
import { catalogCollisionDiagnostics, catalogDiagnostic, catalogObservationDiagnostic, duplicateIdentityDiagnostics, sortCatalogDiagnostics } from "../policies/document-catalog-diagnostics.js";
|
|
5
|
+
import { inspectCatalogDocument } from "../policies/inspect-catalog-document.js";
|
|
6
|
+
const matchesPrefix = (path, prefix) => path === prefix || path.startsWith(`${prefix}/`);
|
|
7
|
+
function collectionContainsPath(collection, repositoryPath) {
|
|
8
|
+
if (collection.kind === "markdown-tree") {
|
|
9
|
+
return matchesPrefix(repositoryPath, collection.root);
|
|
10
|
+
}
|
|
11
|
+
return (repositoryPath.split("/").at(-1) === "README.md" &&
|
|
12
|
+
collection.roots.some((root) => matchesPrefix(repositoryPath, root)));
|
|
13
|
+
}
|
|
14
|
+
function isCatalogDocumentPath(profile, repositoryPath) {
|
|
15
|
+
return profile.collections.some((collection) => collectionContainsPath(collection, repositoryPath));
|
|
16
|
+
}
|
|
17
|
+
function catalogDocumentSource(profile, repositoryPath) {
|
|
18
|
+
return profile.collections.some((collection) => collection.kind === "frontmatter-readme" &&
|
|
19
|
+
collectionContainsPath(collection, repositoryPath))
|
|
20
|
+
? "frontmatter-readme"
|
|
21
|
+
: "markdown-tree";
|
|
22
|
+
}
|
|
23
|
+
function catalogObservation(observation, profile) {
|
|
24
|
+
const rootIssues = new Set(["root-missing", "root-not-directory"]);
|
|
25
|
+
return {
|
|
26
|
+
documents: observation.documents.filter((document) => isCatalogDocumentPath(profile, document.repositoryPath)),
|
|
27
|
+
issues: observation.issues.filter((issue) => rootIssues.has(issue.kind) ||
|
|
28
|
+
isCatalogDocumentPath(profile, issue.repositoryPath))
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function sameObservation(left, right) {
|
|
32
|
+
if (left.documents.length !== right.documents.length ||
|
|
33
|
+
left.issues.length !== right.issues.length) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
for (const [index, document] of left.documents.entries()) {
|
|
37
|
+
const candidate = right.documents[index];
|
|
38
|
+
if (candidate === undefined ||
|
|
39
|
+
document.repositoryPath !== candidate.repositoryPath ||
|
|
40
|
+
document.source !== candidate.source) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (const [index, issue] of left.issues.entries()) {
|
|
45
|
+
const candidate = right.issues[index];
|
|
46
|
+
if (candidate === undefined ||
|
|
47
|
+
issue.kind !== candidate.kind ||
|
|
48
|
+
issue.message !== candidate.message ||
|
|
49
|
+
issue.repositoryPath !== candidate.repositoryPath) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
function sameEvidence(left, right) {
|
|
56
|
+
return (left.path === right.path &&
|
|
57
|
+
left.digest === right.digest &&
|
|
58
|
+
left.size === right.size);
|
|
59
|
+
}
|
|
60
|
+
function assertAuthorityStable(input) {
|
|
61
|
+
if (!sameEvidence(input.metadataBefore.evidence, input.metadataAfter.evidence) ||
|
|
62
|
+
!sameEvidence(input.ownersBefore.evidence, input.ownersAfter.evidence) ||
|
|
63
|
+
!sameEvidence(input.profileBefore.evidence, input.profileAfter.evidence)) {
|
|
64
|
+
throw new DocumentCatalogError("DOCUMENT_CATALOG_AUTHORITY_CHANGED", "Document catalog authority changed while the repository was observed.");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function repositoryRoots(profile) {
|
|
68
|
+
return Object.freeze([...new Set(profile.collections.flatMap((collection) => collection.kind === "markdown-tree" ? [collection.root] : collection.roots))].toSorted(compareBinaryStrings));
|
|
69
|
+
}
|
|
70
|
+
function signalOption(signal) {
|
|
71
|
+
return signal === undefined ? {} : { signal };
|
|
72
|
+
}
|
|
73
|
+
async function loadCatalogAuthority(dependencies, request) {
|
|
74
|
+
const profile = await dependencies.profile.read({
|
|
75
|
+
consumerRoot: request.consumerRoot,
|
|
76
|
+
path: request.profilePath,
|
|
77
|
+
...signalOption(request.signal)
|
|
78
|
+
});
|
|
79
|
+
const [owners, metadata] = await Promise.all([
|
|
80
|
+
dependencies.owners.read({
|
|
81
|
+
consumerRoot: request.consumerRoot,
|
|
82
|
+
contract: profile.ownerCatalog.contract,
|
|
83
|
+
path: profile.ownerCatalog.path,
|
|
84
|
+
...signalOption(request.signal)
|
|
85
|
+
}),
|
|
86
|
+
dependencies.metadata.load({
|
|
87
|
+
consumerRoot: request.consumerRoot,
|
|
88
|
+
path: profile.metadataSchemaPath,
|
|
89
|
+
...signalOption(request.signal)
|
|
90
|
+
})
|
|
91
|
+
]);
|
|
92
|
+
return { metadata, owners, profile };
|
|
93
|
+
}
|
|
94
|
+
async function observeCatalogTwice(repository, authority, request) {
|
|
95
|
+
const observationRequest = {
|
|
96
|
+
consumerRoot: request.consumerRoot,
|
|
97
|
+
excludedPrefixes: authority.profile.excludedPrefixes,
|
|
98
|
+
roots: repositoryRoots(authority.profile),
|
|
99
|
+
...signalOption(request.signal)
|
|
100
|
+
};
|
|
101
|
+
const first = catalogObservation(await repository.observe(observationRequest), authority.profile);
|
|
102
|
+
const second = catalogObservation(await repository.observe(observationRequest), authority.profile);
|
|
103
|
+
return [first, second];
|
|
104
|
+
}
|
|
105
|
+
async function assertAuthorityRemainedStable(dependencies, request, before) {
|
|
106
|
+
let after;
|
|
107
|
+
try {
|
|
108
|
+
after = await loadCatalogAuthority(dependencies, request);
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (error instanceof DocumentCatalogError) {
|
|
112
|
+
throw new DocumentCatalogError("DOCUMENT_CATALOG_AUTHORITY_CHANGED", "Document catalog authority became unavailable while the repository was observed.", { cause: error });
|
|
113
|
+
}
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
assertAuthorityStable({
|
|
117
|
+
metadataAfter: after.metadata,
|
|
118
|
+
metadataBefore: before.metadata,
|
|
119
|
+
ownersAfter: after.owners,
|
|
120
|
+
ownersBefore: before.owners,
|
|
121
|
+
profileAfter: after.profile,
|
|
122
|
+
profileBefore: before.profile
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function createCatalogSnapshot(authority, first, second) {
|
|
126
|
+
const diagnostics = second.issues.map(catalogObservationDiagnostic);
|
|
127
|
+
if (!sameObservation(first, second)) {
|
|
128
|
+
diagnostics.push(catalogDiagnostic("document.catalog.corpus-changed", authority.profile.projectId, "Documentation corpus changed between stable observation passes."));
|
|
129
|
+
}
|
|
130
|
+
const documents = [];
|
|
131
|
+
const searchDocuments = [];
|
|
132
|
+
const identityProjection = [];
|
|
133
|
+
const ownerIds = new Set(authority.owners.ids);
|
|
134
|
+
for (const document of second.documents) {
|
|
135
|
+
const inspected = inspectCatalogDocument(document, authority.metadata, ownerIds, catalogDocumentSource(authority.profile, document.repositoryPath));
|
|
136
|
+
if (inspected.descriptor !== undefined) {
|
|
137
|
+
documents.push(inspected.descriptor);
|
|
138
|
+
}
|
|
139
|
+
if (inspected.searchEntry !== undefined) {
|
|
140
|
+
searchDocuments.push(inspected.searchEntry);
|
|
141
|
+
}
|
|
142
|
+
if (inspected.identity !== undefined) {
|
|
143
|
+
identityProjection.push(inspected.identity);
|
|
144
|
+
}
|
|
145
|
+
if (inspected.diagnostic !== undefined) {
|
|
146
|
+
diagnostics.push(inspected.diagnostic);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const sortedIdentity = identityProjection.toSorted((left, right) => compareBinaryStrings(left.id, right.id) ||
|
|
150
|
+
compareBinaryStrings(left.repositoryPath, right.repositoryPath));
|
|
151
|
+
diagnostics.push(...duplicateIdentityDiagnostics(sortedIdentity));
|
|
152
|
+
diagnostics.push(...catalogCollisionDiagnostics([...new Set([
|
|
153
|
+
...second.documents.map((document) => document.repositoryPath),
|
|
154
|
+
...second.issues
|
|
155
|
+
.filter((issue) => !["root-missing", "root-not-directory"].includes(issue.kind))
|
|
156
|
+
.map((issue) => issue.repositoryPath)
|
|
157
|
+
])]));
|
|
158
|
+
const sortedDiagnostics = sortCatalogDiagnostics(diagnostics);
|
|
159
|
+
const catalog = Object.freeze({
|
|
160
|
+
authority: Object.freeze({
|
|
161
|
+
metadataSchema: authority.metadata.evidence,
|
|
162
|
+
ownerCatalog: authority.owners.evidence,
|
|
163
|
+
profile: authority.profile.evidence
|
|
164
|
+
}),
|
|
165
|
+
diagnostics: Object.freeze(sortedDiagnostics),
|
|
166
|
+
documents: Object.freeze(documents.toSorted((left, right) => compareBinaryStrings(left.repositoryPath, right.repositoryPath))),
|
|
167
|
+
identityProjection: Object.freeze(sortedIdentity),
|
|
168
|
+
ownerIds: Object.freeze([...authority.owners.ids]),
|
|
169
|
+
projectId: authority.profile.projectId,
|
|
170
|
+
status: sortedDiagnostics.length === 0 ? "complete" : "partial"
|
|
171
|
+
});
|
|
172
|
+
return Object.freeze({
|
|
173
|
+
catalog,
|
|
174
|
+
documents: Object.freeze(searchDocuments.toSorted((left, right) => compareBinaryStrings(left.descriptor.repositoryPath, right.descriptor.repositoryPath)))
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
export class BuildDocumentationCatalog {
|
|
178
|
+
#metadata;
|
|
179
|
+
#owners;
|
|
180
|
+
#profile;
|
|
181
|
+
#repository;
|
|
182
|
+
constructor(dependencies) {
|
|
183
|
+
this.#metadata = dependencies.metadata;
|
|
184
|
+
this.#owners = dependencies.owners;
|
|
185
|
+
this.#profile = dependencies.profile;
|
|
186
|
+
this.#repository = dependencies.repository;
|
|
187
|
+
}
|
|
188
|
+
async execute(request) {
|
|
189
|
+
return (await this.read(request)).catalog;
|
|
190
|
+
}
|
|
191
|
+
async read(request) {
|
|
192
|
+
const dependencies = {
|
|
193
|
+
metadata: this.#metadata,
|
|
194
|
+
owners: this.#owners,
|
|
195
|
+
profile: this.#profile,
|
|
196
|
+
repository: this.#repository
|
|
197
|
+
};
|
|
198
|
+
const authority = await loadCatalogAuthority(dependencies, request);
|
|
199
|
+
const [first, second] = await observeCatalogTwice(this.#repository, authority, request);
|
|
200
|
+
await assertAuthorityRemainedStable(dependencies, request, authority);
|
|
201
|
+
return createCatalogSnapshot(authority, first, second);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=build-documentation-catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-documentation-catalog.js","sourceRoot":"","sources":["../../../../src/document-authoring/application/use-cases/build-documentation-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAIN,MAAM,2EAA2E,CAAC;AAiBnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,4BAA4B,EAC5B,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AASjF,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,MAAc,EAAW,EAAE,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;AAElH,SAAS,sBAAsB,CAC7B,UAA6B,EAC7B,cAAsB;IAEtB,IAAI,UAAU,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QACxC,OAAO,aAAa,CAAC,cAAc,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,CACL,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,WAAW;QAChD,UAAU,CAAC,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,yBAAyB;IAC3B,SAAS,CAA4B;IACrC,OAAO,CAAwB;IAC/B,QAAQ,CAAyB;IACjC,WAAW,CAAqB;IAEzC,YAAY,YAKX;QACC,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,QAAQ,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAyC;QACrD,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAwC;QACjD,MAAM,YAAY,GAAG;YACnB,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC;QACF,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACpE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,MAAM,mBAAmB,CAC/C,IAAI,CAAC,WAAW,EAChB,SAAS,EACT,OAAO,CACR,CAAC;QACF,MAAM,6BAA6B,CAAC,YAAY,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACtE,OAAO,qBAAqB,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DocumentFindQuery, DocumentFindResult } from "../model/document-find.js";
|
|
2
|
+
import type { DocumentationSearchCatalogReader } from "../ports/documentation-search-catalog-reader.js";
|
|
3
|
+
export interface FindDocumentsRequest {
|
|
4
|
+
readonly consumerRoot: string;
|
|
5
|
+
readonly profilePath: string;
|
|
6
|
+
readonly query?: DocumentFindQuery;
|
|
7
|
+
readonly signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
export declare class FindDocuments {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(catalog: DocumentationSearchCatalogReader);
|
|
12
|
+
execute(request: FindDocumentsRequest): Promise<DocumentFindResult>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=find-documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-documents.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/application/use-cases/find-documents.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,gCAAgC,EACjC,MAAM,iDAAiD,CAAC;AAOzD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAwHD,qBAAa,aAAa;;IAGxB,YAAY,OAAO,EAAE,gCAAgC,EAEpD;IAEK,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAQxE;CACF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { compareBinaryStrings } from "../../../binary-string-comparator.js";
|
|
2
|
+
import { DocumentCatalogError } from "../../document-catalog-error.js";
|
|
3
|
+
const OPAQUE_ID = /^[A-Za-z0-9@][A-Za-z0-9@._/-]*$/u;
|
|
4
|
+
const LOWER_ID = /^[a-z0-9][a-z0-9._/-]*$/u;
|
|
5
|
+
const MAXIMUM_TEXT_LENGTH = 1_000;
|
|
6
|
+
function invalidQuery(message) {
|
|
7
|
+
throw new DocumentCatalogError("DOCUMENT_CATALOG_INPUT_INVALID", `Document query is invalid: ${message}`);
|
|
8
|
+
}
|
|
9
|
+
function containsUnsafeCharacter(value) {
|
|
10
|
+
for (const character of value) {
|
|
11
|
+
const code = character.codePointAt(0) ?? 0;
|
|
12
|
+
if (code <= 0x1f ||
|
|
13
|
+
code === 0x7f ||
|
|
14
|
+
(code >= 0xd800 && code <= 0xdfff)) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
function validateFilter(value, name, maximumLength, pattern) {
|
|
21
|
+
if (value === undefined) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (value.length === 0 ||
|
|
25
|
+
value.length > maximumLength ||
|
|
26
|
+
containsUnsafeCharacter(value) ||
|
|
27
|
+
!pattern.test(value)) {
|
|
28
|
+
invalidQuery(`${name} does not use the bounded document identifier grammar.`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function compileDocumentFindQuery(query) {
|
|
32
|
+
const filters = query?.filters ?? {};
|
|
33
|
+
validateFilter(filters.id, "id", 214, OPAQUE_ID);
|
|
34
|
+
validateFilter(filters.owner, "owner", 214, OPAQUE_ID);
|
|
35
|
+
validateFilter(filters.status, "status", 160, LOWER_ID);
|
|
36
|
+
validateFilter(filters.type, "type", 160, LOWER_ID);
|
|
37
|
+
const text = query?.text;
|
|
38
|
+
if (text !== undefined &&
|
|
39
|
+
(text.length > MAXIMUM_TEXT_LENGTH || containsUnsafeCharacter(text))) {
|
|
40
|
+
invalidQuery("text must be a bounded Unicode string without control characters.");
|
|
41
|
+
}
|
|
42
|
+
return Object.freeze({
|
|
43
|
+
filters: Object.freeze({ ...filters }),
|
|
44
|
+
...(text === undefined
|
|
45
|
+
? {}
|
|
46
|
+
: { normalizedText: text.normalize("NFC").toLowerCase() })
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function matchesFilters(entry, filters) {
|
|
50
|
+
const { descriptor } = entry;
|
|
51
|
+
return ((filters.id === undefined || descriptor.id === filters.id) &&
|
|
52
|
+
(filters.owner === undefined || descriptor.owner === filters.owner) &&
|
|
53
|
+
(filters.status === undefined || descriptor.status === filters.status) &&
|
|
54
|
+
(filters.type === undefined || descriptor.type === filters.type));
|
|
55
|
+
}
|
|
56
|
+
function normalizedSearchFields(entry) {
|
|
57
|
+
return [
|
|
58
|
+
entry.descriptor.id,
|
|
59
|
+
entry.descriptor.title,
|
|
60
|
+
entry.descriptor.summary,
|
|
61
|
+
...entry.headings,
|
|
62
|
+
entry.body
|
|
63
|
+
].map((value) => value.normalize("NFC").toLowerCase());
|
|
64
|
+
}
|
|
65
|
+
function findInSnapshot(snapshot, query) {
|
|
66
|
+
const documents = snapshot.documents
|
|
67
|
+
.filter((entry) => matchesFilters(entry, query.filters) &&
|
|
68
|
+
(query.normalizedText === undefined ||
|
|
69
|
+
normalizedSearchFields(entry).some((field) => field.includes(query.normalizedText ?? ""))))
|
|
70
|
+
.map((entry) => entry.descriptor)
|
|
71
|
+
.toSorted((left, right) => compareBinaryStrings(left.id, right.id) ||
|
|
72
|
+
compareBinaryStrings(left.repositoryPath, right.repositoryPath));
|
|
73
|
+
return Object.freeze({
|
|
74
|
+
catalogStatus: snapshot.catalog.status,
|
|
75
|
+
diagnostics: snapshot.catalog.diagnostics,
|
|
76
|
+
documents: Object.freeze(documents),
|
|
77
|
+
matches: documents.length
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export class FindDocuments {
|
|
81
|
+
#catalog;
|
|
82
|
+
constructor(catalog) {
|
|
83
|
+
this.#catalog = catalog;
|
|
84
|
+
}
|
|
85
|
+
async execute(request) {
|
|
86
|
+
const query = compileDocumentFindQuery(request.query);
|
|
87
|
+
const snapshot = await this.#catalog.read({
|
|
88
|
+
consumerRoot: request.consumerRoot,
|
|
89
|
+
profilePath: request.profilePath,
|
|
90
|
+
...(request.signal === undefined ? {} : { signal: request.signal })
|
|
91
|
+
});
|
|
92
|
+
return findInSnapshot(snapshot, query);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=find-documents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-documents.js","sourceRoot":"","sources":["../../../../src/document-authoring/application/use-cases/find-documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAa5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,SAAS,GAAG,kCAAkC,CAAC;AACrD,MAAM,QAAQ,GAAG,0BAA0B,CAAC;AAC5C,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAclC,SAAS,YAAY,CAAC,OAAe;IACnC,MAAM,IAAI,oBAAoB,CAC5B,gCAAgC,EAChC,8BAA8B,OAAO,EAAE,CACxC,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAa;IAC5C,KAAK,MAAM,SAAS,IAAI,KAAK,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3C,IACE,IAAI,IAAI,IAAI;YACZ,IAAI,KAAK,IAAI;YACb,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,EAClC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,cAAc,CACrB,KAAyB,EACzB,IAAY,EACZ,aAAqB,EACrB,OAAe;IAEf,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO;IACT,CAAC;IACD,IACE,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,KAAK,CAAC,MAAM,GAAG,aAAa;QAC5B,uBAAuB,CAAC,KAAK,CAAC;QAC9B,CAAC,OAAO,CAAC,IAAI,CAAC,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AK,CAAC,EAAE,CAAC;QACvC,oBAAoB,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,CAClE,CAAC;IACJ,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM;QACtC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW;QACzC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;QACnC,OAAO,EAAE,SAAS,CAAC,MAAM;KAC1B,CAAC,CAAC;AACL,CAAC;AAED,MAAM,OAAO,aAAa;IACf,QAAQ,CAAmC;IAEpD,YAAY,OAAyC;QACnD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAA6B;QACzC,MAAM,KAAK,GAAG,wBAAwB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YACxC,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;SACpE,CAAC,CAAC;QACH,OAAO,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type DocumentCatalogErrorCode = "DOCUMENT_CATALOG_AUTHORITY_CHANGED" | "DOCUMENT_CATALOG_AUTHORITY_UNAVAILABLE" | "DOCUMENT_CATALOG_INPUT_INVALID";
|
|
2
|
+
export declare class DocumentCatalogError extends Error {
|
|
3
|
+
readonly code: DocumentCatalogErrorCode;
|
|
4
|
+
constructor(code: DocumentCatalogErrorCode, message: string, options?: ErrorOptions);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=document-catalog-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-catalog-error.d.ts","sourceRoot":"","sources":["../../src/document-authoring/document-catalog-error.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,wBAAwB,GAChC,oCAAoC,GACpC,wCAAwC,GACxC,gCAAgC,CAAC;AAErC,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IAExC,YACE,IAAI,EAAE,wBAAwB,EAC9B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,EAKvB;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-catalog-error.js","sourceRoot":"","sources":["../../src/document-authoring/document-catalog-error.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,IAAI,CAA2B;IAExC,YACE,IAA8B,EAC9B,OAAe,EACf,OAAsB;QAEtB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DocumentDescriptor } from "./application/model/document-catalog.js";
|
|
2
|
+
import type { DocumentFindFilters, DocumentFindResult } from "./application/model/document-find.js";
|
|
3
|
+
interface CommandDiagnostic {
|
|
4
|
+
readonly message: string;
|
|
5
|
+
readonly phase: "authority" | "input" | "query";
|
|
6
|
+
readonly ruleId: string;
|
|
7
|
+
readonly severity: "error" | "warning";
|
|
8
|
+
readonly subject: string;
|
|
9
|
+
}
|
|
10
|
+
interface DocumentFindEnvelope {
|
|
11
|
+
readonly command: "docs.find";
|
|
12
|
+
readonly diagnostics: readonly CommandDiagnostic[];
|
|
13
|
+
readonly outcome: "authority-stale" | "cancelled" | "execution-failure" | "invalid-input" | "partial" | "success";
|
|
14
|
+
readonly result: {
|
|
15
|
+
readonly documents: readonly DocumentDescriptor[];
|
|
16
|
+
readonly kind: "find";
|
|
17
|
+
readonly matches: number;
|
|
18
|
+
};
|
|
19
|
+
readonly schemaVersion: 1;
|
|
20
|
+
}
|
|
21
|
+
export interface DocumentFindCommandRequest {
|
|
22
|
+
readonly consumerRoot: string;
|
|
23
|
+
readonly filters: DocumentFindFilters;
|
|
24
|
+
readonly profilePath: string;
|
|
25
|
+
readonly signal?: AbortSignal;
|
|
26
|
+
readonly text?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface DocumentFindCommandResult {
|
|
29
|
+
readonly envelope: DocumentFindEnvelope;
|
|
30
|
+
readonly exitCode: 0 | 1 | 2 | 3 | 130;
|
|
31
|
+
}
|
|
32
|
+
export declare function documentFindFailure(error: unknown): DocumentFindCommandResult;
|
|
33
|
+
export declare function documentFindSuccess(result: DocumentFindResult): DocumentFindCommandResult;
|
|
34
|
+
export declare function runDocumentFindCommand(request: DocumentFindCommandRequest): Promise<DocumentFindCommandResult>;
|
|
35
|
+
export declare function renderDocumentFindText(result: DocumentFindCommandResult): string;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=find-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-command.d.ts","sourceRoot":"","sources":["../../src/document-authoring/find-command.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,sCAAsC,CAAC;AAO9C,UAAU,iBAAiB;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;I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