@medicine-wheel/developer-repository-mapping 0.0.0-stage → 0.22.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.
Files changed (74) hide show
  1. package/README.md +68 -2
  2. package/dist/check.d.ts +28 -0
  3. package/dist/check.d.ts.map +1 -0
  4. package/dist/check.js +111 -0
  5. package/dist/check.js.map +1 -0
  6. package/dist/cli.d.ts +26 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +408 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/ids.d.ts +28 -0
  11. package/dist/ids.d.ts.map +1 -0
  12. package/dist/ids.js +68 -0
  13. package/dist/ids.js.map +1 -0
  14. package/dist/index.d.ts +40 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +89 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/jsonl.d.ts +19 -0
  19. package/dist/jsonl.d.ts.map +1 -0
  20. package/dist/jsonl.js +63 -0
  21. package/dist/jsonl.js.map +1 -0
  22. package/dist/lifecycle.d.ts +53 -0
  23. package/dist/lifecycle.d.ts.map +1 -0
  24. package/dist/lifecycle.js +78 -0
  25. package/dist/lifecycle.js.map +1 -0
  26. package/dist/merge.d.ts +30 -0
  27. package/dist/merge.d.ts.map +1 -0
  28. package/dist/merge.js +94 -0
  29. package/dist/merge.js.map +1 -0
  30. package/dist/node/fs.d.ts +28 -0
  31. package/dist/node/fs.d.ts.map +1 -0
  32. package/dist/node/fs.js +162 -0
  33. package/dist/node/fs.js.map +1 -0
  34. package/dist/node/git.d.ts +15 -0
  35. package/dist/node/git.d.ts.map +1 -0
  36. package/dist/node/git.js +73 -0
  37. package/dist/node/git.js.map +1 -0
  38. package/dist/node/hub.d.ts +45 -0
  39. package/dist/node/hub.d.ts.map +1 -0
  40. package/dist/node/hub.js +113 -0
  41. package/dist/node/hub.js.map +1 -0
  42. package/dist/node/index.d.ts +16 -0
  43. package/dist/node/index.d.ts.map +1 -0
  44. package/dist/node/index.js +30 -0
  45. package/dist/node/index.js.map +1 -0
  46. package/dist/node/page.d.ts +9 -0
  47. package/dist/node/page.d.ts.map +1 -0
  48. package/dist/node/page.js +219 -0
  49. package/dist/node/page.js.map +1 -0
  50. package/dist/node/server.d.ts +33 -0
  51. package/dist/node/server.d.ts.map +1 -0
  52. package/dist/node/server.js +111 -0
  53. package/dist/node/server.js.map +1 -0
  54. package/dist/read.d.ts +13 -0
  55. package/dist/read.d.ts.map +1 -0
  56. package/dist/read.js +38 -0
  57. package/dist/read.js.map +1 -0
  58. package/dist/schemas.d.ts +409 -0
  59. package/dist/schemas.d.ts.map +1 -0
  60. package/dist/schemas.js +160 -0
  61. package/dist/schemas.js.map +1 -0
  62. package/dist/summary.d.ts +31 -0
  63. package/dist/summary.d.ts.map +1 -0
  64. package/dist/summary.js +64 -0
  65. package/dist/summary.js.map +1 -0
  66. package/dist/types.d.ts +184 -0
  67. package/dist/types.d.ts.map +1 -0
  68. package/dist/types.js +36 -0
  69. package/dist/types.js.map +1 -0
  70. package/dist/wheel.d.ts +14 -0
  71. package/dist/wheel.d.ts.map +1 -0
  72. package/dist/wheel.js +74 -0
  73. package/dist/wheel.js.map +1 -0
  74. package/package.json +63 -4
