@miadi/relational-git-repository-mapper 0.6.0 → 0.6.2
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 +2 -1
- package/dist/hosts.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/join.d.ts +7 -3
- package/dist/join.js +9 -9
- package/dist/read.js +10 -6
- package/dist/shipped-capabilities.js +462 -524
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -126,7 +126,8 @@ and its files. It never fetches: a clone that does not hold the commit, or whose
|
|
|
126
126
|
another repository, is refused (`CommitReadError`). `changedCapabilities` is the pure half.
|
|
127
127
|
|
|
128
128
|
A record's `capabilities[]` is read back: `capabilitySessions(address, records)` lists the
|
|
129
|
-
sessions whose record names a capability,
|
|
129
|
+
sessions whose record names a capability, each with every entry its record holds for it
|
|
130
|
+
(`entries`: relation, version, evidence, in the record's order), and `findCapability(parts, { sessions: true })`
|
|
130
131
|
carries them. The app's `/api/repositories/capability` answers them to the write tier only.
|
|
131
132
|
|
|
132
133
|
## Where a repository lives
|
package/dist/hosts.d.ts
CHANGED
|
@@ -18,18 +18,18 @@ export declare const RepositoryWhereSchema: z.ZodObject<{
|
|
|
18
18
|
host: "github" | "host-git" | "missing" | "unchecked";
|
|
19
19
|
checkedBy: string;
|
|
20
20
|
checkedAt: string;
|
|
21
|
+
private?: boolean | undefined;
|
|
21
22
|
note?: string | undefined;
|
|
22
23
|
url?: string | undefined;
|
|
23
|
-
private?: boolean | undefined;
|
|
24
24
|
archived?: boolean | undefined;
|
|
25
25
|
}, {
|
|
26
26
|
repository: string;
|
|
27
27
|
host: "github" | "host-git" | "missing" | "unchecked";
|
|
28
28
|
checkedBy: string;
|
|
29
29
|
checkedAt: string;
|
|
30
|
+
private?: boolean | undefined;
|
|
30
31
|
note?: string | undefined;
|
|
31
32
|
url?: string | undefined;
|
|
32
|
-
private?: boolean | undefined;
|
|
33
33
|
archived?: boolean | undefined;
|
|
34
34
|
}>;
|
|
35
35
|
export type RepositoryWhere = z.infer<typeof RepositoryWhereSchema>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { RepositorySession, MappingState, HubState, RepositoryView, RepositorySummary, InventoryState, RepositoryListing, } from "./types";
|
|
2
|
-
export { dayOf, teamOf, dispositionOf, sessionOf, repositoryKey, parseTraceRef, repositoriesOfRecord, capabilityKey, capabilitySessions, type CapabilitySession, sessionsByRepository, repositoryView, listRepositories, type SessionsByRepository, } from "./join";
|
|
2
|
+
export { dayOf, teamOf, dispositionOf, sessionOf, repositoryKey, parseTraceRef, repositoriesOfRecord, capabilityKey, capabilitySessions, type CapabilitySession, type CapabilityEntry, sessionsByRepository, repositoryView, listRepositories, type SessionsByRepository, } from "./join";
|
|
3
3
|
export { LineageRowSchema, parseLineage, lineageOf, lineageGraph, type LineageRow, type LineageEdge, type LineageLink, type RepositoryLineage, type LineageGraph, } from "./lineage";
|
|
4
4
|
export { SHIPPED_LINEAGE_JSONL, SHIPPED_LINEAGE_SOURCE } from "./shipped-lineage";
|
|
5
5
|
export { CAPABILITY_KINDS, capabilityId, kindOf, parsePackageJson, parseSkillFrontMatter, workspaceGlobs, packageManifests, skillFiles, capabilityRows, mergeCapabilityRows, providesEdges, capabilitiesOf, capabilityAddress, medicineWheelSkills, CODE_READERS, type CapabilityKind, type CodeReader, type Artefact, type CapabilityRowContext, type ProvidesEdge, } from "./capabilities";
|
package/dist/join.d.ts
CHANGED
|
@@ -38,13 +38,17 @@ export interface SessionsByRepository {
|
|
|
38
38
|
export declare function sessionsByRepository(records: ReadonlyMap<string, InventorySnapshot>): SessionsByRepository;
|
|
39
39
|
/** A capability address without its scheme, owner and repository case-folded: `miadi-capability:` and `miadi-capability://` read the same. */
|
|
40
40
|
export declare function capabilityKey(address: string): string | undefined;
|
|
41
|
-
/** One
|
|
42
|
-
export interface
|
|
41
|
+
/** One thing a record says the session did with a capability. */
|
|
42
|
+
export interface CapabilityEntry {
|
|
43
43
|
/** uses, revises or brings-into-being, as the record writes it */
|
|
44
44
|
relation?: string;
|
|
45
45
|
version?: string;
|
|
46
46
|
/** the record's evidence for it: commits, issues, npm versions */
|
|
47
|
-
|
|
47
|
+
evidence?: string[];
|
|
48
|
+
}
|
|
49
|
+
/** One session whose record names a capability, with every entry it holds for it, in the record's order. */
|
|
50
|
+
export interface CapabilitySession extends RepositorySession {
|
|
51
|
+
entries: CapabilityEntry[];
|
|
48
52
|
}
|
|
49
53
|
/** The sessions whose record's `capabilities[]` names this capability, newest first. */
|
|
50
54
|
export declare function capabilitySessions(address: string, records: ReadonlyMap<string, InventorySnapshot>): CapabilitySession[];
|
package/dist/join.js
CHANGED
|
@@ -128,15 +128,15 @@ function capabilitySessions(address, records) {
|
|
|
128
128
|
return [];
|
|
129
129
|
const out = [];
|
|
130
130
|
for (const [id, snapshot] of records) {
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
...
|
|
136
|
-
...(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
const entries = (snapshot.capabilities ?? [])
|
|
132
|
+
.filter((c) => capabilityKey(c.capability) === key)
|
|
133
|
+
.map((c) => ({
|
|
134
|
+
...(c.relation ? { relation: c.relation } : {}),
|
|
135
|
+
...(c.version ? { version: c.version } : {}),
|
|
136
|
+
...(c.evidence?.length ? { evidence: c.evidence } : {}),
|
|
137
|
+
}));
|
|
138
|
+
if (entries.length)
|
|
139
|
+
out.push({ ...sessionOf(id, snapshot), entries });
|
|
140
140
|
}
|
|
141
141
|
return out.sort(newestFirst);
|
|
142
142
|
}
|
package/dist/read.js
CHANGED
|
@@ -60,7 +60,7 @@ function readWhere(path = process.env.MIADI_REPOSITORY_HOSTS?.trim() || undefine
|
|
|
60
60
|
function readPackages(file = process.env.MIADI_REPOSITORY_PACKAGES) {
|
|
61
61
|
const packages = [];
|
|
62
62
|
const issues = [];
|
|
63
|
-
// A host's own reading first (`mw-repomap capabilities map --packages <file>`): the first to name a package speaks for it.
|
|
63
|
+
// A host's own reading first (`mw-repomap capabilities map --packages <file>`): the first to name a package of a repository speaks for it.
|
|
64
64
|
if (file) {
|
|
65
65
|
try {
|
|
66
66
|
const parsed = (0, developer_repository_mapping_1.parseJsonl)((0, node_fs_1.readFileSync)(file, "utf8"), impact_1.PackageReadingSchema, file);
|
|
@@ -71,11 +71,12 @@ function readPackages(file = process.env.MIADI_REPOSITORY_PACKAGES) {
|
|
|
71
71
|
issues.push({ severity: "error", file, message: `could not read: ${error.message}` });
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
const
|
|
74
|
+
const key = (p) => `${p.repository.toLowerCase()}|${p.name}`;
|
|
75
|
+
const named = new Set(packages.map(key));
|
|
75
76
|
shipped_capabilities_1.SHIPPED_PACKAGES.forEach((row, index) => {
|
|
76
77
|
const parsed = impact_1.PackageReadingSchema.safeParse(row);
|
|
77
78
|
if (parsed.success) {
|
|
78
|
-
if (!named.has(parsed.data
|
|
79
|
+
if (!named.has(key(parsed.data)))
|
|
79
80
|
packages.push(parsed.data);
|
|
80
81
|
}
|
|
81
82
|
else
|
|
@@ -159,8 +160,11 @@ function findCapability(parts, options = {}) {
|
|
|
159
160
|
const provider = c.providedBy.find((p) => p.toLowerCase() === repository);
|
|
160
161
|
if (!provider)
|
|
161
162
|
continue;
|
|
162
|
-
|
|
163
|
-
const
|
|
163
|
+
// The provider's own reading: a fork, or another repository with a package of the same name, never speaks for it.
|
|
164
|
+
const { packages: all } = readPackages();
|
|
165
|
+
const own = all.find((p) => p.name === c.name && p.repository.toLowerCase() === repository);
|
|
166
|
+
const packages = all.filter((p) => p.name !== c.name || p === own);
|
|
167
|
+
const impact = kind === "package" && own ? (0, impact_1.impactOf)(c.name, packages) : undefined;
|
|
164
168
|
const related = [];
|
|
165
169
|
const version = (v) => (v ? { version: v } : {});
|
|
166
170
|
if (impact) {
|
|
@@ -168,7 +172,7 @@ function findCapability(parts, options = {}) {
|
|
|
168
172
|
related.push({ relation: "consumes", kind: "package", name: l.name, address: (0, capabilities_2.capabilityAddress)(l.repository, "package", l.name), ...version(l.version), range: l.range });
|
|
169
173
|
for (const l of impact.consumers.filter((x) => x.depth === 1))
|
|
170
174
|
related.push({ relation: "consumed-by", kind: "package", name: l.name, address: (0, capabilities_2.capabilityAddress)(l.repository, "package", l.name), ...version(l.version), range: l.range });
|
|
171
|
-
for (const bin of
|
|
175
|
+
for (const bin of own?.bins ?? [])
|
|
172
176
|
related.push({ relation: "ships", kind: "cli", name: bin, address: (0, capabilities_2.capabilityAddress)(provider, "cli", bin) });
|
|
173
177
|
}
|
|
174
178
|
if (kind === "cli") {
|