@singi-labs/sifa-sdk 0.19.67 → 0.19.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/{org-B_0EMNuF.d.cts → org-DLl_2oY6.d.cts} +12 -0
  4. package/dist/{org--5MN6Ev4.d.ts → org-PkrUsjXq.d.ts} +12 -0
  5. package/dist/query/fetchers/index.cjs +12 -0
  6. package/dist/query/fetchers/index.cjs.map +1 -1
  7. package/dist/query/fetchers/index.d.cts +1 -1
  8. package/dist/query/fetchers/index.d.ts +1 -1
  9. package/dist/query/fetchers/org-attestations.js +120 -0
  10. package/dist/query/fetchers/org-attestations.js.map +1 -0
  11. package/dist/query/fetchers/verification.js +49 -0
  12. package/dist/query/fetchers/verification.js.map +1 -0
  13. package/dist/query/hooks/index.cjs +239 -0
  14. package/dist/query/hooks/index.cjs.map +1 -1
  15. package/dist/query/hooks/index.d.cts +2 -2
  16. package/dist/query/hooks/index.d.ts +2 -2
  17. package/dist/query/hooks/index.js +18 -0
  18. package/dist/query/hooks/index.js.map +1 -1
  19. package/dist/query/hooks/use-org-attestations.js +108 -0
  20. package/dist/query/hooks/use-org-attestations.js.map +1 -0
  21. package/dist/query/hooks/use-verification.js +19 -0
  22. package/dist/query/hooks/use-verification.js.map +1 -0
  23. package/dist/query/index.cjs +259 -0
  24. package/dist/query/index.cjs.map +1 -1
  25. package/dist/query/index.d.cts +3 -3
  26. package/dist/query/index.d.ts +3 -3
  27. package/dist/query/index.js +48 -0
  28. package/dist/query/index.js.map +1 -1
  29. package/dist/query/keys.js +12 -0
  30. package/dist/query/keys.js.map +1 -1
  31. package/dist/{use-org-notification-emails-B4INNGOe.d.cts → use-org-notification-emails-CcOMI3qF.d.cts} +201 -3
  32. package/dist/{use-org-notification-emails-DZ0oVtiX.d.ts → use-org-notification-emails-i5dhCaw8.d.ts} +201 -3
  33. package/package.json +1 -1
