@singi-labs/sifa-sdk 0.19.32 → 0.19.33

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 (43) hide show
  1. package/dist/{index-piLIwMN1.d.cts → index-CH8NiQwH.d.cts} +18 -1
  2. package/dist/{index-CpbCm2Fe.d.ts → index-ayiu2kGy.d.ts} +18 -1
  3. package/dist/index.cjs +103 -1
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +53 -7
  6. package/dist/index.d.ts +53 -7
  7. package/dist/index.js +102 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/jsonld/index.d.cts +1 -1
  10. package/dist/jsonld/index.d.ts +1 -1
  11. package/dist/{network-map-9VAyPnle.d.cts → network-map-5ZQalf1g.d.cts} +4 -4
  12. package/dist/{network-map-BgeHssxs.d.ts → network-map-CemKAXaz.d.ts} +4 -4
  13. package/dist/{org-Dx8K7Mh8.d.ts → org-Baoxl7ha.d.ts} +2 -2
  14. package/dist/{org-BIbPhHLx.d.cts → org-D-zPVoep.d.cts} +2 -2
  15. package/dist/{profile-investment-PDLfao_i.d.cts → profile-investment-BIOYJf-x.d.cts} +12 -1
  16. package/dist/{profile-investment-PDLfao_i.d.ts → profile-investment-BIOYJf-x.d.ts} +12 -1
  17. package/dist/{profile-summary-CHUPtU__.d.ts → profile-summary-Bw6SLwnM.d.ts} +1 -1
  18. package/dist/{profile-summary-Bm3gJPKC.d.cts → profile-summary-DOkOlwml.d.cts} +1 -1
  19. package/dist/query/fetchers/index.d.cts +6 -6
  20. package/dist/query/fetchers/index.d.ts +6 -6
  21. package/dist/query/hooks/index.d.cts +5 -5
  22. package/dist/query/hooks/index.d.ts +5 -5
  23. package/dist/query/index.d.cts +8 -8
  24. package/dist/query/index.d.ts +8 -8
  25. package/dist/resume/index.d.cts +1 -1
  26. package/dist/resume/index.d.ts +1 -1
  27. package/dist/schemas/index.cjs +7 -0
  28. package/dist/schemas/index.cjs.map +1 -1
  29. package/dist/schemas/index.d.cts +1 -1
  30. package/dist/schemas/index.d.ts +1 -1
  31. package/dist/schemas/index.js +7 -1
  32. package/dist/schemas/index.js.map +1 -1
  33. package/dist/schemas/write/index.cjs +9 -0
  34. package/dist/schemas/write/index.cjs.map +1 -1
  35. package/dist/schemas/write/index.d.cts +39 -1
  36. package/dist/schemas/write/index.d.ts +39 -1
  37. package/dist/schemas/write/index.js +9 -1
  38. package/dist/schemas/write/index.js.map +1 -1
  39. package/dist/{types-Mosj_JIx.d.ts → types-CKqres0c.d.ts} +6 -1
  40. package/dist/{types-mmGgHkik.d.cts → types-CWIfTV3N.d.cts} +6 -1
  41. package/dist/{use-org-notification-emails-OHgt6WRP.d.cts → use-org-notification-emails-3m5Rit93.d.cts} +3 -3
  42. package/dist/{use-org-notification-emails-Dsek36iZ.d.ts → use-org-notification-emails-Cx-bDFpR.d.ts} +3 -3
  43. package/package.json +1 -1
@@ -255,6 +255,17 @@ interface AuthorSuggestion {
255
255
  /** Display name on the matched account, for showing what is being proposed. */
256
256
  displayName?: string;
257
257
  }
