@singi-labs/sifa-sdk 0.12.68 → 0.12.70

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 (55) hide show
  1. package/dist/{feed-dOSy_48Z.d.cts → feed-BMm9Pkew.d.cts} +1 -1
  2. package/dist/{feed-dOSy_48Z.d.ts → feed-BMm9Pkew.d.ts} +1 -1
  3. package/dist/{index-Cj6jfpAE.d.cts → index-a3xqWsNm.d.cts} +38 -1
  4. package/dist/{index-Cj6jfpAE.d.ts → index-a3xqWsNm.d.ts} +38 -1
  5. package/dist/index.cjs +88 -1
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +47 -9
  8. package/dist/index.d.ts +47 -9
  9. package/dist/index.js +77 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/jsonld/index.cjs +444 -457
  12. package/dist/jsonld/index.cjs.map +1 -1
  13. package/dist/jsonld/index.d.cts +32 -18
  14. package/dist/jsonld/index.d.ts +32 -18
  15. package/dist/jsonld/index.js +444 -457
  16. package/dist/jsonld/index.js.map +1 -1
  17. package/dist/{index-BARfrksZ.d.cts → network-map-BAuHfC6e.d.cts} +5 -5
  18. package/dist/{index-C0iPs_NQ.d.ts → network-map-l-qT7ada.d.ts} +5 -5
  19. package/dist/{org-ClPPJ3-J.d.cts → org-BaWCreh6.d.cts} +3 -3
  20. package/dist/{org-wLJm-WXC.d.ts → org-OaBu-89h.d.ts} +3 -3
  21. package/dist/{shared-BibYErTJ.d.cts → profile-investment-C97ssnBV.d.cts} +45 -1
  22. package/dist/{shared-BibYErTJ.d.ts → profile-investment-C97ssnBV.d.ts} +45 -1
  23. package/dist/{profile-summary-sEHAdvfm.d.cts → profile-summary-BTZAwG1z.d.cts} +1 -1
  24. package/dist/{profile-summary-Cbtnh04E.d.ts → profile-summary-Do5FY7Q0.d.ts} +1 -1
  25. package/dist/query/fetchers/index.cjs +138 -0
  26. package/dist/query/fetchers/index.cjs.map +1 -1
  27. package/dist/query/fetchers/index.d.cts +24 -6
  28. package/dist/query/fetchers/index.d.ts +24 -6
  29. package/dist/query/fetchers/index.js +136 -1
  30. package/dist/query/fetchers/index.js.map +1 -1
  31. package/dist/query/hooks/index.cjs +188 -0
  32. package/dist/query/hooks/index.cjs.map +1 -1
  33. package/dist/query/hooks/index.d.cts +26 -6
  34. package/dist/query/hooks/index.d.ts +26 -6
  35. package/dist/query/hooks/index.js +186 -1
  36. package/dist/query/hooks/index.js.map +1 -1
  37. package/dist/query/index.d.cts +9 -9
  38. package/dist/query/index.d.ts +9 -9
  39. package/dist/schemas/index.cjs +35 -0
  40. package/dist/schemas/index.cjs.map +1 -1
  41. package/dist/schemas/index.d.cts +2 -2
  42. package/dist/schemas/index.d.ts +2 -2
  43. package/dist/schemas/index.js +33 -1
  44. package/dist/schemas/index.js.map +1 -1
  45. package/dist/schemas/write/index.cjs +26 -0
  46. package/dist/schemas/write/index.cjs.map +1 -1
  47. package/dist/schemas/write/index.d.cts +36 -1
  48. package/dist/schemas/write/index.d.ts +36 -1
  49. package/dist/schemas/write/index.js +26 -1
  50. package/dist/schemas/write/index.js.map +1 -1
  51. package/dist/{types-BtoIc4cG.d.ts → types-C3xxTGUE.d.ts} +2 -2
  52. package/dist/{types-DNrRbi9D.d.cts → types-D0LWpGtY.d.cts} +2 -2
  53. package/dist/{index-DQrudL91.d.cts → use-org-notification-emails-CcuTb7LT.d.cts} +4 -4
  54. package/dist/{index-B61EZesA.d.ts → use-org-notification-emails-DG2qXAKu.d.ts} +4 -4
  55. package/package.json +3 -2
