@singi-labs/sifa-sdk 0.12.1 → 0.12.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/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/schemas/write/index.cjs +183 -0
- package/dist/schemas/write/index.cjs.map +1 -0
- package/dist/schemas/write/index.d.cts +274 -0
- package/dist/schemas/write/index.d.ts +274 -0
- package/dist/schemas/write/index.js +164 -0
- package/dist/schemas/write/index.js.map +1 -0
- package/package.json +11 -1
package/dist/index.cjs
CHANGED
|
@@ -3366,7 +3366,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
|
|
|
3366
3366
|
});
|
|
3367
3367
|
|
|
3368
3368
|
// src/index.ts
|
|
3369
|
-
var SIFA_SDK_VERSION = "0.12.
|
|
3369
|
+
var SIFA_SDK_VERSION = "0.12.2";
|
|
3370
3370
|
|
|
3371
3371
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
3372
3372
|
exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
|
package/dist/index.js
CHANGED
|
@@ -3364,7 +3364,7 @@ var ProfileVolunteeringRecordSchema = z.object({
|
|
|
3364
3364
|
});
|
|
3365
3365
|
|
|
3366
3366
|
// src/index.ts
|
|
3367
|
-
var SIFA_SDK_VERSION = "0.12.
|
|
3367
|
+
var SIFA_SDK_VERSION = "0.12.2";
|
|
3368
3368
|
|
|
3369
3369
|
export { ACTIVITY_TIERS, ACTIVITY_VISIBILITY_RULES, ADULT_CONTENT_LABELS, ALL_SECTIONS, APP_CATEGORIES, APP_CATEGORY_IDS, APP_CATEGORY_MAP, APP_URL_PATTERNS, ARTIFACT_LINK_KIND_LABELS, ARTIFACT_LINK_KIND_OPTIONS, ArtifactLinkSchema, AtmosphereFeedItemSchema, CALENDAR_EVENT_MODE_LABELS, CALENDAR_EVENT_STATUS_LABELS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPANY_OPTIONAL_EMPLOYMENT_TYPES, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, ENTITY_REF_ANCHORS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, EntityImportSearchResponseSchema, EntityMintDomainResponseSchema, EntityResolveDomainRequestSchema, EntityResolveDomainResponseSchema, EntitySearchResponseSchema, EntitySearchResultSchema, EntitySelectRequestSchema, EntitySelectResponseSchema, FEATURE_FLAGS, FeatureAllowlistEntrySchema, FeedActorSchema, FollowFeedItemSchema, FollowFeedPageSchema, FollowProfilePageSchema, FollowProfileSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, INVOLVEMENT_HEADING_ORDER, INVOLVEMENT_KIND_HEADINGS, INVOLVEMENT_KIND_LABELS, INVOLVEMENT_KIND_OPTIONS, MIN_SKILLS, OPEN_TO_OPTIONS, OPEN_TO_TOKENS, OPEN_TO_TOKEN_TO_VALUE, OPEN_TO_VALUE_TO_TOKEN, PLATFORM_LABELS, PLATFORM_OPTIONS, PRESENTATION_LINK_TYPE_LABELS, PRESENTATION_LINK_TYPE_OPTIONS, PRESENTATION_ROLE_LABELS, PRESENTATION_ROLE_OPTIONS, PROFILE_INVOLVEMENT_NSID, PUBLISHERS, PresentationDurationSchema, PresentationLinkSchema, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileInvolvementRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfilePresentationDeliveryRecordSchema, ProfilePresentationRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SECTION_GROUPS, SECTION_LABELS, SIFA_SDK_VERSION, SKILL_CATEGORIES, STANDARD_PUBLISHER_ID, SifaFeedItemSchema, VERIFICATION_PROVIDERS, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, atUriSchema, categoryForApp, certDateExtractor, cidSchema, classifyEntityRef, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, datetimeSchema, decodeFeedCursor, dedupeSkills, detectPdsProvider, didSchema, dimensionsFromInputs, durationFromMinutes, encodeFeedCursor, entityDisambiguationLabel, entityResultKey, externalRecordRefSchema, filterHidden, findIndustry, formatCompanyName, formatDateRange, formatDistanceToNow, formatLocation, formatPresentationDuration, formatRelativeTime, formatTimelineDate, getActivityTaxonomyVersion, getActivityTier, getAppCategoryIcon, getAppIdForCollection, getArtifactLinkKindLabel, getCalendarEventModeLabel, getCalendarEventStatusLabel, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getInvolvementKindHeading, getInvolvementKindLabel, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getPresentationLinkTypeLabel, getPresentationRoleLabel, getPublisherByHost, getPublisherById, getPublisherFromSiteUrl, getTierMeta, getVerificationProvider, getVisibleSectionIds, getWorkplaceTypeLabel, groupInvolvementByHeading, groupSkillsByCategory, hasAdultContent, hoistPrimary, isAppCategory, isCompanyRequired, isKnownAppId, isKnownPlatform, isKnownVerificationProvider, isLinked, isPseudoEmployer, isSectionPopulated, isValidRgbColor, isVisibleActivityItem, languageTagSchema, lexiconDateExtractor, limitCombiningMarks, looksLikeDomain, makeGraphFollowRecordSchema, maxGraphemes, meetsContrastAA, normalizeCompanyKey, normalizeLegalForm, normalizeOpenTo, normalizePlatformId, normalizePresentationMode, normalizePresentationRole, normalizeWorkplaceTypes, openToTokenToValue, openToValueToToken, parseIntendedAudiences, parseLocationString, parsePresentationDuration, partialDateSchema, pdsProviderFromApi, pickPrimaryPosition, presentationCsvRowToRecord, presentationDeliveryCsvRowToRecord, primaryVerification, profileToDimensionInputs, relativeLuminance, resolveCardHealth, resolveCardUrl, resolveVerifierProvider, rgbToString, sanitizeDisplayText, sanitizeHandleInput, searchResultDisambiguation, selfLabelsSchema, singleDateExtractor, sortByActiveDateRange, sortByDateDesc, sortCertifications, sortEducation, sortHonors, sortLanguages, sortLanguagesByProficiency, sortPositions, sortProjects, sortPublications, stripHtmlToText, strongRefSchema, summarizePresentationDeliveries, truncateGraphemes, uriSchema, visibleItems };
|
|
3370
3370
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
// src/schemas/write/shared.ts
|
|
6
|
+
function normalizeUrl(val) {
|
|
7
|
+
const trimmed = val.trim();
|
|
8
|
+
if (/^https?:\/\//i.test(trimmed)) return trimmed;
|
|
9
|
+
return `https://${trimmed}`;
|
|
10
|
+
}
|
|
11
|
+
var optionalUrl = () => zod.z.string().optional().transform((val) => {
|
|
12
|
+
if (!val) return void 0;
|
|
13
|
+
try {
|
|
14
|
+
new URL(val);
|
|
15
|
+
return val;
|
|
16
|
+
} catch {
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var writeLocationSchema = zod.z.union([
|
|
21
|
+
zod.z.object({
|
|
22
|
+
country: zod.z.string().nullish(),
|
|
23
|
+
countryCode: zod.z.string().length(2).nullish(),
|
|
24
|
+
region: zod.z.string().nullish(),
|
|
25
|
+
city: zod.z.string().nullish(),
|
|
26
|
+
locality: zod.z.string().nullish(),
|
|
27
|
+
street: zod.z.string().nullish(),
|
|
28
|
+
postalCode: zod.z.string().nullish(),
|
|
29
|
+
name: zod.z.string().nullish()
|
|
30
|
+
}),
|
|
31
|
+
zod.z.string()
|
|
32
|
+
]).nullable().optional();
|
|
33
|
+
var skillRefSchema = zod.z.object({
|
|
34
|
+
uri: zod.z.string()
|
|
35
|
+
});
|
|
36
|
+
var VALID_PLATFORMS = [
|
|
37
|
+
"rss",
|
|
38
|
+
"fediverse",
|
|
39
|
+
"twitter",
|
|
40
|
+
"instagram",
|
|
41
|
+
"github",
|
|
42
|
+
"codeberg",
|
|
43
|
+
"gitlab",
|
|
44
|
+
"forgejo",
|
|
45
|
+
"gitea",
|
|
46
|
+
"youtube",
|
|
47
|
+
"linkedin",
|
|
48
|
+
"substack",
|
|
49
|
+
"website",
|
|
50
|
+
"orcid",
|
|
51
|
+
"keyoxide",
|
|
52
|
+
"other"
|
|
53
|
+
];
|
|
54
|
+
var CertificationWriteSchema = zod.z.object({
|
|
55
|
+
name: zod.z.string().min(1).max(256),
|
|
56
|
+
authority: zod.z.string().max(256).nullable().optional(),
|
|
57
|
+
credentialId: zod.z.string().max(256).nullable().optional(),
|
|
58
|
+
credentialUrl: optionalUrl(),
|
|
59
|
+
issuedAt: zod.z.string().nullable().optional(),
|
|
60
|
+
expiresAt: zod.z.string().nullable().optional()
|
|
61
|
+
});
|
|
62
|
+
var CourseWriteSchema = zod.z.object({
|
|
63
|
+
name: zod.z.string().min(1).max(200),
|
|
64
|
+
number: zod.z.string().max(50).nullable().optional(),
|
|
65
|
+
institution: zod.z.string().max(256).nullable().optional()
|
|
66
|
+
});
|
|
67
|
+
var EducationWriteSchema = zod.z.object({
|
|
68
|
+
institution: zod.z.string().min(1).max(256),
|
|
69
|
+
degree: zod.z.string().max(256).nullable().optional(),
|
|
70
|
+
fieldOfStudy: zod.z.string().max(256).nullable().optional(),
|
|
71
|
+
description: zod.z.string().max(5e4).nullable().optional(),
|
|
72
|
+
activities: zod.z.string().max(1e3).nullable().optional(),
|
|
73
|
+
startedAt: zod.z.string().nullable().optional(),
|
|
74
|
+
endedAt: zod.z.string().nullable().optional()
|
|
75
|
+
});
|
|
76
|
+
var ExternalAccountWriteSchema = zod.z.object({
|
|
77
|
+
platform: zod.z.enum(VALID_PLATFORMS),
|
|
78
|
+
url: zod.z.string().max(2e3).transform(normalizeUrl).pipe(zod.z.string().url()),
|
|
79
|
+
label: zod.z.string().max(100).optional(),
|
|
80
|
+
feedUrl: zod.z.string().max(2e3).transform(normalizeUrl).pipe(zod.z.string().url()).optional()
|
|
81
|
+
});
|
|
82
|
+
var HonorWriteSchema = zod.z.object({
|
|
83
|
+
title: zod.z.string().min(1).max(200),
|
|
84
|
+
issuer: zod.z.string().max(256).nullable().optional(),
|
|
85
|
+
description: zod.z.string().max(5e4).nullable().optional(),
|
|
86
|
+
awardedAt: zod.z.string().nullable().optional()
|
|
87
|
+
});
|
|
88
|
+
var LanguageWriteSchema = zod.z.object({
|
|
89
|
+
name: zod.z.string().min(1).max(64),
|
|
90
|
+
proficiency: zod.z.string().max(50).optional()
|
|
91
|
+
});
|
|
92
|
+
var PositionWriteSchema = zod.z.object({
|
|
93
|
+
company: zod.z.string().min(1).max(256).nullable().optional(),
|
|
94
|
+
title: zod.z.string().min(1).max(256),
|
|
95
|
+
description: zod.z.string().max(5e4).nullable().optional(),
|
|
96
|
+
employmentType: zod.z.string().nullable().optional(),
|
|
97
|
+
workplaceType: zod.z.string().nullable().optional(),
|
|
98
|
+
location: writeLocationSchema,
|
|
99
|
+
startedAt: zod.z.string().nullable().optional(),
|
|
100
|
+
endedAt: zod.z.string().nullable().optional(),
|
|
101
|
+
skills: zod.z.array(skillRefSchema).max(50).nullable().optional()
|
|
102
|
+
});
|
|
103
|
+
var ProfileLocationWriteSchema = zod.z.object({
|
|
104
|
+
address: zod.z.object({
|
|
105
|
+
country: zod.z.string().nullish(),
|
|
106
|
+
countryCode: zod.z.string().length(2).nullish(),
|
|
107
|
+
region: zod.z.string().nullish(),
|
|
108
|
+
city: zod.z.string().nullish(),
|
|
109
|
+
locality: zod.z.string().nullish(),
|
|
110
|
+
street: zod.z.string().nullish(),
|
|
111
|
+
postalCode: zod.z.string().nullish(),
|
|
112
|
+
name: zod.z.string().nullish()
|
|
113
|
+
}),
|
|
114
|
+
type: zod.z.string().min(1),
|
|
115
|
+
label: zod.z.string().max(60).nullable().optional(),
|
|
116
|
+
isPrimary: zod.z.boolean().optional()
|
|
117
|
+
});
|
|
118
|
+
var ProfileSelfWriteSchema = zod.z.object({
|
|
119
|
+
headline: zod.z.string().max(300).optional(),
|
|
120
|
+
about: zod.z.string().max(5e4).optional(),
|
|
121
|
+
givenName: zod.z.string().max(640).optional(),
|
|
122
|
+
familyName: zod.z.string().max(640).optional(),
|
|
123
|
+
industries: zod.z.array(
|
|
124
|
+
zod.z.object({
|
|
125
|
+
industry: zod.z.string().max(100),
|
|
126
|
+
domain: zod.z.string().max(100).optional()
|
|
127
|
+
})
|
|
128
|
+
).max(10).optional(),
|
|
129
|
+
location: writeLocationSchema,
|
|
130
|
+
openTo: zod.z.array(zod.z.string()).max(10).optional(),
|
|
131
|
+
preferredWorkplace: zod.z.array(zod.z.string()).max(5).optional(),
|
|
132
|
+
availableFromUtc: zod.z.number().int().min(0).max(23).optional(),
|
|
133
|
+
availableToUtc: zod.z.number().int().min(0).max(23).optional(),
|
|
134
|
+
langs: zod.z.array(zod.z.string()).max(3).optional(),
|
|
135
|
+
discoverable: zod.z.boolean().optional()
|
|
136
|
+
}).passthrough();
|
|
137
|
+
var ProjectWriteSchema = zod.z.object({
|
|
138
|
+
name: zod.z.string().min(1).max(256),
|
|
139
|
+
description: zod.z.string().max(5e4).nullable().optional(),
|
|
140
|
+
url: optionalUrl(),
|
|
141
|
+
startedAt: zod.z.string().nullable().optional(),
|
|
142
|
+
endedAt: zod.z.string().nullable().optional()
|
|
143
|
+
});
|
|
144
|
+
var PublicationWriteSchema = zod.z.object({
|
|
145
|
+
title: zod.z.string().min(1).max(200),
|
|
146
|
+
publisher: zod.z.string().max(256).nullable().optional(),
|
|
147
|
+
url: optionalUrl(),
|
|
148
|
+
description: zod.z.string().max(5e4).nullable().optional(),
|
|
149
|
+
publishedAt: zod.z.string().nullable().optional()
|
|
150
|
+
});
|
|
151
|
+
var SkillWriteSchema = zod.z.object({
|
|
152
|
+
name: zod.z.string().min(1).max(100),
|
|
153
|
+
category: zod.z.string().max(100).optional()
|
|
154
|
+
});
|
|
155
|
+
var VolunteeringWriteSchema = zod.z.object({
|
|
156
|
+
organization: zod.z.string().min(1).max(256),
|
|
157
|
+
role: zod.z.string().max(256).nullable().optional(),
|
|
158
|
+
cause: zod.z.string().max(256).nullable().optional(),
|
|
159
|
+
description: zod.z.string().max(5e4).nullable().optional(),
|
|
160
|
+
startedAt: zod.z.string().nullable().optional(),
|
|
161
|
+
endedAt: zod.z.string().nullable().optional()
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
exports.CertificationWriteSchema = CertificationWriteSchema;
|
|
165
|
+
exports.CourseWriteSchema = CourseWriteSchema;
|
|
166
|
+
exports.EducationWriteSchema = EducationWriteSchema;
|
|
167
|
+
exports.ExternalAccountWriteSchema = ExternalAccountWriteSchema;
|
|
168
|
+
exports.HonorWriteSchema = HonorWriteSchema;
|
|
169
|
+
exports.LanguageWriteSchema = LanguageWriteSchema;
|
|
170
|
+
exports.PositionWriteSchema = PositionWriteSchema;
|
|
171
|
+
exports.ProfileLocationWriteSchema = ProfileLocationWriteSchema;
|
|
172
|
+
exports.ProfileSelfWriteSchema = ProfileSelfWriteSchema;
|
|
173
|
+
exports.ProjectWriteSchema = ProjectWriteSchema;
|
|
174
|
+
exports.PublicationWriteSchema = PublicationWriteSchema;
|
|
175
|
+
exports.SkillWriteSchema = SkillWriteSchema;
|
|
176
|
+
exports.VALID_PLATFORMS = VALID_PLATFORMS;
|
|
177
|
+
exports.VolunteeringWriteSchema = VolunteeringWriteSchema;
|
|
178
|
+
exports.normalizeUrl = normalizeUrl;
|
|
179
|
+
exports.optionalUrl = optionalUrl;
|
|
180
|
+
exports.skillRefSchema = skillRefSchema;
|
|
181
|
+
exports.writeLocationSchema = writeLocationSchema;
|
|
182
|
+
//# sourceMappingURL=index.cjs.map
|
|
183
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/schemas/write/shared.ts","../../../src/schemas/write/certification.ts","../../../src/schemas/write/course.ts","../../../src/schemas/write/education.ts","../../../src/schemas/write/external-account.ts","../../../src/schemas/write/honor.ts","../../../src/schemas/write/language.ts","../../../src/schemas/write/position.ts","../../../src/schemas/write/profile-location.ts","../../../src/schemas/write/profile-self.ts","../../../src/schemas/write/project.ts","../../../src/schemas/write/publication.ts","../../../src/schemas/write/skill.ts","../../../src/schemas/write/volunteering.ts"],"names":["z"],"mappings":";;;;;AAGO,SAAS,aAAa,GAAA,EAAqB;AAChD,EAAA,MAAM,OAAA,GAAU,IAAI,IAAA,EAAK;AACzB,EAAA,IAAI,eAAA,CAAgB,IAAA,CAAK,OAAO,CAAA,EAAG,OAAO,OAAA;AAC1C,EAAA,OAAO,WAAW,OAAO,CAAA,CAAA;AAC3B;AAMO,IAAM,WAAA,GAAc,MACzBA,KAAA,CACG,MAAA,GACA,QAAA,EAAS,CACT,SAAA,CAAU,CAAC,GAAA,KAAQ;AAClB,EAAA,IAAI,CAAC,KAAK,OAAO,MAAA;AACjB,EAAA,IAAI;AACF,IAAA,IAAI,IAAI,GAAG,CAAA;AACX,IAAA,OAAO,GAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF,CAAC;AAiBE,IAAM,mBAAA,GAAsBA,MAChC,KAAA,CAAM;AAAA,EACLA,MAAE,MAAA,CAAO;AAAA,IACP,OAAA,EAASA,KAAA,CAAE,MAAA,EAAO,CAAE,OAAA,EAAQ;AAAA,IAC5B,aAAaA,KAAA,CAAE,MAAA,GAAS,MAAA,CAAO,CAAC,EAAE,OAAA,EAAQ;AAAA,IAC1C,MAAA,EAAQA,KAAA,CAAE,MAAA,EAAO,CAAE,OAAA,EAAQ;AAAA,IAC3B,IAAA,EAAMA,KAAA,CAAE,MAAA,EAAO,CAAE,OAAA,EAAQ;AAAA,IACzB,QAAA,EAAUA,KAAA,CAAE,MAAA,EAAO,CAAE,OAAA,EAAQ;AAAA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WAAA,EAAY;AAAA,EACjB,WAAA,EAAaA,MAAE,MAAA,EAAO,CAAE,IAAI,GAAK,CAAA,CAAE,QAAA,EAAS,CAAE,QAAA,EAAS;AAAA,EACvD,aAAaA,KAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA;AACrC,CAAC;ACRM,IAAM,gBAAA,GAAmBA,MAAE,MAAA,CAAO;AAAA,EACvC,IAAA,EAAMA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAG,CAAA;AAAA,EAC/B,UAAUA,KAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAChC,CAAC;ACHM,IAAM,uBAAA,GAA0BA,MAAE,MAAA,CAAO;AAAA,EAC9C,YAAA,EAAcA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAG,CAAA;AAAA,EACvC,IAAA,EAAMA,MAAE,MAAA,EAAO,CAAE,IAAI,GAAG,CAAA,CAAE,QAAA,EAAS,CAAE,QAAA,EAAS;AAAA,EAC9C,KAAA,EAAOA,MAAE,MAAA,EAAO,CAAE,IAAI,GAAG,CAAA,CAAE,QAAA,EAAS,CAAE,QAAA,EAAS;AAAA,EAC/C,WAAA,EAAaA,MAAE,MAAA,EAAO,CAAE,IAAI,GAAK,CAAA,CAAE,QAAA,EAAS,CAAE,QAAA,EAAS;AAAA,EACvD,WAAWA,KAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA,EAAS;AAAA,EAC1C,SAASA,KAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA;AACjC,CAAC","file":"index.cjs","sourcesContent":["import { z } from 'zod';\n\n/** Prepend `https://` if no scheme is present. */\nexport function normalizeUrl(val: string): string {\n const trimmed = val.trim();\n if (/^https?:\\/\\//i.test(trimmed)) return trimmed;\n return `https://${trimmed}`;\n}\n\n/**\n * Accept a URL string or silently drop it if invalid (returns `undefined`).\n * Preserves the write-time policy: bad URLs from imports are dropped, not rejected.\n */\nexport const optionalUrl = () =>\n z\n .string()\n .optional()\n .transform((val) => {\n if (!val) return undefined;\n try {\n new URL(val);\n return val;\n } catch {\n return undefined;\n }\n });\n\n/**\n * Location shape accepted by the sifa-api write endpoints.\n *\n * Accepts BOTH the legacy shape (`id.sifa.defs#locationAddress`: `countryCode`,\n * `region`, `city`) AND the new community shape\n * (`community.lexicon.location.address`: `country`, `region`, `locality`,\n * `street?`, `postalCode?`, `name?`). The frontend reads location records from\n * the API and echoes them back on save. The API serializer emits explicit `null`\n * for absent fields (not `undefined`), so every field uses `.nullish()`\n * (`string | null | undefined`) instead of `.optional()` (`string | undefined`).\n *\n * `buildPdsLocation` on the server handles conversion to the PDS shape (always\n * emitting the new community shape) and returns `undefined` when neither\n * `country` nor `countryCode` is usable.\n */\nexport const writeLocationSchema = z\n .union([\n z.object({\n country: z.string().nullish(),\n countryCode: z.string().length(2).nullish(),\n region: z.string().nullish(),\n city: z.string().nullish(),\n locality: z.string().nullish(),\n street: z.string().nullish(),\n postalCode: z.string().nullish(),\n name: z.string().nullish(),\n }),\n z.string(),\n ])\n .nullable()\n .optional();\n\n/** Skill reference: a strong ref to a canonical skill record. */\nexport const skillRefSchema = z.object({\n uri: z.string(),\n});\n\n/**\n * Platforms accepted by the external-account write endpoint.\n *\n * NOTE: this list intentionally differs from `PLATFORM_LABELS` in the SDK's\n * `/taxonomy` subpath. `VALID_PLATFORMS` is what sifa-api's `POST /external-accounts`\n * endpoint enforces; `PLATFORM_LABELS` is the display taxonomy used by the profile\n * UI. Reconciling them is a separate follow-up (see #TBD). For now the two are\n * mirrored verbatim from their prior definitions to preserve behavior.\n */\nexport const VALID_PLATFORMS = [\n 'rss',\n 'fediverse',\n 'twitter',\n 'instagram',\n 'github',\n 'codeberg',\n 'gitlab',\n 'forgejo',\n 'gitea',\n 'youtube',\n 'linkedin',\n 'substack',\n 'website',\n 'orcid',\n 'keyoxide',\n 'other',\n] as const;\n\nexport type ValidPlatform = (typeof VALID_PLATFORMS)[number];\n","import { z } from 'zod';\n\nimport { optionalUrl } from './shared.js';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.certification`. */\nexport const CertificationWriteSchema = z.object({\n name: z.string().min(1).max(256),\n authority: z.string().max(256).nullable().optional(),\n credentialId: z.string().max(256).nullable().optional(),\n credentialUrl: optionalUrl(),\n issuedAt: z.string().nullable().optional(),\n expiresAt: z.string().nullable().optional(),\n});\n\nexport type CertificationWriteInput = z.infer<typeof CertificationWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.course`. */\nexport const CourseWriteSchema = z.object({\n name: z.string().min(1).max(200),\n number: z.string().max(50).nullable().optional(),\n institution: z.string().max(256).nullable().optional(),\n});\n\nexport type CourseWriteInput = z.infer<typeof CourseWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by `POST /profile/education` on sifa-api. */\nexport const EducationWriteSchema = z.object({\n institution: z.string().min(1).max(256),\n degree: z.string().max(256).nullable().optional(),\n fieldOfStudy: z.string().max(256).nullable().optional(),\n description: z.string().max(50000).nullable().optional(),\n activities: z.string().max(1000).nullable().optional(),\n startedAt: z.string().nullable().optional(),\n endedAt: z.string().nullable().optional(),\n});\n\nexport type EducationWriteInput = z.infer<typeof EducationWriteSchema>;\n","import { z } from 'zod';\n\nimport { VALID_PLATFORMS, normalizeUrl } from './shared.js';\n\n/** Schema enforced by `POST /external-accounts` on sifa-api. */\nexport const ExternalAccountWriteSchema = z.object({\n platform: z.enum(VALID_PLATFORMS),\n url: z.string().max(2000).transform(normalizeUrl).pipe(z.string().url()),\n label: z.string().max(100).optional(),\n feedUrl: z.string().max(2000).transform(normalizeUrl).pipe(z.string().url()).optional(),\n});\n\nexport type ExternalAccountWriteInput = z.infer<typeof ExternalAccountWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.honor`. */\nexport const HonorWriteSchema = z.object({\n title: z.string().min(1).max(200),\n issuer: z.string().max(256).nullable().optional(),\n description: z.string().max(50000).nullable().optional(),\n awardedAt: z.string().nullable().optional(),\n});\n\nexport type HonorWriteInput = z.infer<typeof HonorWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.language`. */\nexport const LanguageWriteSchema = z.object({\n name: z.string().min(1).max(64),\n proficiency: z.string().max(50).optional(),\n});\n\nexport type LanguageWriteInput = z.infer<typeof LanguageWriteSchema>;\n","import { z } from 'zod';\n\nimport { skillRefSchema, writeLocationSchema } from './shared.js';\n\n/**\n * Schema enforced by `POST /profile/positions` on sifa-api.\n *\n * Client-side callers can `.safeParse(...)` this before submitting to catch\n * obvious problems (empty `title`, over-length text) before the network\n * round-trip. If it passes here, the API will accept the write modulo\n * transport / auth failures.\n *\n * `company` is intentionally optional to support freelancer / independent\n * employment types where the position has no employer. The current\n * `sifa-api/src/routes/schemas.ts` requires `company` (`.min(1)`); the\n * sifa-api adoption PR that consumes this schema will therefore be a\n * behavior change that unblocks the freelancer flow. The SDK's lexicon\n * schema (`ProfilePositionRecordSchema`) has treated `company` as optional\n * since sifa-sdk #184.\n */\nexport const PositionWriteSchema = z.object({\n company: z.string().min(1).max(256).nullable().optional(),\n title: z.string().min(1).max(256),\n description: z.string().max(50000).nullable().optional(),\n employmentType: z.string().nullable().optional(),\n workplaceType: z.string().nullable().optional(),\n location: writeLocationSchema,\n startedAt: z.string().nullable().optional(),\n endedAt: z.string().nullable().optional(),\n skills: z.array(skillRefSchema).max(50).nullable().optional(),\n});\n\nexport type PositionWriteInput = z.infer<typeof PositionWriteSchema>;\n","import { z } from 'zod';\n\n/**\n * Schema enforced by `POST /profile/locations` on sifa-api.\n *\n * Mirrors the inner object of `writeLocationSchema`: accepts both the community\n * shape (`country`, `locality`) and the legacy shape (`countryCode`, `city`)\n * during the dual-read window. sifa-web #840 switched outbound writes to the\n * community shape; older clients may still send the legacy shape. All address\n * fields are `.nullish()` so explicit `null` from API echoes is accepted\n * (see sifa-api #426).\n *\n * The route handler hands `address` to `buildPdsLocation`, which normalizes\n * either input and enforces alpha-2 on the wire to PDS — returning a 400 with\n * `message: \"address.country (alpha-2) is required\"` when no usable code is\n * present. The schema stays permissive on country length here and lets\n * `buildPdsLocation` be the single enforcement point.\n */\nexport const ProfileLocationWriteSchema = z.object({\n address: z.object({\n country: z.string().nullish(),\n countryCode: z.string().length(2).nullish(),\n region: z.string().nullish(),\n city: z.string().nullish(),\n locality: z.string().nullish(),\n street: z.string().nullish(),\n postalCode: z.string().nullish(),\n name: z.string().nullish(),\n }),\n type: z.string().min(1),\n label: z.string().max(60).nullable().optional(),\n isPrimary: z.boolean().optional(),\n});\n\nexport type ProfileLocationWriteInput = z.infer<typeof ProfileLocationWriteSchema>;\n","import { z } from 'zod';\n\nimport { writeLocationSchema } from './shared.js';\n\n/**\n * Schema enforced by `POST /profile/self` on sifa-api.\n *\n * `.passthrough()` so the API accepts fields not yet enumerated here (used for\n * gradual rollout of new profile-self keys without requiring lockstep bumps\n * between web/api). Note this means client validation on this schema will\n * NEVER reject \"unknown\" fields — the divergence is intentional.\n *\n * Grapheme caps (e.g. 64 on given/familyName) are enforced client-side by the\n * SDK's lexicon schema; the write schema only guards the byte-length ceiling.\n */\nexport const ProfileSelfWriteSchema = z\n .object({\n headline: z.string().max(300).optional(),\n about: z.string().max(50000).optional(),\n givenName: z.string().max(640).optional(),\n familyName: z.string().max(640).optional(),\n industries: z\n .array(\n z.object({\n industry: z.string().max(100),\n domain: z.string().max(100).optional(),\n }),\n )\n .max(10)\n .optional(),\n location: writeLocationSchema,\n openTo: z.array(z.string()).max(10).optional(),\n preferredWorkplace: z.array(z.string()).max(5).optional(),\n availableFromUtc: z.number().int().min(0).max(23).optional(),\n availableToUtc: z.number().int().min(0).max(23).optional(),\n langs: z.array(z.string()).max(3).optional(),\n discoverable: z.boolean().optional(),\n })\n .passthrough();\n\nexport type ProfileSelfWriteInput = z.infer<typeof ProfileSelfWriteSchema>;\n","import { z } from 'zod';\n\nimport { optionalUrl } from './shared.js';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.project`. */\nexport const ProjectWriteSchema = z.object({\n name: z.string().min(1).max(256),\n description: z.string().max(50000).nullable().optional(),\n url: optionalUrl(),\n startedAt: z.string().nullable().optional(),\n endedAt: z.string().nullable().optional(),\n});\n\nexport type ProjectWriteInput = z.infer<typeof ProjectWriteSchema>;\n","import { z } from 'zod';\n\nimport { optionalUrl } from './shared.js';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.publication`. */\nexport const PublicationWriteSchema = z.object({\n title: z.string().min(1).max(200),\n publisher: z.string().max(256).nullable().optional(),\n url: optionalUrl(),\n description: z.string().max(50000).nullable().optional(),\n publishedAt: z.string().nullable().optional(),\n});\n\nexport type PublicationWriteInput = z.infer<typeof PublicationWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by `POST /profile/skills` on sifa-api. */\nexport const SkillWriteSchema = z.object({\n name: z.string().min(1).max(100),\n category: z.string().max(100).optional(),\n});\n\nexport type SkillWriteInput = z.infer<typeof SkillWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.volunteering`. */\nexport const VolunteeringWriteSchema = z.object({\n organization: z.string().min(1).max(256),\n role: z.string().max(256).nullable().optional(),\n cause: z.string().max(256).nullable().optional(),\n description: z.string().max(50000).nullable().optional(),\n startedAt: z.string().nullable().optional(),\n endedAt: z.string().nullable().optional(),\n});\n\nexport type VolunteeringWriteInput = z.infer<typeof VolunteeringWriteSchema>;\n"]}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** Prepend `https://` if no scheme is present. */
|
|
4
|
+
declare function normalizeUrl(val: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Accept a URL string or silently drop it if invalid (returns `undefined`).
|
|
7
|
+
* Preserves the write-time policy: bad URLs from imports are dropped, not rejected.
|
|
8
|
+
*/
|
|
9
|
+
declare const optionalUrl: () => z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
10
|
+
/**
|
|
11
|
+
* Location shape accepted by the sifa-api write endpoints.
|
|
12
|
+
*
|
|
13
|
+
* Accepts BOTH the legacy shape (`id.sifa.defs#locationAddress`: `countryCode`,
|
|
14
|
+
* `region`, `city`) AND the new community shape
|
|
15
|
+
* (`community.lexicon.location.address`: `country`, `region`, `locality`,
|
|
16
|
+
* `street?`, `postalCode?`, `name?`). The frontend reads location records from
|
|
17
|
+
* the API and echoes them back on save. The API serializer emits explicit `null`
|
|
18
|
+
* for absent fields (not `undefined`), so every field uses `.nullish()`
|
|
19
|
+
* (`string | null | undefined`) instead of `.optional()` (`string | undefined`).
|
|
20
|
+
*
|
|
21
|
+
* `buildPdsLocation` on the server handles conversion to the PDS shape (always
|
|
22
|
+
* emitting the new community shape) and returns `undefined` when neither
|
|
23
|
+
* `country` nor `countryCode` is usable.
|
|
24
|
+
*/
|
|
25
|
+
declare const writeLocationSchema: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
26
|
+
country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
+
countryCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
locality: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
}, z.core.$strip>, z.ZodString]>>>;
|
|
35
|
+
/** Skill reference: a strong ref to a canonical skill record. */
|
|
36
|
+
declare const skillRefSchema: z.ZodObject<{
|
|
37
|
+
uri: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
/**
|
|
40
|
+
* Platforms accepted by the external-account write endpoint.
|
|
41
|
+
*
|
|
42
|
+
* NOTE: this list intentionally differs from `PLATFORM_LABELS` in the SDK's
|
|
43
|
+
* `/taxonomy` subpath. `VALID_PLATFORMS` is what sifa-api's `POST /external-accounts`
|
|
44
|
+
* endpoint enforces; `PLATFORM_LABELS` is the display taxonomy used by the profile
|
|
45
|
+
* UI. Reconciling them is a separate follow-up (see #TBD). For now the two are
|
|
46
|
+
* mirrored verbatim from their prior definitions to preserve behavior.
|
|
47
|
+
*/
|
|
48
|
+
declare const VALID_PLATFORMS: readonly ["rss", "fediverse", "twitter", "instagram", "github", "codeberg", "gitlab", "forgejo", "gitea", "youtube", "linkedin", "substack", "website", "orcid", "keyoxide", "other"];
|
|
49
|
+
type ValidPlatform = (typeof VALID_PLATFORMS)[number];
|
|
50
|
+
|
|
51
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.certification`. */
|
|
52
|
+
declare const CertificationWriteSchema: z.ZodObject<{
|
|
53
|
+
name: z.ZodString;
|
|
54
|
+
authority: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
+
credentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
56
|
+
credentialUrl: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
57
|
+
issuedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
type CertificationWriteInput = z.infer<typeof CertificationWriteSchema>;
|
|
61
|
+
|
|
62
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.course`. */
|
|
63
|
+
declare const CourseWriteSchema: z.ZodObject<{
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
|
+
institution: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
type CourseWriteInput = z.infer<typeof CourseWriteSchema>;
|
|
69
|
+
|
|
70
|
+
/** Schema enforced by `POST /profile/education` on sifa-api. */
|
|
71
|
+
declare const EducationWriteSchema: z.ZodObject<{
|
|
72
|
+
institution: z.ZodString;
|
|
73
|
+
degree: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
fieldOfStudy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
activities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
+
startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
type EducationWriteInput = z.infer<typeof EducationWriteSchema>;
|
|
81
|
+
|
|
82
|
+
/** Schema enforced by `POST /external-accounts` on sifa-api. */
|
|
83
|
+
declare const ExternalAccountWriteSchema: z.ZodObject<{
|
|
84
|
+
platform: z.ZodEnum<{
|
|
85
|
+
rss: "rss";
|
|
86
|
+
fediverse: "fediverse";
|
|
87
|
+
twitter: "twitter";
|
|
88
|
+
instagram: "instagram";
|
|
89
|
+
github: "github";
|
|
90
|
+
codeberg: "codeberg";
|
|
91
|
+
gitlab: "gitlab";
|
|
92
|
+
forgejo: "forgejo";
|
|
93
|
+
gitea: "gitea";
|
|
94
|
+
youtube: "youtube";
|
|
95
|
+
linkedin: "linkedin";
|
|
96
|
+
substack: "substack";
|
|
97
|
+
website: "website";
|
|
98
|
+
orcid: "orcid";
|
|
99
|
+
keyoxide: "keyoxide";
|
|
100
|
+
other: "other";
|
|
101
|
+
}>;
|
|
102
|
+
url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
103
|
+
label: z.ZodOptional<z.ZodString>;
|
|
104
|
+
feedUrl: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
type ExternalAccountWriteInput = z.infer<typeof ExternalAccountWriteSchema>;
|
|
107
|
+
|
|
108
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.honor`. */
|
|
109
|
+
declare const HonorWriteSchema: z.ZodObject<{
|
|
110
|
+
title: z.ZodString;
|
|
111
|
+
issuer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
112
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
awardedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
type HonorWriteInput = z.infer<typeof HonorWriteSchema>;
|
|
116
|
+
|
|
117
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.language`. */
|
|
118
|
+
declare const LanguageWriteSchema: z.ZodObject<{
|
|
119
|
+
name: z.ZodString;
|
|
120
|
+
proficiency: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
type LanguageWriteInput = z.infer<typeof LanguageWriteSchema>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Schema enforced by `POST /profile/positions` on sifa-api.
|
|
126
|
+
*
|
|
127
|
+
* Client-side callers can `.safeParse(...)` this before submitting to catch
|
|
128
|
+
* obvious problems (empty `title`, over-length text) before the network
|
|
129
|
+
* round-trip. If it passes here, the API will accept the write modulo
|
|
130
|
+
* transport / auth failures.
|
|
131
|
+
*
|
|
132
|
+
* `company` is intentionally optional to support freelancer / independent
|
|
133
|
+
* employment types where the position has no employer. The current
|
|
134
|
+
* `sifa-api/src/routes/schemas.ts` requires `company` (`.min(1)`); the
|
|
135
|
+
* sifa-api adoption PR that consumes this schema will therefore be a
|
|
136
|
+
* behavior change that unblocks the freelancer flow. The SDK's lexicon
|
|
137
|
+
* schema (`ProfilePositionRecordSchema`) has treated `company` as optional
|
|
138
|
+
* since sifa-sdk #184.
|
|
139
|
+
*/
|
|
140
|
+
declare const PositionWriteSchema: z.ZodObject<{
|
|
141
|
+
company: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
142
|
+
title: z.ZodString;
|
|
143
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
144
|
+
employmentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
145
|
+
workplaceType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
146
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
147
|
+
country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
148
|
+
countryCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
149
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
150
|
+
city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
151
|
+
locality: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
152
|
+
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
153
|
+
postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
154
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
155
|
+
}, z.core.$strip>, z.ZodString]>>>;
|
|
156
|
+
startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
157
|
+
endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
158
|
+
skills: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
159
|
+
uri: z.ZodString;
|
|
160
|
+
}, z.core.$strip>>>>;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
type PositionWriteInput = z.infer<typeof PositionWriteSchema>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Schema enforced by `POST /profile/locations` on sifa-api.
|
|
166
|
+
*
|
|
167
|
+
* Mirrors the inner object of `writeLocationSchema`: accepts both the community
|
|
168
|
+
* shape (`country`, `locality`) and the legacy shape (`countryCode`, `city`)
|
|
169
|
+
* during the dual-read window. sifa-web #840 switched outbound writes to the
|
|
170
|
+
* community shape; older clients may still send the legacy shape. All address
|
|
171
|
+
* fields are `.nullish()` so explicit `null` from API echoes is accepted
|
|
172
|
+
* (see sifa-api #426).
|
|
173
|
+
*
|
|
174
|
+
* The route handler hands `address` to `buildPdsLocation`, which normalizes
|
|
175
|
+
* either input and enforces alpha-2 on the wire to PDS — returning a 400 with
|
|
176
|
+
* `message: "address.country (alpha-2) is required"` when no usable code is
|
|
177
|
+
* present. The schema stays permissive on country length here and lets
|
|
178
|
+
* `buildPdsLocation` be the single enforcement point.
|
|
179
|
+
*/
|
|
180
|
+
declare const ProfileLocationWriteSchema: z.ZodObject<{
|
|
181
|
+
address: z.ZodObject<{
|
|
182
|
+
country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
183
|
+
countryCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
184
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
185
|
+
city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
186
|
+
locality: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
|
+
postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
type: z.ZodString;
|
|
192
|
+
label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
193
|
+
isPrimary: z.ZodOptional<z.ZodBoolean>;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
type ProfileLocationWriteInput = z.infer<typeof ProfileLocationWriteSchema>;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Schema enforced by `POST /profile/self` on sifa-api.
|
|
199
|
+
*
|
|
200
|
+
* `.passthrough()` so the API accepts fields not yet enumerated here (used for
|
|
201
|
+
* gradual rollout of new profile-self keys without requiring lockstep bumps
|
|
202
|
+
* between web/api). Note this means client validation on this schema will
|
|
203
|
+
* NEVER reject "unknown" fields — the divergence is intentional.
|
|
204
|
+
*
|
|
205
|
+
* Grapheme caps (e.g. 64 on given/familyName) are enforced client-side by the
|
|
206
|
+
* SDK's lexicon schema; the write schema only guards the byte-length ceiling.
|
|
207
|
+
*/
|
|
208
|
+
declare const ProfileSelfWriteSchema: z.ZodObject<{
|
|
209
|
+
headline: z.ZodOptional<z.ZodString>;
|
|
210
|
+
about: z.ZodOptional<z.ZodString>;
|
|
211
|
+
givenName: z.ZodOptional<z.ZodString>;
|
|
212
|
+
familyName: z.ZodOptional<z.ZodString>;
|
|
213
|
+
industries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
214
|
+
industry: z.ZodString;
|
|
215
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
216
|
+
}, z.core.$strip>>>;
|
|
217
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
218
|
+
country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
219
|
+
countryCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
220
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
221
|
+
city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
222
|
+
locality: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
223
|
+
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
224
|
+
postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
225
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
226
|
+
}, z.core.$strip>, z.ZodString]>>>;
|
|
227
|
+
openTo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
228
|
+
preferredWorkplace: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
229
|
+
availableFromUtc: z.ZodOptional<z.ZodNumber>;
|
|
230
|
+
availableToUtc: z.ZodOptional<z.ZodNumber>;
|
|
231
|
+
langs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
232
|
+
discoverable: z.ZodOptional<z.ZodBoolean>;
|
|
233
|
+
}, z.core.$loose>;
|
|
234
|
+
type ProfileSelfWriteInput = z.infer<typeof ProfileSelfWriteSchema>;
|
|
235
|
+
|
|
236
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.project`. */
|
|
237
|
+
declare const ProjectWriteSchema: z.ZodObject<{
|
|
238
|
+
name: z.ZodString;
|
|
239
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
240
|
+
url: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
241
|
+
startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
242
|
+
endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
type ProjectWriteInput = z.infer<typeof ProjectWriteSchema>;
|
|
245
|
+
|
|
246
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.publication`. */
|
|
247
|
+
declare const PublicationWriteSchema: z.ZodObject<{
|
|
248
|
+
title: z.ZodString;
|
|
249
|
+
publisher: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
250
|
+
url: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
251
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
252
|
+
publishedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
253
|
+
}, z.core.$strip>;
|
|
254
|
+
type PublicationWriteInput = z.infer<typeof PublicationWriteSchema>;
|
|
255
|
+
|
|
256
|
+
/** Schema enforced by `POST /profile/skills` on sifa-api. */
|
|
257
|
+
declare const SkillWriteSchema: z.ZodObject<{
|
|
258
|
+
name: z.ZodString;
|
|
259
|
+
category: z.ZodOptional<z.ZodString>;
|
|
260
|
+
}, z.core.$strip>;
|
|
261
|
+
type SkillWriteInput = z.infer<typeof SkillWriteSchema>;
|
|
262
|
+
|
|
263
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.volunteering`. */
|
|
264
|
+
declare const VolunteeringWriteSchema: z.ZodObject<{
|
|
265
|
+
organization: z.ZodString;
|
|
266
|
+
role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
267
|
+
cause: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
268
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
269
|
+
startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
270
|
+
endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
271
|
+
}, z.core.$strip>;
|
|
272
|
+
type VolunteeringWriteInput = z.infer<typeof VolunteeringWriteSchema>;
|
|
273
|
+
|
|
274
|
+
export { type CertificationWriteInput, CertificationWriteSchema, type CourseWriteInput, CourseWriteSchema, type EducationWriteInput, EducationWriteSchema, type ExternalAccountWriteInput, ExternalAccountWriteSchema, type HonorWriteInput, HonorWriteSchema, type LanguageWriteInput, LanguageWriteSchema, type PositionWriteInput, PositionWriteSchema, type ProfileLocationWriteInput, ProfileLocationWriteSchema, type ProfileSelfWriteInput, ProfileSelfWriteSchema, type ProjectWriteInput, ProjectWriteSchema, type PublicationWriteInput, PublicationWriteSchema, type SkillWriteInput, SkillWriteSchema, VALID_PLATFORMS, type ValidPlatform, type VolunteeringWriteInput, VolunteeringWriteSchema, normalizeUrl, optionalUrl, skillRefSchema, writeLocationSchema };
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** Prepend `https://` if no scheme is present. */
|
|
4
|
+
declare function normalizeUrl(val: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Accept a URL string or silently drop it if invalid (returns `undefined`).
|
|
7
|
+
* Preserves the write-time policy: bad URLs from imports are dropped, not rejected.
|
|
8
|
+
*/
|
|
9
|
+
declare const optionalUrl: () => z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
10
|
+
/**
|
|
11
|
+
* Location shape accepted by the sifa-api write endpoints.
|
|
12
|
+
*
|
|
13
|
+
* Accepts BOTH the legacy shape (`id.sifa.defs#locationAddress`: `countryCode`,
|
|
14
|
+
* `region`, `city`) AND the new community shape
|
|
15
|
+
* (`community.lexicon.location.address`: `country`, `region`, `locality`,
|
|
16
|
+
* `street?`, `postalCode?`, `name?`). The frontend reads location records from
|
|
17
|
+
* the API and echoes them back on save. The API serializer emits explicit `null`
|
|
18
|
+
* for absent fields (not `undefined`), so every field uses `.nullish()`
|
|
19
|
+
* (`string | null | undefined`) instead of `.optional()` (`string | undefined`).
|
|
20
|
+
*
|
|
21
|
+
* `buildPdsLocation` on the server handles conversion to the PDS shape (always
|
|
22
|
+
* emitting the new community shape) and returns `undefined` when neither
|
|
23
|
+
* `country` nor `countryCode` is usable.
|
|
24
|
+
*/
|
|
25
|
+
declare const writeLocationSchema: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
26
|
+
country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
+
countryCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
locality: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
}, z.core.$strip>, z.ZodString]>>>;
|
|
35
|
+
/** Skill reference: a strong ref to a canonical skill record. */
|
|
36
|
+
declare const skillRefSchema: z.ZodObject<{
|
|
37
|
+
uri: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
/**
|
|
40
|
+
* Platforms accepted by the external-account write endpoint.
|
|
41
|
+
*
|
|
42
|
+
* NOTE: this list intentionally differs from `PLATFORM_LABELS` in the SDK's
|
|
43
|
+
* `/taxonomy` subpath. `VALID_PLATFORMS` is what sifa-api's `POST /external-accounts`
|
|
44
|
+
* endpoint enforces; `PLATFORM_LABELS` is the display taxonomy used by the profile
|
|
45
|
+
* UI. Reconciling them is a separate follow-up (see #TBD). For now the two are
|
|
46
|
+
* mirrored verbatim from their prior definitions to preserve behavior.
|
|
47
|
+
*/
|
|
48
|
+
declare const VALID_PLATFORMS: readonly ["rss", "fediverse", "twitter", "instagram", "github", "codeberg", "gitlab", "forgejo", "gitea", "youtube", "linkedin", "substack", "website", "orcid", "keyoxide", "other"];
|
|
49
|
+
type ValidPlatform = (typeof VALID_PLATFORMS)[number];
|
|
50
|
+
|
|
51
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.certification`. */
|
|
52
|
+
declare const CertificationWriteSchema: z.ZodObject<{
|
|
53
|
+
name: z.ZodString;
|
|
54
|
+
authority: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
+
credentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
56
|
+
credentialUrl: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
57
|
+
issuedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
type CertificationWriteInput = z.infer<typeof CertificationWriteSchema>;
|
|
61
|
+
|
|
62
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.course`. */
|
|
63
|
+
declare const CourseWriteSchema: z.ZodObject<{
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
|
+
institution: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
type CourseWriteInput = z.infer<typeof CourseWriteSchema>;
|
|
69
|
+
|
|
70
|
+
/** Schema enforced by `POST /profile/education` on sifa-api. */
|
|
71
|
+
declare const EducationWriteSchema: z.ZodObject<{
|
|
72
|
+
institution: z.ZodString;
|
|
73
|
+
degree: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
fieldOfStudy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
activities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
+
startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
type EducationWriteInput = z.infer<typeof EducationWriteSchema>;
|
|
81
|
+
|
|
82
|
+
/** Schema enforced by `POST /external-accounts` on sifa-api. */
|
|
83
|
+
declare const ExternalAccountWriteSchema: z.ZodObject<{
|
|
84
|
+
platform: z.ZodEnum<{
|
|
85
|
+
rss: "rss";
|
|
86
|
+
fediverse: "fediverse";
|
|
87
|
+
twitter: "twitter";
|
|
88
|
+
instagram: "instagram";
|
|
89
|
+
github: "github";
|
|
90
|
+
codeberg: "codeberg";
|
|
91
|
+
gitlab: "gitlab";
|
|
92
|
+
forgejo: "forgejo";
|
|
93
|
+
gitea: "gitea";
|
|
94
|
+
youtube: "youtube";
|
|
95
|
+
linkedin: "linkedin";
|
|
96
|
+
substack: "substack";
|
|
97
|
+
website: "website";
|
|
98
|
+
orcid: "orcid";
|
|
99
|
+
keyoxide: "keyoxide";
|
|
100
|
+
other: "other";
|
|
101
|
+
}>;
|
|
102
|
+
url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
103
|
+
label: z.ZodOptional<z.ZodString>;
|
|
104
|
+
feedUrl: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
type ExternalAccountWriteInput = z.infer<typeof ExternalAccountWriteSchema>;
|
|
107
|
+
|
|
108
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.honor`. */
|
|
109
|
+
declare const HonorWriteSchema: z.ZodObject<{
|
|
110
|
+
title: z.ZodString;
|
|
111
|
+
issuer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
112
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
awardedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
type HonorWriteInput = z.infer<typeof HonorWriteSchema>;
|
|
116
|
+
|
|
117
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.language`. */
|
|
118
|
+
declare const LanguageWriteSchema: z.ZodObject<{
|
|
119
|
+
name: z.ZodString;
|
|
120
|
+
proficiency: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
type LanguageWriteInput = z.infer<typeof LanguageWriteSchema>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Schema enforced by `POST /profile/positions` on sifa-api.
|
|
126
|
+
*
|
|
127
|
+
* Client-side callers can `.safeParse(...)` this before submitting to catch
|
|
128
|
+
* obvious problems (empty `title`, over-length text) before the network
|
|
129
|
+
* round-trip. If it passes here, the API will accept the write modulo
|
|
130
|
+
* transport / auth failures.
|
|
131
|
+
*
|
|
132
|
+
* `company` is intentionally optional to support freelancer / independent
|
|
133
|
+
* employment types where the position has no employer. The current
|
|
134
|
+
* `sifa-api/src/routes/schemas.ts` requires `company` (`.min(1)`); the
|
|
135
|
+
* sifa-api adoption PR that consumes this schema will therefore be a
|
|
136
|
+
* behavior change that unblocks the freelancer flow. The SDK's lexicon
|
|
137
|
+
* schema (`ProfilePositionRecordSchema`) has treated `company` as optional
|
|
138
|
+
* since sifa-sdk #184.
|
|
139
|
+
*/
|
|
140
|
+
declare const PositionWriteSchema: z.ZodObject<{
|
|
141
|
+
company: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
142
|
+
title: z.ZodString;
|
|
143
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
144
|
+
employmentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
145
|
+
workplaceType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
146
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
147
|
+
country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
148
|
+
countryCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
149
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
150
|
+
city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
151
|
+
locality: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
152
|
+
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
153
|
+
postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
154
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
155
|
+
}, z.core.$strip>, z.ZodString]>>>;
|
|
156
|
+
startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
157
|
+
endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
158
|
+
skills: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
159
|
+
uri: z.ZodString;
|
|
160
|
+
}, z.core.$strip>>>>;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
type PositionWriteInput = z.infer<typeof PositionWriteSchema>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Schema enforced by `POST /profile/locations` on sifa-api.
|
|
166
|
+
*
|
|
167
|
+
* Mirrors the inner object of `writeLocationSchema`: accepts both the community
|
|
168
|
+
* shape (`country`, `locality`) and the legacy shape (`countryCode`, `city`)
|
|
169
|
+
* during the dual-read window. sifa-web #840 switched outbound writes to the
|
|
170
|
+
* community shape; older clients may still send the legacy shape. All address
|
|
171
|
+
* fields are `.nullish()` so explicit `null` from API echoes is accepted
|
|
172
|
+
* (see sifa-api #426).
|
|
173
|
+
*
|
|
174
|
+
* The route handler hands `address` to `buildPdsLocation`, which normalizes
|
|
175
|
+
* either input and enforces alpha-2 on the wire to PDS — returning a 400 with
|
|
176
|
+
* `message: "address.country (alpha-2) is required"` when no usable code is
|
|
177
|
+
* present. The schema stays permissive on country length here and lets
|
|
178
|
+
* `buildPdsLocation` be the single enforcement point.
|
|
179
|
+
*/
|
|
180
|
+
declare const ProfileLocationWriteSchema: z.ZodObject<{
|
|
181
|
+
address: z.ZodObject<{
|
|
182
|
+
country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
183
|
+
countryCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
184
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
185
|
+
city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
186
|
+
locality: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
|
+
postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
type: z.ZodString;
|
|
192
|
+
label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
193
|
+
isPrimary: z.ZodOptional<z.ZodBoolean>;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
type ProfileLocationWriteInput = z.infer<typeof ProfileLocationWriteSchema>;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Schema enforced by `POST /profile/self` on sifa-api.
|
|
199
|
+
*
|
|
200
|
+
* `.passthrough()` so the API accepts fields not yet enumerated here (used for
|
|
201
|
+
* gradual rollout of new profile-self keys without requiring lockstep bumps
|
|
202
|
+
* between web/api). Note this means client validation on this schema will
|
|
203
|
+
* NEVER reject "unknown" fields — the divergence is intentional.
|
|
204
|
+
*
|
|
205
|
+
* Grapheme caps (e.g. 64 on given/familyName) are enforced client-side by the
|
|
206
|
+
* SDK's lexicon schema; the write schema only guards the byte-length ceiling.
|
|
207
|
+
*/
|
|
208
|
+
declare const ProfileSelfWriteSchema: z.ZodObject<{
|
|
209
|
+
headline: z.ZodOptional<z.ZodString>;
|
|
210
|
+
about: z.ZodOptional<z.ZodString>;
|
|
211
|
+
givenName: z.ZodOptional<z.ZodString>;
|
|
212
|
+
familyName: z.ZodOptional<z.ZodString>;
|
|
213
|
+
industries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
214
|
+
industry: z.ZodString;
|
|
215
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
216
|
+
}, z.core.$strip>>>;
|
|
217
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
218
|
+
country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
219
|
+
countryCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
220
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
221
|
+
city: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
222
|
+
locality: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
223
|
+
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
224
|
+
postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
225
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
226
|
+
}, z.core.$strip>, z.ZodString]>>>;
|
|
227
|
+
openTo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
228
|
+
preferredWorkplace: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
229
|
+
availableFromUtc: z.ZodOptional<z.ZodNumber>;
|
|
230
|
+
availableToUtc: z.ZodOptional<z.ZodNumber>;
|
|
231
|
+
langs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
232
|
+
discoverable: z.ZodOptional<z.ZodBoolean>;
|
|
233
|
+
}, z.core.$loose>;
|
|
234
|
+
type ProfileSelfWriteInput = z.infer<typeof ProfileSelfWriteSchema>;
|
|
235
|
+
|
|
236
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.project`. */
|
|
237
|
+
declare const ProjectWriteSchema: z.ZodObject<{
|
|
238
|
+
name: z.ZodString;
|
|
239
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
240
|
+
url: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
241
|
+
startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
242
|
+
endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
type ProjectWriteInput = z.infer<typeof ProjectWriteSchema>;
|
|
245
|
+
|
|
246
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.publication`. */
|
|
247
|
+
declare const PublicationWriteSchema: z.ZodObject<{
|
|
248
|
+
title: z.ZodString;
|
|
249
|
+
publisher: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
250
|
+
url: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
251
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
252
|
+
publishedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
253
|
+
}, z.core.$strip>;
|
|
254
|
+
type PublicationWriteInput = z.infer<typeof PublicationWriteSchema>;
|
|
255
|
+
|
|
256
|
+
/** Schema enforced by `POST /profile/skills` on sifa-api. */
|
|
257
|
+
declare const SkillWriteSchema: z.ZodObject<{
|
|
258
|
+
name: z.ZodString;
|
|
259
|
+
category: z.ZodOptional<z.ZodString>;
|
|
260
|
+
}, z.core.$strip>;
|
|
261
|
+
type SkillWriteInput = z.infer<typeof SkillWriteSchema>;
|
|
262
|
+
|
|
263
|
+
/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.volunteering`. */
|
|
264
|
+
declare const VolunteeringWriteSchema: z.ZodObject<{
|
|
265
|
+
organization: z.ZodString;
|
|
266
|
+
role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
267
|
+
cause: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
268
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
269
|
+
startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
270
|
+
endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
271
|
+
}, z.core.$strip>;
|
|
272
|
+
type VolunteeringWriteInput = z.infer<typeof VolunteeringWriteSchema>;
|
|
273
|
+
|
|
274
|
+
export { type CertificationWriteInput, CertificationWriteSchema, type CourseWriteInput, CourseWriteSchema, type EducationWriteInput, EducationWriteSchema, type ExternalAccountWriteInput, ExternalAccountWriteSchema, type HonorWriteInput, HonorWriteSchema, type LanguageWriteInput, LanguageWriteSchema, type PositionWriteInput, PositionWriteSchema, type ProfileLocationWriteInput, ProfileLocationWriteSchema, type ProfileSelfWriteInput, ProfileSelfWriteSchema, type ProjectWriteInput, ProjectWriteSchema, type PublicationWriteInput, PublicationWriteSchema, type SkillWriteInput, SkillWriteSchema, VALID_PLATFORMS, type ValidPlatform, type VolunteeringWriteInput, VolunteeringWriteSchema, normalizeUrl, optionalUrl, skillRefSchema, writeLocationSchema };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// src/schemas/write/shared.ts
|
|
4
|
+
function normalizeUrl(val) {
|
|
5
|
+
const trimmed = val.trim();
|
|
6
|
+
if (/^https?:\/\//i.test(trimmed)) return trimmed;
|
|
7
|
+
return `https://${trimmed}`;
|
|
8
|
+
}
|
|
9
|
+
var optionalUrl = () => z.string().optional().transform((val) => {
|
|
10
|
+
if (!val) return void 0;
|
|
11
|
+
try {
|
|
12
|
+
new URL(val);
|
|
13
|
+
return val;
|
|
14
|
+
} catch {
|
|
15
|
+
return void 0;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var writeLocationSchema = z.union([
|
|
19
|
+
z.object({
|
|
20
|
+
country: z.string().nullish(),
|
|
21
|
+
countryCode: z.string().length(2).nullish(),
|
|
22
|
+
region: z.string().nullish(),
|
|
23
|
+
city: z.string().nullish(),
|
|
24
|
+
locality: z.string().nullish(),
|
|
25
|
+
street: z.string().nullish(),
|
|
26
|
+
postalCode: z.string().nullish(),
|
|
27
|
+
name: z.string().nullish()
|
|
28
|
+
}),
|
|
29
|
+
z.string()
|
|
30
|
+
]).nullable().optional();
|
|
31
|
+
var skillRefSchema = z.object({
|
|
32
|
+
uri: z.string()
|
|
33
|
+
});
|
|
34
|
+
var VALID_PLATFORMS = [
|
|
35
|
+
"rss",
|
|
36
|
+
"fediverse",
|
|
37
|
+
"twitter",
|
|
38
|
+
"instagram",
|
|
39
|
+
"github",
|
|
40
|
+
"codeberg",
|
|
41
|
+
"gitlab",
|
|
42
|
+
"forgejo",
|
|
43
|
+
"gitea",
|
|
44
|
+
"youtube",
|
|
45
|
+
"linkedin",
|
|
46
|
+
"substack",
|
|
47
|
+
"website",
|
|
48
|
+
"orcid",
|
|
49
|
+
"keyoxide",
|
|
50
|
+
"other"
|
|
51
|
+
];
|
|
52
|
+
var CertificationWriteSchema = z.object({
|
|
53
|
+
name: z.string().min(1).max(256),
|
|
54
|
+
authority: z.string().max(256).nullable().optional(),
|
|
55
|
+
credentialId: z.string().max(256).nullable().optional(),
|
|
56
|
+
credentialUrl: optionalUrl(),
|
|
57
|
+
issuedAt: z.string().nullable().optional(),
|
|
58
|
+
expiresAt: z.string().nullable().optional()
|
|
59
|
+
});
|
|
60
|
+
var CourseWriteSchema = z.object({
|
|
61
|
+
name: z.string().min(1).max(200),
|
|
62
|
+
number: z.string().max(50).nullable().optional(),
|
|
63
|
+
institution: z.string().max(256).nullable().optional()
|
|
64
|
+
});
|
|
65
|
+
var EducationWriteSchema = z.object({
|
|
66
|
+
institution: z.string().min(1).max(256),
|
|
67
|
+
degree: z.string().max(256).nullable().optional(),
|
|
68
|
+
fieldOfStudy: z.string().max(256).nullable().optional(),
|
|
69
|
+
description: z.string().max(5e4).nullable().optional(),
|
|
70
|
+
activities: z.string().max(1e3).nullable().optional(),
|
|
71
|
+
startedAt: z.string().nullable().optional(),
|
|
72
|
+
endedAt: z.string().nullable().optional()
|
|
73
|
+
});
|
|
74
|
+
var ExternalAccountWriteSchema = z.object({
|
|
75
|
+
platform: z.enum(VALID_PLATFORMS),
|
|
76
|
+
url: z.string().max(2e3).transform(normalizeUrl).pipe(z.string().url()),
|
|
77
|
+
label: z.string().max(100).optional(),
|
|
78
|
+
feedUrl: z.string().max(2e3).transform(normalizeUrl).pipe(z.string().url()).optional()
|
|
79
|
+
});
|
|
80
|
+
var HonorWriteSchema = z.object({
|
|
81
|
+
title: z.string().min(1).max(200),
|
|
82
|
+
issuer: z.string().max(256).nullable().optional(),
|
|
83
|
+
description: z.string().max(5e4).nullable().optional(),
|
|
84
|
+
awardedAt: z.string().nullable().optional()
|
|
85
|
+
});
|
|
86
|
+
var LanguageWriteSchema = z.object({
|
|
87
|
+
name: z.string().min(1).max(64),
|
|
88
|
+
proficiency: z.string().max(50).optional()
|
|
89
|
+
});
|
|
90
|
+
var PositionWriteSchema = z.object({
|
|
91
|
+
company: z.string().min(1).max(256).nullable().optional(),
|
|
92
|
+
title: z.string().min(1).max(256),
|
|
93
|
+
description: z.string().max(5e4).nullable().optional(),
|
|
94
|
+
employmentType: z.string().nullable().optional(),
|
|
95
|
+
workplaceType: z.string().nullable().optional(),
|
|
96
|
+
location: writeLocationSchema,
|
|
97
|
+
startedAt: z.string().nullable().optional(),
|
|
98
|
+
endedAt: z.string().nullable().optional(),
|
|
99
|
+
skills: z.array(skillRefSchema).max(50).nullable().optional()
|
|
100
|
+
});
|
|
101
|
+
var ProfileLocationWriteSchema = z.object({
|
|
102
|
+
address: z.object({
|
|
103
|
+
country: z.string().nullish(),
|
|
104
|
+
countryCode: z.string().length(2).nullish(),
|
|
105
|
+
region: z.string().nullish(),
|
|
106
|
+
city: z.string().nullish(),
|
|
107
|
+
locality: z.string().nullish(),
|
|
108
|
+
street: z.string().nullish(),
|
|
109
|
+
postalCode: z.string().nullish(),
|
|
110
|
+
name: z.string().nullish()
|
|
111
|
+
}),
|
|
112
|
+
type: z.string().min(1),
|
|
113
|
+
label: z.string().max(60).nullable().optional(),
|
|
114
|
+
isPrimary: z.boolean().optional()
|
|
115
|
+
});
|
|
116
|
+
var ProfileSelfWriteSchema = z.object({
|
|
117
|
+
headline: z.string().max(300).optional(),
|
|
118
|
+
about: z.string().max(5e4).optional(),
|
|
119
|
+
givenName: z.string().max(640).optional(),
|
|
120
|
+
familyName: z.string().max(640).optional(),
|
|
121
|
+
industries: z.array(
|
|
122
|
+
z.object({
|
|
123
|
+
industry: z.string().max(100),
|
|
124
|
+
domain: z.string().max(100).optional()
|
|
125
|
+
})
|
|
126
|
+
).max(10).optional(),
|
|
127
|
+
location: writeLocationSchema,
|
|
128
|
+
openTo: z.array(z.string()).max(10).optional(),
|
|
129
|
+
preferredWorkplace: z.array(z.string()).max(5).optional(),
|
|
130
|
+
availableFromUtc: z.number().int().min(0).max(23).optional(),
|
|
131
|
+
availableToUtc: z.number().int().min(0).max(23).optional(),
|
|
132
|
+
langs: z.array(z.string()).max(3).optional(),
|
|
133
|
+
discoverable: z.boolean().optional()
|
|
134
|
+
}).passthrough();
|
|
135
|
+
var ProjectWriteSchema = z.object({
|
|
136
|
+
name: z.string().min(1).max(256),
|
|
137
|
+
description: z.string().max(5e4).nullable().optional(),
|
|
138
|
+
url: optionalUrl(),
|
|
139
|
+
startedAt: z.string().nullable().optional(),
|
|
140
|
+
endedAt: z.string().nullable().optional()
|
|
141
|
+
});
|
|
142
|
+
var PublicationWriteSchema = z.object({
|
|
143
|
+
title: z.string().min(1).max(200),
|
|
144
|
+
publisher: z.string().max(256).nullable().optional(),
|
|
145
|
+
url: optionalUrl(),
|
|
146
|
+
description: z.string().max(5e4).nullable().optional(),
|
|
147
|
+
publishedAt: z.string().nullable().optional()
|
|
148
|
+
});
|
|
149
|
+
var SkillWriteSchema = z.object({
|
|
150
|
+
name: z.string().min(1).max(100),
|
|
151
|
+
category: z.string().max(100).optional()
|
|
152
|
+
});
|
|
153
|
+
var VolunteeringWriteSchema = z.object({
|
|
154
|
+
organization: z.string().min(1).max(256),
|
|
155
|
+
role: z.string().max(256).nullable().optional(),
|
|
156
|
+
cause: z.string().max(256).nullable().optional(),
|
|
157
|
+
description: z.string().max(5e4).nullable().optional(),
|
|
158
|
+
startedAt: z.string().nullable().optional(),
|
|
159
|
+
endedAt: z.string().nullable().optional()
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
export { CertificationWriteSchema, CourseWriteSchema, EducationWriteSchema, ExternalAccountWriteSchema, HonorWriteSchema, LanguageWriteSchema, PositionWriteSchema, ProfileLocationWriteSchema, ProfileSelfWriteSchema, ProjectWriteSchema, PublicationWriteSchema, SkillWriteSchema, VALID_PLATFORMS, VolunteeringWriteSchema, normalizeUrl, optionalUrl, skillRefSchema, writeLocationSchema };
|
|
163
|
+
//# sourceMappingURL=index.js.map
|
|
164
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/schemas/write/shared.ts","../../../src/schemas/write/certification.ts","../../../src/schemas/write/course.ts","../../../src/schemas/write/education.ts","../../../src/schemas/write/external-account.ts","../../../src/schemas/write/honor.ts","../../../src/schemas/write/language.ts","../../../src/schemas/write/position.ts","../../../src/schemas/write/profile-location.ts","../../../src/schemas/write/profile-self.ts","../../../src/schemas/write/project.ts","../../../src/schemas/write/publication.ts","../../../src/schemas/write/skill.ts","../../../src/schemas/write/volunteering.ts"],"names":["z"],"mappings":";;;AAGO,SAAS,aAAa,GAAA,EAAqB;AAChD,EAAA,MAAM,OAAA,GAAU,IAAI,IAAA,EAAK;AACzB,EAAA,IAAI,eAAA,CAAgB,IAAA,CAAK,OAAO,CAAA,EAAG,OAAO,OAAA;AAC1C,EAAA,OAAO,WAAW,OAAO,CAAA,CAAA;AAC3B;AAMO,IAAM,WAAA,GAAc,MACzB,CAAA,CACG,MAAA,GACA,QAAA,EAAS,CACT,SAAA,CAAU,CAAC,GAAA,KAAQ;AAClB,EAAA,IAAI,CAAC,KAAK,OAAO,MAAA;AACjB,EAAA,IAAI;AACF,IAAA,IAAI,IAAI,GAAG,CAAA;AACX,IAAA,OAAO,GAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF,CAAC;AAiBE,IAAM,mBAAA,GAAsB,EAChC,KAAA,CAAM;AAAA,EACL,EAAE,MAAA,CAAO;AAAA,IACP,OAAA,EAAS,CAAA,CAAE,MAAA,EAAO,CAAE,OAAA,EAAQ;AAAA,IAC5B,aAAa,CAAA,CAAE,MAAA,GAAS,MAAA,CAAO,CAAC,EAAE,OAAA,EAAQ;AAAA,IAC1C,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,OAAA,EAAQ;AAAA,IAC3B,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,OAAA,EAAQ;AAAA,IAC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AA,CAAE,QAAA,EAAS,CAAE,QAAA,EAAS;AAAA,EACnD,KAAK,WAAA,EAAY;AAAA,EACjB,WAAA,EAAaA,EAAE,MAAA,EAAO,CAAE,IAAI,GAAK,CAAA,CAAE,QAAA,EAAS,CAAE,QAAA,EAAS;AAAA,EACvD,aAAaA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA;AACrC,CAAC;ACRM,IAAM,gBAAA,GAAmBA,EAAE,MAAA,CAAO;AAAA,EACvC,IAAA,EAAMA,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAG,CAAA;AAAA,EAC/B,UAAUA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAChC,CAAC;ACHM,IAAM,uBAAA,GAA0BA,EAAE,MAAA,CAAO;AAAA,EAC9C,YAAA,EAAcA,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAG,CAAA;AAAA,EACvC,IAAA,EAAMA,EAAE,MAAA,EAAO,CAAE,IAAI,GAAG,CAAA,CAAE,QAAA,EAAS,CAAE,QAAA,EAAS;AAAA,EAC9C,KAAA,EAAOA,EAAE,MAAA,EAAO,CAAE,IAAI,GAAG,CAAA,CAAE,QAAA,EAAS,CAAE,QAAA,EAAS;AAAA,EAC/C,WAAA,EAAaA,EAAE,MAAA,EAAO,CAAE,IAAI,GAAK,CAAA,CAAE,QAAA,EAAS,CAAE,QAAA,EAAS;AAAA,EACvD,WAAWA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA,EAAS;AAAA,EAC1C,SAASA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA;AACjC,CAAC","file":"index.js","sourcesContent":["import { z } from 'zod';\n\n/** Prepend `https://` if no scheme is present. */\nexport function normalizeUrl(val: string): string {\n const trimmed = val.trim();\n if (/^https?:\\/\\//i.test(trimmed)) return trimmed;\n return `https://${trimmed}`;\n}\n\n/**\n * Accept a URL string or silently drop it if invalid (returns `undefined`).\n * Preserves the write-time policy: bad URLs from imports are dropped, not rejected.\n */\nexport const optionalUrl = () =>\n z\n .string()\n .optional()\n .transform((val) => {\n if (!val) return undefined;\n try {\n new URL(val);\n return val;\n } catch {\n return undefined;\n }\n });\n\n/**\n * Location shape accepted by the sifa-api write endpoints.\n *\n * Accepts BOTH the legacy shape (`id.sifa.defs#locationAddress`: `countryCode`,\n * `region`, `city`) AND the new community shape\n * (`community.lexicon.location.address`: `country`, `region`, `locality`,\n * `street?`, `postalCode?`, `name?`). The frontend reads location records from\n * the API and echoes them back on save. The API serializer emits explicit `null`\n * for absent fields (not `undefined`), so every field uses `.nullish()`\n * (`string | null | undefined`) instead of `.optional()` (`string | undefined`).\n *\n * `buildPdsLocation` on the server handles conversion to the PDS shape (always\n * emitting the new community shape) and returns `undefined` when neither\n * `country` nor `countryCode` is usable.\n */\nexport const writeLocationSchema = z\n .union([\n z.object({\n country: z.string().nullish(),\n countryCode: z.string().length(2).nullish(),\n region: z.string().nullish(),\n city: z.string().nullish(),\n locality: z.string().nullish(),\n street: z.string().nullish(),\n postalCode: z.string().nullish(),\n name: z.string().nullish(),\n }),\n z.string(),\n ])\n .nullable()\n .optional();\n\n/** Skill reference: a strong ref to a canonical skill record. */\nexport const skillRefSchema = z.object({\n uri: z.string(),\n});\n\n/**\n * Platforms accepted by the external-account write endpoint.\n *\n * NOTE: this list intentionally differs from `PLATFORM_LABELS` in the SDK's\n * `/taxonomy` subpath. `VALID_PLATFORMS` is what sifa-api's `POST /external-accounts`\n * endpoint enforces; `PLATFORM_LABELS` is the display taxonomy used by the profile\n * UI. Reconciling them is a separate follow-up (see #TBD). For now the two are\n * mirrored verbatim from their prior definitions to preserve behavior.\n */\nexport const VALID_PLATFORMS = [\n 'rss',\n 'fediverse',\n 'twitter',\n 'instagram',\n 'github',\n 'codeberg',\n 'gitlab',\n 'forgejo',\n 'gitea',\n 'youtube',\n 'linkedin',\n 'substack',\n 'website',\n 'orcid',\n 'keyoxide',\n 'other',\n] as const;\n\nexport type ValidPlatform = (typeof VALID_PLATFORMS)[number];\n","import { z } from 'zod';\n\nimport { optionalUrl } from './shared.js';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.certification`. */\nexport const CertificationWriteSchema = z.object({\n name: z.string().min(1).max(256),\n authority: z.string().max(256).nullable().optional(),\n credentialId: z.string().max(256).nullable().optional(),\n credentialUrl: optionalUrl(),\n issuedAt: z.string().nullable().optional(),\n expiresAt: z.string().nullable().optional(),\n});\n\nexport type CertificationWriteInput = z.infer<typeof CertificationWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.course`. */\nexport const CourseWriteSchema = z.object({\n name: z.string().min(1).max(200),\n number: z.string().max(50).nullable().optional(),\n institution: z.string().max(256).nullable().optional(),\n});\n\nexport type CourseWriteInput = z.infer<typeof CourseWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by `POST /profile/education` on sifa-api. */\nexport const EducationWriteSchema = z.object({\n institution: z.string().min(1).max(256),\n degree: z.string().max(256).nullable().optional(),\n fieldOfStudy: z.string().max(256).nullable().optional(),\n description: z.string().max(50000).nullable().optional(),\n activities: z.string().max(1000).nullable().optional(),\n startedAt: z.string().nullable().optional(),\n endedAt: z.string().nullable().optional(),\n});\n\nexport type EducationWriteInput = z.infer<typeof EducationWriteSchema>;\n","import { z } from 'zod';\n\nimport { VALID_PLATFORMS, normalizeUrl } from './shared.js';\n\n/** Schema enforced by `POST /external-accounts` on sifa-api. */\nexport const ExternalAccountWriteSchema = z.object({\n platform: z.enum(VALID_PLATFORMS),\n url: z.string().max(2000).transform(normalizeUrl).pipe(z.string().url()),\n label: z.string().max(100).optional(),\n feedUrl: z.string().max(2000).transform(normalizeUrl).pipe(z.string().url()).optional(),\n});\n\nexport type ExternalAccountWriteInput = z.infer<typeof ExternalAccountWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.honor`. */\nexport const HonorWriteSchema = z.object({\n title: z.string().min(1).max(200),\n issuer: z.string().max(256).nullable().optional(),\n description: z.string().max(50000).nullable().optional(),\n awardedAt: z.string().nullable().optional(),\n});\n\nexport type HonorWriteInput = z.infer<typeof HonorWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.language`. */\nexport const LanguageWriteSchema = z.object({\n name: z.string().min(1).max(64),\n proficiency: z.string().max(50).optional(),\n});\n\nexport type LanguageWriteInput = z.infer<typeof LanguageWriteSchema>;\n","import { z } from 'zod';\n\nimport { skillRefSchema, writeLocationSchema } from './shared.js';\n\n/**\n * Schema enforced by `POST /profile/positions` on sifa-api.\n *\n * Client-side callers can `.safeParse(...)` this before submitting to catch\n * obvious problems (empty `title`, over-length text) before the network\n * round-trip. If it passes here, the API will accept the write modulo\n * transport / auth failures.\n *\n * `company` is intentionally optional to support freelancer / independent\n * employment types where the position has no employer. The current\n * `sifa-api/src/routes/schemas.ts` requires `company` (`.min(1)`); the\n * sifa-api adoption PR that consumes this schema will therefore be a\n * behavior change that unblocks the freelancer flow. The SDK's lexicon\n * schema (`ProfilePositionRecordSchema`) has treated `company` as optional\n * since sifa-sdk #184.\n */\nexport const PositionWriteSchema = z.object({\n company: z.string().min(1).max(256).nullable().optional(),\n title: z.string().min(1).max(256),\n description: z.string().max(50000).nullable().optional(),\n employmentType: z.string().nullable().optional(),\n workplaceType: z.string().nullable().optional(),\n location: writeLocationSchema,\n startedAt: z.string().nullable().optional(),\n endedAt: z.string().nullable().optional(),\n skills: z.array(skillRefSchema).max(50).nullable().optional(),\n});\n\nexport type PositionWriteInput = z.infer<typeof PositionWriteSchema>;\n","import { z } from 'zod';\n\n/**\n * Schema enforced by `POST /profile/locations` on sifa-api.\n *\n * Mirrors the inner object of `writeLocationSchema`: accepts both the community\n * shape (`country`, `locality`) and the legacy shape (`countryCode`, `city`)\n * during the dual-read window. sifa-web #840 switched outbound writes to the\n * community shape; older clients may still send the legacy shape. All address\n * fields are `.nullish()` so explicit `null` from API echoes is accepted\n * (see sifa-api #426).\n *\n * The route handler hands `address` to `buildPdsLocation`, which normalizes\n * either input and enforces alpha-2 on the wire to PDS — returning a 400 with\n * `message: \"address.country (alpha-2) is required\"` when no usable code is\n * present. The schema stays permissive on country length here and lets\n * `buildPdsLocation` be the single enforcement point.\n */\nexport const ProfileLocationWriteSchema = z.object({\n address: z.object({\n country: z.string().nullish(),\n countryCode: z.string().length(2).nullish(),\n region: z.string().nullish(),\n city: z.string().nullish(),\n locality: z.string().nullish(),\n street: z.string().nullish(),\n postalCode: z.string().nullish(),\n name: z.string().nullish(),\n }),\n type: z.string().min(1),\n label: z.string().max(60).nullable().optional(),\n isPrimary: z.boolean().optional(),\n});\n\nexport type ProfileLocationWriteInput = z.infer<typeof ProfileLocationWriteSchema>;\n","import { z } from 'zod';\n\nimport { writeLocationSchema } from './shared.js';\n\n/**\n * Schema enforced by `POST /profile/self` on sifa-api.\n *\n * `.passthrough()` so the API accepts fields not yet enumerated here (used for\n * gradual rollout of new profile-self keys without requiring lockstep bumps\n * between web/api). Note this means client validation on this schema will\n * NEVER reject \"unknown\" fields — the divergence is intentional.\n *\n * Grapheme caps (e.g. 64 on given/familyName) are enforced client-side by the\n * SDK's lexicon schema; the write schema only guards the byte-length ceiling.\n */\nexport const ProfileSelfWriteSchema = z\n .object({\n headline: z.string().max(300).optional(),\n about: z.string().max(50000).optional(),\n givenName: z.string().max(640).optional(),\n familyName: z.string().max(640).optional(),\n industries: z\n .array(\n z.object({\n industry: z.string().max(100),\n domain: z.string().max(100).optional(),\n }),\n )\n .max(10)\n .optional(),\n location: writeLocationSchema,\n openTo: z.array(z.string()).max(10).optional(),\n preferredWorkplace: z.array(z.string()).max(5).optional(),\n availableFromUtc: z.number().int().min(0).max(23).optional(),\n availableToUtc: z.number().int().min(0).max(23).optional(),\n langs: z.array(z.string()).max(3).optional(),\n discoverable: z.boolean().optional(),\n })\n .passthrough();\n\nexport type ProfileSelfWriteInput = z.infer<typeof ProfileSelfWriteSchema>;\n","import { z } from 'zod';\n\nimport { optionalUrl } from './shared.js';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.project`. */\nexport const ProjectWriteSchema = z.object({\n name: z.string().min(1).max(256),\n description: z.string().max(50000).nullable().optional(),\n url: optionalUrl(),\n startedAt: z.string().nullable().optional(),\n endedAt: z.string().nullable().optional(),\n});\n\nexport type ProjectWriteInput = z.infer<typeof ProjectWriteSchema>;\n","import { z } from 'zod';\n\nimport { optionalUrl } from './shared.js';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.publication`. */\nexport const PublicationWriteSchema = z.object({\n title: z.string().min(1).max(200),\n publisher: z.string().max(256).nullable().optional(),\n url: optionalUrl(),\n description: z.string().max(50000).nullable().optional(),\n publishedAt: z.string().nullable().optional(),\n});\n\nexport type PublicationWriteInput = z.infer<typeof PublicationWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by `POST /profile/skills` on sifa-api. */\nexport const SkillWriteSchema = z.object({\n name: z.string().min(1).max(100),\n category: z.string().max(100).optional(),\n});\n\nexport type SkillWriteInput = z.infer<typeof SkillWriteSchema>;\n","import { z } from 'zod';\n\n/** Schema enforced by the generic-record write endpoint for `id.sifa.profile.volunteering`. */\nexport const VolunteeringWriteSchema = z.object({\n organization: z.string().min(1).max(256),\n role: z.string().max(256).nullable().optional(),\n cause: z.string().max(256).nullable().optional(),\n description: z.string().max(50000).nullable().optional(),\n startedAt: z.string().nullable().optional(),\n endedAt: z.string().nullable().optional(),\n});\n\nexport type VolunteeringWriteInput = z.infer<typeof VolunteeringWriteSchema>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singi-labs/sifa-sdk",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "Sifa SDK — public client library for the Sifa AppView on AT Protocol. Shared by sifa-web and sifa-app.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -52,6 +52,16 @@
|
|
|
52
52
|
"default": "./dist/schemas/index.cjs"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
+
"./schemas/write": {
|
|
56
|
+
"import": {
|
|
57
|
+
"types": "./dist/schemas/write/index.d.ts",
|
|
58
|
+
"default": "./dist/schemas/write/index.js"
|
|
59
|
+
},
|
|
60
|
+
"require": {
|
|
61
|
+
"types": "./dist/schemas/write/index.d.cts",
|
|
62
|
+
"default": "./dist/schemas/write/index.cjs"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
55
65
|
"./query": {
|
|
56
66
|
"import": {
|
|
57
67
|
"types": "./dist/query/index.d.ts",
|