@singi-labs/sifa-sdk 0.12.57 → 0.12.59

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 (31) hide show
  1. package/dist/{index-Cd_heN1n.d.ts → index-B1WYOzm1.d.ts} +3 -2
  2. package/dist/{index-mXTN0GbN.d.cts → index-BcKfdI4X.d.cts} +3 -2
  3. package/dist/{types-Vf-kTiu1.d.cts → index-DMyroYoB.d.cts} +1 -509
  4. package/dist/{types-Vf-kTiu1.d.ts → index-DMyroYoB.d.ts} +1 -509
  5. package/dist/{index-DZGw-VDY.d.cts → index-Dqe0Nlck.d.cts} +4 -3
  6. package/dist/{index-GmKuSxp6.d.ts → index-czrerd84.d.ts} +4 -3
  7. package/dist/index.cjs +142 -117
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +30 -4
  10. package/dist/index.d.ts +30 -4
  11. package/dist/index.js +142 -118
  12. package/dist/index.js.map +1 -1
  13. package/dist/jsonld/index.cjs +891 -0
  14. package/dist/jsonld/index.cjs.map +1 -0
  15. package/dist/jsonld/index.d.cts +494 -0
  16. package/dist/jsonld/index.d.ts +494 -0
  17. package/dist/jsonld/index.js +878 -0
  18. package/dist/jsonld/index.js.map +1 -0
  19. package/dist/{org-fq2Xwg6Q.d.ts → org-66bQLHJd.d.ts} +2 -1
  20. package/dist/{org-CHVTcTcj.d.cts → org-GI1GVjZw.d.cts} +2 -1
  21. package/dist/{profile-summary-CdLI8k7M.d.cts → profile-summary-Bqj3TDVd.d.cts} +1 -1
  22. package/dist/{profile-summary-BS2GPBxw.d.ts → profile-summary-YZXjMymn.d.ts} +1 -1
  23. package/dist/query/fetchers/index.d.cts +5 -4
  24. package/dist/query/fetchers/index.d.ts +5 -4
  25. package/dist/query/hooks/index.d.cts +4 -3
  26. package/dist/query/hooks/index.d.ts +4 -3
  27. package/dist/query/index.d.cts +8 -7
  28. package/dist/query/index.d.ts +8 -7
  29. package/dist/types-BiBx2Utr.d.cts +511 -0
  30. package/dist/types-BkRDvKTp.d.ts +511 -0
  31. package/package.json +11 -1
