@singi-labs/sifa-sdk 0.21.0 → 0.22.0

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.
@@ -111,8 +111,8 @@ declare const CertificationWriteSchema: z.ZodObject<{
111
111
  entityRef: z.ZodOptional<z.ZodString>;
112
112
  credentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
113
113
  credentialUrl: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
114
- issuedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
115
- expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
114
+ issuedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
115
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
116
116
  }, z.core.$strip>;
117
117
  type CertificationWriteInput = z.infer<typeof CertificationWriteSchema>;
118
118
 
@@ -123,10 +123,10 @@ declare const CourseWriteSchema: z.ZodObject<{
123
123
  institution: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
124
  entityRef: z.ZodOptional<z.ZodString>;
125
125
  credential: z.ZodOptional<z.ZodNullable<z.ZodString>>;
126
- completedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
126
+ completedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
127
127
  role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
128
- startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
129
- endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
128
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
129
+ endedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
130
130
  position: z.ZodOptional<z.ZodNullable<z.ZodString>>;
131
131
  education: z.ZodOptional<z.ZodNullable<z.ZodString>>;
132
132
  }, z.core.$strip>;
@@ -141,8 +141,8 @@ declare const EducationWriteSchema: z.ZodObject<{
141
141
  eqfLevel: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
142
142
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
143
143
  activities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
- startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
145
- endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
145
+ endedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
146
146
  }, z.core.$strip>;
147
147
  type EducationWriteInput = z.infer<typeof EducationWriteSchema>;
148
148
 
@@ -178,7 +178,7 @@ declare const HonorWriteSchema: z.ZodObject<{
178
178
  issuer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
179
179
  entityRef: z.ZodOptional<z.ZodString>;
180
180
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
181
- awardedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
181
+ awardedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
182
182
  }, z.core.$strip>;
183
183
  type HonorWriteInput = z.infer<typeof HonorWriteSchema>;
184
184
 
@@ -197,8 +197,8 @@ declare const InvolvementWriteSchema: z.ZodObject<{
197
197
  upstreamUrl: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
198
198
  role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
199
199
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
200
- startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
201
- endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
200
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
201
+ endedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
202
202
  links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
203
203
  url: z.ZodString;
204
204
  kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -254,8 +254,8 @@ declare const InvestmentWriteSchema: z.ZodObject<{
254
254
  value: z.ZodNumber;
255
255
  currency: z.ZodString;
256
256
  }, z.core.$strip>>>;
257
- startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
258
- endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
257
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
258
+ endedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
259
259
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
260
260
  links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
261
261
  url: z.ZodString;
@@ -371,8 +371,8 @@ declare const PositionWriteSchema: z.ZodObject<{
371
371
  postalCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
372
372
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
373
373
  }, z.core.$strip>, z.ZodString]>>>;
374
- startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
375
- endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
374
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
375
+ endedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
376
376
  skills: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
377
377
  uri: z.ZodString;
378
378
  }, z.core.$strip>>>>;
@@ -563,8 +563,8 @@ declare const ProjectWriteSchema: z.ZodObject<{
563
563
  }, z.core.$strip>;
564
564
  role: z.ZodOptional<z.ZodString>;
565
565
  }, z.core.$strip>>>;
566
- startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
567
- endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
566
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
567
+ endedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
568
568
  }, z.core.$strip>;
569
569
  type ProjectWriteInput = z.infer<typeof ProjectWriteSchema>;
570
570
 
