@singi-labs/sifa-sdk 0.19.70 → 0.19.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -6474,17 +6474,66 @@ var OrgProfileRecordSchema = zod.z.object({
6474
6474
  });
6475
6475
  var OrgEmploymentAttestationRecordSchema = zod.z.object({
6476
6476
  subject: didSchema,
6477
- position: strongRefSchema,
6478
- status: zod.z.enum(["current", "past"]),
6479
- title: zod.z.string().min(1).refine(maxGraphemes(256)).max(2560),
6480
- startedAt: partialDateSchema,
6477
+ position: strongRefSchema.optional(),
6478
+ status: zod.z.enum([
6479
+ "id.sifa.defs#employmentCurrent",
6480
+ "id.sifa.defs#employmentPast",
6481
+ "current",
6482
+ "past"
6483
+ ]),
6484
+ source: zod.z.enum(["id.sifa.defs#attestationManual", "id.sifa.defs#attestationDirectory"]).optional(),
6485
+ title: zod.z.string().min(1).refine(maxGraphemes(256)).max(2560).optional(),
6486
+ startedAt: partialDateSchema.optional(),
6481
6487
  entityRef: uriSchema.optional(),
6488
+ /**
6489
+ * @deprecated The author DID is the organization. Still parsed so a record
6490
+ * that carries it validates; readers must not use it for anything.
6491
+ */
6482
6492
  companyDid: didSchema.optional(),
6483
6493
  endedAt: partialDateSchema.optional(),
6484
6494
  comment: zod.z.string().refine(maxGraphemes(300)).max(3e3).optional(),
6485
6495
  labels: selfLabelsSchema.optional(),
6486
6496
  createdAt: datetimeSchema
6487
6497
  });
