@agnocon/piece-bluesky 0.1.6

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 (67) hide show
  1. package/LICENSE.MIT-AP +24 -0
  2. package/dist/index.d.ts +8 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +32 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/actions/create-post.d.ts +21 -0
  7. package/dist/lib/actions/create-post.d.ts.map +1 -0
  8. package/dist/lib/actions/create-post.js +379 -0
  9. package/dist/lib/actions/create-post.js.map +1 -0
  10. package/dist/lib/actions/find-post.d.ts +8 -0
  11. package/dist/lib/actions/find-post.d.ts.map +1 -0
  12. package/dist/lib/actions/find-post.js +77 -0
  13. package/dist/lib/actions/find-post.js.map +1 -0
  14. package/dist/lib/actions/find-thread.d.ts +10 -0
  15. package/dist/lib/actions/find-thread.d.ts.map +1 -0
  16. package/dist/lib/actions/find-thread.js +117 -0
  17. package/dist/lib/actions/find-thread.js.map +1 -0
  18. package/dist/lib/actions/like-post.d.ts +14 -0
  19. package/dist/lib/actions/like-post.d.ts.map +1 -0
  20. package/dist/lib/actions/like-post.js +129 -0
  21. package/dist/lib/actions/like-post.js.map +1 -0
  22. package/dist/lib/actions/repost.d.ts +14 -0
  23. package/dist/lib/actions/repost.d.ts.map +1 -0
  24. package/dist/lib/actions/repost.js +132 -0
  25. package/dist/lib/actions/repost.js.map +1 -0
  26. package/dist/lib/common/auth.d.ts +11 -0
  27. package/dist/lib/common/auth.d.ts.map +1 -0
  28. package/dist/lib/common/auth.js +75 -0
  29. package/dist/lib/common/auth.js.map +1 -0
  30. package/dist/lib/common/client.d.ts +8 -0
  31. package/dist/lib/common/client.d.ts.map +1 -0
  32. package/dist/lib/common/client.js +47 -0
  33. package/dist/lib/common/client.js.map +1 -0
  34. package/dist/lib/common/props.d.ts +45 -0
  35. package/dist/lib/common/props.d.ts.map +1 -0
  36. package/dist/lib/common/props.js +360 -0
  37. package/dist/lib/common/props.js.map +1 -0
  38. package/dist/lib/triggers/new-follower-on-account.d.ts +19 -0
  39. package/dist/lib/triggers/new-follower-on-account.d.ts.map +1 -0
  40. package/dist/lib/triggers/new-follower-on-account.js +116 -0
  41. package/dist/lib/triggers/new-follower-on-account.js.map +1 -0
  42. package/dist/lib/triggers/new-post.d.ts +75 -0
  43. package/dist/lib/triggers/new-post.d.ts.map +1 -0
  44. package/dist/lib/triggers/new-post.js +214 -0
  45. package/dist/lib/triggers/new-post.js.map +1 -0
  46. package/dist/lib/triggers/new-posts-by-author.d.ts +59 -0
  47. package/dist/lib/triggers/new-posts-by-author.d.ts.map +1 -0
  48. package/dist/lib/triggers/new-posts-by-author.js +243 -0
  49. package/dist/lib/triggers/new-posts-by-author.js.map +1 -0
  50. package/dist/lib/triggers/new-timeline-posts.d.ts +19 -0
  51. package/dist/lib/triggers/new-timeline-posts.d.ts.map +1 -0
  52. package/dist/lib/triggers/new-timeline-posts.js +143 -0
  53. package/dist/lib/triggers/new-timeline-posts.js.map +1 -0
  54. package/package.json +48 -0
  55. package/src/index.ts +25 -0
  56. package/src/lib/actions/create-post.ts +444 -0
  57. package/src/lib/actions/find-post.ts +76 -0
  58. package/src/lib/actions/find-thread.ts +121 -0
  59. package/src/lib/actions/like-post.ts +128 -0
  60. package/src/lib/actions/repost.ts +132 -0
  61. package/src/lib/common/auth.ts +74 -0
  62. package/src/lib/common/client.ts +42 -0
  63. package/src/lib/common/props.ts +392 -0
  64. package/src/lib/triggers/new-follower-on-account.ts +112 -0
  65. package/src/lib/triggers/new-post.ts +225 -0
  66. package/src/lib/triggers/new-posts-by-author.ts +252 -0
  67. package/src/lib/triggers/new-timeline-posts.ts +141 -0
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findThread = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bluesky/src/lib/actions/find-thread.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const auth_1 = require("../common/auth");
9
+ const client_1 = require("../common/client");
10
+ const props_1 = require("../common/props");
11
+ exports.findThread = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.blueskyAuth,
13
+ name: 'findThread',
14
+ displayName: 'Find Thread',
15
+ description: 'Get a full conversation thread with replies',
16
+ audience: 'both',
17
+ aiMetadata: {
18
+ description: 'Retrieves the full conversation thread around a Bluesky post — parent posts and nested replies — given a bsky.app post URL or AT-URI, with configurable reply depth and parent height (each 0-1000). Use to read an entire discussion rather than a single post. Read-only and idempotent.',
19
+ idempotent: true,
20
+ },
21
+ props: {
22
+ postUrl: props_1.postUrlProperty,
23
+ depth: props_1.threadDepthDropdown,
24
+ parentHeight: props_1.parentHeightDropdown,
25
+ },
26
+ run(_a) {
27
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
28
+ var _b;
29
+ const { postUrl, depth = 6, parentHeight = 80 } = propsValue;
30
+ try {
31
+ const agent = yield (0, client_1.createBlueskyAgent)(auth.props);
32
+ const postInfo = (0, props_1.extractPostInfoFromUrl)(postUrl);
33
+ let atUri = postInfo.uri;
34
+ if (!atUri && postInfo.handle && postInfo.postId) {
35
+ const didDoc = yield agent.resolveHandle({ handle: postInfo.handle });
36
+ if ((_b = didDoc.data) === null || _b === void 0 ? void 0 : _b.did) {
37
+ atUri = `at://${didDoc.data.did}/app.bsky.feed.post/${postInfo.postId}`;
38
+ }
39
+ else {
40
+ throw new Error(`Could not resolve handle: ${postInfo.handle}`);
41
+ }
42
+ }
43
+ if (!atUri) {
44
+ throw new Error('Could not parse the post URL. Please make sure you are using a valid Bluesky post URL like: https://bsky.app/profile/username.bsky.social/post/xxx');
45
+ }
46
+ if (!atUri.startsWith('at://')) {
47
+ throw new Error('Invalid URI format. Must be an AT-URI starting with "at://" or a valid Bluesky URL');
48
+ }
49
+ const depthNum = parseInt(depth.toString(), 10);
50
+ const parentHeightNum = parseInt(parentHeight.toString(), 10);
51
+ if (isNaN(depthNum) || depthNum < 0 || depthNum > 1000) {
52
+ throw new Error('Depth must be a number between 0 and 1000');
53
+ }
54
+ if (isNaN(parentHeightNum) || parentHeightNum < 0 || parentHeightNum > 1000) {
55
+ throw new Error('Parent height must be a number between 0 and 1000');
56
+ }
57
+ const response = yield agent.getPostThread({
58
+ uri: atUri,
59
+ depth: depthNum,
60
+ parentHeight: parentHeightNum,
61
+ });
62
+ const stats = {
63
+ totalPosts: 0,
64
+ parentPosts: 0,
65
+ replyPosts: 0,
66
+ notFoundPosts: 0,
67
+ blockedPosts: 0,
68
+ };
69
+ const countPosts = (threadPost) => {
70
+ if (!threadPost)
71
+ return;
72
+ if (threadPost.$type === 'app.bsky.feed.defs#notFoundPost') {
73
+ stats.notFoundPosts++;
74
+ }
75
+ else if (threadPost.$type === 'app.bsky.feed.defs#blockedPost') {
76
+ stats.blockedPosts++;
77
+ }
78
+ else if (threadPost.post) {
79
+ stats.totalPosts++;
80
+ }
81
+ if (threadPost.parent) {
82
+ stats.parentPosts++;
83
+ countPosts(threadPost.parent);
84
+ }
85
+ if (threadPost.replies && Array.isArray(threadPost.replies)) {
86
+ stats.replyPosts += threadPost.replies.length;
87
+ threadPost.replies.forEach((reply) => countPosts(reply));
88
+ }
89
+ };
90
+ if (response.data.thread) {
91
+ countPosts(response.data.thread);
92
+ if (response.data.thread.$type === 'app.bsky.feed.defs#threadViewPost' &&
93
+ 'post' in response.data.thread &&
94
+ response.data.thread.post) {
95
+ stats.totalPosts = 1;
96
+ }
97
+ }
98
+ return {
99
+ success: true,
100
+ thread: response.data.thread,
101
+ requestedUri: atUri,
102
+ parameters: {
103
+ depth: depthNum,
104
+ parentHeight: parentHeightNum,
105
+ },
106
+ statistics: stats,
107
+ retrievedAt: new Date().toISOString(),
108
+ };
109
+ }
110
+ catch (error) {
111
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
112
+ throw new Error(`Failed to find thread: ${errorMessage}`);
113
+ }
114
+ });
115
+ },
116
+ });
117
+ //# sourceMappingURL=find-thread.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-thread.js","sourceRoot":"","sources":["../../../src/lib/actions/find-thread.ts"],"names":[],"mappings":";;;;AAAA,qGAAqG;AACrG,qEAAqE;AACrE,gEAAmE;AACnE,yCAA6C;AAC7C,6CAAsD;AACtD,2CAAqH;AAExG,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,6CAA6C;IAC1D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,4RAA4R;QACzS,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe;QACxB,KAAK,EAAE,2BAAmB;QAC1B,YAAY,EAAE,4BAAoB;KACnC;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;;YAC5B,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,EAAE,YAAY,GAAG,EAAE,EAAE,GAAG,UAAU,CAAC;YAE7D,IAAI,CAAC;gBACH,MAAM,KAAK,GAAG,MAAM,IAAA,2BAAkB,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAEnD,MAAM,QAAQ,GAAG,IAAA,8BAAsB,EAAC,OAAO,CAAC,CAAC;gBACjD,IAAI,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC;gBAEzB,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;oBACjD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;oBAEtE,IAAI,MAAA,MAAM,CAAC,IAAI,0CAAE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AAC,UAAU,GAAG,CAAC,CAAC;oBACvB,CAAC;gBACH,CAAC;gBAED,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;oBAC5B,YAAY,EAAE,KAAK;oBACnB,UAAU,EAAE;wBACV,KAAK,EAAE,QAAQ;wBACf,YAAY,EAAE,eAAe;qBAC9B;oBACD,UAAU,EAAE,KAAK;oBACjB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACtC,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;gBAC9E,MAAM,IAAI,KAAK,CAAC,0BAA0B,YAAY,EAAE,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const likePost: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
2
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
3
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
4
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
5
+ }>, {
6
+ selectionMethod: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
7
+ postSelection: import("@agnocon/pieces-framework").DropdownProperty<string, false, import("@agnocon/pieces-framework").CustomAuthProperty<{
8
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
9
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
10
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
11
+ }>>;
12
+ postUrl: import("@agnocon/pieces-framework").ShortTextProperty<false>;
13
+ }>;
14
+ //# sourceMappingURL=like-post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"like-post.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/like-post.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,QAAQ;;;;;;;;;;;;EAyHnB,CAAC"}
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.likePost = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bluesky/src/lib/actions/like-post.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const auth_1 = require("../common/auth");
9
+ const client_1 = require("../common/client");
10
+ const props_1 = require("../common/props");
11
+ exports.likePost = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.blueskyAuth,
13
+ name: 'likePost',
14
+ displayName: 'Like Post',
15
+ description: 'Like a post on Bluesky',
16
+ audience: 'both',
17
+ aiMetadata: {
18
+ description: 'Adds a like from the authenticated account to a specific Bluesky post, identified either by an AT-URI / bsky.app post URL or by selecting from the recent timeline. Use to register approval of a post. Not idempotent — each call creates a separate like record.',
19
+ idempotent: false,
20
+ },
21
+ props: {
22
+ selectionMethod: pieces_framework_1.Property.StaticDropdown({
23
+ displayName: 'Select Method',
24
+ description: 'How to choose the post',
25
+ required: true,
26
+ defaultValue: 'timeline',
27
+ options: {
28
+ options: [
29
+ { label: 'From my timeline', value: 'timeline' },
30
+ { label: 'Enter URL manually', value: 'manual' },
31
+ ],
32
+ },
33
+ }),
34
+ postSelection: pieces_framework_1.Property.Dropdown({
35
+ auth: auth_1.blueskyAuth,
36
+ displayName: 'Select Post',
37
+ description: 'Choose from your recent timeline posts (only when "From my timeline" is selected above)',
38
+ required: false,
39
+ refreshers: ['auth'],
40
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
41
+ try {
42
+ if (!auth)
43
+ return { options: [] };
44
+ const agent = yield (0, client_1.createBlueskyAgent)(auth.props);
45
+ const timeline = yield agent.getTimeline({ limit: 50 });
46
+ return {
47
+ options: timeline.data.feed.map(item => ({
48
+ label: `@${item.post.author.handle}: ${item.post.record['text'] ? String(item.post.record['text']).substring(0, 80) : 'Media post'}${String(item.post.record['text'] || '').length > 80 ? '...' : ''} (${new Date(item.post.indexedAt).toLocaleDateString()})`,
49
+ value: item.post.uri
50
+ }))
51
+ };
52
+ }
53
+ catch (error) {
54
+ return {
55
+ options: [{ label: 'Error loading posts', value: '' }]
56
+ };
57
+ }
58
+ })
59
+ }),
60
+ postUrl: pieces_framework_1.Property.ShortText({
61
+ displayName: 'Post URL',
62
+ description: 'Paste the Bluesky post URL',
63
+ required: false,
64
+ }),
65
+ },
66
+ run(_a) {
67
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
68
+ const { selectionMethod, postSelection, postUrl } = propsValue;
69
+ let postUri;
70
+ if (selectionMethod === 'timeline') {
71
+ if (!postSelection) {
72
+ throw new Error('Please select a post from your timeline dropdown');
73
+ }
74
+ postUri = postSelection;
75
+ }
76
+ else if (selectionMethod === 'manual') {
77
+ if (!postUrl || !postUrl.trim()) {
78
+ throw new Error('Post URL is required when using manual entry method');
79
+ }
80
+ try {
81
+ const agent = yield (0, client_1.createBlueskyAgent)(auth.props);
82
+ postUri = yield (0, props_1.parseBlueskyUrl)(postUrl.trim(), agent);
83
+ }
84
+ catch (error) {
85
+ throw new Error(`Invalid post URL: ${error instanceof Error ? error.message : 'Unknown error'}`);
86
+ }
87
+ }
88
+ else {
89
+ throw new Error('Please select a post selection method');
90
+ }
91
+ try {
92
+ const agent = yield (0, client_1.createBlueskyAgent)(auth.props);
93
+ const postsResponse = yield agent.getPosts({ uris: [postUri] });
94
+ if (!postsResponse.data.posts || postsResponse.data.posts.length === 0) {
95
+ throw new Error('Post not found');
96
+ }
97
+ const post = postsResponse.data.posts[0];
98
+ const response = yield agent.like(postUri, post.cid);
99
+ return {
100
+ success: true,
101
+ likeUri: response.uri,
102
+ likeCid: response.cid,
103
+ postUri: postUri,
104
+ postCid: post.cid,
105
+ postAuthor: post.author.handle,
106
+ postText: post.record['text'] ? String(post.record['text']).substring(0, 100) + (String(post.record['text']).length > 100 ? '...' : '') : 'No text available',
107
+ selectionMethod: selectionMethod,
108
+ likedAt: new Date().toISOString(),
109
+ };
110
+ }
111
+ catch (error) {
112
+ if (error instanceof Error) {
113
+ if (error.message.includes('Post not found')) {
114
+ throw new Error('Post not found. Please check the URL and try again.');
115
+ }
116
+ if (error.message.includes('Invalid post URL format')) {
117
+ throw new Error('Invalid post URL format. Please use a valid Bluesky post URL or AT-URI.');
118
+ }
119
+ if (error.message.includes('Authentication')) {
120
+ throw new Error('Authentication failed. Please check your credentials.');
121
+ }
122
+ throw new Error(`Failed to like post: ${error.message}`);
123
+ }
124
+ throw new Error('Failed to like post: Unknown error occurred');
125
+ }
126
+ });
127
+ },
128
+ });
129
+ //# sourceMappingURL=like-post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"like-post.js","sourceRoot":"","sources":["../../../src/lib/actions/like-post.ts"],"names":[],"mappings":";;;;AAAA,mGAAmG;AACnG,qEAAqE;AACrE,gEAAmE;AACnE,yCAA8D;AAC9D,6CAAsD;AACtD,2CAAkD;AAGrC,QAAA,QAAQ,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,wBAAwB;IACrC,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,oQAAoQ;QACjR,UAAU,EAAE,KAAK;KAClB;IACD,KAAK,EAAE;QACL,eAAe,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACvC,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,wBAAwB;YACrC,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,UAAU;YACxB,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EA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,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,mBAAmB;oBAC7J,eAAe,EAAE,eAAe;oBAChC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBAClC,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;oBAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;wBAC7C,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;oBACzE,CAAC;oBACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC;wBACtD,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;oBAC7F,CAAC;oBACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;wBAC7C,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;oBAC3E,CAAC;oBACD,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC3D,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const repostPost: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
2
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
3
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
4
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
5
+ }>, {
6
+ selectionMethod: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
7
+ postSelection: import("@agnocon/pieces-framework").DropdownProperty<string, false, import("@agnocon/pieces-framework").CustomAuthProperty<{
8
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
9
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
10
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
11
+ }>>;
12
+ postUrl: import("@agnocon/pieces-framework").ShortTextProperty<false>;
13
+ }>;
14
+ //# sourceMappingURL=repost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repost.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/repost.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,UAAU;;;;;;;;;;;;EA4HrB,CAAC"}
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.repostPost = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bluesky/src/lib/actions/repost.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const auth_1 = require("../common/auth");
9
+ const client_1 = require("../common/client");
10
+ const props_1 = require("../common/props");
11
+ exports.repostPost = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.blueskyAuth,
13
+ name: 'repostPost',
14
+ displayName: 'Repost Post',
15
+ description: 'Share someone else\'s post to your timeline',
16
+ audience: 'both',
17
+ aiMetadata: {
18
+ description: 'Reposts an existing Bluesky post to the authenticated account\'s timeline, identified by an AT-URI / bsky.app post URL or selected from the recent timeline. Use to amplify another user\'s post. Not idempotent — each call creates a separate repost record.',
19
+ idempotent: false,
20
+ },
21
+ props: {
22
+ selectionMethod: pieces_framework_1.Property.StaticDropdown({
23
+ displayName: 'Select Method',
24
+ description: 'How to choose the post',
25
+ required: true,
26
+ defaultValue: 'timeline',
27
+ options: {
28
+ options: [
29
+ { label: 'From my timeline', value: 'timeline' },
30
+ { label: 'Enter URL manually', value: 'manual' },
31
+ ],
32
+ },
33
+ }),
34
+ postSelection: pieces_framework_1.Property.Dropdown({
35
+ auth: auth_1.blueskyAuth,
36
+ displayName: 'Select Post',
37
+ description: 'Choose from your recent timeline posts (only when "From my timeline" is selected above)',
38
+ required: false,
39
+ refreshers: ['auth'],
40
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
41
+ try {
42
+ if (!auth)
43
+ return { options: [] };
44
+ const agent = yield (0, client_1.createBlueskyAgent)(auth.props);
45
+ const timeline = yield agent.getTimeline({ limit: 50 });
46
+ return {
47
+ options: timeline.data.feed.map(item => ({
48
+ label: `@${item.post.author.handle}: ${item.post.record['text'] ? String(item.post.record['text']).substring(0, 80) : 'Media post'}${String(item.post.record['text'] || '').length > 80 ? '...' : ''} (${new Date(item.post.indexedAt).toLocaleDateString()})`,
49
+ value: item.post.uri
50
+ }))
51
+ };
52
+ }
53
+ catch (error) {
54
+ return {
55
+ options: [{ label: 'Error loading posts', value: '' }]
56
+ };
57
+ }
58
+ })
59
+ }),
60
+ postUrl: pieces_framework_1.Property.ShortText({
61
+ displayName: 'Post URL',
62
+ description: 'Paste the Bluesky post URL',
63
+ required: false,
64
+ }),
65
+ },
66
+ run(_a) {
67
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
68
+ const { selectionMethod, postSelection, postUrl } = propsValue;
69
+ let postUri;
70
+ if (selectionMethod === 'timeline') {
71
+ if (!postSelection) {
72
+ throw new Error('Please select a post from your timeline dropdown');
73
+ }
74
+ postUri = postSelection;
75
+ }
76
+ else if (selectionMethod === 'manual') {
77
+ if (!postUrl || !postUrl.trim()) {
78
+ throw new Error('Post URL is required when using manual entry method');
79
+ }
80
+ try {
81
+ const agent = yield (0, client_1.createBlueskyAgent)(auth.props);
82
+ postUri = yield (0, props_1.parseBlueskyUrl)(postUrl.trim(), agent);
83
+ }
84
+ catch (error) {
85
+ throw new Error(`Invalid post URL: ${error instanceof Error ? error.message : 'Unknown error'}`);
86
+ }
87
+ }
88
+ else {
89
+ throw new Error('Please select a post selection method');
90
+ }
91
+ try {
92
+ const agent = yield (0, client_1.createBlueskyAgent)(auth.props);
93
+ const postsResponse = yield agent.getPosts({ uris: [postUri] });
94
+ if (!postsResponse.data.posts || postsResponse.data.posts.length === 0) {
95
+ throw new Error('Post not found');
96
+ }
97
+ const post = postsResponse.data.posts[0];
98
+ const response = yield agent.repost(postUri, post.cid);
99
+ return {
100
+ success: true,
101
+ repostUri: response.uri,
102
+ repostCid: response.cid,
103
+ originalPost: {
104
+ uri: postUri,
105
+ cid: post.cid,
106
+ author: post.author.handle,
107
+ text: post.record['text'] ? String(post.record['text']).substring(0, 100) + (String(post.record['text']).length > 100 ? '...' : '') : 'No text available',
108
+ createdAt: post.record['createdAt'] || post.indexedAt,
109
+ },
110
+ selectionMethod: selectionMethod,
111
+ repostedAt: new Date().toISOString(),
112
+ };
113
+ }
114
+ catch (error) {
115
+ if (error instanceof Error) {
116
+ if (error.message.includes('Post not found')) {
117
+ throw new Error('Post not found. Please check the URL and try again.');
118
+ }
119
+ if (error.message.includes('Invalid post URL format')) {
120
+ throw new Error('Invalid post URL format. Please use a valid Bluesky post URL or AT-URI.');
121
+ }
122
+ if (error.message.includes('Authentication')) {
123
+ throw new Error('Authentication failed. Please check your credentials.');
124
+ }
125
+ throw new Error(`Failed to repost: ${error.message}`);
126
+ }
127
+ throw new Error('Failed to repost: Unknown error occurred');
128
+ }
129
+ });
130
+ },
131
+ });
132
+ //# sourceMappingURL=repost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repost.js","sourceRoot":"","sources":["../../../src/lib/actions/repost.ts"],"names":[],"mappings":";;;;AAAA,gGAAgG;AAChG,qEAAqE;AACrE,gEAAmE;AACnE,yCAA8D;AAC9D,6CAAsD;AACtD,2CAAkD;AAIrC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,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AC,CAAC;gBACxD,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC9D,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface BlueSkyAuthType {
2
+ pdsHost?: string;
3
+ identifier: string;
4
+ password: string;
5
+ }
6
+ export declare const blueskyAuth: import("@agnocon/pieces-framework").CustomAuthProperty<{
7
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
8
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
9
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
10
+ }>;
11
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAYD,eAAO,MAAM,WAAW;;;;EAsDtB,CAAC"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.blueskyAuth = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bluesky/src/lib/common/auth.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const api_1 = require("@atproto/api");
9
+ const description = `
10
+ To authenticate with Bluesky:
11
+
12
+ 1. **PDS Host**: The Personal Data Server host. Leave empty to use the default Bluesky network (https://bsky.social).
13
+ 2. **Identifier**: Your Bluesky handle (e.g., yourhandle.bsky.social) or email address.
14
+ 3. **Password**: Your Bluesky account password or app password.
15
+
16
+ For enhanced security, consider using an app password from your Bluesky account settings.
17
+ `;
18
+ exports.blueskyAuth = pieces_framework_1.PieceAuth.CustomAuth({
19
+ description: description,
20
+ required: true,
21
+ props: {
22
+ pdsHost: pieces_framework_1.Property.ShortText({
23
+ displayName: 'PDS Host',
24
+ description: 'The Personal Data Server host. Leave empty for default Bluesky network (https://bsky.social)',
25
+ required: false,
26
+ defaultValue: 'https://bsky.social',
27
+ }),
28
+ identifier: pieces_framework_1.Property.ShortText({
29
+ displayName: 'Identifier',
30
+ description: 'Your Bluesky handle or email address',
31
+ required: true,
32
+ }),
33
+ password: pieces_framework_1.PieceAuth.SecretText({
34
+ displayName: 'Password',
35
+ description: 'Your Bluesky account password or app password',
36
+ required: true,
37
+ }),
38
+ },
39
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
40
+ var _b, _c;
41
+ try {
42
+ const agent = new api_1.AtpAgent({
43
+ service: auth.pdsHost || 'https://bsky.social',
44
+ });
45
+ yield agent.login({
46
+ identifier: auth.identifier,
47
+ password: auth.password,
48
+ });
49
+ return {
50
+ valid: true,
51
+ };
52
+ }
53
+ catch (error) {
54
+ if ((_b = error.message) === null || _b === void 0 ? void 0 : _b.includes('Invalid identifier or password')) {
55
+ return {
56
+ valid: false,
57
+ error: 'Invalid credentials. Please check your identifier and password.',
58
+ };
59
+ }
60
+ else if ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes('Invalid request')) {
61
+ return {
62
+ valid: false,
63
+ error: 'Invalid request. Please check your identifier format.',
64
+ };
65
+ }
66
+ else {
67
+ return {
68
+ valid: false,
69
+ error: `Authentication failed: ${error.message || 'Unknown error'}`,
70
+ };
71
+ }
72
+ }
73
+ }),
74
+ });
75
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,6FAA6F;AAC7F,qEAAqE;AACrE,gEAAgE;AAChE,sCAAwC;AAQxC,MAAM,WAAW,GAAG;;;;;;;;CAQnB,CAAC;AAEW,Q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,EAAE,KAAK;oBACZ,KAAK,EAAE,uDAAuD;iBAC/D,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,0BAA0B,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE;iBACpE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { AtpAgent } from '@atproto/api';
2
+ import { BlueSkyAuthType } from './auth';
3
+ export declare function createBlueskyAgent(auth: BlueSkyAuthType): Promise<AtpAgent>;
4
+ export declare function getCurrentSession(auth: BlueSkyAuthType): Promise<{
5
+ did: string | undefined;
6
+ handle: string | undefined;
7
+ }>;
8
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/lib/common/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAIzC,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CA4BjF;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,eAAe;;;GAM5D"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createBlueskyAgent = createBlueskyAgent;
4
+ exports.getCurrentSession = getCurrentSession;
5
+ const tslib_1 = require("tslib");
6
+ // Vendored from Activepieces packages/pieces/community/bluesky/src/lib/common/client.ts (MIT).
7
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
8
+ const api_1 = require("@atproto/api");
9
+ const agentCache = new Map();
10
+ function createBlueskyAgent(auth) {
11
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
+ const cacheKey = `${auth.identifier}:${auth.pdsHost || 'https://bsky.social'}`;
13
+ const cached = agentCache.get(cacheKey);
14
+ if (cached && Date.now() < cached.expires) {
15
+ return cached.agent;
16
+ }
17
+ try {
18
+ const agent = new api_1.AtpAgent({
19
+ service: auth.pdsHost || 'https://bsky.social',
20
+ });
21
+ yield agent.login({
22
+ identifier: auth.identifier,
23
+ password: auth.password,
24
+ });
25
+ agentCache.set(cacheKey, {
26
+ agent,
27
+ expires: Date.now() + 50 * 60 * 1000,
28
+ });
29
+ return agent;
30
+ }
31
+ catch (error) {
32
+ agentCache.delete(cacheKey);
33
+ throw new Error(`Failed to create Bluesky agent: ${error.message || 'Unknown error'}`);
34
+ }
35
+ });
36
+ }
37
+ function getCurrentSession(auth) {
38
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
39
+ var _a, _b;
40
+ const agent = yield createBlueskyAgent(auth);
41
+ return {
42
+ did: (_a = agent.session) === null || _a === void 0 ? void 0 : _a.did,
43
+ handle: (_b = agent.session) === null || _b === void 0 ? void 0 : _b.handle,
44
+ };
45
+ });
46
+ }
47
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/lib/common/client.ts"],"names":[],"mappings":";;AAOA,gDA4BC;AAED,8CAMC;;AA3CD,+FAA+F;AAC/F,qEAAqE;AACrE,sCAAwC;AAGxC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAgD,CAAC;AAE3E,SAAsB,kBAAkB,CAAC,IAAqB;;QAC5D,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,IAAI,qBAAqB,EAAE,CAAC;QAC/E,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAExC,IAAI,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YAC1C,OAAO,MAAM,CAAC,KAAK,CAAC;QACtB,CAAC;QAED,IAAI,CAAC;YACH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