@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.
- package/dist/index.cjs +23 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/jsonld/index.cjs +444 -457
- package/dist/jsonld/index.cjs.map +1 -1
- package/dist/jsonld/index.d.cts +31 -17
- package/dist/jsonld/index.d.ts +31 -17
- package/dist/jsonld/index.js +444 -457
- package/dist/jsonld/index.js.map +1 -1
- package/dist/{profile-investment-DmtsZK8d.d.cts → profile-investment-C97ssnBV.d.cts} +3 -1
- package/dist/{profile-investment-DmtsZK8d.d.ts → profile-investment-C97ssnBV.d.ts} +3 -1
- package/dist/query/fetchers/index.cjs +127 -6
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.cts +6 -8
- package/dist/query/fetchers/index.d.ts +6 -8
- package/dist/query/fetchers/index.js +127 -6
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/hooks/index.cjs +127 -6
- package/dist/query/hooks/index.cjs.map +1 -1
- package/dist/query/hooks/index.js +127 -6
- package/dist/query/hooks/index.js.map +1 -1
- package/dist/schemas/index.cjs +2 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +1 -1
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.js +2 -1
- package/dist/schemas/index.js.map +1 -1
- package/package.json +3 -2
|
@@ -1548,19 +1548,140 @@ var sifaQueryKeys = {
|
|
|
1548
1548
|
wipePreview: () => ["sifa", "destructive", "wipe-preview"]
|
|
1549
1549
|
}
|
|
1550
1550
|
};
|
|
1551
|
+
function maxGraphemes(max) {
|
|
1552
|
+
return (value) => {
|
|
1553
|
+
const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
1554
|
+
let count = 0;
|
|
1555
|
+
for (const _ of segmenter.segment(value)) {
|
|
1556
|
+
count++;
|
|
1557
|
+
if (count > max) return false;
|
|
1558
|
+
}
|
|
1559
|
+
return true;
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1562
|
+
var didSchema = zod.z.string().regex(/^did:[a-z]+:[a-zA-Z0-9._:%-]+$/, "Invalid DID");
|
|
1563
|
+
var datetimeSchema = zod.z.string().datetime({ offset: true });
|
|
1564
|
+
var partialDateSchema = zod.z.string().regex(/^\d{4}(-\d{2}(-\d{2}(T.+)?)?)?$/, "Expected YYYY, YYYY-MM, YYYY-MM-DD, or a datetime");
|
|
1565
|
+
var atUriSchema = zod.z.string().regex(/^at:\/\/[^\s]+$/, "Invalid AT-URI");
|
|
1566
|
+
var cidSchema = zod.z.string().regex(/^(Qm[1-9A-HJ-NP-Za-km-z]{44}|b[A-Za-z0-9+/=]+)$/, "Invalid CID");
|
|
1567
|
+
zod.z.string().regex(/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/, "Invalid BCP 47 language tag");
|
|
1568
|
+
var uriSchema = zod.z.string().url();
|
|
1569
|
+
var strongRefSchema = zod.z.object({
|
|
1570
|
+
uri: atUriSchema,
|
|
1571
|
+
cid: cidSchema
|
|
1572
|
+
});
|
|
1573
|
+
zod.z.object({
|
|
1574
|
+
uri: atUriSchema
|
|
1575
|
+
});
|
|
1576
|
+
var externalRecordRefSchema = zod.z.object({
|
|
1577
|
+
uri: atUriSchema,
|
|
1578
|
+
cid: cidSchema.optional()
|
|
1579
|
+
});
|
|
1580
|
+
var selfLabelsSchema = zod.z.object({
|
|
1581
|
+
$type: zod.z.literal("com.atproto.label.defs#selfLabels").optional(),
|
|
1582
|
+
values: zod.z.array(zod.z.object({ val: zod.z.string() }))
|
|
1583
|
+
});
|
|
1584
|
+
var projectMemberRefSchema = zod.z.object({
|
|
1585
|
+
did: didSchema,
|
|
1586
|
+
role: zod.z.string().optional(),
|
|
1587
|
+
title: zod.z.string().refine(maxGraphemes(128)).max(1280).optional()
|
|
1588
|
+
});
|
|
1589
|
+
zod.z.object({
|
|
1590
|
+
name: zod.z.string().min(1).refine(maxGraphemes(256)).max(2560),
|
|
1591
|
+
description: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
|
|
1592
|
+
url: uriSchema.optional(),
|
|
1593
|
+
members: zod.z.array(projectMemberRefSchema).max(50).optional(),
|
|
1594
|
+
/**
|
|
1595
|
+
* The canonical `id.sifa.project.self` this personal entry corresponds to.
|
|
1596
|
+
* A composition link. For the same project recorded on someone else's
|
|
1597
|
+
* profile, see `sameAs`.
|
|
1598
|
+
*/
|
|
1599
|
+
projectRef: strongRefSchema.optional(),
|
|
1600
|
+
/**
|
|
1601
|
+
* The same project as recorded on another person's profile. Each side stays
|
|
1602
|
+
* its own record; this only says the two describe one thing. Resolves by
|
|
1603
|
+
* AT-URI, since they will keep editing their copy.
|
|
1604
|
+
*/
|
|
1605
|
+
sameAs: externalRecordRefSchema.optional(),
|
|
1606
|
+
position: strongRefSchema.optional(),
|
|
1607
|
+
startedAt: partialDateSchema.optional(),
|
|
1608
|
+
endedAt: partialDateSchema.optional(),
|
|
1609
|
+
labels: selfLabelsSchema.optional(),
|
|
1610
|
+
createdAt: datetimeSchema
|
|
1611
|
+
});
|
|
1612
|
+
|
|
1613
|
+
// src/schemas/profile-involvement.ts
|
|
1614
|
+
var ArtifactLinkSchema = zod.z.object({
|
|
1615
|
+
url: uriSchema,
|
|
1616
|
+
kind: zod.z.string().optional(),
|
|
1617
|
+
label: zod.z.string().refine(maxGraphemes(200)).max(2e3).optional()
|
|
1618
|
+
}).passthrough();
|
|
1619
|
+
zod.z.object({
|
|
1620
|
+
kind: zod.z.string(),
|
|
1621
|
+
upstream: zod.z.string().refine(maxGraphemes(256)).max(2560).optional(),
|
|
1622
|
+
upstreamDid: didSchema.optional(),
|
|
1623
|
+
upstreamUrl: uriSchema.optional(),
|
|
1624
|
+
role: zod.z.string().refine(maxGraphemes(256)).max(2560).optional(),
|
|
1625
|
+
description: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
|
|
1626
|
+
startedAt: partialDateSchema.optional(),
|
|
1627
|
+
endedAt: partialDateSchema.optional(),
|
|
1628
|
+
links: zod.z.array(ArtifactLinkSchema).max(50).optional(),
|
|
1629
|
+
// Portable org entity identifier (Wikidata/ROR/LEI URI) from the resolver
|
|
1630
|
+
// typeahead, constrained to http(s) so a script scheme is never a valid ref.
|
|
1631
|
+
entityRef: zod.z.string().url().refine((s) => /^https?:\/\//i.test(s), { message: "entityRef must be an http(s) URL" }).max(2048).optional(),
|
|
1632
|
+
// community.lexicon.location.address — validated at the app layer.
|
|
1633
|
+
location: zod.z.unknown().optional(),
|
|
1634
|
+
// id.sifa.defs#skillRef references (at-uri to a skill record in the same repo).
|
|
1635
|
+
skills: zod.z.array(zod.z.object({ uri: zod.z.string() })).max(50).optional(),
|
|
1636
|
+
labels: selfLabelsSchema.optional(),
|
|
1637
|
+
collaborators: zod.z.array(projectMemberRefSchema).max(50).optional(),
|
|
1638
|
+
sameAs: externalRecordRefSchema.optional(),
|
|
1639
|
+
createdAt: datetimeSchema
|
|
1640
|
+
}).passthrough();
|
|
1641
|
+
|
|
1642
|
+
// src/schemas/profile-investment.ts
|
|
1643
|
+
var entityRefField = zod.z.string().url().refine((s) => /^https?:\/\//i.test(s), { message: "entityRef must be an http(s) URL" }).max(2048).optional();
|
|
1644
|
+
var InvestmentAmountSchema = zod.z.object({
|
|
1645
|
+
/** Whole major currency units (euros, not cents). Cheque sizes are round numbers. */
|
|
1646
|
+
value: zod.z.number().int().min(0),
|
|
1647
|
+
/** ISO 4217 three-letter code, uppercase. */
|
|
1648
|
+
currency: zod.z.string().length(3)
|
|
1649
|
+
});
|
|
1650
|
+
var PROFILE_INVESTMENT_NSID = "id.sifa.profile.investment";
|
|
1651
|
+
zod.z.object({
|
|
1652
|
+
/** For a limited-partner entry this names the fund, not a portfolio company. */
|
|
1653
|
+
company: zod.z.string().min(1).refine(maxGraphemes(256)).max(2560),
|
|
1654
|
+
companyDid: didSchema.optional(),
|
|
1655
|
+
entityRef: entityRefField,
|
|
1656
|
+
role: zod.z.string().optional(),
|
|
1657
|
+
stage: zod.z.string().optional(),
|
|
1658
|
+
status: zod.z.string().optional(),
|
|
1659
|
+
/** The vehicle the capital went through. Absent for a cheque in the person's own name. */
|
|
1660
|
+
via: zod.z.string().refine(maxGraphemes(256)).max(2560).optional(),
|
|
1661
|
+
viaDid: didSchema.optional(),
|
|
1662
|
+
viaEntityRef: entityRefField,
|
|
1663
|
+
/**
|
|
1664
|
+
* Optional and empty by default. Cheque size is a personal financial disclosure,
|
|
1665
|
+
* and clients must not prompt for it.
|
|
1666
|
+
*/
|
|
1667
|
+
amount: InvestmentAmountSchema.optional(),
|
|
1668
|
+
startedAt: partialDateSchema.optional(),
|
|
1669
|
+
endedAt: partialDateSchema.optional(),
|
|
1670
|
+
description: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
|
|
1671
|
+
links: zod.z.array(ArtifactLinkSchema).max(50).optional(),
|
|
1672
|
+
labels: selfLabelsSchema.optional(),
|
|
1673
|
+
createdAt: datetimeSchema
|
|
1674
|
+
}).passthrough();
|
|
1551
1675
|
|
|
1552
1676
|
// src/query/fetchers/investments.ts
|
|
1553
1677
|
function createInvestment(config, data, options = {}) {
|
|
1554
|
-
return
|
|
1678
|
+
return createRecord(config, PROFILE_INVESTMENT_NSID, data, options);
|
|
1555
1679
|
}
|
|
1556
1680
|
function updateInvestment(config, rkey, data, options = {}) {
|
|
1557
|
-
return
|
|
1558
|
-
body: data,
|
|
1559
|
-
...options
|
|
1560
|
-
});
|
|
1681
|
+
return updateRecord(config, PROFILE_INVESTMENT_NSID, rkey, data, options);
|
|
1561
1682
|
}
|
|
1562
1683
|
function deleteInvestment(config, rkey, options = {}) {
|
|
1563
|
-
return
|
|
1684
|
+
return deleteRecord(config, PROFILE_INVESTMENT_NSID, rkey, options);
|
|
1564
1685
|
}
|
|
1565
1686
|
|
|
1566
1687
|
exports.ApiError = ApiError;
|