258
+ /**
259
+ * A typed link from a work to another version or form of it
260
+ * (`id.sifa.defs#relatedIdentifier`). `relationType` uses the DataCite
261
+ * vocabulary, e.g. `IsPreprintOf` on a preprint pointing at its published
262
+ * version. `identifierType` is `DOI` (the default when absent), `AT-URI` or `URL`.
263
+ */
264
+ interface RelatedIdentifier {
265
+ identifier: string;
266
+ identifierType?: string;
267
+ relationType: string;
268
+ }
258
269
  interface ProfilePublication {
259
270
  rkey: string;
260
271
  title: string;
@@ -293,6 +304,12 @@ interface ProfilePublication {
293
304
  * for Sifa/ORCID publications, null when none could be resolved.
294
305
  */
295
306
  image?: string | null;
307
+ /**
308
+ * Other versions or forms of this work: relations declared on the record
309
+ * plus, for a DOI, those registered with DataCite or Crossref (#590). Feed
310
+ * to `groupPublicationVersions` to fold a preprint under its published version.
311
+ */
312
+ relatedIdentifiers?: RelatedIdentifier[];
296
313
  }
297
314
  interface ProfileVolunteering {
298
315
  rkey: string;
@@ -932,4 +949,4 @@ interface Profile {
932
949
  externalAccounts?: ExternalAccount[];
933
950
  }
934
951
 
935
- export { type AccountFacetMode as A, type ProfileInvestmentLink as B, type CoSpeaker as C, type ProfileInvolvementLink as D, type Endorsement as E, type FeedItem as F, type ProfileLocation as G, type ProfileOverrideSource as H, type ProfilePresentation as I, type ProfileVolunteering as J, type ProjectMemberCard as K, type LocationValue as L, type ProjectRole as M, type PublicationContributor as N, type OrgAddressView as O, type ProfileSkill as P, type SkillSuggestion as Q, type RecognizedEntity as R, type SkillRef as S, type TrustStat as T, type VerifiedAccount as V, type ProfilePresentationDelivery as a, type PdsProviderInfo as b, type Profile as c, type ProfilePosition as d, type ProfileCertification as e, type ProfileEducation as f, type ProfileHonor as g, type ProfileLanguage as h, type ProfileProject as i, type ProfilePublication as j, type ProfileInvolvement as k, type ActiveApp as l, type ActorCard as m, type AuthorSuggestion as n, type EndorsementData as o, type ExternalAccount as p, type ExternalAccountKeytraceClaim as q, type LanguageProficiency as r, type OrgFloorVerdict as s, type OrgLinkView as t, type OrgProfileView as u, PROJECT_ROLES as v, type PresentationLinkView as w, type ProfileCourse as x, type ProfileIndustry as y, type ProfileInvestment as z };
952
+ export { type AccountFacetMode as A, type ProfileInvestmentLink as B, type CoSpeaker as C, type ProfileInvolvementLink as D, type Endorsement as E, type FeedItem as F, type ProfileLocation as G, type ProfileOverrideSource as H, type ProfilePresentation as I, type ProfileVolunteering as J, type ProjectMemberCard as K, type LocationValue as L, type ProjectRole as M, type PublicationContributor as N, type OrgAddressView as O, type ProfileSkill as P, type RecognizedEntity as Q, type RelatedIdentifier as R, type SkillRef as S, type SkillSuggestion as T, type TrustStat as U, type VerifiedAccount as V, type ProfilePresentationDelivery as a, type PdsProviderInfo as b, type Profile as c, type ProfilePosition as d, type ProfileCertification as e, type ProfileEducation as f, type ProfileHonor as g, type ProfileLanguage as h, type ProfileProject as i, type ProfilePublication as j, type ProfileInvolvement as k, type ActiveApp as l, type ActorCard as m, type AuthorSuggestion as n, type EndorsementData as o, type ExternalAccount as p, type ExternalAccountKeytraceClaim as q, type LanguageProficiency as r, type OrgFloorVerdict as s, type OrgLinkView as t, type OrgProfileView as u, PROJECT_ROLES as v, type PresentationLinkView as w, type ProfileCourse as x, type ProfileIndustry as y, type ProfileInvestment as z };
@@ -255,6 +255,17 @@ interface AuthorSuggestion {
255
255
  /** Display name on the matched account, for showing what is being proposed. */
256
256
  displayName?: string;
257
257
  }
258
+ /**
259
+ * A typed link from a work to another version or form of it
260
+ * (`id.sifa.defs#relatedIdentifier`). `relationType` uses the DataCite
261
+ * vocabulary, e.g. `IsPreprintOf` on a preprint pointing at its published
262
+ * version. `identifierType` is `DOI` (the default when absent), `AT-URI` or `URL`.
263
+ */
264
+ interface RelatedIdentifier {
265
+ identifier: string;
266
+ identifierType?: string;
267
+ relationType: string;
268
+ }
258
269
  interface ProfilePublication {
259
270
  rkey: string;
260
271
  title: string;
@@ -293,6 +304,12 @@ interface ProfilePublication {
293
304
  * for Sifa/ORCID publications, null when none could be resolved.
294
305
  */
295
306
  image?: string | null;
307
+ /**
308
+ * Other versions or forms of this work: relations declared on the record
309
+ * plus, for a DOI, those registered with DataCite or Crossref (#590). Feed
310
+ * to `groupPublicationVersions` to fold a preprint under its published version.
311
+ */
312
+ relatedIdentifiers?: RelatedIdentifier[];
296
313
  }
297
314
  interface ProfileVolunteering {
298
315
  rkey: string;
@@ -932,4 +949,4 @@ interface Profile {
932
949
  externalAccounts?: ExternalAccount[];
933
950
  }
934
951
 
935
- export { type AccountFacetMode as A, type ProfileInvestmentLink as B, type CoSpeaker as C, type ProfileInvolvementLink as D, type Endorsement as E, type FeedItem as F, type ProfileLocation as G, type ProfileOverrideSource as H, type ProfilePresentation as I, type ProfileVolunteering as J, type ProjectMemberCard as K, type LocationValue as L, type ProjectRole as M, type PublicationContributor as N, type OrgAddressView as O, type ProfileSkill as P, type SkillSuggestion as Q, type RecognizedEntity as R, type SkillRef as S, type TrustStat as T, type VerifiedAccount as V, type ProfilePresentationDelivery as a, type PdsProviderInfo as b, type Profile as c, type ProfilePosition as d, type ProfileCertification as e, type ProfileEducation as f, type ProfileHonor as g, type ProfileLanguage as h, type ProfileProject as i, type ProfilePublication as j, type ProfileInvolvement as k, type ActiveApp as l, type ActorCard as m, type AuthorSuggestion as n, type EndorsementData as o, type ExternalAccount as p, type ExternalAccountKeytraceClaim as q, type LanguageProficiency as r, type OrgFloorVerdict as s, type OrgLinkView as t, type OrgProfileView as u, PROJECT_ROLES as v, type PresentationLinkView as w, type ProfileCourse as x, type ProfileIndustry as y, type ProfileInvestment as z };
952
+ export { type AccountFacetMode as A, type ProfileInvestmentLink as B, type CoSpeaker as C, type ProfileInvolvementLink as D, type Endorsement as E, type FeedItem as F, type ProfileLocation as G, type ProfileOverrideSource as H, type ProfilePresentation as I, type ProfileVolunteering as J, type ProjectMemberCard as K, type LocationValue as L, type ProjectRole as M, type PublicationContributor as N, type OrgAddressView as O, type ProfileSkill as P, type RecognizedEntity as Q, type RelatedIdentifier as R, type SkillRef as S, type SkillSuggestion as T, type TrustStat as U, type VerifiedAccount as V, type ProfilePresentationDelivery as a, type PdsProviderInfo as b, type Profile as c, type ProfilePosition as d, type ProfileCertification as e, type ProfileEducation as f, type ProfileHonor as g, type ProfileLanguage as h, type ProfileProject as i, type ProfilePublication as j, type ProfileInvolvement as k, type ActiveApp as l, type ActorCard as m, type AuthorSuggestion as n, type EndorsementData as o, type ExternalAccount as p, type ExternalAccountKeytraceClaim as q, type LanguageProficiency as r, type OrgFloorVerdict as s, type OrgLinkView as t, type OrgProfileView as u, PROJECT_ROLES as v, type PresentationLinkView as w, type ProfileCourse as x, type ProfileIndustry as y, type ProfileInvestment as z };
package/dist/index.cjs CHANGED
@@ -5669,6 +5669,100 @@ function groupInvolvementByHeading(items) {
5669
5669
  return groups;
5670
5670
  }
5671
5671
 
5672
+ // src/profile/publication-versions.ts
5673
+ var PREPRINT_OF = /* @__PURE__ */ new Set(["IsPreprintOf", "IsPublishedIn"]);
5674
+ var DEFERS_TO = /* @__PURE__ */ new Set(["IsVersionOf", "IsPreviousVersionOf"]);
5675
+ var doiKey = (doi) => `doi:${normalizeDoi(doi).toLowerCase()}`;
5676
+ function targetKey(rel) {
5677
+ const id = rel.identifier?.trim();
5678
+ if (!id) return void 0;
5679
+ const type = rel.identifierType ?? "DOI";
5680
+ if (type === "AT-URI") return `uri:${id}`;
5681
+ if (type === "URL") {
5682
+ const bare = normalizeDoi(id);
5683
+ return bare.startsWith("10.") ? doiKey(bare) : `url:${id}`;
5684
+ }
5685
+ return doiKey(id);
5686
+ }
5687
+ function groupPublicationVersions(pubs, options = {}) {
5688
+ const keyToIndex = /* @__PURE__ */ new Map();
5689
+ pubs.forEach((p, i) => {
5690
+ if (p.doi) keyToIndex.set(doiKey(p.doi), i);
5691
+ if (options.ownerDid && (!p.source || p.source === "sifa")) {
5692
+ keyToIndex.set(`uri:at://${options.ownerDid}/id.sifa.profile.publication/${p.rkey}`, i);
5693
+ }
5694
+ if (p.publicationUri) keyToIndex.set(`uri:${p.publicationUri}`, i);
5695
+ });
5696
+ const parent = pubs.map((_, i) => i);
5697
+ const find = (i) => {
5698
+ while (parent[i] !== i) {
5699
+ parent[i] = parent[parent[i]];
5700
+ i = parent[i];
5701
+ }
5702
+ return i;
5703
+ };
5704
+ const union = (a, b) => {
5705
+ const ra = find(a);
5706
+ const rb = find(b);
5707
+ if (ra !== rb) parent[rb] = ra;
5708
+ };
5709
+ const preprints = /* @__PURE__ */ new Set();
5710
+ const deferring = /* @__PURE__ */ new Set();
5711
+ const siblingsOf = /* @__PURE__ */ new Map();
5712
+ pubs.forEach((p, i) => {
5713
+ if (p.type === "preprint") preprints.add(i);
5714
+ for (const rel of p.relatedIdentifiers ?? []) {
5715
+ const key = targetKey(rel);
5716
+ if (!key) continue;
5717
+ const j = keyToIndex.get(key);
5718
+ if (j === void 0) {
5719
+ if (rel.relationType === "IsVersionOf") {
5720
+ const first = siblingsOf.get(key);
5721
+ if (first === void 0) siblingsOf.set(key, i);
5722
+ else union(first, i);
5723
+ }
5724
+ continue;
5725
+ }
5726
+ if (j === i) continue;
5727
+ union(i, j);
5728
+ if (PREPRINT_OF.has(rel.relationType)) preprints.add(i);
5729
+ if (DEFERS_TO.has(rel.relationType)) deferring.add(i);
5730
+ if (rel.relationType === "HasPreprint") preprints.add(j);
5731
+ }
5732
+ });
5733
+ const members = /* @__PURE__ */ new Map();
5734
+ pubs.forEach((_, i) => {
5735
+ const root = find(i);
5736
+ const list = members.get(root);
5737
+ if (list) list.push(i);
5738
+ else members.set(root, [i]);
5739
+ });
5740
+ const newestFirst = (a, b) => {
5741
+ const da = pubs[a].date ?? "";
5742
+ const db = pubs[b].date ?? "";
5743
+ if (da !== db) return db.localeCompare(da);
5744
+ const fa = deferring.has(a) ? 1 : 0;
5745
+ const fb = deferring.has(b) ? 1 : 0;
5746
+ if (fa !== fb) return fa - fb;
5747
+ return a - b;
5748
+ };
5749
+ const groups = [];
5750
+ for (const indexes of members.values()) {
5751
+ const primary = indexes.find((i) => pubs[i].primary);
5752
+ const published = indexes.filter((i) => !preprints.has(i));
5753
+ const pool = published.length ? published : indexes;
5754
+ const lead = primary ?? [...pool].sort(newestFirst)[0];
5755
+ groups.push({
5756
+ order: Math.min(...indexes),
5757
+ group: {
5758
+ lead: pubs[lead],
5759
+ versions: indexes.filter((i) => i !== lead).sort(newestFirst).map((i) => ({ pub: pubs[i], kind: preprints.has(i) ? "preprint" : "version" }))
5760
+ }
5761
+ });
5762
+ }
5763
+ return groups.sort((a, b) => a.order - b.order).map((g) => g.group);
5764
+ }
5765
+
5672
5766
  // src/profile/highlights.ts
5673
5767
  function coPeopleLabel(people, self) {
5674
5768
  const names = (people ?? []).filter((p) => p.did !== self.did && (!p.handle || p.handle !== self.handle)).map((p) => p.displayName ?? p.name ?? p.handle).filter((n) => Boolean(n && n.trim()));
@@ -6326,6 +6420,11 @@ var PublicationAuthorSchema = zod.z.object({
6326
6420
  name: zod.z.string().min(1).refine(maxGraphemes(100)).max(1e3),
6327
6421
  did: didSchema.optional()
6328
6422
  });
6423
+ var RelatedIdentifierSchema = zod.z.object({
6424
+ identifier: zod.z.string().min(1).max(2048),
6425
+ identifierType: zod.z.string().max(32).optional(),
6426
+ relationType: zod.z.string().min(1).max(64)
6427
+ });
6329
6428
  var ProfilePublicationRecordSchema = zod.z.object({
6330
6429
  title: zod.z.string().min(1).refine(maxGraphemes(200)).max(2e3),
6331
6430
  subtitle: zod.z.string().refine(maxGraphemes(200)).max(2e3).optional(),
@@ -6333,6 +6432,7 @@ var ProfilePublicationRecordSchema = zod.z.object({
6333
6432
  url: uriSchema.optional(),
6334
6433
  description: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
6335
6434
  authors: zod.z.array(PublicationAuthorSchema).max(50).optional(),
6435
+ relatedIdentifiers: zod.z.array(RelatedIdentifierSchema).max(20).optional(),
6336
6436
  publishedAt: partialDateSchema.optional(),
6337
6437
  isPrimary: zod.z.boolean().optional(),
6338
6438
  createdAt: datetimeSchema
@@ -6696,7 +6796,7 @@ function describeSifaRecord(collection, value) {
6696
6796
  }
6697
6797
 
6698
6798
  // src/index.ts
6699
- var SIFA_SDK_VERSION = "0.19.32";
6799
+ var SIFA_SDK_VERSION = "0.19.33";
6700
6800
 
6701
6801
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
6702
6802
  exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
@@ -6802,6 +6902,7 @@ exports.ProfileVolunteeringRecordSchema = ProfileVolunteeringRecordSchema;
6802
6902
  exports.PublicationAuthorSchema = PublicationAuthorSchema;
6803
6903
  exports.ROADMAP_ISSUES_REPO = ROADMAP_ISSUES_REPO;
6804
6904
  exports.ROADMAP_ITEM_META = ROADMAP_ITEM_META;
6905
+ exports.RelatedIdentifierSchema = RelatedIdentifierSchema;
6805
6906
  exports.SECTION_GROUPS = SECTION_GROUPS;
6806
6907
  exports.SECTION_LABELS = SECTION_LABELS;
6807
6908
  exports.SELF_APP_ID = SELF_APP_ID;
@@ -6896,6 +6997,7 @@ exports.getVerificationProvider = getVerificationProvider;
6896
6997
  exports.getVisibleSectionIds = getVisibleSectionIds;
6897
6998
  exports.getWorkplaceTypeLabel = getWorkplaceTypeLabel;
6898
6999
  exports.groupInvolvementByHeading = groupInvolvementByHeading;
7000
+ exports.groupPublicationVersions = groupPublicationVersions;
6899
7001
  exports.groupSkillsByCategory = groupSkillsByCategory;
6900
7002
  exports.groupSkillsBySubCategory = groupSkillsBySubCategory;
6901
7003
  exports.groupSkillsForDisplay = groupSkillsForDisplay;