@singi-labs/sifa-sdk 0.19.7 → 0.19.9
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/atproto/index.cjs +19 -0
- package/dist/atproto/index.cjs.map +1 -1
- package/dist/atproto/index.d.cts +42 -2
- package/dist/atproto/index.d.ts +42 -2
- package/dist/atproto/index.js +19 -1
- package/dist/atproto/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/jsonld/index.cjs +14 -7
- package/dist/jsonld/index.cjs.map +1 -1
- package/dist/jsonld/index.js +14 -7
- package/dist/jsonld/index.js.map +1 -1
- package/package.json +1 -1
package/dist/atproto/index.cjs
CHANGED
|
@@ -19,7 +19,26 @@ function followUser(agent, subjectDid) {
|
|
|
19
19
|
function unfollowUser(agent, followUri) {
|
|
20
20
|
return agent.deleteFollow(followUri);
|
|
21
21
|
}
|
|
22
|
+
var ENDORSEMENT_CONFIRMATION_COLLECTION = "id.sifa.endorsement.confirmation";
|
|
23
|
+
async function createEndorsementConfirmation(agent, input) {
|
|
24
|
+
if (!agent.did) {
|
|
25
|
+
throw new Error("createEndorsementConfirmation requires an authenticated agent with a did");
|
|
26
|
+
}
|
|
27
|
+
const record = {
|
|
28
|
+
$type: ENDORSEMENT_CONFIRMATION_COLLECTION,
|
|
29
|
+
endorsement: input.endorsement,
|
|
30
|
+
...input.skill ? { skill: input.skill } : {},
|
|
31
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
32
|
+
};
|
|
33
|
+
const { data } = await agent.com.atproto.repo.createRecord({
|
|
34
|
+
repo: agent.did,
|
|
35
|
+
collection: ENDORSEMENT_CONFIRMATION_COLLECTION,
|
|
36
|
+
record
|
|
37
|
+
});
|
|
38
|
+
return { uri: data.uri, cid: data.cid };
|
|
39
|
+
}
|
|
22
40
|
|
|
41
|
+
exports.createEndorsementConfirmation = createEndorsementConfirmation;
|
|
23
42
|
exports.followUser = followUser;
|
|
24
43
|
exports.likeRecord = likeRecord;
|
|
25
44
|
exports.repostRecord = repostRecord;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/atproto/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../../src/atproto/index.ts"],"names":[],"mappings":";;;AAuCO,SAAS,UAAA,CAAW,OAA0B,OAAA,EAAwC;AAC3F,EAAA,OAAO,KAAA,CAAM,IAAA,CAAK,OAAA,CAAQ,GAAA,EAAK,QAAQ,GAAG,CAAA;AAC5C;AAGO,SAAS,YAAA,CAAa,OAA0B,OAAA,EAAgC;AACrF,EAAA,OAAO,KAAA,CAAM,WAAW,OAAO,CAAA;AACjC;AAMO,SAAS,YAAA,CAAa,OAA0B,OAAA,EAAwC;AAC7F,EAAA,OAAO,KAAA,CAAM,MAAA,CAAO,OAAA,CAAQ,GAAA,EAAK,QAAQ,GAAG,CAAA;AAC9C;AAGO,SAAS,cAAA,CAAe,OAA0B,SAAA,EAAkC;AACzF,EAAA,OAAO,KAAA,CAAM,aAAa,SAAS,CAAA;AACrC;AAMO,SAAS,UAAA,CAAW,OAA0B,UAAA,EAAwC;AAC3F,EAAA,OAAO,KAAA,CAAM,OAAO,UAAU,CAAA;AAChC;AAGO,SAAS,YAAA,CAAa,OAA0B,SAAA,EAAkC;AACvF,EAAA,OAAO,KAAA,CAAM,aAAa,SAAS,CAAA;AACrC;AAGA,IAAM,mCAAA,GAAsC,kCAAA;AAiC5C,eAAsB,6BAAA,CACpB,OACA,KAAA,EACoB;AACpB,EAAA,IAAI,CAAC,MAAM,GAAA,EAAK;AACd,IAAA,MAAM,IAAI,MAAM,0EAA0E,CAAA;AAAA,EAC5F;AACA,EAAA,MAAM,MAAA,GAAkC;AAAA,IACtC,KAAA,EAAO,mCAAA;AAAA,IACP,aAAa,KAAA,CAAM,WAAA;AAAA,IACnB,GAAI,MAAM,KAAA,GAAQ,EAAE,OAAO,KAAA,CAAM,KAAA,KAAU,EAAC;AAAA,IAC5C,SAAA,EAAA,iBAAW,IAAI,IAAA,EAAK,EAAE,WAAA;AAAY,GACpC;AACA,EAAA,MAAM,EAAE,MAAK,GAAI,MAAM,MAAM,GAAA,CAAI,OAAA,CAAQ,KAAK,YAAA,CAAa;AAAA,IACzD,MAAM,KAAA,CAAM,GAAA;AAAA,IACZ,UAAA,EAAY,mCAAA;AAAA,IACZ;AAAA,GACD,CAAA;AACD,EAAA,OAAO,EAAE,GAAA,EAAK,IAAA,CAAK,GAAA,EAAK,GAAA,EAAK,KAAK,GAAA,EAAI;AACxC","file":"index.cjs","sourcesContent":["/**\n * Direct-to-PDS write helpers for AT Protocol interactions (like, repost, follow,\n * endorsement confirmation).\n *\n * The native app performs OAuth on-device and holds its own authenticated agent,\n * then writes records directly to the user's PDS. These helpers are the shared,\n * typed service layer for those writes: the app passes its agent in, and the SDK\n * never constructs one itself. Reads stay on the sifa-api HTTP client (the rest\n * of this package); this subpath is the write side.\n *\n * Kept dependency-free: the agent is described structurally (below) rather than\n * imported from `@atproto/api`, so consuming this subpath adds no dependency.\n * The app's real `Agent` satisfies the structural type.\n */\n\n/** A strong reference to a record: its AT-URI and content id. */\nexport interface StrongRef {\n uri: string;\n cid: string;\n}\n\n/**\n * The subset of an authenticated AT Protocol agent (e.g. `@atproto/api`'s\n * `Agent`) that these write helpers use. Declared structurally so the SDK needs\n * no `@atproto/api` dependency.\n */\nexport interface AtprotoWriteAgent {\n like(uri: string, cid: string): Promise<StrongRef>;\n deleteLike(likeUri: string): Promise<void>;\n repost(uri: string, cid: string): Promise<StrongRef>;\n deleteRepost(repostUri: string): Promise<void>;\n follow(subjectDid: string): Promise<StrongRef>;\n deleteFollow(followUri: string): Promise<void>;\n}\n\n/**\n * Like a record. `subject` is the post being liked; the returned ref is the\n * like record itself, which {@link unlikeRecord} needs to undo it.\n */\nexport function likeRecord(agent: AtprotoWriteAgent, subject: StrongRef): Promise<StrongRef> {\n return agent.like(subject.uri, subject.cid);\n}\n\n/** Remove a like, given the like record's AT-URI (from {@link likeRecord}). */\nexport function unlikeRecord(agent: AtprotoWriteAgent, likeUri: string): Promise<void> {\n return agent.deleteLike(likeUri);\n}\n\n/**\n * Repost a record. `subject` is the post being reposted; the returned ref is the\n * repost record itself, which {@link unrepostRecord} needs to undo it.\n */\nexport function repostRecord(agent: AtprotoWriteAgent, subject: StrongRef): Promise<StrongRef> {\n return agent.repost(subject.uri, subject.cid);\n}\n\n/** Remove a repost, given the repost record's AT-URI (from {@link repostRecord}). */\nexport function unrepostRecord(agent: AtprotoWriteAgent, repostUri: string): Promise<void> {\n return agent.deleteRepost(repostUri);\n}\n\n/**\n * Follow an actor by DID. The returned ref is the follow record itself, which\n * {@link unfollowUser} needs to undo it.\n */\nexport function followUser(agent: AtprotoWriteAgent, subjectDid: string): Promise<StrongRef> {\n return agent.follow(subjectDid);\n}\n\n/** Unfollow, given the follow record's AT-URI (from {@link followUser}). */\nexport function unfollowUser(agent: AtprotoWriteAgent, followUri: string): Promise<void> {\n return agent.deleteFollow(followUri);\n}\n\n/** Collection NSID (and record `$type`) for an endorsement confirmation. */\nconst ENDORSEMENT_CONFIRMATION_COLLECTION = 'id.sifa.endorsement.confirmation';\n\n/**\n * The subset of an authenticated agent used to write a record to an arbitrary\n * collection. Convenience methods like {@link AtprotoWriteAgent.like} do not\n * cover custom `id.sifa.*` collections, so those go through `createRecord`.\n * Declared structurally so the SDK needs no `@atproto/api` dependency; the app's\n * real `Agent` satisfies it. `did` is the authenticated repo the record lands in.\n */\nexport interface AtprotoRecordWriteAgent {\n did?: string;\n com: {\n atproto: {\n repo: {\n createRecord(input: {\n repo: string;\n collection: string;\n record: Record<string, unknown>;\n }): Promise<{ data: { uri: string; cid: string } }>;\n };\n };\n };\n}\n\n/**\n * Confirm an endorsement by writing an `id.sifa.endorsement.confirmation` record\n * to the endorsee's own repository. `endorsement` is a strong ref to the\n * endorser's endorsement record. `skill` links the skill this endorsement\n * applies to: pass it when the endorsement proposed a skill the endorsee then\n * created, or when a proposed name matched a skill the endorsee already had (the\n * endorser cannot write to the endorsee's repo, so the skill record is theirs to\n * create and reference). The returned ref is the confirmation record itself.\n */\nexport async function createEndorsementConfirmation(\n agent: AtprotoRecordWriteAgent,\n input: { endorsement: StrongRef; skill?: StrongRef },\n): Promise<StrongRef> {\n if (!agent.did) {\n throw new Error('createEndorsementConfirmation requires an authenticated agent with a did');\n }\n const record: Record<string, unknown> = {\n $type: ENDORSEMENT_CONFIRMATION_COLLECTION,\n endorsement: input.endorsement,\n ...(input.skill ? { skill: input.skill } : {}),\n createdAt: new Date().toISOString(),\n };\n const { data } = await agent.com.atproto.repo.createRecord({\n repo: agent.did,\n collection: ENDORSEMENT_CONFIRMATION_COLLECTION,\n record,\n });\n return { uri: data.uri, cid: data.cid };\n}\n"]}
|
package/dist/atproto/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Direct-to-PDS write helpers for AT Protocol interactions (like, repost
|
|
2
|
+
* Direct-to-PDS write helpers for AT Protocol interactions (like, repost, follow,
|
|
3
|
+
* endorsement confirmation).
|
|
3
4
|
*
|
|
4
5
|
* The native app performs OAuth on-device and holds its own authenticated agent,
|
|
5
6
|
* then writes records directly to the user's PDS. These helpers are the shared,
|
|
@@ -50,5 +51,44 @@ declare function unrepostRecord(agent: AtprotoWriteAgent, repostUri: string): Pr
|
|
|
50
51
|
declare function followUser(agent: AtprotoWriteAgent, subjectDid: string): Promise<StrongRef>;
|
|
51
52
|
/** Unfollow, given the follow record's AT-URI (from {@link followUser}). */
|
|
52
53
|
declare function unfollowUser(agent: AtprotoWriteAgent, followUri: string): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* The subset of an authenticated agent used to write a record to an arbitrary
|
|
56
|
+
* collection. Convenience methods like {@link AtprotoWriteAgent.like} do not
|
|
57
|
+
* cover custom `id.sifa.*` collections, so those go through `createRecord`.
|
|
58
|
+
* Declared structurally so the SDK needs no `@atproto/api` dependency; the app's
|
|
59
|
+
* real `Agent` satisfies it. `did` is the authenticated repo the record lands in.
|
|
60
|
+
*/
|
|
61
|
+
interface AtprotoRecordWriteAgent {
|
|
62
|
+
did?: string;
|
|
63
|
+
com: {
|
|
64
|
+
atproto: {
|
|
65
|
+
repo: {
|
|
66
|
+
createRecord(input: {
|
|
67
|
+
repo: string;
|
|
68
|
+
collection: string;
|
|
69
|
+
record: Record<string, unknown>;
|
|
70
|
+
}): Promise<{
|
|
71
|
+
data: {
|
|
72
|
+
uri: string;
|
|
73
|
+
cid: string;
|
|
74
|
+
};
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Confirm an endorsement by writing an `id.sifa.endorsement.confirmation` record
|
|
82
|
+
* to the endorsee's own repository. `endorsement` is a strong ref to the
|
|
83
|
+
* endorser's endorsement record. `skill` links the skill this endorsement
|
|
84
|
+
* applies to: pass it when the endorsement proposed a skill the endorsee then
|
|
85
|
+
* created, or when a proposed name matched a skill the endorsee already had (the
|
|
86
|
+
* endorser cannot write to the endorsee's repo, so the skill record is theirs to
|
|
87
|
+
* create and reference). The returned ref is the confirmation record itself.
|
|
88
|
+
*/
|
|
89
|
+
declare function createEndorsementConfirmation(agent: AtprotoRecordWriteAgent, input: {
|
|
90
|
+
endorsement: StrongRef;
|
|
91
|
+
skill?: StrongRef;
|
|
92
|
+
}): Promise<StrongRef>;
|
|
53
93
|
|
|
54
|
-
export { type AtprotoWriteAgent, type StrongRef, followUser, likeRecord, repostRecord, unfollowUser, unlikeRecord, unrepostRecord };
|
|
94
|
+
export { type AtprotoRecordWriteAgent, type AtprotoWriteAgent, type StrongRef, createEndorsementConfirmation, followUser, likeRecord, repostRecord, unfollowUser, unlikeRecord, unrepostRecord };
|
package/dist/atproto/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Direct-to-PDS write helpers for AT Protocol interactions (like, repost
|
|
2
|
+
* Direct-to-PDS write helpers for AT Protocol interactions (like, repost, follow,
|
|
3
|
+
* endorsement confirmation).
|
|
3
4
|
*
|
|
4
5
|
* The native app performs OAuth on-device and holds its own authenticated agent,
|
|
5
6
|
* then writes records directly to the user's PDS. These helpers are the shared,
|
|
@@ -50,5 +51,44 @@ declare function unrepostRecord(agent: AtprotoWriteAgent, repostUri: string): Pr
|
|
|
50
51
|
declare function followUser(agent: AtprotoWriteAgent, subjectDid: string): Promise<StrongRef>;
|
|
51
52
|
/** Unfollow, given the follow record's AT-URI (from {@link followUser}). */
|
|
52
53
|
declare function unfollowUser(agent: AtprotoWriteAgent, followUri: string): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* The subset of an authenticated agent used to write a record to an arbitrary
|
|
56
|
+
* collection. Convenience methods like {@link AtprotoWriteAgent.like} do not
|
|
57
|
+
* cover custom `id.sifa.*` collections, so those go through `createRecord`.
|
|
58
|
+
* Declared structurally so the SDK needs no `@atproto/api` dependency; the app's
|
|
59
|
+
* real `Agent` satisfies it. `did` is the authenticated repo the record lands in.
|
|
60
|
+
*/
|
|
61
|
+
interface AtprotoRecordWriteAgent {
|
|
62
|
+
did?: string;
|
|
63
|
+
com: {
|
|
64
|
+
atproto: {
|
|
65
|
+
repo: {
|
|
66
|
+
createRecord(input: {
|
|
67
|
+
repo: string;
|
|
68
|
+
collection: string;
|
|
69
|
+
record: Record<string, unknown>;
|
|
70
|
+
}): Promise<{
|
|
71
|
+
data: {
|
|
72
|
+
uri: string;
|
|
73
|
+
cid: string;
|
|
74
|
+
};
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Confirm an endorsement by writing an `id.sifa.endorsement.confirmation` record
|
|
82
|
+
* to the endorsee's own repository. `endorsement` is a strong ref to the
|
|
83
|
+
* endorser's endorsement record. `skill` links the skill this endorsement
|
|
84
|
+
* applies to: pass it when the endorsement proposed a skill the endorsee then
|
|
85
|
+
* created, or when a proposed name matched a skill the endorsee already had (the
|
|
86
|
+
* endorser cannot write to the endorsee's repo, so the skill record is theirs to
|
|
87
|
+
* create and reference). The returned ref is the confirmation record itself.
|
|
88
|
+
*/
|
|
89
|
+
declare function createEndorsementConfirmation(agent: AtprotoRecordWriteAgent, input: {
|
|
90
|
+
endorsement: StrongRef;
|
|
91
|
+
skill?: StrongRef;
|
|
92
|
+
}): Promise<StrongRef>;
|
|
53
93
|
|
|
54
|
-
export { type AtprotoWriteAgent, type StrongRef, followUser, likeRecord, repostRecord, unfollowUser, unlikeRecord, unrepostRecord };
|
|
94
|
+
export { type AtprotoRecordWriteAgent, type AtprotoWriteAgent, type StrongRef, createEndorsementConfirmation, followUser, likeRecord, repostRecord, unfollowUser, unlikeRecord, unrepostRecord };
|
package/dist/atproto/index.js
CHANGED
|
@@ -17,7 +17,25 @@ function followUser(agent, subjectDid) {
|
|
|
17
17
|
function unfollowUser(agent, followUri) {
|
|
18
18
|
return agent.deleteFollow(followUri);
|
|
19
19
|
}
|
|
20
|
+
var ENDORSEMENT_CONFIRMATION_COLLECTION = "id.sifa.endorsement.confirmation";
|
|
21
|
+
async function createEndorsementConfirmation(agent, input) {
|
|
22
|
+
if (!agent.did) {
|
|
23
|
+
throw new Error("createEndorsementConfirmation requires an authenticated agent with a did");
|
|
24
|
+
}
|
|
25
|
+
const record = {
|
|
26
|
+
$type: ENDORSEMENT_CONFIRMATION_COLLECTION,
|
|
27
|
+
endorsement: input.endorsement,
|
|
28
|
+
...input.skill ? { skill: input.skill } : {},
|
|
29
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
30
|
+
};
|
|
31
|
+
const { data } = await agent.com.atproto.repo.createRecord({
|
|
32
|
+
repo: agent.did,
|
|
33
|
+
collection: ENDORSEMENT_CONFIRMATION_COLLECTION,
|
|
34
|
+
record
|
|
35
|
+
});
|
|
36
|
+
return { uri: data.uri, cid: data.cid };
|
|
37
|
+
}
|
|
20
38
|
|
|
21
|
-
export { followUser, likeRecord, repostRecord, unfollowUser, unlikeRecord, unrepostRecord };
|
|
39
|
+
export { createEndorsementConfirmation, followUser, likeRecord, repostRecord, unfollowUser, unlikeRecord, unrepostRecord };
|
|
22
40
|
//# sourceMappingURL=index.js.map
|
|
23
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/atproto/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../src/atproto/index.ts"],"names":[],"mappings":";AAuCO,SAAS,UAAA,CAAW,OAA0B,OAAA,EAAwC;AAC3F,EAAA,OAAO,KAAA,CAAM,IAAA,CAAK,OAAA,CAAQ,GAAA,EAAK,QAAQ,GAAG,CAAA;AAC5C;AAGO,SAAS,YAAA,CAAa,OAA0B,OAAA,EAAgC;AACrF,EAAA,OAAO,KAAA,CAAM,WAAW,OAAO,CAAA;AACjC;AAMO,SAAS,YAAA,CAAa,OAA0B,OAAA,EAAwC;AAC7F,EAAA,OAAO,KAAA,CAAM,MAAA,CAAO,OAAA,CAAQ,GAAA,EAAK,QAAQ,GAAG,CAAA;AAC9C;AAGO,SAAS,cAAA,CAAe,OAA0B,SAAA,EAAkC;AACzF,EAAA,OAAO,KAAA,CAAM,aAAa,SAAS,CAAA;AACrC;AAMO,SAAS,UAAA,CAAW,OAA0B,UAAA,EAAwC;AAC3F,EAAA,OAAO,KAAA,CAAM,OAAO,UAAU,CAAA;AAChC;AAGO,SAAS,YAAA,CAAa,OAA0B,SAAA,EAAkC;AACvF,EAAA,OAAO,KAAA,CAAM,aAAa,SAAS,CAAA;AACrC;AAGA,IAAM,mCAAA,GAAsC,kCAAA;AAiC5C,eAAsB,6BAAA,CACpB,OACA,KAAA,EACoB;AACpB,EAAA,IAAI,CAAC,MAAM,GAAA,EAAK;AACd,IAAA,MAAM,IAAI,MAAM,0EAA0E,CAAA;AAAA,EAC5F;AACA,EAAA,MAAM,MAAA,GAAkC;AAAA,IACtC,KAAA,EAAO,mCAAA;AAAA,IACP,aAAa,KAAA,CAAM,WAAA;AAAA,IACnB,GAAI,MAAM,KAAA,GAAQ,EAAE,OAAO,KAAA,CAAM,KAAA,KAAU,EAAC;AAAA,IAC5C,SAAA,EAAA,iBAAW,IAAI,IAAA,EAAK,EAAE,WAAA;AAAY,GACpC;AACA,EAAA,MAAM,EAAE,MAAK,GAAI,MAAM,MAAM,GAAA,CAAI,OAAA,CAAQ,KAAK,YAAA,CAAa;AAAA,IACzD,MAAM,KAAA,CAAM,GAAA;AAAA,IACZ,UAAA,EAAY,mCAAA;AAAA,IACZ;AAAA,GACD,CAAA;AACD,EAAA,OAAO,EAAE,GAAA,EAAK,IAAA,CAAK,GAAA,EAAK,GAAA,EAAK,KAAK,GAAA,EAAI;AACxC","file":"index.js","sourcesContent":["/**\n * Direct-to-PDS write helpers for AT Protocol interactions (like, repost, follow,\n * endorsement confirmation).\n *\n * The native app performs OAuth on-device and holds its own authenticated agent,\n * then writes records directly to the user's PDS. These helpers are the shared,\n * typed service layer for those writes: the app passes its agent in, and the SDK\n * never constructs one itself. Reads stay on the sifa-api HTTP client (the rest\n * of this package); this subpath is the write side.\n *\n * Kept dependency-free: the agent is described structurally (below) rather than\n * imported from `@atproto/api`, so consuming this subpath adds no dependency.\n * The app's real `Agent` satisfies the structural type.\n */\n\n/** A strong reference to a record: its AT-URI and content id. */\nexport interface StrongRef {\n uri: string;\n cid: string;\n}\n\n/**\n * The subset of an authenticated AT Protocol agent (e.g. `@atproto/api`'s\n * `Agent`) that these write helpers use. Declared structurally so the SDK needs\n * no `@atproto/api` dependency.\n */\nexport interface AtprotoWriteAgent {\n like(uri: string, cid: string): Promise<StrongRef>;\n deleteLike(likeUri: string): Promise<void>;\n repost(uri: string, cid: string): Promise<StrongRef>;\n deleteRepost(repostUri: string): Promise<void>;\n follow(subjectDid: string): Promise<StrongRef>;\n deleteFollow(followUri: string): Promise<void>;\n}\n\n/**\n * Like a record. `subject` is the post being liked; the returned ref is the\n * like record itself, which {@link unlikeRecord} needs to undo it.\n */\nexport function likeRecord(agent: AtprotoWriteAgent, subject: StrongRef): Promise<StrongRef> {\n return agent.like(subject.uri, subject.cid);\n}\n\n/** Remove a like, given the like record's AT-URI (from {@link likeRecord}). */\nexport function unlikeRecord(agent: AtprotoWriteAgent, likeUri: string): Promise<void> {\n return agent.deleteLike(likeUri);\n}\n\n/**\n * Repost a record. `subject` is the post being reposted; the returned ref is the\n * repost record itself, which {@link unrepostRecord} needs to undo it.\n */\nexport function repostRecord(agent: AtprotoWriteAgent, subject: StrongRef): Promise<StrongRef> {\n return agent.repost(subject.uri, subject.cid);\n}\n\n/** Remove a repost, given the repost record's AT-URI (from {@link repostRecord}). */\nexport function unrepostRecord(agent: AtprotoWriteAgent, repostUri: string): Promise<void> {\n return agent.deleteRepost(repostUri);\n}\n\n/**\n * Follow an actor by DID. The returned ref is the follow record itself, which\n * {@link unfollowUser} needs to undo it.\n */\nexport function followUser(agent: AtprotoWriteAgent, subjectDid: string): Promise<StrongRef> {\n return agent.follow(subjectDid);\n}\n\n/** Unfollow, given the follow record's AT-URI (from {@link followUser}). */\nexport function unfollowUser(agent: AtprotoWriteAgent, followUri: string): Promise<void> {\n return agent.deleteFollow(followUri);\n}\n\n/** Collection NSID (and record `$type`) for an endorsement confirmation. */\nconst ENDORSEMENT_CONFIRMATION_COLLECTION = 'id.sifa.endorsement.confirmation';\n\n/**\n * The subset of an authenticated agent used to write a record to an arbitrary\n * collection. Convenience methods like {@link AtprotoWriteAgent.like} do not\n * cover custom `id.sifa.*` collections, so those go through `createRecord`.\n * Declared structurally so the SDK needs no `@atproto/api` dependency; the app's\n * real `Agent` satisfies it. `did` is the authenticated repo the record lands in.\n */\nexport interface AtprotoRecordWriteAgent {\n did?: string;\n com: {\n atproto: {\n repo: {\n createRecord(input: {\n repo: string;\n collection: string;\n record: Record<string, unknown>;\n }): Promise<{ data: { uri: string; cid: string } }>;\n };\n };\n };\n}\n\n/**\n * Confirm an endorsement by writing an `id.sifa.endorsement.confirmation` record\n * to the endorsee's own repository. `endorsement` is a strong ref to the\n * endorser's endorsement record. `skill` links the skill this endorsement\n * applies to: pass it when the endorsement proposed a skill the endorsee then\n * created, or when a proposed name matched a skill the endorsee already had (the\n * endorser cannot write to the endorsee's repo, so the skill record is theirs to\n * create and reference). The returned ref is the confirmation record itself.\n */\nexport async function createEndorsementConfirmation(\n agent: AtprotoRecordWriteAgent,\n input: { endorsement: StrongRef; skill?: StrongRef },\n): Promise<StrongRef> {\n if (!agent.did) {\n throw new Error('createEndorsementConfirmation requires an authenticated agent with a did');\n }\n const record: Record<string, unknown> = {\n $type: ENDORSEMENT_CONFIRMATION_COLLECTION,\n endorsement: input.endorsement,\n ...(input.skill ? { skill: input.skill } : {}),\n createdAt: new Date().toISOString(),\n };\n const { data } = await agent.com.atproto.repo.createRecord({\n repo: agent.did,\n collection: ENDORSEMENT_CONFIRMATION_COLLECTION,\n record,\n });\n return { uri: data.uri, cid: data.cid };\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -6447,7 +6447,7 @@ function describeSifaRecord(collection, value) {
|
|
|
6447
6447
|
}
|
|
6448
6448
|
|
|
6449
6449
|
// src/index.ts
|
|
6450
|
-
var SIFA_SDK_VERSION = "0.19.
|
|
6450
|
+
var SIFA_SDK_VERSION = "0.19.9";
|
|
6451
6451
|
|
|
6452
6452
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
6453
6453
|
exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
|
package/dist/index.js
CHANGED
|
@@ -6445,7 +6445,7 @@ function describeSifaRecord(collection, value) {
|
|
|
6445
6445
|
}
|
|
6446
6446
|
|
|
6447
6447
|
// src/index.ts
|
|
6448
|
-
var SIFA_SDK_VERSION = "0.19.
|
|
6448
|
+
var SIFA_SDK_VERSION = "0.19.9";
|
|
6449
6449
|
|
|
6450
6450
|
export { ACTIVITY_TIERS, ACTIVITY_VERBS, ACTIVITY_VISIBILITY_RULES, ADULT_CONTENT_LABELS, ALL_SECTIONS, APP_CATEGORIES, APP_CATEGORY_IDS, APP_CATEGORY_MAP, APP_URL_PATTERNS, ARTIFACT_LINK_KIND_LABELS, ARTIFACT_LINK_KIND_OPTIONS, ArtifactLinkSchema, AtmosphereFeedItemSchema, BlobRefSchema, CALENDAR_EVENT_MODE_LABELS, CALENDAR_EVENT_STATUS_LABELS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPANY_OPTIONAL_EMPLOYMENT_TYPES, COMPANY_PAGE_MIN_FIRMOGRAPHIC_FIELDS, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, ENTITY_REF_ANCHORS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, EntityImportSearchResponseSchema, EntityMintDomainResponseSchema, EntityResolveDomainRequestSchema, EntityResolveDomainResponseSchema, EntitySearchResponseSchema, EntitySearchResultSchema, EntitySelectRequestSchema, EntitySelectResponseSchema, FEATURE_FLAGS, FeatureAllowlistEntrySchema, FeedActorSchema, FollowFeedItemSchema, FollowFeedPageSchema, FollowProfilePageSchema, FollowProfileSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, INVESTMENT_ROLE_LABELS, INVESTMENT_ROLE_OPTIONS, INVESTMENT_STAGE_LABELS, INVESTMENT_STAGE_OPTIONS, INVESTMENT_STATUS_LABELS, INVESTMENT_STATUS_OPTIONS, INVOLVEMENT_HEADING_ORDER, INVOLVEMENT_KIND_HEADINGS, INVOLVEMENT_KIND_LABELS, INVOLVEMENT_KIND_OPTIONS, InvestmentAmountSchema, MIN_SKILLS, ON_BEHALF_OF_EMPLOYMENT_TYPES, OPEN_TO_OPTIONS, OPEN_TO_TOKENS, OPEN_TO_TOKEN_TO_VALUE, OPEN_TO_VALUE_TO_TOKEN, OrgEmploymentAttestationRecordSchema, OrgProfileRecordSchema, PLATFORM_LABELS, PLATFORM_OPTIONS, PRESENTATION_LINK_TYPE_LABELS, PRESENTATION_LINK_TYPE_OPTIONS, PRESENTATION_ROLE_LABELS, PRESENTATION_ROLE_OPTIONS, PROFILE_INVESTMENT_NSID, PROFILE_INVOLVEMENT_NSID, PROJECT_ROLES, PUBLICATION_TYPE_LABELS, PUBLICATION_TYPE_OPTIONS, PUBLISHERS, PresentationDurationSchema, PresentationLinkSchema, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileInvestmentRecordSchema, ProfileInvolvementRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfilePresentationDeliveryRecordSchema, ProfilePresentationRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, ROADMAP_ISSUES_REPO, ROADMAP_ITEM_META, SECTION_GROUPS, SECTION_LABELS, SELF_APP_ID, SIFA_REPO_GROUPS, SIFA_SDK_VERSION, SKILL_CATEGORIES, STANDARD_PUBLISHER_ID, STREAM_VERBS, SifaFeedItemSchema, VERIFICATION_PROVIDERS, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, actorShowsIdentity, agentRefSchema, atUriSchema, buildMetaDescription, buildProfileHighlights, buildTalkSlug, categoryForApp, certDateExtractor, cidSchema, classifyEntityRef, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countRecentActivity, countryCodeToFlag, dateRangeExtractor, datetimeSchema, decodeFeedCursor, dedupeSkills, describeSifaRecord, detectPdsProvider, didSchema, dimensionsFromInputs, durationFromMinutes, encodeFeedCursor, entityDisambiguationLabel, entityResultKey, excludeSelfApp, externalRecordRefSchema, filterHidden, findIndustry, formatCompanyName, formatDateRange, formatDisplayUrl, formatDistanceToNow, formatEventDate, formatLocation, formatPresentationDuration, formatRelativeTime, formatSingleDate, formatSpanDate, formatTimelineDate, getActivityTaxonomyVersion, getActivityTier, getActivityVerbsVersion, getAppCategoryIcon, getAppIdForCollection, getArtifactLinkKindLabel, getCalendarEventModeLabel, getCalendarEventStatusLabel, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getInvestmentRoleLabel, getInvestmentStageLabel, getInvestmentStatusLabel, getInvolvementKindHeading, getInvolvementKindLabel, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getPresentationLinkTypeLabel, getPresentationRoleLabel, getPublicationTypeLabel, getPublisherByHost, getPublisherById, getPublisherFromSiteUrl, getTierMeta, getVerificationProvider, getVisibleSectionIds, getWorkplaceTypeLabel, groupInvolvementByHeading, groupSkillsByCategory, groupSkillsBySubCategory, groupSkillsForDisplay, hasAdultContent, hasPersonalProfileContent, hoistPrimary, isAppCategory, isCompanyPageIndexable, isCompanyRequired, isKnownAppId, isKnownPlatform, isKnownVerificationProvider, isLinked, isOnBehalfOfApplicable, isPseudoEmployer, isRegistrableDomainHandle, isRoleLineRedundant, isSectionPopulated, isValidRgbColor, isVisibleActivityItem, languageTagSchema, lexiconDateExtractor, limitCombiningMarks, locationSegments, looksLikeDomain, makeGraphFollowRecordSchema, maxGraphemes, meetsContrastAA, normalizeCompanyKey, normalizeDoi, normalizeLegalForm, normalizeOpenTo, normalizePlatformId, normalizePresentationMode, normalizePresentationRole, normalizeSkillCategory, normalizeWorkplaceTypes, openToTokenToValue, openToValueToToken, parseIntendedAudiences, parseLocationString, parsePresentationDuration, parseTalkRkey, partialDateSchema, pdsProviderFromApi, pickPrimaryFlagged, pickPrimaryPosition, presentationCsvRowToRecord, presentationDeliveryCsvRowToRecord, primaryVerification, profileToDimensionInputs, qualifiesAsOrg, relativeLuminance, rendersCompanyProfile, rendersPersonalProfile, repoGroupForCollection, resolveAccountFacetMode, resolveAgentRef, resolveCardHealth, resolveCardUrl, resolveEmbed, resolveVerifierProvider, rgbToString, roadmapIssueUrl, sanitizeDisplayText, sanitizeHandleInput, searchResultDisambiguation, selfLabelsSchema, shouldRenderHighlights, singleDateExtractor, skillRefSchema, slugifyTitle, sortByActiveDateRange, sortByDateDesc, sortCertifications, sortEducation, sortHonors, sortLanguages, sortLanguagesByProficiency, sortPositions, sortProjects, sortPublications, streamAddressSchema, streamAuthorSchema, streamCardBodySchema, streamCardSubjectSchema, streamCardVMSchema, streamExternalLinkSchema, streamGeoSchema, streamMediaSchema, streamRichSegmentSchema, streamSourceSchema, streamThemeSchema, streamVerbSchema, stripHtmlToText, strongRefSchema, summarizePresentationDeliveries, summarizeProfileView, toStreamCardVM, toStreamCardVMs, truncateGraphemes, uriSchema, verbForCollection, visibleItems, youtubeThumbnailUrl, youtubeVideoId };
|
|
6451
6451
|
//# sourceMappingURL=index.js.map
|
package/dist/jsonld/index.cjs
CHANGED
|
@@ -285,6 +285,13 @@ var term_mappings_default = {
|
|
|
285
285
|
match: "exactMatch",
|
|
286
286
|
terms: ["bibo:abstract", "schema:abstract"]
|
|
287
287
|
},
|
|
288
|
+
{
|
|
289
|
+
lexicon: "id.sifa.profile.publication",
|
|
290
|
+
field: "doi",
|
|
291
|
+
match: "exactMatch",
|
|
292
|
+
terms: ["bibo:doi", "prism:doi"],
|
|
293
|
+
note: "schema:identifier with a PropertyValue of propertyID 'doi' is the JSON-LD serialization; bibo:doi is the direct term."
|
|
294
|
+
},
|
|
288
295
|
{
|
|
289
296
|
lexicon: "id.sifa.profile.publication",
|
|
290
297
|
field: "publishedAt",
|
|
@@ -309,6 +316,13 @@ var term_mappings_default = {
|
|
|
309
316
|
match: "exactMatch",
|
|
310
317
|
terms: ["dcterms:title", "schema:name"]
|
|
311
318
|
},
|
|
319
|
+
{
|
|
320
|
+
lexicon: "id.sifa.profile.publication",
|
|
321
|
+
field: "type",
|
|
322
|
+
match: "closeMatch",
|
|
323
|
+
terms: ["dcterms:type", "schema:additionalType"],
|
|
324
|
+
note: "COAR Resource Types is the anchor a consumer should map to. The values here are ORCID's because that is the vocabulary the data arrives in; deviating from the id.sifa.defs token convention is deliberate, since the vocabulary is ORCID's rather than Sifa's."
|
|
325
|
+
},
|
|
312
326
|
{
|
|
313
327
|
lexicon: "id.sifa.profile.publication",
|
|
314
328
|
field: "url",
|
|
@@ -372,13 +386,6 @@ var term_mappings_default = {
|
|
|
372
386
|
lexicon: "id.sifa.profile.volunteering",
|
|
373
387
|
match: "closeMatch",
|
|
374
388
|
terms: ["org:Membership", "schema:OrganizationRole"]
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
lexicon: "id.sifa.profile.publication",
|
|
378
|
-
field: "doi",
|
|
379
|
-
terms: ["bibo:doi", "prism:doi"],
|
|
380
|
-
match: "exactMatch",
|
|
381
|
-
note: "Present on the AppView view type (ORCID-sourced), not yet on the id.sifa.profile.publication lexicon, so user-authored publications cannot carry one."
|
|
382
389
|
}
|
|
383
390
|
],
|
|
384
391
|
unmapped: [
|