@@ -612,7 +612,7 @@ declare const PublicationWriteSchema: z.ZodObject<{
612
612
  publisher: z.ZodOptional<z.ZodNullable<z.ZodString>>;
613
613
  url: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
614
614
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
615
- publishedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
615
+ publishedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
616
616
  authors: z.ZodOptional<z.ZodArray<z.ZodObject<{
617
617
  name: z.ZodString;
618
618
  did: z.ZodOptional<z.ZodString>;
@@ -654,8 +654,8 @@ declare const VolunteeringWriteSchema: z.ZodObject<{
654
654
  role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
655
655
  cause: z.ZodOptional<z.ZodNullable<z.ZodString>>;
656
656
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
657
- startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
658
- endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
657
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
658
+ endedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
659
659
  }, z.core.$strip>;
660
660
  type VolunteeringWriteInput = z.infer<typeof VolunteeringWriteSchema>;
661
661
 
@@ -1,6 +1,6 @@
1
1
  // src/schemas/write/investment.ts
2
2
  import { z } from "zod";
3
- import { artifactLinkSchema, entityRefSchema } from "./shared.js";
3
+ import { artifactLinkSchema, entityRefSchema, partialDateFieldSchema } from "./shared.js";
4
4
  var InvestmentWriteSchema = z.object({
5
5
  /** For a limited-partner entry this names the fund, not a portfolio company. */
6
6
  company: z.string().min(1).max(256),
@@ -21,8 +21,8 @@ var InvestmentWriteSchema = z.object({
21
21
  value: z.number().int().min(0),
22
22
  currency: z.string().length(3)
23
23
  }).nullable().optional(),
24
- startedAt: z.string().nullable().optional(),
25
- endedAt: z.string().nullable().optional(),
24
+ startedAt: partialDateFieldSchema,
25
+ endedAt: partialDateFieldSchema,
26
26
  description: z.string().max(5e4).nullable().optional(),
27
27
  links: z.array(artifactLinkSchema).max(50).nullable().optional()
28
28
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schemas/write/investment.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { artifactLinkSchema, entityRefSchema } from './shared.js';\n\n/**\n * Schema enforced by `POST /profile/investment` on sifa-api.\n *\n * An investment is capital the person put in. Roles with duties -- board seats,\n * advisory work -- are positions and use `PositionWriteSchema` instead.\n *\n * Every optional field is nullable so a client can clear it. Omitting a field on\n * update leaves the stored value in place, which would let a corrected status or a\n * withdrawn amount silently persist.\n */\nexport const InvestmentWriteSchema = z.object({\n /** For a limited-partner entry this names the fund, not a portfolio company. */\n company: z.string().min(1).max(256),\n companyDid: z.string().max(256).nullable().optional(),\n entityRef: entityRefSchema.nullable(),\n role: z.string().max(256).nullable().optional(),\n stage: z.string().max(256).nullable().optional(),\n status: z.string().max(256).nullable().optional(),\n via: z.string().max(256).nullable().optional(),\n viaDid: z.string().max(256).nullable().optional(),\n viaEntityRef: entityRefSchema.nullable(),\n /**\n * Optional and empty by default -- cheque size is a personal financial disclosure.\n * Structured rather than free text: an unparseable money string cannot be repaired\n * once people have written them.\n */\n amount: z\n .object({\n value: z.number().int().min(0),\n currency: z.string().length(3),\n })\n .nullable()\n .optional(),\n startedAt: z.string().nullable().optional(),\n endedAt: z.string().nullable().optional(),\n description: z.string().max(50000).nullable().optional(),\n links: z.array(artifactLinkSchema).max(50).nullable().optional(),\n});\n\nexport type InvestmentWriteInput = z.infer<typeof InvestmentWriteSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,oBAAoB,uBAAuB;AAY7C,IAAM,wBAAwB,EAAE,OAAO;AAAA;AAAA,EAE5C,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAClC,YAAY,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EACpD,WAAW,gBAAgB,SAAS;AAAA,EACpC,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC/C,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,KAAK,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC7C,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,cAAc,gBAAgB,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,QAAQ,EACL,OAAO;AAAA,IACN,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC;AAAA,IAC7B,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC;AAAA,EAC/B,CAAC,EACA,SAAS,EACT,SAAS;AAAA,EACZ,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC1C,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACxC,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,OAAO,EAAE,MAAM,kBAAkB,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AACjE,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/schemas/write/investment.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { artifactLinkSchema, entityRefSchema, partialDateFieldSchema } from './shared.js';\n\n/**\n * Schema enforced by `POST /profile/investment` on sifa-api.\n *\n * An investment is capital the person put in. Roles with duties -- board seats,\n * advisory work -- are positions and use `PositionWriteSchema` instead.\n *\n * Every optional field is nullable so a client can clear it. Omitting a field on\n * update leaves the stored value in place, which would let a corrected status or a\n * withdrawn amount silently persist.\n */\nexport const InvestmentWriteSchema = z.object({\n /** For a limited-partner entry this names the fund, not a portfolio company. */\n company: z.string().min(1).max(256),\n companyDid: z.string().max(256).nullable().optional(),\n entityRef: entityRefSchema.nullable(),\n role: z.string().max(256).nullable().optional(),\n stage: z.string().max(256).nullable().optional(),\n status: z.string().max(256).nullable().optional(),\n via: z.string().max(256).nullable().optional(),\n viaDid: z.string().max(256).nullable().optional(),\n viaEntityRef: entityRefSchema.nullable(),\n /**\n * Optional and empty by default -- cheque size is a personal financial disclosure.\n * Structured rather than free text: an unparseable money string cannot be repaired\n * once people have written them.\n */\n amount: z\n .object({\n value: z.number().int().min(0),\n currency: z.string().length(3),\n })\n .nullable()\n .optional(),\n startedAt: partialDateFieldSchema,\n endedAt: partialDateFieldSchema,\n description: z.string().max(50000).nullable().optional(),\n links: z.array(artifactLinkSchema).max(50).nullable().optional(),\n});\n\nexport type InvestmentWriteInput = z.infer<typeof InvestmentWriteSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,oBAAoB,iBAAiB,8BAA8B;AAYrE,IAAM,wBAAwB,EAAE,OAAO;AAAA;AAAA,EAE5C,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAClC,YAAY,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EACpD,WAAW,gBAAgB,SAAS;AAAA,EACpC,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC/C,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,KAAK,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC7C,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,cAAc,gBAAgB,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,QAAQ,EACL,OAAO;AAAA,IACN,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC;AAAA,IAC7B,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC;AAAA,EAC/B,CAAC,EACA,SAAS,EACT,SAAS;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,OAAO,EAAE,MAAM,kBAAkB,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AACjE,CAAC;","names":[]}
@@ -6,6 +6,7 @@ import {
6
6
  entityRefSchema,
7
7
  externalRecordRefSchema,
8
8
  optionalUrl,
9
+ partialDateFieldSchema,
9
10
  skillRefSchema,
10
11
  writeLocationSchema
11
12
  } from "./shared.js";
@@ -16,9 +17,8 @@ var InvolvementWriteSchema = z.object({
16
17
  upstreamUrl: optionalUrl(),
17
18
  role: z.string().max(2560).nullable().optional(),
18
19
  description: z.string().max(5e4).nullable().optional(),
19
- // Freeform YYYY / YYYY-MM / YYYY-MM-DD; validated loosely so partial dates pass.
20
- startedAt: z.string().max(32).nullable().optional(),
21
- endedAt: z.string().max(32).nullable().optional(),
20
+ startedAt: partialDateFieldSchema,
21
+ endedAt: partialDateFieldSchema,
22
22
  links: z.array(artifactLinkSchema).max(50).nullable().optional(),
23
23
  /** Other people who worked on this alongside you. Same shape as project members. */
24
24
  collaborators: z.array(projectMemberWriteSchema).max(50).optional(),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schemas/write/involvement.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { projectMemberWriteSchema } from './project.js';\n\nimport {\n artifactLinkSchema,\n entityRefSchema,\n externalRecordRefSchema,\n optionalUrl,\n skillRefSchema,\n writeLocationSchema,\n} from './shared.js';\n\n/**\n * Schema enforced by the generic-record write endpoint for `id.sifa.profile.involvement`.\n *\n * Represents contribution to an upstream project or community\n * (open-source maintainership, community volunteering, etc.). `upstream` /\n * `upstreamDid` / `upstreamUrl` describe what the user contributed to;\n * `links` collect proof artifacts.\n */\nexport const InvolvementWriteSchema = z.object({\n kind: z.string().min(1).max(256),\n upstream: z.string().max(2560).nullable().optional(),\n upstreamDid: z\n .string()\n .regex(/^did:[a-z]+:[^\\s]+$/, 'must be a DID')\n .nullable()\n .optional(),\n upstreamUrl: optionalUrl(),\n role: z.string().max(2560).nullable().optional(),\n description: z.string().max(50000).nullable().optional(),\n // Freeform YYYY / YYYY-MM / YYYY-MM-DD; validated loosely so partial dates pass.\n startedAt: z.string().max(32).nullable().optional(),\n endedAt: z.string().max(32).nullable().optional(),\n links: z.array(artifactLinkSchema).max(50).nullable().optional(),\n /** Other people who worked on this alongside you. Same shape as project members. */\n collaborators: z.array(projectMemberWriteSchema).max(50).optional(),\n /** The same involvement as recorded on another person's profile. */\n sameAs: externalRecordRefSchema.optional(),\n entityRef: entityRefSchema,\n location: writeLocationSchema,\n skills: z.array(skillRefSchema).max(50).nullable().optional(),\n});\n\nexport type InvolvementWriteInput = z.infer<typeof InvolvementWriteSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,gCAAgC;AAEzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUA,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAC/B,UAAU,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EACnD,aAAa,EACV,OAAO,EACP,MAAM,uBAAuB,eAAe,EAC5C,SAAS,EACT,SAAS;AAAA,EACZ,aAAa,YAAY;AAAA,EACzB,MAAM,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAC/C,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS,EAAE,SAAS;AAAA;AAAA,EAEvD,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AAAA,EAClD,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,OAAO,EAAE,MAAM,kBAAkB,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AAAA;AAAA,EAE/D,eAAe,EAAE,MAAM,wBAAwB,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA;AAAA,EAElE,QAAQ,wBAAwB,SAAS;AAAA,EACzC,WAAW;AAAA,EACX,UAAU;AAAA,EACV,QAAQ,EAAE,MAAM,cAAc,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AAC9D,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/schemas/write/involvement.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { projectMemberWriteSchema } from './project.js';\n\nimport {\n artifactLinkSchema,\n entityRefSchema,\n externalRecordRefSchema,\n optionalUrl,\n partialDateFieldSchema,\n skillRefSchema,\n writeLocationSchema,\n} from './shared.js';\n\n/**\n * Schema enforced by the generic-record write endpoint for `id.sifa.profile.involvement`.\n *\n * Represents contribution to an upstream project or community\n * (open-source maintainership, community volunteering, etc.). `upstream` /\n * `upstreamDid` / `upstreamUrl` describe what the user contributed to;\n * `links` collect proof artifacts.\n */\nexport const InvolvementWriteSchema = z.object({\n kind: z.string().min(1).max(256),\n upstream: z.string().max(2560).nullable().optional(),\n upstreamDid: z\n .string()\n .regex(/^did:[a-z]+:[^\\s]+$/, 'must be a DID')\n .nullable()\n .optional(),\n upstreamUrl: optionalUrl(),\n role: z.string().max(2560).nullable().optional(),\n description: z.string().max(50000).nullable().optional(),\n startedAt: partialDateFieldSchema,\n endedAt: partialDateFieldSchema,\n links: z.array(artifactLinkSchema).max(50).nullable().optional(),\n /** Other people who worked on this alongside you. Same shape as project members. */\n collaborators: z.array(projectMemberWriteSchema).max(50).optional(),\n /** The same involvement as recorded on another person's profile. */\n sameAs: externalRecordRefSchema.optional(),\n entityRef: entityRefSchema,\n location: writeLocationSchema,\n skills: z.array(skillRefSchema).max(50).nullable().optional(),\n});\n\nexport type InvolvementWriteInput = z.infer<typeof InvolvementWriteSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,gCAAgC;AAEzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUA,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAC/B,UAAU,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EACnD,aAAa,EACV,OAAO,EACP,MAAM,uBAAuB,eAAe,EAC5C,SAAS,EACT,SAAS;AAAA,EACZ,aAAa,YAAY;AAAA,EACzB,MAAM,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAC/C,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO,EAAE,MAAM,kBAAkB,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AAAA;AAAA,EAE/D,eAAe,EAAE,MAAM,wBAAwB,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA;AAAA,EAElE,QAAQ,wBAAwB,SAAS;AAAA,EACzC,WAAW;AAAA,EACX,UAAU;AAAA,EACV,QAAQ,EAAE,MAAM,cAAc,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AAC9D,CAAC;","names":[]}
@@ -1,6 +1,11 @@
1
1
  // src/schemas/write/position.ts
2
2
  import { z } from "zod";
3
- import { entityRefSchema, skillRefSchema, writeLocationSchema } from "./shared.js";
3
+ import {
4
+ entityRefSchema,
5
+ partialDateFieldSchema,
6
+ skillRefSchema,
7
+ writeLocationSchema
8
+ } from "./shared.js";
4
9
  var PositionWriteSchema = z.object({
5
10
  company: z.string().min(1).max(256).nullable().optional(),
6
11
  entityRef: entityRefSchema,
@@ -14,8 +19,8 @@ var PositionWriteSchema = z.object({
14
19
  onBehalfOfEntityRef: entityRefSchema.nullable(),
15
20
  workplaceType: z.string().nullable().optional(),
16
21
  location: writeLocationSchema,
17
- startedAt: z.string().nullable().optional(),
18
- endedAt: z.string().nullable().optional(),
22
+ startedAt: partialDateFieldSchema,
23
+ endedAt: partialDateFieldSchema,
19
24
  skills: z.array(skillRefSchema).max(50).nullable().optional()
20
25
  });
21
26
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schemas/write/position.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { entityRefSchema, 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 optional to support freelancer / independent employment types\n * where the position has no employer. This matches sifa-api's current\n * behavior in `src/routes/schemas.ts` and the SDK's lexicon schema\n * (`ProfilePositionRecordSchema`) since sifa-sdk #184.\n */\nexport const PositionWriteSchema = z.object({\n company: z.string().min(1).max(256).nullable().optional(),\n entityRef: entityRefSchema,\n title: z.string().min(1).max(256),\n description: z.string().max(50000).nullable().optional(),\n employmentType: z.string().nullable().optional(),\n // Held-on-behalf-of disclosure for board and advisory roles. Nullable so a client\n // can clear it when a seat stops being a representative one.\n onBehalfOf: z.string().max(256).nullable().optional(),\n onBehalfOfDid: z.string().max(256).nullable().optional(),\n onBehalfOfEntityRef: entityRefSchema.nullable(),\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"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,iBAAiB,gBAAgB,2BAA2B;AAe9D,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EACxD,WAAW;AAAA,EACX,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAChC,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA;AAAA;AAAA,EAG/C,YAAY,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EACpD,eAAe,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,qBAAqB,gBAAgB,SAAS;AAAA,EAC9C,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC1C,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACxC,QAAQ,EAAE,MAAM,cAAc,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AAC9D,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/schemas/write/position.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport {\n entityRefSchema,\n partialDateFieldSchema,\n skillRefSchema,\n writeLocationSchema,\n} 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 optional to support freelancer / independent employment types\n * where the position has no employer. This matches sifa-api's current\n * behavior in `src/routes/schemas.ts` and the SDK's lexicon schema\n * (`ProfilePositionRecordSchema`) since sifa-sdk #184.\n */\nexport const PositionWriteSchema = z.object({\n company: z.string().min(1).max(256).nullable().optional(),\n entityRef: entityRefSchema,\n title: z.string().min(1).max(256),\n description: z.string().max(50000).nullable().optional(),\n employmentType: z.string().nullable().optional(),\n // Held-on-behalf-of disclosure for board and advisory roles. Nullable so a client\n // can clear it when a seat stops being a representative one.\n onBehalfOf: z.string().max(256).nullable().optional(),\n onBehalfOfDid: z.string().max(256).nullable().optional(),\n onBehalfOfEntityRef: entityRefSchema.nullable(),\n workplaceType: z.string().nullable().optional(),\n location: writeLocationSchema,\n startedAt: partialDateFieldSchema,\n endedAt: partialDateFieldSchema,\n skills: z.array(skillRefSchema).max(50).nullable().optional(),\n});\n\nexport type PositionWriteInput = z.infer<typeof PositionWriteSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAElB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAeA,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EACxD,WAAW;AAAA,EACX,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAChC,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA;AAAA;AAAA,EAG/C,YAAY,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EACpD,eAAe,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,qBAAqB,gBAAgB,SAAS;AAAA,EAC9C,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,SAAS;AAAA,EACT,QAAQ,EAAE,MAAM,cAAc,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AAC9D,CAAC;","names":[]}
@@ -1,6 +1,6 @@
1
1
  // src/schemas/write/project.ts
2
2
  import { z } from "zod";
3
- import { externalRecordRefSchema, optionalUrl } from "./shared.js";
3
+ import { externalRecordRefSchema, optionalUrl, partialDateFieldSchema } from "./shared.js";
4
4
  var projectMemberWriteSchema = z.object({
5
5
  did: z.string().regex(/^did:[a-z]+:[^\s]+$/, "must be a DID"),
6
6
  role: z.string().max(256).nullable().optional(),
@@ -23,8 +23,8 @@ var ProjectWriteSchema = z.object({
23
23
  sameAs: externalRecordRefSchema.optional(),
24
24
  /** Calendar events this project organized or hosted. An empty list clears them. */
25
25
  events: z.array(projectEventWriteSchema).max(200).optional(),
26
- startedAt: z.string().nullable().optional(),
27
- endedAt: z.string().nullable().optional()
26
+ startedAt: partialDateFieldSchema,
27
+ endedAt: partialDateFieldSchema
28
28
  });
29
29
  export {
30
30
  ProjectWriteSchema,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schemas/write/project.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { externalRecordRefSchema, optionalUrl } from './shared.js';\n\n/**\n * A person named as a member of the project. Naming someone is a claim: they\n * render as a bare handle until they publish an `id.sifa.confirmation`, and\n * confirming never puts this record on their profile. `role` is display only.\n */\nexport const projectMemberWriteSchema = z.object({\n did: z.string().regex(/^did:[a-z]+:[^\\s]+$/, 'must be a DID'),\n role: z.string().max(256).nullable().optional(),\n title: z.string().max(1280).nullable().optional(),\n});\n\n/**\n * One calendar event the project organized or hosted (lexicon `#projectEvent`).\n * `role` is the user's role at this occurrence when it differs from the\n * project's role.\n */\nexport const projectEventWriteSchema = z.object({\n event: externalRecordRefSchema,\n role: z.string().max(640).optional(),\n});\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 /** The user's own role on the project (#596), e.g. Maintainer. */\n role: z.string().max(256).nullable().optional(),\n description: z.string().max(50000).nullable().optional(),\n url: optionalUrl(),\n members: z.array(projectMemberWriteSchema).max(50).optional(),\n /** The canonical project.self this entry corresponds to. Composition, not peer sameness. */\n projectRef: externalRecordRefSchema.optional(),\n /** The same project as recorded on another person's profile. */\n sameAs: externalRecordRefSchema.optional(),\n /** Calendar events this project organized or hosted. An empty list clears them. */\n events: z.array(projectEventWriteSchema).max(200).optional(),\n startedAt: z.string().nullable().optional(),\n endedAt: z.string().nullable().optional(),\n});\n\nexport type ProjectWriteInput = z.infer<typeof ProjectWriteSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,yBAAyB,mBAAmB;AAO9C,IAAM,2BAA2B,EAAE,OAAO;AAAA,EAC/C,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,eAAe;AAAA,EAC5D,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,SAAS,EAAE,SAAS;AAClD,CAAC;AAOM,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC9C,OAAO;AAAA,EACP,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS;AACrC,CAAC;AAGM,IAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA;AAAA,EAE/B,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,KAAK,YAAY;AAAA,EACjB,SAAS,EAAE,MAAM,wBAAwB,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA;AAAA,EAE5D,YAAY,wBAAwB,SAAS;AAAA;AAAA,EAE7C,QAAQ,wBAAwB,SAAS;AAAA;AAAA,EAEzC,QAAQ,EAAE,MAAM,uBAAuB,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EAC3D,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC1C,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAC1C,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/schemas/write/project.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { externalRecordRefSchema, optionalUrl, partialDateFieldSchema } from './shared.js';\n\n/**\n * A person named as a member of the project. Naming someone is a claim: they\n * render as a bare handle until they publish an `id.sifa.confirmation`, and\n * confirming never puts this record on their profile. `role` is display only.\n */\nexport const projectMemberWriteSchema = z.object({\n did: z.string().regex(/^did:[a-z]+:[^\\s]+$/, 'must be a DID'),\n role: z.string().max(256).nullable().optional(),\n title: z.string().max(1280).nullable().optional(),\n});\n\n/**\n * One calendar event the project organized or hosted (lexicon `#projectEvent`).\n * `role` is the user's role at this occurrence when it differs from the\n * project's role.\n */\nexport const projectEventWriteSchema = z.object({\n event: externalRecordRefSchema,\n role: z.string().max(640).optional(),\n});\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 /** The user's own role on the project (#596), e.g. Maintainer. */\n role: z.string().max(256).nullable().optional(),\n description: z.string().max(50000).nullable().optional(),\n url: optionalUrl(),\n members: z.array(projectMemberWriteSchema).max(50).optional(),\n /** The canonical project.self this entry corresponds to. Composition, not peer sameness. */\n projectRef: externalRecordRefSchema.optional(),\n /** The same project as recorded on another person's profile. */\n sameAs: externalRecordRefSchema.optional(),\n /** Calendar events this project organized or hosted. An empty list clears them. */\n events: z.array(projectEventWriteSchema).max(200).optional(),\n startedAt: partialDateFieldSchema,\n endedAt: partialDateFieldSchema,\n});\n\nexport type ProjectWriteInput = z.infer<typeof ProjectWriteSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,yBAAyB,aAAa,8BAA8B;AAOtE,IAAM,2BAA2B,EAAE,OAAO;AAAA,EAC/C,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,eAAe;AAAA,EAC5D,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,SAAS,EAAE,SAAS;AAClD,CAAC;AAOM,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC9C,OAAO;AAAA,EACP,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS;AACrC,CAAC;AAGM,IAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA;AAAA,EAE/B,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,KAAK,YAAY;AAAA,EACjB,SAAS,EAAE,MAAM,wBAAwB,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA;AAAA,EAE5D,YAAY,wBAAwB,SAAS;AAAA;AAAA,EAE7C,QAAQ,wBAAwB,SAAS;AAAA;AAAA,EAEzC,QAAQ,EAAE,MAAM,uBAAuB,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EAC3D,WAAW;AAAA,EACX,SAAS;AACX,CAAC;","names":[]}
@@ -1,7 +1,7 @@
1
1
  // src/schemas/write/publication.ts
2
2
  import { z } from "zod";
3
3
  import { normalizeDoi } from "../../format/doi.js";
4
- import { optionalUrl } from "./shared.js";
4
+ import { optionalUrl, partialDateFieldSchema } from "./shared.js";
5
5
  var publicationAuthorWriteSchema = z.object({
6
6
  name: z.string().min(1).max(100),
7
7
  did: z.string().regex(/^did:[a-z]+:[^\s]+$/, "must be a DID").optional()
@@ -19,7 +19,7 @@ var PublicationWriteSchema = z.object({
19
19
  publisher: z.string().max(256).nullable().optional(),
20
20
  url: optionalUrl(),
21
21
  description: z.string().max(5e4).nullable().optional(),
22
- publishedAt: z.string().nullable().optional(),
22
+ publishedAt: partialDateFieldSchema,
23
23
  // Absent here until now, so the write route stripped every co-author before
24
24
  // it reached the PDS: the lexicon field, the indexer, the claim flattening
25
25
  // and the editor all existed, and nothing joined them. An object schema
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schemas/write/publication.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { normalizeDoi } from '../../format/doi.js';\nimport { optionalUrl } from './shared.js';\n\n/**\n * A co-author named on the publication.\n *\n * Name-first, unlike a project member, and that is the lexicon's shape rather\n * than an inconsistency: a paper has co-authors whether or not they are on\n * atproto. A name alone is a complete entry that renders as written and claims\n * nothing about any account.\n *\n * `did` is the optional extra that turns the entry into a claim. The named\n * person renders as a bare name until they publish an `id.sifa.confirmation`,\n * and confirming never puts this record on their profile.\n */\nexport const publicationAuthorWriteSchema = z.object({\n name: z.string().min(1).max(100),\n did: z\n .string()\n .regex(/^did:[a-z]+:[^\\s]+$/, 'must be a DID')\n .optional(),\n});\n\n/**\n * A typed link to another version of the work (#590). A DOI identifier (the\n * default type) is stored bare, like the record's own `doi`, so it matches.\n */\nexport const relatedIdentifierWriteSchema = z\n .object({\n identifier: z.string().min(1).max(2048),\n identifierType: z.enum(['DOI', 'AT-URI', 'URL']).optional(),\n relationType: z.string().min(1).max(64),\n })\n .transform((rel) =>\n !rel.identifierType || rel.identifierType === 'DOI'\n ? { ...rel, identifier: normalizeDoi(rel.identifier) }\n : rel,\n );\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 subtitle: z.string().max(2000).nullable().optional(),\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 // Absent here until now, so the write route stripped every co-author before\n // it reached the PDS: the lexicon field, the indexer, the claim flattening\n // and the editor all existed, and nothing joined them. An object schema\n // drops unknown keys silently, so the editor reported success and wrote\n // nothing.\n authors: z.array(publicationAuthorWriteSchema).max(50).optional(),\n relatedIdentifiers: z.array(relatedIdentifierWriteSchema).max(20).optional(),\n doi: z\n .string()\n .max(256)\n .nullable()\n .optional()\n .transform((val) => (val ? normalizeDoi(val) : val)),\n // Open set. The known values are ORCID's work types (PUBLICATION_TYPE_OPTIONS),\n // and a value outside them is kept as written: a publication that reached Sifa\n // from Standard.site, RSS, or by hand need not fit ORCID's list.\n type: z.string().max(64).nullable().optional(),\n});\n\nexport type PublicationWriteInput = z.infer<typeof PublicationWriteSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAcrB,IAAM,+BAA+B,EAAE,O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AA;AAAA,EAIrD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AAC/C,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/schemas/write/publication.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { normalizeDoi } from '../../format/doi.js';\nimport { optionalUrl, partialDateFieldSchema } from './shared.js';\n\n/**\n * A co-author named on the publication.\n *\n * Name-first, unlike a project member, and that is the lexicon's shape rather\n * than an inconsistency: a paper has co-authors whether or not they are on\n * atproto. A name alone is a complete entry that renders as written and claims\n * nothing about any account.\n *\n * `did` is the optional extra that turns the entry into a claim. The named\n * person renders as a bare name until they publish an `id.sifa.confirmation`,\n * and confirming never puts this record on their profile.\n */\nexport const publicationAuthorWriteSchema = z.object({\n name: z.string().min(1).max(100),\n did: z\n .string()\n .regex(/^did:[a-z]+:[^\\s]+$/, 'must be a DID')\n .optional(),\n});\n\n/**\n * A typed link to another version of the work (#590). A DOI identifier (the\n * default type) is stored bare, like the record's own `doi`, so it matches.\n */\nexport const relatedIdentifierWriteSchema = z\n .object({\n identifier: z.string().min(1).max(2048),\n identifierType: z.enum(['DOI', 'AT-URI', 'URL']).optional(),\n relationType: z.string().min(1).max(64),\n })\n .transform((rel) =>\n !rel.identifierType || rel.identifierType === 'DOI'\n ? { ...rel, identifier: normalizeDoi(rel.identifier) }\n : rel,\n );\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 subtitle: z.string().max(2000).nullable().optional(),\n publisher: z.string().max(256).nullable().optional(),\n url: optionalUrl(),\n description: z.string().max(50000).nullable().optional(),\n publishedAt: partialDateFieldSchema,\n // Absent here until now, so the write route stripped every co-author before\n // it reached the PDS: the lexicon field, the indexer, the claim flattening\n // and the editor all existed, and nothing joined them. An object schema\n // drops unknown keys silently, so the editor reported success and wrote\n // nothing.\n authors: z.array(publicationAuthorWriteSchema).max(50).optional(),\n relatedIdentifiers: z.array(relatedIdentifierWriteSchema).max(20).optional(),\n doi: z\n .string()\n .max(256)\n .nullable()\n .optional()\n .transform((val) => (val ? normalizeDoi(val) : val)),\n // Open set. The known values are ORCID's work types (PUBLICATION_TYPE_OPTIONS),\n // and a value outside them is kept as written: a publication that reached Sifa\n // from Standard.site, RSS, or by hand need not fit ORCID's list.\n type: z.string().max(64).nullable().optional(),\n});\n\nexport type PublicationWriteInput = z.infer<typeof PublicationWriteSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,oBAAoB;AAC7B,SAAS,aAAa,8BAA8B;AAc7C,IAAM,+BAA+B,EAAE,OAAO;AAAA,EACnD,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAC/B,KAAK,EACF,OAAO,EACP,MAAM,uBAAuB,eAAe,EAC5C,SAAS;AACd,CAAC;AAMM,IAAM,+BAA+B,EACzC,OAAO;AAAA,EACN,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,IAAI;AAAA,EACtC,gBAAgB,EAAE,KAAK,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,SAAS;AAAA,EAC1D,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AACxC,CAAC,EACA;AAAA,EAAU,CAAC,QACV,CAAC,IAAI,kBAAkB,IAAI,mBAAmB,QAC1C,EAAE,GAAG,KAAK,YAAY,aAAa,IAAI,UAAU,EAAE,IACnD;AACN;AAGK,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAChC,UAAU,EAAE,OAAO,EAAE,IAAI,GAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EACnD,WAAW,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EACnD,KAAK,YAAY;AAAA,EACjB,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMb,SAAS,EAAE,MAAM,4BAA4B,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EAChE,oBAAoB,EAAE,MAAM,4BAA4B,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EAC3E,KAAK,EACF,OAAO,EACP,IAAI,GAAG,EACP,SAAS,EACT,SAAS,EACT,UAAU,CAAC,QAAS,MAAM,aAAa,GAAG,IAAI,GAAI;AAAA;AAAA;AAAA;AAAA,EAIrD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AAC/C,CAAC;","names":[]}
@@ -63,6 +63,11 @@ function isValidPartialDate(input) {
63
63
  if (typeof input !== "string") return false;
64
64
  return PARTIAL_DATE_RE.test(input) || isValidDateOnly(input);
65
65
  }
66
+ var DATETIME_DAY_RE = /^(\d{4}-\d{2}-\d{2})T\d{2}:\d{2}/;
67
+ var partialDateFieldSchema = z.string().transform((v) => DATETIME_DAY_RE.exec(v)?.[1] ?? v).refine(
68
+ (v) => v === "" || isValidPartialDate(v),
69
+ "must be a valid YYYY, YYYY-MM or YYYY-MM-DD date"
70
+ ).nullable().optional();
66
71
  var entityRefSchema = z.string().url().refine((s) => /^https?:\/\//i.test(s), { message: "entityRef must be an http(s) URL" }).max(2048).optional();
67
72
  var artifactLinkSchema = z.object({
68
73
  url: z.string().max(2048).refine((v) => httpUrlOrNull(v) !== null, "must be an http(s) URL"),
@@ -89,6 +94,7 @@ export {
89
94
  isValidPartialDate,
90
95
  normalizeUrl,
91
96
  optionalUrl,
97
+ partialDateFieldSchema,
92
98
  presentationLinkSchema,
93
99
  skillRefSchema,
94
100
  writeLocationSchema
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schemas/write/shared.ts"],"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 an http(s) URL string or silently drop it (returns `undefined`).\n * Preserves the write-time policy: bad URLs from imports are dropped, not\n * rejected. A dangerous scheme (`javascript:`, `data:`, ...) parses as a URL, so\n * this drops anything that is not http(s) via {@link httpUrlOrNull} rather than a\n * bare parse check, keeping a script-bearing scheme out of the stored record. All\n * consumers of this schema are web-link fields (project/publication/involvement/\n * certification URLs), so no non-http scheme is legitimate here.\n */\nexport const optionalUrl = () =>\n z\n .string()\n .optional()\n .transform((val) => {\n if (!val) return undefined;\n return httpUrlOrNull(val) ?? undefined;\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\n// ---- pure sanitization primitives (previously in sifa-api/src/lib/sanitize.ts) ----\n\n/**\n * Returns `input` when it is an http(s) URL string, else `null`. Blocks\n * dangerous schemes (`javascript:`, `data:`, etc.) from being stored and\n * later rendered.\n */\nexport function httpUrlOrNull(input: unknown): string | null {\n if (typeof input !== 'string') return null;\n try {\n const url = new URL(input);\n return url.protocol === 'http:' || url.protocol === 'https:' ? input : null;\n } catch {\n return null;\n }\n}\n\nconst DATE_ONLY_RE = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n/**\n * Strict calendar-date validator. Returns `true` for `YYYY-MM-DD` strings\n * that name a real day, rejecting impossible values (`2024-02-30`, `2024-13-01`)\n * by requiring the JavaScript `Date` round-trip to preserve the input.\n */\nexport function isValidDateOnly(input: unknown): boolean {\n if (typeof input !== 'string' || !DATE_ONLY_RE.test(input)) return false;\n const parsed = new Date(`${input}T00:00:00Z`);\n return !Number.isNaN(parsed.getTime()) && parsed.toISOString().startsWith(input);\n}\n\nconst PARTIAL_DATE_RE = /^\\d{4}(-(0[1-9]|1[0-2]))?$/;\n\n/**\n * Partial calendar-date validator. Returns `true` for a year (`YYYY`), a month\n * (`YYYY-MM`, month 01-12), or a real day per {@link isValidDateOnly}. For\n * dates where the exact day is often unknown, such as a past talk session.\n */\nexport function isValidPartialDate(input: unknown): boolean {\n if (typeof input !== 'string') return false;\n return PARTIAL_DATE_RE.test(input) || isValidDateOnly(input);\n}\n\n// ---- shared write-schema fragments used by multiple sections ----\n\n/**\n * Portable org entity identifier (Wikidata / ROR / LEI / sifa.id URI) chosen\n * from the typeahead. Constrained to http(s) so a script-bearing scheme can't\n * be written to the PDS record. Absent for free-text / unlinked records.\n * Shared by the org-bearing sections (position, education, certification,\n * volunteering, course, honor).\n */\nexport const entityRefSchema = z\n .string()\n .url()\n .refine((s) => /^https?:\\/\\//i.test(s), { message: 'entityRef must be an http(s) URL' })\n .max(2048)\n .optional();\n\n/**\n * One proof link on an involvement record (`id.sifa.defs#artifactLink`).\n * Only http(s) URLs are accepted so a dangerous scheme is never written to\n * the PDS.\n */\nexport const artifactLinkSchema = z.object({\n url: z\n .string()\n .max(2048)\n .refine((v) => httpUrlOrNull(v) !== null, 'must be an http(s) URL'),\n kind: z.string().max(64).nullable().optional(),\n label: z.string().max(2000).nullable().optional(),\n});\n\n/**\n * Reference to a record by at-uri, with an optional CID\n * (`id.sifa.defs#externalRecordRef`).\n */\nexport const externalRecordRefSchema = z.object({\n uri: z.string().regex(/^at:\\/\\/[^/\\s]+\\/[^/\\s]+\\/[^/\\s]+$/, 'must be an at-uri'),\n // CIDv0 (`Qm…`) or CIDv1 (base32, `b…`). Loose but rejects arbitrary strings.\n cid: z\n .string()\n .max(256)\n .regex(/^(Qm[1-9A-HJ-NP-Za-km-z]{44}|b[A-Za-z2-7]+)$/, 'must be a CID')\n .optional(),\n});\n\n/** Link attached to a presentation record. */\nexport const presentationLinkSchema = z.object({\n uri: z\n .string()\n .max(2048)\n .refine((v) => httpUrlOrNull(v) !== null, 'must be an http(s) URL'),\n label: z.string().max(640).nullable().optional(),\n type: z.string().max(256).nullable().optional(),\n});\n"],"mappings":";AAAA,SAAS,SAAS;AAGX,SAAS,aAAa,KAAqB;AAChD,QAAM,UAAU,IAAI,KAAK;AACzB,MAAI,gBAAgB,KAAK,OAAO,EAAG,QAAO;AAC1C,SAAO,WAAW,OAAO;AAC3B;AAWO,IAAM,cAAc,MACzB,EACG,OAAO,EACP,SAAS,EACT,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esContent":["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 an http(s) URL string or silently drop it (returns `undefined`).\n * Preserves the write-time policy: bad URLs from imports are dropped, not\n * rejected. A dangerous scheme (`javascript:`, `data:`, ...) parses as a URL, so\n * this drops anything that is not http(s) via {@link httpUrlOrNull} rather than a\n * bare parse check, keeping a script-bearing scheme out of the stored record. All\n * consumers of this schema are web-link fields (project/publication/involvement/\n * certification URLs), so no non-http scheme is legitimate here.\n */\nexport const optionalUrl = () =>\n z\n .string()\n .optional()\n .transform((val) => {\n if (!val) return undefined;\n return httpUrlOrNull(val) ?? undefined;\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\n// ---- pure sanitization primitives (previously in sifa-api/src/lib/sanitize.ts) ----\n\n/**\n * Returns `input` when it is an http(s) URL string, else `null`. Blocks\n * dangerous schemes (`javascript:`, `data:`, etc.) from being stored and\n * later rendered.\n */\nexport function httpUrlOrNull(input: unknown): string | null {\n if (typeof input !== 'string') return null;\n try {\n const url = new URL(input);\n return url.protocol === 'http:' || url.protocol === 'https:' ? input : null;\n } catch {\n return null;\n }\n}\n\nconst DATE_ONLY_RE = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n/**\n * Strict calendar-date validator. Returns `true` for `YYYY-MM-DD` strings\n * that name a real day, rejecting impossible values (`2024-02-30`, `2024-13-01`)\n * by requiring the JavaScript `Date` round-trip to preserve the input.\n */\nexport function isValidDateOnly(input: unknown): boolean {\n if (typeof input !== 'string' || !DATE_ONLY_RE.test(input)) return false;\n const parsed = new Date(`${input}T00:00:00Z`);\n return !Number.isNaN(parsed.getTime()) && parsed.toISOString().startsWith(input);\n}\n\nconst PARTIAL_DATE_RE = /^\\d{4}(-(0[1-9]|1[0-2]))?$/;\n\n/**\n * Partial calendar-date validator. Returns `true` for a year (`YYYY`), a month\n * (`YYYY-MM`, month 01-12), or a real day per {@link isValidDateOnly}. For\n * dates where the exact day is often unknown, such as a past talk session.\n */\nexport function isValidPartialDate(input: unknown): boolean {\n if (typeof input !== 'string') return false;\n return PARTIAL_DATE_RE.test(input) || isValidDateOnly(input);\n}\n\nconst DATETIME_DAY_RE = /^(\\d{4}-\\d{2}-\\d{2})T\\d{2}:\\d{2}/;\n\n/**\n * Optional, clearable partial-date field (`YYYY`, `YYYY-MM` or `YYYY-MM-DD`,\n * no time) shared by the dated profile sections. `null` clears the date.\n *\n * Older records hold RFC 3339 datetimes and the editor sends a stored value\n * back unchanged, so a datetime is shortened to its calendar day rather than\n * rejected. An empty string stays accepted, as before this field was checked.\n */\nexport const partialDateFieldSchema = z\n .string()\n .transform((v) => DATETIME_DAY_RE.exec(v)?.[1] ?? v)\n .refine(\n (v) => v === '' || isValidPartialDate(v),\n 'must be a valid YYYY, YYYY-MM or YYYY-MM-DD date',\n )\n .nullable()\n .optional();\n\n// ---- shared write-schema fragments used by multiple sections ----\n\n/**\n * Portable org entity identifier (Wikidata / ROR / LEI / sifa.id URI) chosen\n * from the typeahead. Constrained to http(s) so a script-bearing scheme can't\n * be written to the PDS record. Absent for free-text / unlinked records.\n * Shared by the org-bearing sections (position, education, certification,\n * volunteering, course, honor).\n */\nexport const entityRefSchema = z\n .string()\n .url()\n .refine((s) => /^https?:\\/\\//i.test(s), { message: 'entityRef must be an http(s) URL' })\n .max(2048)\n .optional();\n\n/**\n * One proof link on an involvement record (`id.sifa.defs#artifactLink`).\n * Only http(s) URLs are accepted so a dangerous scheme is never written to\n * the PDS.\n */\nexport const artifactLinkSchema = z.object({\n url: z\n .string()\n .max(2048)\n .refine((v) => httpUrlOrNull(v) !== null, 'must be an http(s) URL'),\n kind: z.string().max(64).nullable().optional(),\n label: z.string().max(2000).nullable().optional(),\n});\n\n/**\n * Reference to a record by at-uri, with an optional CID\n * (`id.sifa.defs#externalRecordRef`).\n */\nexport const externalRecordRefSchema = z.object({\n uri: z.string().regex(/^at:\\/\\/[^/\\s]+\\/[^/\\s]+\\/[^/\\s]+$/, 'must be an at-uri'),\n // CIDv0 (`Qm…`) or CIDv1 (base32, `b…`). Loose but rejects arbitrary strings.\n cid: z\n .string()\n .max(256)\n .regex(/^(Qm[1-9A-HJ-NP-Za-km-z]{44}|b[A-Za-z2-7]+)$/, 'must be a CID')\n .optional(),\n});\n\n/** Link attached to a presentation record. */\nexport const presentationLinkSchema = z.object({\n uri: z\n .string()\n .max(2048)\n .refine((v) => httpUrlOrNull(v) !== null, 'must be an http(s) URL'),\n label: z.string().max(640).nullable().optional(),\n type: z.string().max(256).nullable().optional(),\n});\n"],"mappings":";AAAA,SAAS,SAAS;AAGX,SAAS,aAAa,KAAqB;AAChD,QAAM,UAAU,IAAI,KAAK;AACzB,MAAI,gBAAgB,KAAK,OAAO,EAAG,QAAO;AAC1C,SAAO,WAAW,OAAO;AAC3B;AAWO,IAAM,cAAc,MACzB,EACG,OAAO,EACP,SAAS,EACT,UAAU,CAAC,QAAQ;AAClB,MAAI,CAAC,IAAK,QAAO;AACjB,SAAO,cAAc,GAAG,KAAK;AAC/B,CAAC;AAiBE,IAAM,sBAAsB,EAChC,MAAM;AAAA,EACL,EAAE,OAAO;AAAA,IACP,SAAS,EAAE,OAAO,EAAE,QAAQ;AAAA,IAC5B,aAAa,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,QAAQ;AAAA,IAC1C,QAAQ,EAAE,OAAO,EAAE,QAAQ;AAAA,IAC3B,MAAM,EAAE,OAAO,EAAE,QAAQ;AAAA,IACzB,UAAU,EAAE,OAAO,EAAE,QAAQ;AAAA,IAC7B,QAAQ,EAAE,OAAO,EAAE,QAAQ;AAAA,IAC3B,YAAY,EAAE,OAAO,EAAE,QAAQ;AAAA,IAC/B,MAAM,EAAE,OAAO,EAAE,QAAQ;AAAA,EAC3B,CAAC;AAAA,EACD,EAAE,OAAO;AACX,CAAC,EACA,SAAS,EACT,SAAS;AAGL,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,KAAK,EAAE,OAAO;AAChB,CAAC;AAWM,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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wBAAwB;AAAA,EACpE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS;AAAA,EAC7C,OAAO,EAAE,OAAO,EAAE,IAAI,GAAI,EAAE,SAAS,EAAE,SAAS;AAClD,CAAC;AAMM,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC9C,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,mBAAmB;AAAA;AAAA,EAE/E,KAAK,EACF,OAAO,EACP,IAAI,GAAG,EACP,MAAM,gDAAgD,eAAe,EACrE,SAAS;AACd,CAAC;AAGM,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,KAAK,EACF,OAAO,EACP,IAAI,IAAI,EACR,OAAO,CAAC,MAAM,cAAc,CAAC,MAAM,MAAM,wBAAwB;AAAA,EACpE,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC/C,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAChD,CAAC;","names":[]}
@@ -1,14 +1,14 @@
1
1
  // src/schemas/write/volunteering.ts
2
2
  import { z } from "zod";
3
- import { entityRefSchema } from "./shared.js";
3
+ import { entityRefSchema, partialDateFieldSchema } from "./shared.js";
4
4
  var VolunteeringWriteSchema = z.object({
5
5
  organization: z.string().min(1).max(256),
6
6
  entityRef: entityRefSchema,
7
7
  role: z.string().max(256).nullable().optional(),
8
8
  cause: z.string().max(256).nullable().optional(),
9
9
  description: z.string().max(5e4).nullable().optional(),
10
- startedAt: z.string().nullable().optional(),
11
- endedAt: z.string().nullable().optional()
10
+ startedAt: partialDateFieldSchema,
11
+ endedAt: partialDateFieldSchema
12
12
  });
13
13
  export {
14
14
  VolunteeringWriteSchema
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/schemas/write/volunteering.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { entityRefSchema } from './shared.js';\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 entityRef: entityRefSchema,\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"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,uBAAuB;AAGzB,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC9C,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EACvC,WAAW;AAAA,EACX,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC/C,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC1C,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAC1C,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/schemas/write/volunteering.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { entityRefSchema, partialDateFieldSchema } from './shared.js';\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 entityRef: entityRefSchema,\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: partialDateFieldSchema,\n endedAt: partialDateFieldSchema,\n});\n\nexport type VolunteeringWriteInput = z.infer<typeof VolunteeringWriteSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,iBAAiB,8BAA8B;AAGjD,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC9C,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EACvC,WAAW;AAAA,EACX,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS,EAAE,SAAS;AAAA,EAC/C,aAAa,EAAE,OAAO,EAAE,IAAI,GAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACvD,WAAW;AAAA,EACX,SAAS;AACX,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singi-labs/sifa-sdk",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
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",