package/dist/merge.js ADDED
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ /**
3
+ * The meta mapping: one reading of several owner hubs, without copying them.
4
+ *
5
+ * A meta hub (jgwill/jgwill) registers other owner hubs in `owners.jsonl`
6
+ * and reads their mapping folders where they live. Nothing is indexed into
7
+ * the meta hub; the merge happens at read time, and each row keeps the hub it
8
+ * came from.
9
+ *
10
+ * Who speaks for a repository: the hub of the owner who holds it. A row about
11
+ * `repository:miadisabelle/x` found in another hub — the repository, one of its
12
+ * features, or a relation starting from either — is skipped and reported.
13
+ * Capabilities are the platform's, so the first hub read (the meta hub) speaks
14
+ * for them, and a different definition elsewhere is reported; it also speaks
15
+ * for relations that start from a service.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.mergeMappings = mergeMappings;
19
+ const check_1 = require("./check");
20
+ const ids_1 = require("./ids");
21
+ function mergeMappings(readings) {
22
+ if (!readings.length)
23
+ throw new Error('mergeMappings needs at least the meta hub');
24
+ const [first] = readings;
25
+ const merged = {
26
+ manifest: first.mapping.manifest,
27
+ repositories: [],
28
+ features: [],
29
+ capabilities: [],
30
+ relations: [],
31
+ owners: [...first.mapping.owners],
32
+ hubs: [],
33
+ sources: {},
34
+ issues: [],
35
+ };
36
+ const { sources, issues } = merged;
37
+ const capabilityJson = new Map();
38
+ for (const [index, { hub, mapping }] of readings.entries()) {
39
+ merged.hubs.push(hub);
40
+ const owner = hub.split('/')[0].toLowerCase();
41
+ const accepted = new Set();
42
+ for (const r of mapping.repositories) {
43
+ const repoOwner = (0, ids_1.parseRepositoryNodeId)(r.nodeId)?.owner.toLowerCase();
44
+ if (repoOwner !== owner) {
45
+ issues.push({ severity: 'warning', file: hub, nodeId: r.nodeId, message: `${hub} maps ${r.nodeId}, which is not its owner's; skipped` });
46
+ continue;
47
+ }
48
+ if (sources[r.nodeId]) {
49
+ issues.push({ severity: 'warning', file: hub, nodeId: r.nodeId, message: `${r.nodeId} already read from ${sources[r.nodeId]}; skipped` });
50
+ continue;
51
+ }
52
+ merged.repositories.push(r);
53
+ sources[r.nodeId] = hub;
54
+ accepted.add(r.nodeId);
55
+ }
56
+ for (const f of mapping.features) {
57
+ if (!accepted.has(f.repository)) {
58
+ issues.push({ severity: 'warning', file: hub, nodeId: f.nodeId, message: `${hub} holds ${f.nodeId}, but ${f.repository} is not read from ${hub}; skipped` });
59
+ continue;
60
+ }
61
+ if (sources[f.nodeId])
62
+ continue;
63
+ merged.features.push(f);
64
+ sources[f.nodeId] = hub;
65
+ }
66
+ for (const c of mapping.capabilities) {
67
+ const json = JSON.stringify(c);
68
+ const earlier = sources[c.nodeId];
69
+ if (earlier) {
70
+ if (capabilityJson.get(c.nodeId) !== json) {
71
+ issues.push({ severity: 'warning', file: hub, nodeId: c.nodeId, message: `${c.nodeId} is defined differently in ${hub}; kept ${earlier}'s` });
72
+ }
73
+ continue;
74
+ }
75
+ merged.capabilities.push(c);
76
+ capabilityJson.set(c.nodeId, json);
77
+ sources[c.nodeId] = hub;
78
+ }
79
+ for (const rel of mapping.relations) {
80
+ const key = (0, check_1.relationKey)(rel);
81
+ const speaker = (0, check_1.speakingOwner)(rel.from)?.toLowerCase();
82
+ if (speaker ? speaker !== owner : index > 0) {
83
+ issues.push({ severity: 'warning', file: hub, nodeId: rel.from, message: `${hub} holds ${key}, which ${speaker ? `${speaker}/${speaker}` : 'the meta hub'} speaks for; skipped` });
84
+ continue;
85
+ }
86
+ if (sources[key])
87
+ continue;
88
+ merged.relations.push(rel);
89
+ sources[key] = hub;
90
+ }
91
+ }
92
+ return merged;
93
+ }
94
+ //# sourceMappingURL=merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.js","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAoBH,sCA2EC;AA7FD,mCAAqD;AACrD,+BAA8C;AAiB9C,SAAgB,aAAa,CAAC,QAA+B;IAC3D,IAAI,CAAC,QAAQ,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACnF,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;IACzB,MAAM,MAAM,GAAkB;QAC5B,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ;QAChC,YAAY,EAAE,EAAE;QAChB,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,EAAE;QAChB,SAAS,EAAE,EAAE;QACb,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QACjC,IAAI,EAAE,EAAE;QACR,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;KACX,CAAC;IACF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAA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AS;YACX,CAAC;YACD,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC5B,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YACnC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;QAC1B,CAAC;QAED,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACpC,MAAM,GAAG,GAAG,IAAA,mBAAW,EAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAC,GAAG,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC;YACvD,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;gBAC5C,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,GAAG,UAAU,GAAG,WAAW,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,cAAc,sBAAsB,EAAE,CAAC,CAAC;gBACnL,SAAS;YACX,CAAC;YACD,IAAI,OAAO,CAAC,GAAG,CAAC;gBAAE,SAAS;YAC3B,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * A mapping folder on disk.
3
+ *
4
+ * Rows are written sorted (repositories, features and capabilities by node
5
+ * id, relations by `from type to`), one per line, so a second writer produces
6
+ * a reviewable diff instead of a reshuffled file. `owners.jsonl` keeps the
7
+ * order it was written in: that order is the order hubs are read in, and the
8
+ * first hub to define a capability speaks for it.
9
+ *
10
+ * Nothing is written that would not read back: every row is checked against
11
+ * its schema first, and each file is written beside itself and renamed into
12
+ * place, so a crash leaves the old file or the new one, never half of one.
13
+ */
14
+ import { type MappingRead } from '../read';
15
+ import { type MappingManifest, type RepositoryMapping } from '../types';
16
+ /**
17
+ * The mapping folder of a hub clone (`start/.miadi/repository-mapping`), or
18
+ * `start` itself when it holds a repository-mapping manifest, or `undefined`.
19
+ * The nested folder wins: a hub clone's own `manifest.json` (a web app's, an
20
+ * extension's) is not a mapping.
21
+ */
22
+ export declare function findMappingDir(start: string): Promise<string | undefined>;
23
+ export declare function readMappingDir(dir: string, label?: string): Promise<MappingRead>;
24
+ /** Write a mapping folder. Refuses, writing nothing, when any row would not read back. */
25
+ export declare function writeMappingDir(dir: string, given: RepositoryMapping): Promise<void>;
26
+ /** Make an empty mapping folder. Refuses a folder that already holds any mapping file. */
27
+ export declare function initMappingDir(dir: string, manifest: MappingManifest): Promise<void>;
28
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/node/fs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AASxD,OAAO,EAA8C,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAqBpH;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAM/E;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAStF;AAoCD,0FAA0F;AAC1F,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAc1F;AAED,0FAA0F;AAC1F,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAO1F"}
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ /**
3
+ * A mapping folder on disk.
4
+ *
5
+ * Rows are written sorted (repositories, features and capabilities by node
6
+ * id, relations by `from type to`), one per line, so a second writer produces
7
+ * a reviewable diff instead of a reshuffled file. `owners.jsonl` keeps the
8
+ * order it was written in: that order is the order hubs are read in, and the
9
+ * first hub to define a capability speaks for it.
10
+ *
11
+ * Nothing is written that would not read back: every row is checked against
12
+ * its schema first, and each file is written beside itself and renamed into
13
+ * place, so a crash leaves the old file or the new one, never half of one.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.findMappingDir = findMappingDir;
50
+ exports.readMappingDir = readMappingDir;
51
+ exports.writeMappingDir = writeMappingDir;
52
+ exports.initMappingDir = initMappingDir;
53
+ const promises_1 = require("node:fs/promises");
54
+ const path = __importStar(require("node:path"));
55
+ const capabilities_1 = require("@medicine-wheel/capabilities");
56
+ const check_1 = require("../check");
57
+ const read_1 = require("../read");
58
+ const jsonl_1 = require("../jsonl");
59
+ const schemas_1 = require("../schemas");
60
+ const types_1 = require("../types");
61
+ async function exists(file) {
62
+ try {
63
+ await (0, promises_1.stat)(file);
64
+ return true;
65
+ }
66
+ catch {
67
+ return false;
68
+ }
69
+ }
70
+ /** True when the file is a repository-mapping manifest, not some other `manifest.json`. */
71
+ async function isMappingManifest(file) {
72
+ try {
73
+ const value = JSON.parse((await (0, promises_1.readFile)(file, 'utf8')).replace(/^/, ''));
74
+ return value?.schema === types_1.MAPPING_SCHEMA;
75
+ }
76
+ catch {
77
+ return false;
78
+ }
79
+ }
80
+ /**
81
+ * The mapping folder of a hub clone (`start/.miadi/repository-mapping`), or
82
+ * `start` itself when it holds a repository-mapping manifest, or `undefined`.
83
+ * The nested folder wins: a hub clone's own `manifest.json` (a web app's, an
84
+ * extension's) is not a mapping.
85
+ */
86
+ async function findMappingDir(start) {
87
+ const dir = path.resolve(start);
88
+ const nested = path.join(dir, types_1.MAPPING_DIR);
89
+ if (await exists(path.join(nested, types_1.MAPPING_FILES.manifest)))
90
+ return nested;
91
+ if (await isMappingManifest(path.join(dir, types_1.MAPPING_FILES.manifest)))
92
+ return dir;
93
+ return undefined;
94
+ }
95
+ async function readMappingDir(dir, label) {
96
+ return (0, read_1.readMapping)(async (file) => {
97
+ try {
98
+ return await (0, promises_1.readFile)(path.join(dir, file), 'utf8');
99
+ }
100
+ catch (error) {
101
+ if (error.code === 'ENOENT')
102
+ return undefined;
103
+ throw error;
104
+ }
105
+ }, label);
106
+ }
107
+ const byId = (a, b) => (a.nodeId < b.nodeId ? -1 : a.nodeId > b.nodeId ? 1 : 0);
108
+ const byRelation = (a, b) => (0, check_1.relationKey)(a) < (0, check_1.relationKey)(b) ? -1 : (0, check_1.relationKey)(a) > (0, check_1.relationKey)(b) ? 1 : 0;
109
+ /**
110
+ * Every row as its schema returns it (keys in schema order), and every
111
+ * failure as a `file: id: message` line.
112
+ */
113
+ function normalize(mapping) {
114
+ const failures = [];
115
+ const parse = (file, schema, rows, id) => rows.map((row) => {
116
+ const parsed = schema.safeParse(row);
117
+ if (parsed.success)
118
+ return parsed.data;
119
+ failures.push(...parsed.error.issues.map((i) => `${file}: ${id(row)}: ${i.path.join('.')}${i.path.length ? ': ' : ''}${i.message}`));
120
+ return row;
121
+ });
122
+ const normalized = {
123
+ manifest: parse(types_1.MAPPING_FILES.manifest, schemas_1.MappingManifestSchema, [mapping.manifest], (m) => m.hub)[0],
124
+ repositories: parse(types_1.MAPPING_FILES.repositories, schemas_1.RepositoryFacetSchema, mapping.repositories, (r) => r.nodeId),
125
+ features: parse(types_1.MAPPING_FILES.features, schemas_1.FeatureFacetSchema, mapping.features, (r) => r.nodeId),
126
+ capabilities: parse(types_1.MAPPING_FILES.capabilities, capabilities_1.CapabilityFacetSchema, mapping.capabilities, (r) => r.nodeId),
127
+ relations: parse(types_1.MAPPING_FILES.relations, schemas_1.RelationRowSchema, mapping.relations, check_1.relationKey),
128
+ owners: parse(types_1.MAPPING_FILES.owners, schemas_1.OwnerRegistrationSchema, mapping.owners, (o) => o.hub),
129
+ };
130
+ return { mapping: normalized, failures };
131
+ }
132
+ async function writeAtomically(file, text) {
133
+ const temporary = `${file}.${process.pid}.tmp`;
134
+ await (0, promises_1.writeFile)(temporary, text);
135
+ await (0, promises_1.rename)(temporary, file);
136
+ }
137
+ /** Write a mapping folder. Refuses, writing nothing, when any row would not read back. */
138
+ async function writeMappingDir(dir, given) {
139
+ const { mapping, failures } = normalize(given);
140
+ if (failures.length) {
141
+ throw new Error(`nothing written; these rows would not read back:\n ${failures.join('\n ')}`);
142
+ }
143
+ await (0, promises_1.mkdir)(dir, { recursive: true });
144
+ await writeAtomically(path.join(dir, types_1.MAPPING_FILES.manifest), JSON.stringify(mapping.manifest, null, 2) + '\n');
145
+ await writeAtomically(path.join(dir, types_1.MAPPING_FILES.repositories), (0, jsonl_1.toJsonl)([...mapping.repositories].sort(byId)));
146
+ await writeAtomically(path.join(dir, types_1.MAPPING_FILES.features), (0, jsonl_1.toJsonl)([...mapping.features].sort(byId)));
147
+ await writeAtomically(path.join(dir, types_1.MAPPING_FILES.capabilities), (0, jsonl_1.toJsonl)([...mapping.capabilities].sort(byId)));
148
+ await writeAtomically(path.join(dir, types_1.MAPPING_FILES.relations), (0, jsonl_1.toJsonl)([...mapping.relations].sort(byRelation)));
149
+ if (mapping.manifest.kind === 'meta' || mapping.owners.length) {
150
+ await writeAtomically(path.join(dir, types_1.MAPPING_FILES.owners), (0, jsonl_1.toJsonl)(mapping.owners));
151
+ }
152
+ }
153
+ /** Make an empty mapping folder. Refuses a folder that already holds any mapping file. */
154
+ async function initMappingDir(dir, manifest) {
155
+ for (const file of Object.values(types_1.MAPPING_FILES)) {
156
+ if (await exists(path.join(dir, file))) {
157
+ throw new Error(`${dir} already holds ${file}; init writes only into a folder with no mapping file`);
158
+ }
159
+ }
160
+ await writeMappingDir(dir, { manifest, repositories: [], features: [], capabilities: [], relations: [], owners: [] });
161
+ }
162
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/node/fs.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CH,wCAMC;AAED,wCASC;AAqCD,0CAcC;AAGD,wCAOC;AAvHD,+CAA4E;AAC5E,gDAAkC;AAElC,+DAAqE;AACrE,oCAA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E,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;AACxH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Read a clone's history into an `ActivityReading`. Read-only: `git log`,
3
+ * `git tag`, `git rev-parse`, `git remote get-url`. Never fetches or pulls —
4
+ * the reading is of the clone as it is, and says when it was taken.
5
+ */
6
+ import type { ActivityReading } from '../types';
7
+ export interface ReadActivityOptions {
8
+ observedBy: string;
9
+ /** The reading's time. Defaults to the moment of reading. */
10
+ now?: Date;
11
+ }
12
+ export declare function readActivity(clone: string, options: ReadActivityOptions): Promise<ActivityReading>;
13
+ /** `repository:<owner>/<name>` from the clone's `origin` remote, when it is on GitHub. */
14
+ export declare function originRepository(clone: string): Promise<string | undefined>;
15
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/node/git.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAiBhD,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAoCxG;AAED,0FAA0F;AAC1F,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAIjF"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ /**
3
+ * Read a clone's history into an `ActivityReading`. Read-only: `git log`,
4
+ * `git tag`, `git rev-parse`, `git remote get-url`. Never fetches or pulls —
5
+ * the reading is of the clone as it is, and says when it was taken.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.readActivity = readActivity;
9
+ exports.originRepository = originRepository;
10
+ const node_child_process_1 = require("node:child_process");
11
+ const node_util_1 = require("node:util");
12
+ const ids_1 = require("../ids");
13
+ const run = (0, node_util_1.promisify)(node_child_process_1.execFile);
14
+ const DAY_MS = 86_400_000;
15
+ async function git(clone, args) {
16
+ try {
17
+ // A signer's `log.showSignature` would put a signature report between the dates.
18
+ const { stdout } = await run('git', ['-c', 'log.showSignature=false', '-C', clone, ...args], {
19
+ maxBuffer: 256 * 1024 * 1024,
20
+ });
21
+ return stdout;
22
+ }
23
+ catch {
24
+ return undefined;
25
+ }
26
+ }
27
+ async function readActivity(clone, options) {
28
+ if ((await git(clone, ['rev-parse', '--git-dir'])) === undefined) {
29
+ throw new Error(`not a git clone: ${clone}`);
30
+ }
31
+ const now = options.now ?? new Date();
32
+ // An empty repository has no HEAD to log; that reads as zero commits. Only
33
+ // lines that are dates count, whatever else a configured git prints.
34
+ const dates = ((await git(clone, ['log', '--format=%cI'])) ?? '')
35
+ .split('\n')
36
+ .filter((line) => /^\d{4}-\d{2}-\d{2}T/.test(line) && Number.isFinite(Date.parse(line)));
37
+ const times = dates.map((d) => Date.parse(d));
38
+ const tags = ((await git(clone, ['tag', '--list'])) ?? '').split('\n').filter(Boolean).length;
39
+ const branch = (await git(clone, ['rev-parse', '--abbrev-ref', 'HEAD']))?.trim();
40
+ const head = (await git(clone, ['rev-parse', 'HEAD']))?.trim();
41
+ const reading = {
42
+ observedBy: options.observedBy,
43
+ observedAt: now.toISOString(),
44
+ commits: dates.length,
45
+ commitsLast90Days: times.filter((t) => now.getTime() - t <= 90 * DAY_MS).length,
46
+ tags,
47
+ };
48
+ // A loop, not Math.max(...times): a spread of a large history overflows the stack.
49
+ let last = 0;
50
+ let first = 0;
51
+ for (let i = 1; i < times.length; i++) {
52
+ if (times[i] > times[last])
53
+ last = i;
54
+ if (times[i] < times[first])
55
+ first = i;
56
+ }
57
+ if (dates.length) {
58
+ reading.lastCommitAt = dates[last];
59
+ reading.firstCommitAt = dates[first];
60
+ }
61
+ if (branch && branch !== 'HEAD')
62
+ reading.branch = branch;
63
+ if (head && /^[0-9a-f]{40}$/.test(head))
64
+ reading.head = head;
65
+ return reading;
66
+ }
67
+ /** `repository:<owner>/<name>` from the clone's `origin` remote, when it is on GitHub. */
68
+ async function originRepository(clone) {
69
+ const url = (await git(clone, ['remote', 'get-url', 'origin']))?.trim();
70
+ const repo = url ? (0, ids_1.parseGithubRemote)(url) : undefined;
71
+ return repo ? (0, ids_1.repositoryNodeId)(repo.owner, repo.name) : undefined;
72
+ }
73
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/node/git.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA4BH,oCAoCC;AAGD,4CAIC;AArED,2DAA8C;AAC9C,yCAAsC;AACtC,gCAA6D;AAG7D,MAAM,GAAG,GAAG,IAAA,qBAAS,EAAC,6BAAQ,CAAC,CAAC;AAChC,MAAM,MAAM,GAAG,UAAU,CAAC;AAE1B,KAAK,UAAU,GAAG,CAAC,KAAa,EAAE,IAAc;IAC9C,IAAI,CAAC;QACH,iFAAiF;QACjF,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,yBAAyB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,EAAE;YAC3F,SAAS,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;SAC7B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAQM,KAAK,UAAU,YAAY,CAAC,KAAa,EAAE,OAA4B;IAC5E,IAAI,CAAC,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;Q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AiB,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,OAAO,IAAI,CAAC,CAAC,CAAC,IAAA,sBAAgB,EAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpE,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Read a hub: its own folder, and when it is a meta hub, every owner hub it
3
+ * registers, from a local path or over https. Each hub is checked on its
4
+ * own, then merged. A hub that cannot be read is reported and the others are
5
+ * still read.
6
+ */
7
+ import { type MergedMapping } from '../merge';
8
+ import { type MappingRead } from '../read';
9
+ import { type MappingIssue, type RepositoryMapping } from '../types';
10
+ export type FetchLike = (url: string, init?: {
11
+ signal?: AbortSignal;
12
+ }) => Promise<{
13
+ ok: boolean;
14
+ status: number;
15
+ text(): Promise<string>;
16
+ }>;
17
+ /** How long one file of a remote hub may take before that hub is reported unread. */
18
+ export declare const HUB_FETCH_TIMEOUT_MS = 15000;
19
+ /** Where GitHub serves a hub's mapping folder from its default branch. */
20
+ export declare function defaultHubSource(hub: string): string;
21
+ /** Read a mapping folder from a local path (relative to `base`) or an https URL. */
22
+ export declare function readMappingSource(source: string, base: string, fetchImpl?: FetchLike, label?: string): Promise<MappingRead>;
23
+ export interface HubStatus {
24
+ hub: string;
25
+ source: string;
26
+ read: boolean;
27
+ repositories: number;
28
+ issues: MappingIssue[];
29
+ }
30
+ export interface HubRead {
31
+ /** The folder's own rows. */
32
+ local?: RepositoryMapping;
33
+ /** The folder's own rows merged with every hub it registers (just its own for an owner hub). */
34
+ merged?: MergedMapping;
35
+ hubs: HubStatus[];
36
+ /** Every issue: each hub's reading and check, then the merge's. */
37
+ issues: MappingIssue[];
38
+ }
39
+ export interface ReadHubOptions {
40
+ /** Read only the folder's own rows, even for a meta hub. */
41
+ local?: boolean;
42
+ fetch?: FetchLike;
43
+ }
44
+ export declare function readHub(dir: string, options?: ReadHubOptions): Promise<HubRead>;
45
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,EAAE,CAAC;IAClB,mEAAmE;IACnE,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAgCzF"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ /**
3
+ * Read a hub: its own folder, and when it is a meta hub, every owner hub it
4
+ * registers, from a local path or over https. Each hub is checked on its
5
+ * own, then merged. A hub that cannot be read is reported and the others are
6
+ * still read.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.HUB_FETCH_TIMEOUT_MS = void 0;
43
+ exports.defaultHubSource = defaultHubSource;
44
+ exports.readMappingSource = readMappingSource;
45
+ exports.readHub = readHub;
46
+ const path = __importStar(require("node:path"));
47
+ const check_1 = require("../check");
48
+ const merge_1 = require("../merge");
49
+ const read_1 = require("../read");
50
+ const types_1 = require("../types");
51
+ const fs_1 = require("./fs");
52
+ /** How long one file of a remote hub may take before that hub is reported unread. */
53
+ exports.HUB_FETCH_TIMEOUT_MS = 15_000;
54
+ /** Where GitHub serves a hub's mapping folder from its default branch. */
55
+ function defaultHubSource(hub) {
56
+ return `https://raw.githubusercontent.com/${hub}/HEAD/${types_1.MAPPING_DIR}/`;
57
+ }
58
+ /** Read a mapping folder from a local path (relative to `base`) or an https URL. */
59
+ async function readMappingSource(source, base, fetchImpl = globalThis.fetch, label) {
60
+ try {
61
+ if (/^https?:\/\//.test(source)) {
62
+ const folder = source.endsWith('/') ? source : `${source}/`;
63
+ return await (0, read_1.readMapping)(async (file) => {
64
+ const res = await fetchImpl(new URL(file, folder).toString(), { signal: AbortSignal.timeout(exports.HUB_FETCH_TIMEOUT_MS) });
65
+ if (res.status === 404)
66
+ return undefined;
67
+ if (!res.ok)
68
+ throw new Error(`${res.status} from ${folder}${file}`);
69
+ return res.text();
70
+ }, label ?? source);
71
+ }
72
+ const resolved = path.resolve(base, source);
73
+ const dir = (await (0, fs_1.findMappingDir)(resolved)) ?? resolved;
74
+ return await (0, fs_1.readMappingDir)(dir, label ?? source);
75
+ }
76
+ catch (error) {
77
+ return { issues: [{ severity: 'error', file: label ?? source, message: error.message }] };
78
+ }
79
+ }
80
+ async function readHub(dir, options = {}) {
81
+ const own = await (0, fs_1.readMappingDir)(dir);
82
+ if (!own.mapping)
83
+ return { hubs: [], issues: own.issues };
84
+ const local = own.mapping;
85
+ const selfHub = local.manifest.hub;
86
+ const selfIssues = [...own.issues, ...(0, check_1.checkMapping)(local)];
87
+ const hubs = [
88
+ { hub: selfHub, source: dir, read: true, repositories: local.repositories.length, issues: selfIssues },
89
+ ];
90
+ const readings = [{ hub: selfHub, mapping: local }];
91
+ if (local.manifest.kind === 'meta' && !options.local) {
92
+ for (const owner of local.owners) {
93
+ if (owner.hub === selfHub)
94
+ continue;
95
+ const source = owner.source ?? defaultHubSource(owner.hub);
96
+ const read = await readMappingSource(source, dir, options.fetch, owner.hub);
97
+ const issues = [...read.issues];
98
+ let ok = Boolean(read.mapping);
99
+ if (read.mapping && read.mapping.manifest.hub !== owner.hub) {
100
+ issues.push({ severity: 'error', file: owner.hub, message: `${source} holds ${read.mapping.manifest.hub}'s mapping, not ${owner.hub}'s` });
101
+ ok = false;
102
+ }
103
+ if (read.mapping && ok) {
104
+ issues.push(...(0, check_1.checkMapping)(read.mapping).map((i) => ({ ...i, file: `${owner.hub}/${i.file ?? ''}` })));
105
+ readings.push({ hub: owner.hub, mapping: read.mapping });
106
+ }
107
+ hubs.push({ hub: owner.hub, source, read: ok, repositories: read.mapping?.repositories.length ?? 0, issues });
108
+ }
109
+ }
110
+ const merged = (0, merge_1.mergeMappings)(readings);
111
+ return { local, merged, hubs, issues: [...hubs.flatMap((h) => h.issues), ...merged.issues] };
112
+ }
113
+ //# sourceMappingURL=hub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub.js","sourceRoot":"","sources":["../../src/node/hub.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBH,4CAEC;AAGD,8CAsBC;AA0BD,0BAgCC;AArGD,gDAAkC;AAClC,oCAAwC;AACxC,oCAA8E;AAC9E,kCAAwD;AACxD,oCAAkF;AAClF,6BAAsD;AAOtD,qFAAqF;AACxE,QAAA,oBAAoB,GAAG,MAAM,CAAC;AAE3C,0EAA0E;AAC1E,SAAgB,gBAAgB,CAAC,GAAW;I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I,CAAC,OAAO,EAAE,YAAY,CAAC,MAAM,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAChH,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,qBAAa,EAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;AAC/F,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @medicine-wheel/developer-repository-mapping/node
3
+ *
4
+ * File, git and HTTP access for repository mappings, on Node: read and write
5
+ * a mapping folder, read a clone's history into an activity reading, read a
6
+ * meta hub with every owner hub it registers, and serve the small web page.
7
+ */
8
+ export { findMappingDir, readMappingDir, writeMappingDir, initMappingDir } from './fs';
9
+ export { readActivity, originRepository } from './git';
10
+ export type { ReadActivityOptions } from './git';
11
+ export { defaultHubSource, readMappingSource, readHub, HUB_FETCH_TIMEOUT_MS } from './hub';
12
+ export type { FetchLike, HubStatus, HubRead, ReadHubOptions } from './hub';
13
+ export { createMappingServer, toView, LOOPBACK_HOSTS } from './server';
14
+ export type { MappingView, MappingServerOptions } from './server';
15
+ export { MAPPING_PAGE } from './page';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACvD,YAAY,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC3F,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACvE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * @medicine-wheel/developer-repository-mapping/node
4
+ *
5
+ * File, git and HTTP access for repository mappings, on Node: read and write
6
+ * a mapping folder, read a clone's history into an activity reading, read a
7
+ * meta hub with every owner hub it registers, and serve the small web page.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.MAPPING_PAGE = exports.LOOPBACK_HOSTS = exports.toView = exports.createMappingServer = exports.HUB_FETCH_TIMEOUT_MS = exports.readHub = exports.readMappingSource = exports.defaultHubSource = exports.originRepository = exports.readActivity = exports.initMappingDir = exports.writeMappingDir = exports.readMappingDir = exports.findMappingDir = void 0;
11
+ var fs_1 = require("./fs");
12
+ Object.defineProperty(exports, "findMappingDir", { enumerable: true, get: function () { return fs_1.findMappingDir; } });
13
+ Object.defineProperty(exports, "readMappingDir", { enumerable: true, get: function () { return fs_1.readMappingDir; } });
14
+ Object.defineProperty(exports, "writeMappingDir", { enumerable: true, get: function () { return fs_1.writeMappingDir; } });
15
+ Object.defineProperty(exports, "initMappingDir", { enumerable: true, get: function () { return fs_1.initMappingDir; } });
16
+ var git_1 = require("./git");
17
+ Object.defineProperty(exports, "readActivity", { enumerable: true, get: function () { return git_1.readActivity; } });
18
+ Object.defineProperty(exports, "originRepository", { enumerable: true, get: function () { return git_1.originRepository; } });
19
+ var hub_1 = require("./hub");
20
+ Object.defineProperty(exports, "defaultHubSource", { enumerable: true, get: function () { return hub_1.defaultHubSource; } });
21
+ Object.defineProperty(exports, "readMappingSource", { enumerable: true, get: function () { return hub_1.readMappingSource; } });
22
+ Object.defineProperty(exports, "readHub", { enumerable: true, get: function () { return hub_1.readHub; } });
23
+ Object.defineProperty(exports, "HUB_FETCH_TIMEOUT_MS", { enumerable: true, get: function () { return hub_1.HUB_FETCH_TIMEOUT_MS; } });
24
+ var server_1 = require("./server");
25
+ Object.defineProperty(exports, "createMappingServer", { enumerable: true, get: function () { return server_1.createMappingServer; } });
26
+ Object.defineProperty(exports, "toView", { enumerable: true, get: function () { return server_1.toView; } });
27
+ Object.defineProperty(exports, "LOOPBACK_HOSTS", { enumerable: true, get: function () { return server_1.LOOPBACK_HOSTS; } });
28
+ var page_1 = require("./page");
29
+ Object.defineProperty(exports, "MAPPING_PAGE", { enumerable: true, get: function () { return page_1.MAPPING_PAGE; } });
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2BAAuF;AAA9E,oGAAA,cAAc,OAAA;AAAE,oGAAA,cAAc,OAAA;AAAE,qGAAA,eAAe,OAAA;AAAE,oGAAA,cAAc,OAAA;AACxE,6BAAuD;AAA9C,mGAAA,YAAY,OAAA;AAAE,uGAAA,gBAAgB,OAAA;AAEvC,6BAA2F;AAAlF,uGAAA,gBAAgB,OAAA;AAAE,wGAAA,iBAAiB,OAAA;AAAE,8FAAA,OAAO,OAAA;AAAE,2GAAA,oBAAoB,OAAA;AAE3E,mCAAuE;AAA9D,6GAAA,mBAAmB,OAAA;AAAE,gGAAA,MAAM,OAAA;AAAE,wGAAA,cAAc,OAAA;AAEpD,+BAAsC;AAA7B,oGAAA,YAAY,OAAA"}