@singi-labs/sifa-sdk 0.12.69 → 0.12.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.
@@ -2859,19 +2859,140 @@ 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();
2862
2986
 
2863
2987
  // src/query/fetchers/investments.ts
2864
2988
  function createInvestment(config, data, options = {}) {
2865
- return apiWriteCreate(config, "/api/profile/investment", data, options);
2989
+ return createRecord(config, PROFILE_INVESTMENT_NSID, data, options);
2866
2990
  }
2867
2991
  function updateInvestment(config, rkey, data, options = {}) {
2868
- return apiWrite(config, `/api/profile/investment/${encodeURIComponent(rkey)}`, "PUT", {
2869
- body: data,
2870
- ...options
2871
- });
2992
+ return updateRecord(config, PROFILE_INVESTMENT_NSID, rkey, data, options);
2872
2993
  }
2873
2994
  function deleteInvestment(config, rkey, options = {}) {
2874
- return apiWrite(config, `/api/profile/investment/${encodeURIComponent(rkey)}`, "DELETE", options);
2995
+ return deleteRecord(config, PROFILE_INVESTMENT_NSID, rkey, options);
2875
2996
  }
2876
2997
 
2877
2998
  // src/query/hooks/use-investment-mutations.ts