6498
+ var EMPLOYMENT_STATUS_TOKENS = [
6499
+ "id.sifa.defs#employmentCurrent",
6500
+ "id.sifa.defs#employmentPast"
6501
+ ];
6502
+ var VERIFICATION_METHOD_TOKENS = [
6503
+ "id.sifa.defs#verifiedByEmail",
6504
+ "id.sifa.defs#verifiedByOrg",
6505
+ "id.sifa.defs#verifiedByDirectory",
6506
+ "id.sifa.defs#verifiedByPeer"
6507
+ ];
6508
+ var EmploymentVerificationRecordSchema = zod.z.object({
6509
+ $type: zod.z.literal("id.sifa.verification.employment").optional(),
6510
+ subject: didSchema,
6511
+ position: externalRecordRefSchema,
6512
+ status: zod.z.enum(EMPLOYMENT_STATUS_TOKENS),
6513
+ // Open on purpose, like the lexicon's knownValues: a method Sifa adds
6514
+ // later must not make an older client reject the whole record. Compare
6515
+ // against VERIFICATION_METHOD_TOKENS when you need a specific one.
6516
+ methods: zod.z.array(zod.z.string().min(1)).min(1).max(4),
6517
+ title: zod.z.string().min(1).refine(maxGraphemes(256)).max(2560),
6518
+ startedAt: partialDateSchema,
6519
+ endedAt: partialDateSchema.optional(),
6520
+ entityRef: uriSchema.optional(),
6521
+ organization: didSchema.optional(),
6522
+ evidence: zod.z.array(externalRecordRefSchema).max(20).optional(),
6523
+ verifiedAt: datetimeSchema,
6524
+ expiresAt: datetimeSchema.optional(),
6525
+ createdAt: datetimeSchema
6526
+ }).strict();
6527
+ function resolveEmploymentVerification(value, options) {
6528
+ if (options.repoDid !== options.issuerDid) return { ok: false, reason: "not-issuer" };
6529
+ const parsed3 = EmploymentVerificationRecordSchema.safeParse(value);
6530
+ if (!parsed3.success) return { ok: false, reason: "malformed" };
6531
+ const now = options.now ?? /* @__PURE__ */ new Date();
6532
+ if (parsed3.data.expiresAt && new Date(parsed3.data.expiresAt).getTime() <= now.getTime()) {
6533
+ return { ok: false, reason: "lapsed" };
6534
+ }
6535
+ return { ok: true, record: parsed3.data };
6536
+ }
6488
6537
  var GraphFollowRecordSchema = zod.z.object({
6489
6538
  subject: didSchema,
6490
6539
  createdAt: datetimeSchema,
@@ -7201,7 +7250,7 @@ function describeSifaRecord(collection, value) {
7201
7250
  }
7202
7251
 
7203
7252
  // src/index.ts
7204
- var SIFA_SDK_VERSION = "0.19.70";
7253
+ var SIFA_SDK_VERSION = "0.19.71";
7205
7254
 
7206
7255
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
7207
7256
  exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
@@ -7236,11 +7285,13 @@ exports.COURSE_ROLE_TAUGHT = COURSE_ROLE_TAUGHT;
7236
7285
  exports.COURSE_ROLE_TEACHING_ASSISTANT = COURSE_ROLE_TEACHING_ASSISTANT;
7237
7286
  exports.DATE_LOOKAHEAD_MONTHS = DATE_LOOKAHEAD_MONTHS;
7238
7287
  exports.DIMENSIONS_MAX_SCORE = DIMENSIONS_MAX_SCORE;
7288
+ exports.EMPLOYMENT_STATUS_TOKENS = EMPLOYMENT_STATUS_TOKENS;
7239
7289
  exports.EMPLOYMENT_TYPE_GROUPS = EMPLOYMENT_TYPE_GROUPS;
7240
7290
  exports.EMPLOYMENT_TYPE_LABELS = EMPLOYMENT_TYPE_LABELS;
7241
7291
  exports.ENTITY_REF_ANCHORS = ENTITY_REF_ANCHORS;
7242
7292
  exports.EQF_LEVEL_LABELS = EQF_LEVEL_LABELS;
7243
7293
  exports.EQF_LEVEL_OPTIONS = EQF_LEVEL_OPTIONS;
7294
+ exports.EmploymentVerificationRecordSchema = EmploymentVerificationRecordSchema;
7244
7295
  exports.EndorsementConfirmationRecordSchema = EndorsementConfirmationRecordSchema;
7245
7296
  exports.EndorsementRecordSchema = EndorsementRecordSchema;
7246
7297
  exports.EntityImportSearchResponseSchema = EntityImportSearchResponseSchema;
@@ -7326,6 +7377,7 @@ exports.SKILL_CATEGORIES = SKILL_CATEGORIES;
7326
7377
  exports.STANDARD_PUBLISHER_ID = STANDARD_PUBLISHER_ID;
7327
7378
  exports.STREAM_VERBS = STREAM_VERBS;
7328
7379
  exports.SifaFeedItemSchema = SifaFeedItemSchema;
7380
+ exports.VERIFICATION_METHOD_TOKENS = VERIFICATION_METHOD_TOKENS;
7329
7381
  exports.VERIFICATION_PROVIDERS = VERIFICATION_PROVIDERS;
7330
7382
  exports.WORKPLACE_TYPE_LABELS = WORKPLACE_TYPE_LABELS;
7331
7383
  exports.WORKPLACE_TYPE_OPTIONS = WORKPLACE_TYPE_OPTIONS;
@@ -7488,6 +7540,7 @@ exports.resolveAgentRef = resolveAgentRef;
7488
7540
  exports.resolveCardHealth = resolveCardHealth;
7489
7541
  exports.resolveCardUrl = resolveCardUrl;
7490
7542
  exports.resolveEmbed = resolveEmbed;
7543
+ exports.resolveEmploymentVerification = resolveEmploymentVerification;
7491
7544
  exports.resolveVerifierProvider = resolveVerifierProvider;
7492
7545
  exports.rgbToString = rgbToString;
7493
7546
  exports.roadmapIssueUrl = roadmapIssueUrl;