@odla-ai/chapter 0.47.3 → 0.47.4

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.
@@ -7013,6 +7013,9 @@ async function networkSourceKey(sourceSystem, sourceRecordId) {
7013
7013
  async function networkChapterLinkId(personId, chapterId, chapterPersonId) {
7014
7014
  return `chapter_person_${await sha256(`${personId}\0${chapterId}\0${chapterPersonId}`)}`;
7015
7015
  }
7016
+ async function networkChapterPersonSourceKey(chapterId, chapterPersonId) {
7017
+ return `chapter_source_${await sha256(`${chapterId}\0${chapterPersonId}`)}`;
7018
+ }
7016
7019
  function projectNetworkContactPolicy(policy, links) {
7017
7020
  return links.map((link) => ({ ...link, contactPolicy: { ...policy } }));
7018
7021
  }
@@ -7274,10 +7277,11 @@ var MUTATION_ID4 = /^[A-Za-z0-9_-]{16,128}$/;
7274
7277
  function redactedName(displayName) {
7275
7278
  return displayName.split(/\s+/).filter(Boolean).map((part) => `${part[0]?.toUpperCase() ?? ""}\u2026`).join(" ");
7276
7279
  }
7277
- var redactedLink = (link) => ({
7280
+ var redactedLink = async (link) => ({
7278
7281
  id: link.id,
7279
7282
  personId: link.personId,
7280
7283
  chapterId: link.chapterId,
7284
+ sourceKey: await networkChapterPersonSourceKey(link.chapterId, link.chapterPersonId),
7281
7285
  state: link.state,
7282
7286
  createdAt: link.createdAt
7283
7287
  });
@@ -7441,8 +7445,9 @@ var handleAdminNetworkPersonRegistry = async (req, url, env, ctx) => {
7441
7445
  }
7442
7446
  }
7443
7447
  const state = await loadNetworkPersonRegistry(db);
7444
- const persons = state.persons.map((person) => {
7448
+ const persons = await Promise.all(state.persons.map(async (person) => {
7445
7449
  const links = state.links.filter((link) => link.personId === person.id);
7450
+ const safeLinks = await Promise.all(links.map(redactedLink));
7446
7451
  const canonicalId = canonicalNetworkPersonId(person.id, state.persons);
7447
7452
  const canonical2 = state.persons.find((candidate) => candidate.id === canonicalId) ?? person;
7448
7453
  return {
@@ -7454,16 +7459,20 @@ var handleAdminNetworkPersonRegistry = async (req, url, env, ctx) => {
7454
7459
  revision: person.revision,
7455
7460
  contactPolicy: safePolicy(person.contactPolicy),
7456
7461
  identityClaims: state.claims.filter((claim) => claim.personId === person.id).map(({ id, kind, hint, verifiedAt }) => ({ id, kind, hint: hint ?? null, verifiedAt })),
7457
- chapterLinks: links.map(redactedLink),
7458
- chapterProjections: projectNetworkContactPolicy(canonical2.contactPolicy, links.map(redactedLink)).map(({ contactPolicy, ...projection }) => ({ ...projection, contactPolicy: safePolicy(contactPolicy) }))
7462
+ chapterLinks: safeLinks,
7463
+ chapterProjections: projectNetworkContactPolicy(canonical2.contactPolicy, safeLinks).map(({ contactPolicy, ...projection }) => ({ ...projection, contactPolicy: safePolicy(contactPolicy) }))
7459
7464
  };
7460
- });
7465
+ }));
7461
7466
  const aliases = state.aliases.map(safeAlias);
7462
7467
  return json({
7463
7468
  version: 1,
7464
7469
  mode: "shadow",
7465
7470
  writable: true,
7466
7471
  authoritativeForChapterOperation: false,
7472
+ // loadNetworkPersonRegistry deliberately bounds each collection at 1,000.
7473
+ // Exactly 1,000 links may mean there are more, so fail closed rather than
7474
+ // letting a consumer mistake an omitted explicit link for "source only".
7475
+ chapterLinkProjectionComplete: state.links.length < 1e3,
7467
7476
  configuredChapterIds: ctx.chapter.networkPersonRegistry.chapterIds,
7468
7477
  persons,
7469
7478
  aliases,