@@ -0,0 +1,494 @@
1
+ import { L as LocationValue } from '../index-DMyroYoB.cjs';
2
+
3
+ /**
4
+ * Reconciliation between `id.sifa.*` lexicon terms and existing RDF
5
+ * vocabularies.
6
+ *
7
+ * This table is the single source of truth for "what does this lexicon field
8
+ * mean in somebody else's vocabulary". It drives the JSON-LD emitters in this
9
+ * module and is intended to also back a published machine-readable mapping
10
+ * document, so the two cannot drift.
11
+ *
12
+ * Scope note: RDF is adopted here as *vocabulary only*. Sifa records are
13
+ * Lexicon JSON on the AT Protocol; nothing in this module changes how records
14
+ * are stored or transmitted. A mapping is a one-directional annotation over a
15
+ * lexicon designed on its own merits, never a constraint on lexicon design.
16
+ * When a term does not fit, the correct answer is `noMatch`, not a different
17
+ * lexicon.
18
+ */
19
+ /** Vocabulary prefix -> namespace IRI. */
20
+ declare const VOCABULARIES: {
21
+ readonly schema: "https://schema.org/";
22
+ readonly bibo: "http://purl.org/ontology/bibo/";
23
+ readonly dcterms: "http://purl.org/dc/terms/";
24
+ readonly foaf: "http://xmlns.com/foaf/0.1/";
25
+ readonly org: "http://www.w3.org/ns/org#";
26
+ readonly prism: "http://prismstandard.org/namespaces/basic/2.1/";
27
+ readonly event: "http://purl.org/NET/c4dm/event.owl#";
28
+ readonly skos: "http://www.w3.org/2004/02/skos/core#";
29
+ };
30
+ type VocabularyPrefix = keyof typeof VOCABULARIES;
31
+ /**
32
+ * Strength of a mapping, using SKOS mapping relations so the table is itself
33
+ * expressible as RDF.
34
+ *
35
+ * `noMatch` is not the absence of an entry. It is a deliberate statement that
36
+ * no external term should be used for this concept, and it carries a reason.
37
+ */
38
+ type MatchStrength = 'exactMatch' | 'closeMatch' | 'broadMatch' | 'narrowMatch' | 'relatedMatch' | 'noMatch';
39
+ interface TermMapping {
40
+ /** Lexicon NSID, e.g. `id.sifa.profile.presentation`. */
41
+ readonly lexicon: string;
42
+ /**
43
+ * Field name within the record. Omitted for a record-level class mapping
44
+ * (what the record *is*, rather than what one of its fields means).
45
+ */
46
+ readonly field?: string;
47
+ /** CURIEs, e.g. `dcterms:title`. Empty when `match` is `noMatch`. */
48
+ readonly terms: readonly string[];
49
+ readonly match: MatchStrength;
50
+ /** Required when `match` is `noMatch`: why no term is appropriate. */
51
+ readonly note?: string;
52
+ }
53
+ /** Every reconciliation Sifa asserts, including the deliberate non-mappings. */
54
+ declare const TERM_MAPPINGS: readonly TermMapping[];
55
+ /**
56
+ * Expand a CURIE (`dcterms:title`) to a full IRI. Returns null for an unknown
57
+ * prefix rather than guessing a namespace.
58
+ */
59
+ declare function expandCurie(curie: string): string | null;
60
+ /** All mappings declared for one lexicon NSID, record level and field level. */
61
+ declare function mappingsForLexicon(nsid: string): readonly TermMapping[];
62
+ /** True when Sifa has deliberately declined to map this lexicon or field. */
63
+ declare function isDeliberatelyUnmapped(nsid: string, field?: string): boolean;
64
+
65
+ /**
66
+ * Schema.org JSON-LD for a Sifa profile.
67
+ *
68
+ * Ported from sifa-web's `src/lib/jsonld.ts` so that sifa.id, page.sifa.id and
69
+ * any future consumer emit the same graph from one implementation. Term choices
70
+ * are recorded in `./terms.js`.
71
+ *
72
+ * These are pure functions: no fetching, no DOM, no framework.
73
+ */
74
+
75
+ type Sanitizer = (input: string) => string;
76
+ interface JsonLdOptions {
77
+ /** Canonical origin for profile URLs. Defaults to `https://sifa.id`. */
78
+ readonly baseUrl?: string;
79
+ /** Applied to every user-authored string. Defaults to identity. */
80
+ readonly sanitize?: Sanitizer;
81
+ }
82
+ /**
83
+ * Structural input for the emitters.
84
+ *
85
+ * Deliberately looser than `Profile`: it accepts a `Profile` unchanged, but
86
+ * also the partial shapes held by consumers that render a subset (page.sifa.id)
87
+ * without forcing them to fabricate required fields.
88
+ */
89
+ interface JsonLdProfileInput {
90
+ readonly handle: string;
91
+ readonly displayName?: string;
92
+ readonly givenName?: string;
93
+ readonly familyName?: string;
94
+ readonly headline?: string;
95
+ readonly about?: string;
96
+ readonly avatar?: string;
97
+ readonly website?: string;
98
+ readonly location?: LocationValue | null;
99
+ readonly updatedAt?: string;
100
+ readonly positions?: readonly JsonLdPosition[];
101
+ readonly education?: readonly JsonLdEducation[];
102
+ readonly skills?: readonly JsonLdSkill[];
103
+ readonly certifications?: readonly JsonLdCertification[];
104
+ readonly volunteering?: readonly JsonLdVolunteering[];
105
+ readonly honors?: readonly JsonLdHonor[];
106
+ readonly languages?: readonly JsonLdLanguage[];
107
+ readonly verifiedAccounts?: readonly {
108
+ platform: string;
109
+ identifier: string;
110
+ url?: string;
111
+ }[];
112
+ readonly activeApps?: readonly {
113
+ id: string;
114
+ }[];
115
+ /** Only the length is read, to decide which section anchors to advertise. */
116
+ readonly projects?: readonly unknown[];
117
+ readonly publications?: readonly unknown[];
118
+ readonly courses?: readonly unknown[];
119
+ readonly externalAccounts?: readonly unknown[];
120
+ }
121
+ interface Hideable {
122
+ readonly hidden?: boolean;
123
+ }
124
+ interface JsonLdPosition extends Hideable {
125
+ readonly company?: string;
126
+ readonly title?: string;
127
+ readonly startedAt?: string;
128
+ readonly endedAt?: string;
129
+ readonly description?: string;
130
+ readonly primary?: boolean;
131
+ }
132
+ interface JsonLdEducation extends Hideable {
133
+ readonly institution?: string;
134
+ readonly degree?: string;
135
+ readonly fieldOfStudy?: string;
136
+ }
137
+ interface JsonLdSkill extends Hideable {
138
+ readonly name?: string;
139
+ readonly endorsementCount?: number;
140
+ }
141
+ interface JsonLdCertification extends Hideable {
142
+ readonly name?: string;
143
+ readonly authority?: string;
144
+ readonly issuingOrg?: string;
145
+ readonly credentialUrl?: string;
146
+ }
147
+ interface JsonLdVolunteering extends Hideable {
148
+ readonly organization?: string;
149
+ readonly role?: string;
150
+ readonly startDate?: string;
151
+ readonly endDate?: string;
152
+ }
153
+ interface JsonLdHonor extends Hideable {
154
+ readonly title?: string;
155
+ }
156
+ interface JsonLdLanguage extends Hideable {
157
+ readonly language?: string;
158
+ }
159
+ declare function buildPersonJsonLd(profile: JsonLdProfileInput, options?: JsonLdOptions): {
160
+ sameAs?: string[] | undefined;
161
+ knowsAbout?: string[] | undefined;
162
+ knowsLanguage?: string[] | undefined;
163
+ award?: string[] | undefined;
164
+ memberOf?: {
165
+ endDate?: string | undefined;
166
+ startDate?: string | undefined;
167
+ roleName?: string | undefined;
168
+ '@type': "OrganizationRole";
169
+ memberOf: {
170
+ '@type': "Organization";
171
+ name: string;
172
+ };
173
+ }[] | undefined;
174
+ hasCredential?: ({
175
+ recognizedBy?: {
176
+ '@type': "EducationalOrganization";
177
+ name: string;
178
+ } | undefined;
179
+ '@type': "EducationalOccupationalCredential";
180
+ credentialCategory: "degree";
181
+ name: string;
182
+ } | {
183
+ url?: string | undefined;
184
+ recognizedBy?: {
185
+ '@type': "Organization";
186
+ name: string;
187
+ } | undefined;
188
+ '@type': "EducationalOccupationalCredential";
189
+ name: string;
190
+ })[] | undefined;
191
+ alumniOf?: {
192
+ '@type': "EducationalOrganization";
193
+ name: string;
194
+ }[] | undefined;
195
+ worksFor?: {
196
+ member?: {
197
+ endDate?: string | undefined;
198
+ startDate?: string | undefined;
199
+ '@type': "OrganizationRole";
200
+ roleName: string;
201
+ } | undefined;
202
+ '@type': "Organization";
203
+ name: string;
204
+ }[] | undefined;
205
+ homeLocation?: {
206
+ address?: {
207
+ addressCountry?: string | undefined;
208
+ addressLocality?: string | undefined;
209
+ '@type': "PostalAddress";
210
+ } | undefined;
211
+ '@type': "Place";
212
+ name: string;
213
+ } | undefined;
214
+ jobTitle: string | undefined;
215
+ description: string | undefined;
216
+ url: string;
217
+ image: string | undefined;
218
+ familyName?: string | undefined;
219
+ givenName?: string | undefined;
220
+ '@context': string;
221
+ '@type': string;
222
+ name: string;
223
+ };
224
+ declare function buildProfilePageJsonLd(profile: JsonLdProfileInput, options?: JsonLdOptions): {
225
+ hasPart?: {
226
+ '@type': "WebPageElement";
227
+ name: string;
228
+ url: string;
229
+ }[] | undefined;
230
+ mainEntity: {
231
+ sameAs?: string[] | undefined;
232
+ knowsAbout?: string[] | undefined;
233
+ knowsLanguage?: string[] | undefined;
234
+ award?: string[] | undefined;
235
+ memberOf?: {
236
+ endDate?: string | undefined;
237
+ startDate?: string | undefined;
238
+ roleName?: string | undefined;
239
+ '@type': "OrganizationRole";
240
+ memberOf: {
241
+ '@type': "Organization";
242
+ name: string;
243
+ };
244
+ }[] | undefined;
245
+ hasCredential?: ({
246
+ recognizedBy?: {
247
+ '@type': "EducationalOrganization";
248
+ name: string;
249
+ } | undefined;
250
+ '@type': "EducationalOccupationalCredential";
251
+ credentialCategory: "degree";
252
+ name: string;
253
+ } | {
254
+ url?: string | undefined;
255
+ recognizedBy?: {
256
+ '@type': "Organization";
257
+ name: string;
258
+ } | undefined;
259
+ '@type': "EducationalOccupationalCredential";
260
+ name: string;
261
+ })[] | undefined;
262
+ alumniOf?: {
263
+ '@type': "EducationalOrganization";
264
+ name: string;
265
+ }[] | undefined;
266
+ worksFor?: {
267
+ member?: {
268
+ endDate?: string | undefined;
269
+ startDate?: string | undefined;
270
+ '@type': "OrganizationRole";
271
+ roleName: string;
272
+ } | undefined;
273
+ '@type': "Organization";
274
+ name: string;
275
+ }[] | undefined;
276
+ homeLocation?: {
277
+ address?: {
278
+ addressCountry?: string | undefined;
279
+ addressLocality?: string | undefined;
280
+ '@type': "PostalAddress";
281
+ } | undefined;
282
+ '@type': "Place";
283
+ name: string;
284
+ } | undefined;
285
+ jobTitle: string | undefined;
286
+ description: string | undefined;
287
+ url: string;
288
+ image: string | undefined;
289
+ familyName?: string | undefined;
290
+ givenName?: string | undefined;
291
+ '@type': string;
292
+ name: string;
293
+ };
294
+ dateModified?: string | undefined;
295
+ '@context': string;
296
+ '@type': "ProfilePage";
297
+ url: string;
298
+ };
299
+ declare function buildBreadcrumbListJsonLd(profile: Pick<JsonLdProfileInput, 'handle' | 'displayName'>, options?: JsonLdOptions): {
300
+ '@context': string;
301
+ '@type': "BreadcrumbList";
302
+ itemListElement: {
303
+ '@type': "ListItem";
304
+ position: number;
305
+ name: string;
306
+ item: string;
307
+ }[];
308
+ };
309
+
310
+ /**
311
+ * Schema.org JSON-LD for the things a person made: talks, publications,
312
+ * courses and projects.
313
+ *
314
+ * These collections carried no structured data before this module existed;
315
+ * a talk page emitted a four-property `CreativeWork` and publications,
316
+ * courses and projects emitted nothing at all. Term choices are recorded in
317
+ * `./terms.js`.
318
+ */
319
+ interface WorksOptions {
320
+ readonly baseUrl?: string;
321
+ readonly sanitize?: (input: string) => string;
322
+ }
323
+ /** Minimal identity for the profile owner a work is attributed to. */
324
+ interface WorkAuthor {
325
+ readonly handle: string;
326
+ readonly displayName?: string;
327
+ }
328
+ /**
329
+ * A person named on somebody else's record. `confirmed` is load bearing: an
330
+ * unconfirmed claim is a claim, not a fact, and must never be laundered into
331
+ * structured data as a schema.org Person.
332
+ */
333
+ interface NamedActor {
334
+ readonly did?: string;
335
+ readonly handle?: string;
336
+ readonly displayName?: string;
337
+ readonly confirmed?: boolean;
338
+ }
339
+ interface PersonNode {
340
+ readonly '@type': 'Person';
341
+ readonly name: string;
342
+ readonly url?: string;
343
+ readonly sameAs?: string[];
344
+ }
345
+ interface PresentationLinkInput {
346
+ readonly uri: string;
347
+ readonly label?: string;
348
+ readonly type?: string;
349
+ }
350
+ interface PresentationDeliveryInput {
351
+ readonly rkey: string;
352
+ readonly title?: string | null;
353
+ readonly role?: string | null;
354
+ readonly eventName?: string | null;
355
+ readonly date?: string | null;
356
+ readonly location?: string | null;
357
+ readonly locationLocality?: string | null;
358
+ readonly locationRegion?: string | null;
359
+ readonly countryCode?: string | null;
360
+ readonly mode?: string | null;
361
+ readonly status?: string | null;
362
+ readonly links?: readonly PresentationLinkInput[];
363
+ readonly coSpeakers?: readonly NamedActor[];
364
+ readonly hidden?: boolean;
365
+ }
366
+ interface PresentationInput {
367
+ readonly rkey: string;
368
+ readonly title: string;
369
+ readonly description?: string | null;
370
+ readonly duration?: {
371
+ minMinutes: number;
372
+ maxMinutes?: number;
373
+ } | null;
374
+ readonly coverImageUrl?: string | null;
375
+ readonly links?: readonly PresentationLinkInput[];
376
+ readonly deliveries?: readonly PresentationDeliveryInput[];
377
+ readonly hidden?: boolean;
378
+ }
379
+ declare function buildPresentationJsonLd(presentation: PresentationInput, author: WorkAuthor, options?: WorksOptions): {
380
+ subjectOf?: {
381
+ workFeatured?: {
382
+ '@type': "PresentationDigitalDocument";
383
+ url: string;
384
+ } | undefined;
385
+ recordedIn?: {
386
+ '@type': "VideoObject";
387
+ url: string;
388
+ } | undefined;
389
+ performer: PersonNode[];
390
+ eventStatus?: string | undefined;
391
+ eventAttendanceMode?: string | undefined;
392
+ location?: {
393
+ '@type': "Place";
394
+ address: {
395
+ addressCountry?: string | undefined;
396
+ addressRegion?: string | undefined;
397
+ addressLocality?: string | undefined;
398
+ '@type': "PostalAddress";
399
+ };
400
+ name?: undefined;
401
+ } | {
402
+ '@type': "Place";
403
+ name: string;
404
+ address?: undefined;
405
+ } | undefined;
406
+ startDate?: string | undefined;
407
+ '@type': "Event";
408
+ name: string;
409
+ }[] | undefined;
410
+ author: PersonNode;
411
+ url: string;
412
+ image?: string | undefined;
413
+ timeRequired?: string | undefined;
414
+ abstract?: string | undefined;
415
+ '@context': string;
416
+ '@type': "PresentationDigitalDocument";
417
+ name: string;
418
+ };
419
+ interface PublicationContributorInput {
420
+ readonly name: string;
421
+ readonly orcidId?: string;
422
+ readonly handle?: string;
423
+ }
424
+ interface PublicationInput {
425
+ readonly rkey: string;
426
+ readonly title: string;
427
+ readonly subtitle?: string;
428
+ readonly publisher?: string;
429
+ readonly date?: string;
430
+ readonly url?: string;
431
+ readonly description?: string;
432
+ readonly doi?: string;
433
+ readonly contributors?: readonly PublicationContributorInput[];
434
+ readonly hidden?: boolean;
435
+ }
436
+ declare function buildPublicationJsonLd(publication: PublicationInput, author: WorkAuthor, options?: WorksOptions): {
437
+ identifier?: {
438
+ '@type': "PropertyValue";
439
+ propertyID: string;
440
+ value: string;
441
+ } | undefined;
442
+ sameAs?: string[] | undefined;
443
+ author: PersonNode[];
444
+ url?: string | undefined;
445
+ datePublished?: string | undefined;
446
+ publisher?: {
447
+ '@type': "Organization";
448
+ name: string;
449
+ } | undefined;
450
+ abstract?: string | undefined;
451
+ alternativeHeadline?: string | undefined;
452
+ '@context': string;
453
+ '@type': "ScholarlyArticle";
454
+ name: string;
455
+ };
456
+ interface CourseInput {
457
+ readonly rkey: string;
458
+ readonly name: string;
459
+ readonly number?: string;
460
+ readonly institution?: string;
461
+ readonly hidden?: boolean;
462
+ }
463
+ declare function buildCourseJsonLd(course: CourseInput, options?: WorksOptions): {
464
+ provider?: {
465
+ '@type': "EducationalOrganization";
466
+ name: string;
467
+ } | undefined;
468
+ courseCode?: string | undefined;
469
+ '@context': string;
470
+ '@type': "Course";
471
+ name: string;
472
+ };
473
+ interface ProjectInput {
474
+ readonly rkey: string;
475
+ readonly name: string;
476
+ readonly description?: string;
477
+ readonly url?: string;
478
+ readonly startDate?: string;
479
+ readonly endDate?: string;
480
+ readonly members?: readonly NamedActor[];
481
+ readonly hidden?: boolean;
482
+ }
483
+ declare function buildProjectJsonLd(project: ProjectInput, author: WorkAuthor, options?: WorksOptions): {
484
+ member: PersonNode[];
485
+ endDate?: string | undefined;
486
+ startDate?: string | undefined;
487
+ url?: string | undefined;
488
+ description?: string | undefined;
489
+ '@context': string;
490
+ '@type': "Project";
491
+ name: string;
492
+ };
493
+
494
+ export { type CourseInput, type JsonLdCertification, type JsonLdEducation, type JsonLdHonor, type JsonLdLanguage, type JsonLdOptions, type JsonLdPosition, type JsonLdProfileInput, type JsonLdSkill, type JsonLdVolunteering, type MatchStrength, type PresentationDeliveryInput, type PresentationInput, type PresentationLinkInput, type ProjectInput, type PublicationContributorInput, type PublicationInput, type Sanitizer, TERM_MAPPINGS, type TermMapping, VOCABULARIES, type VocabularyPrefix, type WorkAuthor, type WorksOptions, buildBreadcrumbListJsonLd, buildCourseJsonLd, buildPersonJsonLd, buildPresentationJsonLd, buildProfilePageJsonLd, buildProjectJsonLd, buildPublicationJsonLd, expandCurie, isDeliberatelyUnmapped, mappingsForLexicon };