@singi-labs/sifa-sdk 0.12.0 → 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/{adult-content-BO4nea-m.d.cts → adult-content-DDGP8W1e.d.cts} +1 -1
- package/dist/{adult-content-BO4nea-m.d.ts → adult-content-DDGP8W1e.d.ts} +1 -1
- package/dist/{index-BeAu_9VV.d.cts → index-BS7zO7KI.d.cts} +2 -2
- package/dist/{index-D6ZKjuEo.d.cts → index-CNh-GI9A.d.cts} +2 -2
- package/dist/{index-BjzvRGGZ.d.ts → index-IMvNS08M.d.ts} +2 -2
- package/dist/{index-DUSGkW3U.d.ts → index-iAzeLOcz.d.ts} +2 -2
- package/dist/index.cjs +219 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +213 -3
- package/dist/index.d.ts +213 -3
- package/dist/index.js +199 -2
- package/dist/index.js.map +1 -1
- package/dist/{keys-Cy0T900D.d.ts → keys-5oyp950_.d.ts} +1 -1
- package/dist/{keys-B9_KrPw_.d.cts → keys-Bn36IA8Q.d.cts} +1 -1
- package/dist/query/fetchers/index.d.cts +3 -3
- package/dist/query/fetchers/index.d.ts +3 -3
- package/dist/query/hooks/index.d.cts +3 -3
- package/dist/query/hooks/index.d.ts +3 -3
- package/dist/query/index.d.cts +5 -5
- package/dist/query/index.d.ts +5 -5
- 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
|
@@ -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 };
|