@@ -646,6 +646,146 @@ function dismissConfirmation(config, data, options = {}) {
646
646
  function revokeConfirmation(config, data, options = {}) {
647
647
  return apiWrite(config, "/api/confirmation/revoke", "POST", { body: data, ...options });
648
648
  }
649
+ var VERIFICATION_EVENT_KINDS = [
650
+ "mailbox_verified",
651
+ "domain_recognized",
652
+ "reverified",
653
+ "reverification_failed",
654
+ "org_confirmed",
655
+ "org_status_changed",
656
+ "org_revoked",
657
+ "peer_vouched",
658
+ "peer_withdrawn"
659
+ ];
660
+ var VerificationLogEntrySchema = zod.z.object({
661
+ id: zod.z.number(),
662
+ kind: zod.z.string(),
663
+ occurredAt: zod.z.string(),
664
+ entityId: zod.z.number().nullable().default(null),
665
+ emailDomain: zod.z.string().nullable().default(null),
666
+ emailAddress: zod.z.string().nullable().optional(),
667
+ meta: zod.z.record(zod.z.string(), zod.z.unknown()).default({})
668
+ }).passthrough();
669
+ var VerificationLogSchema = zod.z.object({
670
+ events: zod.z.array(VerificationLogEntrySchema).default([])
671
+ });
672
+ async function fetchVerificationLog(config, did, positionRkey, options = {}) {
673
+ const { cookieHeader, ...rest } = options;
674
+ const headers = { ...rest.headers ?? {} };
675
+ if (cookieHeader) headers.cookie = cookieHeader;
676
+ try {
677
+ const data = await apiFetch(
678
+ config,
679
+ `/api/verification/${encodeURIComponent(did)}/${encodeURIComponent(positionRkey)}`,
680
+ { cache: "no-store", credentials: "include", timeoutMs: 5e3, ...rest, headers }
681
+ );
682
+ const parsed = VerificationLogSchema.safeParse(data);
683
+ return parsed.success ? parsed.data : { events: [] };
684
+ } catch {
685
+ return { events: [] };
686
+ }
687
+ }
688
+ function createOrgAttestation(config, input, options = {}) {
689
+ return apiWriteCreate(
690
+ config,
691
+ "/api/org/attestations",
692
+ input,
693
+ options
694
+ );
695
+ }
696
+ function offboardOrgAttestation(config, rkey, input, options = {}) {
697
+ return apiWrite(config, `/api/org/attestations/${encodeURIComponent(rkey)}`, "PATCH", {
698
+ body: { status: "past", ...input },
699
+ ...options
700
+ });
701
+ }
702
+ function revokeOrgAttestation(config, rkey, options = {}) {
703
+ return apiWrite(config, `/api/org/attestations/${encodeURIComponent(rkey)}`, "DELETE", options);
704
+ }
705
+ var OrgAttestationSchema = zod.z.object({
706
+ rkey: zod.z.string(),
707
+ uri: zod.z.string(),
708
+ subjectDid: zod.z.string(),
709
+ subjectHandle: zod.z.string().nullable().optional(),
710
+ subjectDisplayName: zod.z.string().nullable().optional(),
711
+ subjectAvatar: zod.z.string().nullable().optional(),
712
+ status: zod.z.string(),
713
+ source: zod.z.string().nullable().optional(),
714
+ title: zod.z.string().nullable().optional(),
715
+ startedAt: zod.z.string().nullable().optional(),
716
+ endedAt: zod.z.string().nullable().optional(),
717
+ positionUri: zod.z.string().nullable().optional(),
718
+ renderState: zod.z.string(),
719
+ matchedRkeys: zod.z.array(zod.z.string()).default([]),
720
+ createdAt: zod.z.string()
721
+ }).passthrough();
722
+ var OrgAttestationsSchema = zod.z.object({ attestations: zod.z.array(OrgAttestationSchema).default([]) });
723
+ var AttestationRequestSchema = zod.z.object({
724
+ id: zod.z.number(),
725
+ subjectDid: zod.z.string(),
726
+ subjectHandle: zod.z.string().nullable().optional(),
727
+ subjectDisplayName: zod.z.string().nullable().optional(),
728
+ subjectAvatar: zod.z.string().nullable().optional(),
729
+ positionRkey: zod.z.string(),
730
+ positionTitle: zod.z.string().nullable().optional(),
731
+ positionStartedAt: zod.z.string().nullable().optional(),
732
+ positionEndedAt: zod.z.string().nullable().optional(),
733
+ note: zod.z.string().nullable().optional(),
734
+ status: zod.z.string(),
735
+ createdAt: zod.z.string()
736
+ }).passthrough();
737
+ var AttestationRequestsSchema = zod.z.object({
738
+ requests: zod.z.array(AttestationRequestSchema).default([])
739
+ });
740
+ function withCookie(options) {
741
+ const { cookieHeader, ...rest } = options;
742
+ const headers = { ...rest.headers ?? {} };
743
+ if (cookieHeader) headers.cookie = cookieHeader;
744
+ return { rest, headers };
745
+ }
746
+ async function fetchOrgAttestations(config, options = {}) {
747
+ const { rest, headers } = withCookie(options);
748
+ try {
749
+ const data = await apiFetch(config, "/api/org/attestations", {
750
+ cache: "no-store",
751
+ credentials: "include",
752
+ timeoutMs: 5e3,
753
+ ...rest,
754
+ headers
755
+ });
756
+ const parsed = OrgAttestationsSchema.safeParse(data);
757
+ return parsed.success ? parsed.data : { attestations: [] };
758
+ } catch {
759
+ return { attestations: [] };
760
+ }
761
+ }
762
+ async function fetchAttestationRequests(config, options = {}) {
763
+ const { rest, headers } = withCookie(options);
764
+ try {
765
+ const data = await apiFetch(config, "/api/org/attestations/requests", {
766
+ cache: "no-store",
767
+ credentials: "include",
768
+ timeoutMs: 5e3,
769
+ ...rest,
770
+ headers
771
+ });
772
+ const parsed = AttestationRequestsSchema.safeParse(data);
773
+ return parsed.success ? parsed.data : { requests: [] };
774
+ } catch {
775
+ return { requests: [] };
776
+ }
777
+ }
778
+ function rejectAttestationRequest(config, id, options = {}) {
779
+ return apiWrite(config, `/api/org/attestations/requests/${id}/reject`, "POST", options);
780
+ }
781
+ function requestEmploymentConfirmation(config, input, options = {}) {
782
+ return apiWriteCreate(
783
+ config,
784
+ "/api/verification/org/request",
785
+ input,
786
+ options
787
+ );
788
+ }
649
789
 
650
790
  // src/query/fetchers/inbox.ts
651
791
  function toCount(value) {
@@ -1960,6 +2100,18 @@ var sifaQueryKeys = {
1960
2100
  /** Confirmations this session has given, for the withdraw surface. */
1961
2101
  given: () => ["sifa", "confirmation", "given"]
1962
2102
  },
2103
+ org: {
2104
+ all: () => ["sifa", "org"],
2105
+ /** Attestations the signed-in organization wrote. */
2106
+ attestations: () => ["sifa", "org", "attestations"],
2107
+ /** Pending confirmation requests addressed to the signed-in organization. */
2108
+ attestationRequests: () => ["sifa", "org", "attestation-requests"]
2109
+ },
2110
+ verification: {
2111
+ all: () => ["sifa", "verification"],
2112
+ /** The append-only verification log of one position. */
2113
+ log: (did, positionRkey) => ["sifa", "verification", "log", did, positionRkey]
2114
+ },
1963
2115
  stream: {
1964
2116
  all: () => ["sifa", "stream"],
1965
2117
  networkCount: (did) => ["sifa", "stream", "network-count", did]
@@ -2834,6 +2986,92 @@ function useInboxCounts(options) {
2834
2986
  ...options
2835
2987
  });
2836
2988
  }
2989
+ function useVerificationLog(did, positionRkey, options) {
2990
+ const config = useSifaConfig();
2991
+ return reactQuery.useQuery({
2992
+ queryKey: sifaQueryKeys.verification.log(did, positionRkey),
2993
+ queryFn: () => fetchVerificationLog(config, did, positionRkey),
2994
+ ...options
2995
+ });
2996
+ }
2997
+ function useOrgAttestations(options) {
2998
+ const config = useSifaConfig();
2999
+ return reactQuery.useQuery({
3000
+ queryKey: sifaQueryKeys.org.attestations(),
3001
+ queryFn: () => fetchOrgAttestations(config),
3002
+ ...options
3003
+ });
3004
+ }
3005
+ function useAttestationRequests(options) {
3006
+ const config = useSifaConfig();
3007
+ return reactQuery.useQuery({
3008
+ queryKey: sifaQueryKeys.org.attestationRequests(),
3009
+ queryFn: () => fetchAttestationRequests(config),
3010
+ ...options
3011
+ });
3012
+ }
3013
+ function useInvalidateOrg() {
3014
+ const queryClient = reactQuery.useQueryClient();
3015
+ return async () => {
3016
+ await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.org.all() });
3017
+ };
3018
+ }
3019
+ function useCreateOrgAttestation(options) {
3020
+ const config = useSifaConfig();
3021
+ const invalidate = useInvalidateOrg();
3022
+ return reactQuery.useMutation({
3023
+ // Spread first so a consumer handler cannot drop the invalidation.
3024
+ ...options,
3025
+ mutationFn: (input) => createOrgAttestation(config, input),
3026
+ onSuccess: async (result, variables, onMutateResult, context) => {
3027
+ if (result.success) await invalidate();
3028
+ await options?.onSuccess?.(result, variables, onMutateResult, context);
3029
+ }
3030
+ });
3031
+ }
3032
+ function useOffboardOrgAttestation(options) {
3033
+ const config = useSifaConfig();
3034
+ const invalidate = useInvalidateOrg();
3035
+ return reactQuery.useMutation({
3036
+ ...options,
3037
+ mutationFn: ({ rkey, endedAt }) => offboardOrgAttestation(config, rkey, { endedAt }),
3038
+ onSuccess: async (result, variables, onMutateResult, context) => {
3039
+ if (result.success) await invalidate();
3040
+ await options?.onSuccess?.(result, variables, onMutateResult, context);
3041
+ }
3042
+ });
3043
+ }
3044
+ function useRevokeOrgAttestation(options) {
3045
+ const config = useSifaConfig();
3046
+ const invalidate = useInvalidateOrg();
3047
+ return reactQuery.useMutation({
3048
+ ...options,
3049
+ mutationFn: (rkey) => revokeOrgAttestation(config, rkey),
3050
+ onSuccess: async (result, variables, onMutateResult, context) => {
3051
+ if (result.success) await invalidate();
3052
+ await options?.onSuccess?.(result, variables, onMutateResult, context);
3053
+ }
3054
+ });
3055
+ }
3056
+ function useRejectAttestationRequest(options) {
3057
+ const config = useSifaConfig();
3058
+ const invalidate = useInvalidateOrg();
3059
+ return reactQuery.useMutation({
3060
+ ...options,
3061
+ mutationFn: (id) => rejectAttestationRequest(config, id),
3062
+ onSuccess: async (result, variables, onMutateResult, context) => {
3063
+ if (result.success) await invalidate();
3064
+ await options?.onSuccess?.(result, variables, onMutateResult, context);
3065
+ }
3066
+ });
3067
+ }
3068
+ function useRequestEmploymentConfirmation(options) {
3069
+ const config = useSifaConfig();
3070
+ return reactQuery.useMutation({
3071
+ ...options,
3072
+ mutationFn: (input) => requestEmploymentConfirmation(config, input)
3073
+ });
3074
+ }
2837
3075
  function useUnlinkedPositions(options) {
2838
3076
  const config = useSifaConfig();
2839
3077
  return reactQuery.useQuery({
@@ -3837,13 +4075,18 @@ function useRemoveOrgNotificationEmail(options) {
3837
4075
  }
3838
4076
 
3839
4077
  exports.ApiError = ApiError;
4078
+ exports.AttestationRequestSchema = AttestationRequestSchema;
3840
4079
  exports.HIDDEN_ITEM_SOURCES = HIDDEN_ITEM_SOURCES;
3841
4080
  exports.HIDDEN_ITEM_TYPES = HIDDEN_ITEM_TYPES;
4081
+ exports.OrgAttestationSchema = OrgAttestationSchema;
3842
4082
  exports.PROFILE_COMPLETENESS_SIGNALS = PROFILE_COMPLETENESS_SIGNALS;
3843
4083
  exports.QUOTED_POSTS_BATCH_MAX = QUOTED_POSTS_BATCH_MAX;
3844
4084
  exports.RpgItemStatusSchema = RpgItemStatusSchema;
3845
4085
  exports.RpgStatusResponseSchema = RpgStatusResponseSchema;
3846
4086
  exports.SifaProvider = SifaProvider;
4087
+ exports.VERIFICATION_EVENT_KINDS = VERIFICATION_EVENT_KINDS;
4088
+ exports.VerificationLogEntrySchema = VerificationLogEntrySchema;
4089
+ exports.VerificationLogSchema = VerificationLogSchema;
3847
4090
  exports.addFeatureAllowlist = addFeatureAllowlist;
3848
4091
  exports.addOrgNotificationEmail = addOrgNotificationEmail;
3849
4092
  exports.apiFetch = apiFetch;
@@ -3862,6 +4105,7 @@ exports.createConfirmation = createConfirmation;
3862
4105
  exports.createEducation = createEducation;
3863
4106
  exports.createEndorsement = createEndorsement;
3864
4107
  exports.createExternalAccount = createExternalAccount;
4108
+ exports.createOrgAttestation = createOrgAttestation;
3865
4109
  exports.createPosition = createPosition;
3866
4110
  exports.createProfileLocation = createProfileLocation;
3867
4111
  exports.createReaction = createReaction;
@@ -3887,6 +4131,7 @@ exports.fetchActivityFeed = fetchActivityFeed;
3887
4131
  exports.fetchActivityTeaser = fetchActivityTeaser;
3888
4132
  exports.fetchAppsRegistry = fetchAppsRegistry;
3889
4133
  exports.fetchAtFundLink = fetchAtFundLink;
4134
+ exports.fetchAttestationRequests = fetchAttestationRequests;
3890
4135
  exports.fetchBskyContentLabelPrefs = fetchBskyContentLabelPrefs;
3891
4136
  exports.fetchEndorsementCount = fetchEndorsementCount;
3892
4137
  exports.fetchEntitySearch = fetchEntitySearch;
@@ -3905,6 +4150,7 @@ exports.fetchMyGithubPullRequests = fetchMyGithubPullRequests;
3905
4150
  exports.fetchMyRoadmapVotes = fetchMyRoadmapVotes;
3906
4151
  exports.fetchNetworkMap = fetchNetworkMap;
3907
4152
  exports.fetchNetworkStreamCount = fetchNetworkStreamCount;
4153
+ exports.fetchOrgAttestations = fetchOrgAttestations;
3908
4154
  exports.fetchPendingConfirmations = fetchPendingConfirmations;
3909
4155
  exports.fetchPendingEndorsements = fetchPendingEndorsements;
3910
4156
  exports.fetchProfile = fetchProfile;
@@ -3928,6 +4174,7 @@ exports.fetchSuggestions = fetchSuggestions;
3928
4174
  exports.fetchTalks = fetchTalks;
3929
4175
  exports.fetchTypeaheadActors = fetchTypeaheadActors;
3930
4176
  exports.fetchUnlinkedPositions = fetchUnlinkedPositions;
4177
+ exports.fetchVerificationLog = fetchVerificationLog;
3931
4178
  exports.fetchViewerPositionConfirmations = fetchViewerPositionConfirmations;
3932
4179
  exports.fetchWipePreview = fetchWipePreview;
3933
4180
  exports.followUser = followUser;
@@ -3949,11 +4196,14 @@ exports.isNewerFollowingFeed = isNewerFollowingFeed;
3949
4196
  exports.linkSkillToPosition = linkSkillToPosition;
3950
4197
  exports.listFeatureAllowlist = listFeatureAllowlist;
3951
4198
  exports.mintEntityDomain = mintEntityDomain;
4199
+ exports.offboardOrgAttestation = offboardOrgAttestation;
3952
4200
  exports.refreshOrcidPublications = refreshOrcidPublications;
3953
4201
  exports.refreshPds = refreshPds;
4202
+ exports.rejectAttestationRequest = rejectAttestationRequest;
3954
4203
  exports.removeFeatureAllowlist = removeFeatureAllowlist;
3955
4204
  exports.removeOrgNotificationEmail = removeOrgNotificationEmail;
3956
4205
  exports.repoExportUrl = repoExportUrl;
4206
+ exports.requestEmploymentConfirmation = requestEmploymentConfirmation;
3957
4207
  exports.requestOrgDomainChallenge = requestOrgDomainChallenge;
3958
4208
  exports.resetProfile = resetProfile;
3959
4209
  exports.resolveEntityDomain = resolveEntityDomain;
@@ -3961,6 +4211,7 @@ exports.resolveQuotedPosts = resolveQuotedPosts;
3961
4211
  exports.retractRoadmapVote = retractRoadmapVote;
3962
4212
  exports.revealMarqueDomain = revealMarqueDomain;
3963
4213
  exports.revokeConfirmation = revokeConfirmation;
4214
+ exports.revokeOrgAttestation = revokeOrgAttestation;
3964
4215
  exports.searchSkills = searchSkills;
3965
4216
  exports.selectEntity = selectEntity;
3966
4217
  exports.setExternalAccountPrimary = setExternalAccountPrimary;
@@ -4004,6 +4255,7 @@ exports.useAdminReviewQueues = useAdminReviewQueues;
4004
4255
  exports.useAppAccountCheck = useAppAccountCheck;
4005
4256
  exports.useAppsRegistry = useAppsRegistry;
4006
4257
  exports.useAtFundLink = useAtFundLink;
4258
+ exports.useAttestationRequests = useAttestationRequests;
4007
4259
  exports.useBlueskySuggestions = useBlueskySuggestions;
4008
4260
  exports.useBskyContentLabelPrefs = useBskyContentLabelPrefs;
4009
4261
  exports.useBulkHideProfileItems = useBulkHideProfileItems;
@@ -4017,6 +4269,7 @@ exports.useCreateConfirmation = useCreateConfirmation;
4017
4269
  exports.useCreateEducation = useCreateEducation;
4018
4270
  exports.useCreateEndorsement = useCreateEndorsement;
4019
4271
  exports.useCreateExternalAccount = useCreateExternalAccount;
4272
+ exports.useCreateOrgAttestation = useCreateOrgAttestation;
4020
4273
  exports.useCreatePosition = useCreatePosition;
4021
4274
  exports.useCreateProfileLocation = useCreateProfileLocation;
4022
4275
  exports.useCreateReaction = useCreateReaction;
@@ -4067,6 +4320,8 @@ exports.useMutuals = useMutuals;
4067
4320
  exports.useMyGithubPullRequests = useMyGithubPullRequests;
4068
4321
  exports.useMyRoadmapVotes = useMyRoadmapVotes;
4069
4322
  exports.useNetworkStreamCount = useNetworkStreamCount;
4323
+ exports.useOffboardOrgAttestation = useOffboardOrgAttestation;
4324
+ exports.useOrgAttestations = useOrgAttestations;
4070
4325
  exports.useOrgClaim = useOrgClaim;
4071
4326
  exports.useOrgDomainChallenge = useOrgDomainChallenge;
4072
4327
  exports.useOrgDomainVerify = useOrgDomainVerify;
@@ -4080,14 +4335,17 @@ exports.useReceivedEndorsements = useReceivedEndorsements;
4080
4335
  exports.useReciprocityCandidate = useReciprocityCandidate;
4081
4336
  exports.useRefreshOrcidPublications = useRefreshOrcidPublications;
4082
4337
  exports.useRefreshPds = useRefreshPds;
4338
+ exports.useRejectAttestationRequest = useRejectAttestationRequest;
4083
4339
  exports.useRemoveFeatureAllowlist = useRemoveFeatureAllowlist;
4084
4340
  exports.useRemoveOrgNotificationEmail = useRemoveOrgNotificationEmail;
4085
4341
  exports.useRepoInventory = useRepoInventory;
4342
+ exports.useRequestEmploymentConfirmation = useRequestEmploymentConfirmation;
4086
4343
  exports.useResetProfile = useResetProfile;
4087
4344
  exports.useResolveEntityDomain = useResolveEntityDomain;
4088
4345
  exports.useRetractRoadmapVote = useRetractRoadmapVote;
4089
4346
  exports.useRevealMarqueDomain = useRevealMarqueDomain;
4090
4347
  exports.useRevokeConfirmation = useRevokeConfirmation;
4348
+ exports.useRevokeOrgAttestation = useRevokeOrgAttestation;
4091
4349
  exports.useRoadmapVotes = useRoadmapVotes;
4092
4350
  exports.useSearchFilters = useSearchFilters;
4093
4351
  exports.useSearchProfiles = useSearchProfiles;
@@ -4127,6 +4385,7 @@ exports.useUpdateSkill = useUpdateSkill;
4127
4385
  exports.useUpdateSkillSubCategories = useUpdateSkillSubCategories;
4128
4386
  exports.useUploadAvatar = useUploadAvatar;
4129
4387
  exports.useUploadNamePronunciationAudio = useUploadNamePronunciationAudio;
4388
+ exports.useVerificationLog = useVerificationLog;
4130
4389
  exports.useVerifyExternalAccount = useVerifyExternalAccount;
4131
4390
  exports.useWipePreview = useWipePreview;
4132
4391
  exports.verifyExternalAccount = verifyExternalAccount;