@@ -2859,6 +2859,191 @@ function useRemoveOrgNotificationEmail(options) {
2859
2859
  ...options
2860
2860
  });
2861
2861
  }
2862
+ function maxGraphemes(max) {
2863
+ return (value) => {
2864
+ const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
2865
+ let count = 0;
2866
+ for (const _ of segmenter.segment(value)) {
2867
+ count++;
2868
+ if (count > max) return false;
2869
+ }
2870
+ return true;
2871
+ };
2872
+ }
2873
+ var didSchema = zod.z.string().regex(/^did:[a-z]+:[a-zA-Z0-9._:%-]+$/, "Invalid DID");
2874
+ var datetimeSchema = zod.z.string().datetime({ offset: true });
2875
+ var partialDateSchema = zod.z.string().regex(/^\d{4}(-\d{2}(-\d{2}(T.+)?)?)?$/, "Expected YYYY, YYYY-MM, YYYY-MM-DD, or a datetime");
2876
+ var atUriSchema = zod.z.string().regex(/^at:\/\/[^\s]+$/, "Invalid AT-URI");
2877
+ var cidSchema = zod.z.string().regex(/^(Qm[1-9A-HJ-NP-Za-km-z]{44}|b[A-Za-z0-9+/=]+)$/, "Invalid CID");
2878
+ zod.z.string().regex(/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/, "Invalid BCP 47 language tag");
2879
+ var uriSchema = zod.z.string().url();
2880
+ var strongRefSchema = zod.z.object({
2881
+ uri: atUriSchema,
2882
+ cid: cidSchema
2883
+ });
2884
+ zod.z.object({
2885
+ uri: atUriSchema
2886
+ });
2887
+ var externalRecordRefSchema = zod.z.object({
2888
+ uri: atUriSchema,
2889
+ cid: cidSchema.optional()
2890
+ });
2891
+ var selfLabelsSchema = zod.z.object({
2892
+ $type: zod.z.literal("com.atproto.label.defs#selfLabels").optional(),
2893
+ values: zod.z.array(zod.z.object({ val: zod.z.string() }))
2894
+ });
2895
+ var projectMemberRefSchema = zod.z.object({
2896
+ did: didSchema,
2897
+ role: zod.z.string().optional(),
2898
+ title: zod.z.string().refine(maxGraphemes(128)).max(1280).optional()
2899
+ });
2900
+ zod.z.object({
2901
+ name: zod.z.string().min(1).refine(maxGraphemes(256)).max(2560),
2902
+ description: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
2903
+ url: uriSchema.optional(),
2904
+ members: zod.z.array(projectMemberRefSchema).max(50).optional(),
2905
+ /**
2906
+ * The canonical `id.sifa.project.self` this personal entry corresponds to.
2907
+ * A composition link. For the same project recorded on someone else's
2908
+ * profile, see `sameAs`.
2909
+ */
2910
+ projectRef: strongRefSchema.optional(),
2911
+ /**
2912
+ * The same project as recorded on another person's profile. Each side stays
2913
+ * its own record; this only says the two describe one thing. Resolves by
2914
+ * AT-URI, since they will keep editing their copy.
2915
+ */
2916
+ sameAs: externalRecordRefSchema.optional(),
2917
+ position: strongRefSchema.optional(),
2918
+ startedAt: partialDateSchema.optional(),
2919
+ endedAt: partialDateSchema.optional(),
2920
+ labels: selfLabelsSchema.optional(),
2921
+ createdAt: datetimeSchema
2922
+ });
2923
+
2924
+ // src/schemas/profile-involvement.ts
2925
+ var ArtifactLinkSchema = zod.z.object({
2926
+ url: uriSchema,
2927
+ kind: zod.z.string().optional(),
2928
+ label: zod.z.string().refine(maxGraphemes(200)).max(2e3).optional()
2929
+ }).passthrough();
2930
+ zod.z.object({
2931
+ kind: zod.z.string(),
2932
+ upstream: zod.z.string().refine(maxGraphemes(256)).max(2560).optional(),
2933
+ upstreamDid: didSchema.optional(),
2934
+ upstreamUrl: uriSchema.optional(),
2935
+ role: zod.z.string().refine(maxGraphemes(256)).max(2560).optional(),
2936
+ description: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
2937
+ startedAt: partialDateSchema.optional(),
2938
+ endedAt: partialDateSchema.optional(),
2939
+ links: zod.z.array(ArtifactLinkSchema).max(50).optional(),
2940
+ // Portable org entity identifier (Wikidata/ROR/LEI URI) from the resolver
2941
+ // typeahead, constrained to http(s) so a script scheme is never a valid ref.
2942
+ entityRef: zod.z.string().url().refine((s) => /^https?:\/\//i.test(s), { message: "entityRef must be an http(s) URL" }).max(2048).optional(),
2943
+ // community.lexicon.location.address — validated at the app layer.
2944
+ location: zod.z.unknown().optional(),
2945
+ // id.sifa.defs#skillRef references (at-uri to a skill record in the same repo).
2946
+ skills: zod.z.array(zod.z.object({ uri: zod.z.string() })).max(50).optional(),
2947
+ labels: selfLabelsSchema.optional(),
2948
+ collaborators: zod.z.array(projectMemberRefSchema).max(50).optional(),
2949
+ sameAs: externalRecordRefSchema.optional(),
2950
+ createdAt: datetimeSchema
2951
+ }).passthrough();
2952
+
2953
+ // src/schemas/profile-investment.ts
2954
+ var entityRefField = zod.z.string().url().refine((s) => /^https?:\/\//i.test(s), { message: "entityRef must be an http(s) URL" }).max(2048).optional();
2955
+ var InvestmentAmountSchema = zod.z.object({
2956
+ /** Whole major currency units (euros, not cents). Cheque sizes are round numbers. */
2957
+ value: zod.z.number().int().min(0),
2958
+ /** ISO 4217 three-letter code, uppercase. */
2959
+ currency: zod.z.string().length(3)
2960
+ });
2961
+ var PROFILE_INVESTMENT_NSID = "id.sifa.profile.investment";
2962
+ zod.z.object({
2963
+ /** For a limited-partner entry this names the fund, not a portfolio company. */
2964
+ company: zod.z.string().min(1).refine(maxGraphemes(256)).max(2560),
2965
+ companyDid: didSchema.optional(),
2966
+ entityRef: entityRefField,
2967
+ role: zod.z.string().optional(),
2968
+ stage: zod.z.string().optional(),
2969
+ status: zod.z.string().optional(),
2970
+ /** The vehicle the capital went through. Absent for a cheque in the person's own name. */
2971
+ via: zod.z.string().refine(maxGraphemes(256)).max(2560).optional(),
2972
+ viaDid: didSchema.optional(),
2973
+ viaEntityRef: entityRefField,
2974
+ /**
2975
+ * Optional and empty by default. Cheque size is a personal financial disclosure,
2976
+ * and clients must not prompt for it.
2977
+ */
2978
+ amount: InvestmentAmountSchema.optional(),
2979
+ startedAt: partialDateSchema.optional(),
2980
+ endedAt: partialDateSchema.optional(),
2981
+ description: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
2982
+ links: zod.z.array(ArtifactLinkSchema).max(50).optional(),
2983
+ labels: selfLabelsSchema.optional(),
2984
+ createdAt: datetimeSchema
2985
+ }).passthrough();
2986
+
2987
+ // src/query/fetchers/investments.ts
2988
+ function createInvestment(config, data, options = {}) {
2989
+ return createRecord(config, PROFILE_INVESTMENT_NSID, data, options);
2990
+ }
2991
+ function updateInvestment(config, rkey, data, options = {}) {
2992
+ return updateRecord(config, PROFILE_INVESTMENT_NSID, rkey, data, options);
2993
+ }
2994
+ function deleteInvestment(config, rkey, options = {}) {
2995
+ return deleteRecord(config, PROFILE_INVESTMENT_NSID, rkey, options);
2996
+ }
2997
+
2998
+ // src/query/hooks/use-investment-mutations.ts
2999
+ function useCreateInvestment(ownerDid, options) {
3000
+ const config = useSifaConfig();
3001
+ const queryClient = reactQuery.useQueryClient();
3002
+ return reactQuery.useMutation({
3003
+ // Spread first: a consumer-supplied onSuccess would otherwise replace the handler
3004
+ // below and silently drop cache invalidation. The handler forwards to it instead.
3005
+ ...options,
3006
+ mutationFn: (data) => createInvestment(config, data),
3007
+ onSuccess: async (result, variables, onMutateResult, context) => {
3008
+ if (result.success) {
3009
+ await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.profile.byHandle(ownerDid) });
3010
+ }
3011
+ await options?.onSuccess?.(result, variables, onMutateResult, context);
3012
+ }
3013
+ });
3014
+ }
3015
+ function useUpdateInvestment(ownerDid, options) {
3016
+ const config = useSifaConfig();
3017
+ const queryClient = reactQuery.useQueryClient();
3018
+ return reactQuery.useMutation({
3019
+ // Spread first: a consumer-supplied onSuccess would otherwise replace the handler
3020
+ // below and silently drop cache invalidation. The handler forwards to it instead.
3021
+ ...options,
3022
+ mutationFn: ({ rkey, data }) => updateInvestment(config, rkey, data),
3023
+ onSuccess: async (result, variables, onMutateResult, context) => {
3024
+ if (result.success) {
3025
+ await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.profile.byHandle(ownerDid) });
3026
+ }
3027
+ await options?.onSuccess?.(result, variables, onMutateResult, context);
3028
+ }
3029
+ });
3030
+ }
3031
+ function useDeleteInvestment(ownerDid, options) {
3032
+ const config = useSifaConfig();
3033
+ const queryClient = reactQuery.useQueryClient();
3034
+ return reactQuery.useMutation({
3035
+ // Spread first: a consumer-supplied onSuccess would otherwise replace the handler
3036
+ // below and silently drop cache invalidation. The handler forwards to it instead.
3037
+ ...options,
3038
+ mutationFn: (rkey) => deleteInvestment(config, rkey),
3039
+ onSuccess: async (result, variables, onMutateResult, context) => {
3040
+ if (result.success) {
3041
+ await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.profile.byHandle(ownerDid) });
3042
+ }
3043
+ await options?.onSuccess?.(result, variables, onMutateResult, context);
3044
+ }
3045
+ });
3046
+ }
2862
3047
 
2863
3048
  exports.SifaProvider = SifaProvider;
2864
3049
  exports.sifaQueryKeys = sifaQueryKeys;
@@ -2881,6 +3066,7 @@ exports.useCreateConfirmation = useCreateConfirmation;
2881
3066
  exports.useCreateEducation = useCreateEducation;
2882
3067
  exports.useCreateEndorsement = useCreateEndorsement;
2883
3068
  exports.useCreateExternalAccount = useCreateExternalAccount;
3069
+ exports.useCreateInvestment = useCreateInvestment;
2884
3070
  exports.useCreatePosition = useCreatePosition;
2885
3071
  exports.useCreateProfileLocation = useCreateProfileLocation;
2886
3072
  exports.useCreateReaction = useCreateReaction;
@@ -2891,6 +3077,7 @@ exports.useDeleteAccount = useDeleteAccount;
2891
3077
  exports.useDeleteAvatarOverride = useDeleteAvatarOverride;
2892
3078
  exports.useDeleteEducation = useDeleteEducation;
2893
3079
  exports.useDeleteExternalAccount = useDeleteExternalAccount;
3080
+ exports.useDeleteInvestment = useDeleteInvestment;
2894
3081
  exports.useDeletePosition = useDeletePosition;
2895
3082
  exports.useDeleteProfileLocation = useDeleteProfileLocation;
2896
3083
  exports.useDeleteReaction = useDeleteReaction;
@@ -2963,6 +3150,7 @@ exports.useUnsetExternalAccountPrimary = useUnsetExternalAccountPrimary;
2963
3150
  exports.useUnsetPositionPrimary = useUnsetPositionPrimary;
2964
3151
  exports.useUpdateEducation = useUpdateEducation;
2965
3152
  exports.useUpdateExternalAccount = useUpdateExternalAccount;
3153
+ exports.useUpdateInvestment = useUpdateInvestment;
2966
3154
  exports.useUpdateOrgProfile = useUpdateOrgProfile;
2967
3155
  exports.useUpdatePosition = useUpdatePosition;
2968
3156
  exports.useUpdateProfileLocation = useUpdateProfileLocation;