@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,75 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ export declare const newPost: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
3
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
4
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
5
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
6
+ }>, {
7
+ searchQuery: import("@agnocon/pieces-framework").ShortTextProperty<true>;
8
+ searchLanguage: {
9
+ displayName: string;
10
+ description: string;
11
+ required: false;
12
+ options: import("@agnocon/pieces-framework").DropdownState<string>;
13
+ valueSchema: string;
14
+ type: import("@agnocon/pieces-framework").PropertyType.STATIC_DROPDOWN;
15
+ defaultValue?: unknown;
16
+ };
17
+ includeImages: import("@agnocon/pieces-framework").CheckboxProperty<false>;
18
+ includeVideos: import("@agnocon/pieces-framework").CheckboxProperty<false>;
19
+ sortBy: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
20
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").CustomAuthProperty<{
21
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
22
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
23
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
24
+ }>, {
25
+ searchQuery: import("@agnocon/pieces-framework").ShortTextProperty<true>;
26
+ searchLanguage: {
27
+ displayName: string;
28
+ description: string;
29
+ required: false;
30
+ options: import("@agnocon/pieces-framework").DropdownState<string>;
31
+ valueSchema: string;
32
+ type: import("@agnocon/pieces-framework").PropertyType.STATIC_DROPDOWN;
33
+ defaultValue?: unknown;
34
+ };
35
+ includeImages: import("@agnocon/pieces-framework").CheckboxProperty<false>;
36
+ includeVideos: import("@agnocon/pieces-framework").CheckboxProperty<false>;
37
+ sortBy: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
38
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").CustomAuthProperty<{
39
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
40
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
41
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
42
+ }>, {
43
+ searchQuery: import("@agnocon/pieces-framework").ShortTextProperty<true>;
44
+ searchLanguage: {
45
+ displayName: string;
46
+ description: string;
47
+ required: false;
48
+ options: import("@agnocon/pieces-framework").DropdownState<string>;
49
+ valueSchema: string;
50
+ type: import("@agnocon/pieces-framework").PropertyType.STATIC_DROPDOWN;
51
+ defaultValue?: unknown;
52
+ };
53
+ includeImages: import("@agnocon/pieces-framework").CheckboxProperty<false>;
54
+ includeVideos: import("@agnocon/pieces-framework").CheckboxProperty<false>;
55
+ sortBy: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
56
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
57
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
58
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
59
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
60
+ }>, {
61
+ searchQuery: import("@agnocon/pieces-framework").ShortTextProperty<true>;
62
+ searchLanguage: {
63
+ displayName: string;
64
+ description: string;
65
+ required: false;
66
+ options: import("@agnocon/pieces-framework").DropdownState<string>;
67
+ valueSchema: string;
68
+ type: import("@agnocon/pieces-framework").PropertyType.STATIC_DROPDOWN;
69
+ defaultValue?: unknown;
70
+ };
71
+ includeImages: import("@agnocon/pieces-framework").CheckboxProperty<false>;
72
+ includeVideos: import("@agnocon/pieces-framework").CheckboxProperty<false>;
73
+ sortBy: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
74
+ }>;
75
+ //# sourceMappingURL=new-post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-post.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/new-post.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAAqE,MAAM,2BAA2B,CAAC;AAsH9I,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0GlB,CAAC"}
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newPost = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bluesky/src/lib/triggers/new-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 pieces_common_1 = require("@agnocon/pieces-common");
9
+ const auth_1 = require("../common/auth");
10
+ const client_1 = require("../common/client");
11
+ const props_1 = require("../common/props");
12
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
13
+ const polling = {
14
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
15
+ items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
16
+ var _b;
17
+ const { searchQuery, searchLanguage, includeImages, includeVideos, sortBy } = propsValue;
18
+ try {
19
+ if (!searchQuery || searchQuery.trim().length === 0) {
20
+ return [];
21
+ }
22
+ const agent = yield (0, client_1.createBlueskyAgent)(auth.props);
23
+ const searchParams = {
24
+ q: searchQuery.trim(),
25
+ limit: 50,
26
+ sort: sortBy || 'latest'
27
+ };
28
+ if (searchLanguage && searchLanguage !== 'other') {
29
+ searchParams.lang = searchLanguage;
30
+ }
31
+ const response = yield agent.api.app.bsky.feed.searchPosts(searchParams);
32
+ if (!((_b = response.data) === null || _b === void 0 ? void 0 : _b.posts) || !Array.isArray(response.data.posts)) {
33
+ return [];
34
+ }
35
+ const cutoffTime = lastFetchEpochMS || 0;
36
+ return response.data.posts
37
+ .filter((post) => {
38
+ var _a, _b, _c, _d;
39
+ if (!post.indexedAt)
40
+ return false;
41
+ const postTime = (0, dayjs_1.default)(post.indexedAt).valueOf();
42
+ if (postTime <= cutoffTime)
43
+ return false;
44
+ if (includeImages === false && ((_a = post.embed) === null || _a === void 0 ? void 0 : _a.images))
45
+ return false;
46
+ if (includeVideos === false && ((_b = post.embed) === null || _b === void 0 ? void 0 : _b.video))
47
+ return false;
48
+ if (includeImages === true && !((_c = post.embed) === null || _c === void 0 ? void 0 : _c.images))
49
+ return false;
50
+ if (includeVideos === true && !((_d = post.embed) === null || _d === void 0 ? void 0 : _d.video))
51
+ return false;
52
+ return true;
53
+ })
54
+ .map((post) => {
55
+ var _a, _b, _c, _d;
56
+ return ({
57
+ epochMilliSeconds: (0, dayjs_1.default)(post.indexedAt).valueOf(),
58
+ data: {
59
+ uri: post.uri,
60
+ cid: post.cid,
61
+ author: post.author,
62
+ record: post.record,
63
+ indexedAt: post.indexedAt,
64
+ replyCount: post.replyCount || 0,
65
+ repostCount: post.repostCount || 0,
66
+ likeCount: post.likeCount || 0,
67
+ quoteCount: post.quoteCount || 0,
68
+ labels: post.labels || [],
69
+ viewer: post.viewer || {},
70
+ embed: post.embed || null,
71
+ searchContext: {
72
+ query: searchQuery,
73
+ language: searchLanguage || null,
74
+ matchedTerms: extractMatchedTerms(((_a = post.record) === null || _a === void 0 ? void 0 : _a.text) || '', searchQuery),
75
+ hasImages: !!((_b = post.embed) === null || _b === void 0 ? void 0 : _b.images),
76
+ hasVideo: !!((_c = post.embed) === null || _c === void 0 ? void 0 : _c.video),
77
+ hasExternalLink: !!((_d = post.embed) === null || _d === void 0 ? void 0 : _d.external)
78
+ }
79
+ }
80
+ });
81
+ })
82
+ .sort((a, b) => b.epochMilliSeconds - a.epochMilliSeconds);
83
+ }
84
+ catch (error) {
85
+ console.warn('Failed to search posts:', error instanceof Error ? error.message : 'Unknown error');
86
+ return [];
87
+ }
88
+ })
89
+ };
90
+ function extractMatchedTerms(text, query) {
91
+ if (!text || !query)
92
+ return [];
93
+ const cleanQuery = query.toLowerCase()
94
+ .replace(/["']/g, '')
95
+ .replace(/\s+(or|and)\s+/gi, ' ');
96
+ const terms = cleanQuery.split(/\s+/).filter(term => term.length > 0 && !['or', 'and'].includes(term.toLowerCase()));
97
+ const matchedTerms = [];
98
+ const lowerText = text.toLowerCase();
99
+ terms.forEach(term => {
100
+ if (term.startsWith('#') || term.startsWith('@')) {
101
+ if (lowerText.includes(term)) {
102
+ matchedTerms.push(term);
103
+ }
104
+ }
105
+ else if (lowerText.includes(term)) {
106
+ matchedTerms.push(term);
107
+ }
108
+ });
109
+ return [...new Set(matchedTerms)];
110
+ }
111
+ exports.newPost = (0, pieces_framework_1.createTrigger)({
112
+ auth: auth_1.blueskyAuth,
113
+ name: 'newPost',
114
+ displayName: 'New Post (with Search Options)',
115
+ description: 'Triggers when posts match your search criteria',
116
+ aiMetadata: {
117
+ description: 'Fires when a new public Bluesky post matches a configured search query (keywords, hashtags, or mentions), with optional language and media filters; each event represents one newly indexed matching post.',
118
+ },
119
+ props: {
120
+ searchQuery: pieces_framework_1.Property.ShortText({
121
+ displayName: 'Search Query',
122
+ description: 'Keywords, hashtags (#example), or mentions (@handle) to find',
123
+ required: true
124
+ }),
125
+ searchLanguage: Object.assign(Object.assign({}, props_1.simpleLanguageDropdown), { displayName: 'Language Filter', description: 'Filter by language', required: false }),
126
+ includeImages: pieces_framework_1.Property.Checkbox({
127
+ displayName: 'Filter by Images',
128
+ description: 'Only posts with/without images',
129
+ required: false,
130
+ defaultValue: undefined
131
+ }),
132
+ includeVideos: pieces_framework_1.Property.Checkbox({
133
+ displayName: 'Filter by Videos',
134
+ description: 'Only posts with/without videos',
135
+ required: false,
136
+ defaultValue: undefined
137
+ }),
138
+ sortBy: pieces_framework_1.Property.StaticDropdown({
139
+ displayName: 'Sort Order',
140
+ description: 'How to sort results',
141
+ required: false,
142
+ defaultValue: 'latest',
143
+ options: {
144
+ options: [
145
+ { label: 'Latest First', value: 'latest' },
146
+ { label: 'Most Popular', value: 'top' }
147
+ ]
148
+ }
149
+ })
150
+ },
151
+ sampleData: {
152
+ uri: 'at://did:plc:example123/app.bsky.feed.post/example456',
153
+ cid: 'bafyreib2rxk3vcfbqij7y6kzgy4knknc7ff4t5jn2m5fbn6jdl7czfqyqe',
154
+ author: {
155
+ did: 'did:plc:example123',
156
+ handle: 'searchauthor.bsky.social',
157
+ displayName: 'Search Result Author',
158
+ avatar: 'https://cdn.bsky.app/img/avatar/plain/did:plc:example123/example@jpeg',
159
+ viewer: {
160
+ muted: false,
161
+ blockedBy: false
162
+ }
163
+ },
164
+ record: {
165
+ $type: 'app.bsky.feed.post',
166
+ createdAt: '2024-01-01T12:00:00.000Z',
167
+ text: 'This post matches your search criteria! #automation #activepieces',
168
+ langs: ['en']
169
+ },
170
+ indexedAt: '2024-01-01T12:00:00.000Z',
171
+ replyCount: 2,
172
+ repostCount: 5,
173
+ likeCount: 12,
174
+ quoteCount: 1,
175
+ labels: [],
176
+ viewer: {
177
+ repost: null,
178
+ like: null
179
+ },
180
+ embed: null,
181
+ searchContext: {
182
+ query: 'automation',
183
+ language: 'en',
184
+ matchedTerms: ['automation'],
185
+ hasImages: false,
186
+ hasVideo: false,
187
+ hasExternalLink: false
188
+ }
189
+ },
190
+ type: pieces_framework_1.TriggerStrategy.POLLING,
191
+ test(context) {
192
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
193
+ return yield pieces_common_1.pollingHelper.test(polling, context);
194
+ });
195
+ },
196
+ onEnable(context) {
197
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
198
+ const { store, auth, propsValue } = context;
199
+ yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
200
+ });
201
+ },
202
+ onDisable(context) {
203
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
204
+ const { store, auth, propsValue } = context;
205
+ yield pieces_common_1.pollingHelper.onDisable(polling, { store, auth, propsValue });
206
+ });
207
+ },
208
+ run(context) {
209
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
210
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
211
+ });
212
+ },
213
+ });
214
+ //# sourceMapping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,CAAC,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ export declare const newPostsByAuthor: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
3
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
4
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
5
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
6
+ }>, {
7
+ authorSelection: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
8
+ authorFromFollowing: import("@agnocon/pieces-framework").DropdownProperty<string, false, import("@agnocon/pieces-framework").CustomAuthProperty<{
9
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
10
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
11
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
12
+ }>>;
13
+ authorHandle: import("@agnocon/pieces-framework").ShortTextProperty<false>;
14
+ includeReplies: import("@agnocon/pieces-framework").CheckboxProperty<false>;
15
+ includeReposts: import("@agnocon/pieces-framework").CheckboxProperty<false>;
16
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").CustomAuthProperty<{
17
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
18
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
19
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
20
+ }>, {
21
+ authorSelection: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
22
+ authorFromFollowing: import("@agnocon/pieces-framework").DropdownProperty<string, false, import("@agnocon/pieces-framework").CustomAuthProperty<{
23
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
24
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
25
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
26
+ }>>;
27
+ authorHandle: import("@agnocon/pieces-framework").ShortTextProperty<false>;
28
+ includeReplies: import("@agnocon/pieces-framework").CheckboxProperty<false>;
29
+ includeReposts: import("@agnocon/pieces-framework").CheckboxProperty<false>;
30
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").CustomAuthProperty<{
31
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
32
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
33
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
34
+ }>, {
35
+ authorSelection: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
36
+ authorFromFollowing: import("@agnocon/pieces-framework").DropdownProperty<string, false, import("@agnocon/pieces-framework").CustomAuthProperty<{
37
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
38
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
39
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
40
+ }>>;
41
+ authorHandle: import("@agnocon/pieces-framework").ShortTextProperty<false>;
42
+ includeReplies: import("@agnocon/pieces-framework").CheckboxProperty<false>;
43
+ includeReposts: import("@agnocon/pieces-framework").CheckboxProperty<false>;
44
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
45
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
46
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
47
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
48
+ }>, {
49
+ authorSelection: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
50
+ authorFromFollowing: import("@agnocon/pieces-framework").DropdownProperty<string, false, import("@agnocon/pieces-framework").CustomAuthProperty<{
51
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
52
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
53
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
54
+ }>>;
55
+ authorHandle: import("@agnocon/pieces-framework").ShortTextProperty<false>;
56
+ includeReplies: import("@agnocon/pieces-framework").CheckboxProperty<false>;
57
+ includeReposts: import("@agnocon/pieces-framework").CheckboxProperty<false>;
58
+ }>;
59
+ //# sourceMappingURL=new-posts-by-author.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-posts-by-author.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/new-posts-by-author.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAAqE,MAAM,2BAA2B,CAAC;AA8G9I,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6I3B,CAAC"}
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newPostsByAuthor = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bluesky/src/lib/triggers/new-posts-by-author.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 pieces_common_1 = require("@agnocon/pieces-common");
9
+ const auth_1 = require("../common/auth");
10
+ const client_1 = require("../common/client");
11
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
12
+ const polling = {
13
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
14
+ items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
15
+ var _b;
16
+ const { authorSelection, authorFromFollowing, authorHandle, includeReplies = false, includeReposts = false } = propsValue;
17
+ let selectedAuthorHandle;
18
+ if (authorSelection === 'following') {
19
+ if (!authorFromFollowing) {
20
+ return [];
21
+ }
22
+ selectedAuthorHandle = authorFromFollowing;
23
+ }
24
+ else if (authorSelection === 'manual') {
25
+ if (!authorHandle) {
26
+ return [];
27
+ }
28
+ selectedAuthorHandle = authorHandle;
29
+ }
30
+ else {
31
+ return [];
32
+ }
33
+ try {
34
+ if (!selectedAuthorHandle || selectedAuthorHandle.trim().length === 0) {
35
+ return [];
36
+ }
37
+ const agent = yield (0, client_1.createBlueskyAgent)(auth.props);
38
+ const normalizedHandle = selectedAuthorHandle.replace('@', '').trim();
39
+ const response = yield agent.getAuthorFeed({
40
+ actor: normalizedHandle,
41
+ limit: 50,
42
+ filter: 'posts_with_replies'
43
+ });
44
+ if (!((_b = response.data) === null || _b === void 0 ? void 0 : _b.feed) || !Array.isArray(response.data.feed)) {
45
+ return [];
46
+ }
47
+ const cutoffTime = lastFetchEpochMS || 0;
48
+ return response.data.feed
49
+ .filter((feedItem) => {
50
+ var _a, _b;
51
+ const post = feedItem.post;
52
+ if (!post || !post.indexedAt)
53
+ return false;
54
+ const postTime = (0, dayjs_1.default)(post.indexedAt).valueOf();
55
+ if (postTime <= cutoffTime)
56
+ return false;
57
+ const isReply = ((_a = post.record) === null || _a === void 0 ? void 0 : _a.reply) !== undefined;
58
+ const isRepost = ((_b = feedItem.reason) === null || _b === void 0 ? void 0 : _b.$type) === 'app.bsky.feed.defs#reasonRepost';
59
+ if (isReply && !includeReplies)
60
+ return false;
61
+ if (isRepost && !includeReposts)
62
+ return false;
63
+ return post.author.handle === normalizedHandle || post.author.did === normalizedHandle;
64
+ })
65
+ .map((feedItem) => {
66
+ var _a, _b, _c, _d, _e, _f, _g, _h;
67
+ const post = feedItem.post;
68
+ return {
69
+ epochMilliSeconds: (0, dayjs_1.default)(post.indexedAt).valueOf(),
70
+ data: {
71
+ uri: post.uri,
72
+ cid: post.cid,
73
+ author: post.author,
74
+ record: post.record,
75
+ indexedAt: post.indexedAt,
76
+ replyCount: post.replyCount || 0,
77
+ repostCount: post.repostCount || 0,
78
+ likeCount: post.likeCount || 0,
79
+ quoteCount: post.quoteCount || 0,
80
+ labels: post.labels || [],
81
+ viewer: post.viewer || {},
82
+ embed: post.embed || null,
83
+ postContext: {
84
+ authorHandle: normalizedHandle,
85
+ isReply: ((_a = post.record) === null || _a === void 0 ? void 0 : _a.reply) !== undefined,
86
+ isRepost: ((_b = feedItem.reason) === null || _b === void 0 ? void 0 : _b.$type) === 'app.bsky.feed.defs#reasonRepost',
87
+ replyTo: ((_e = (_d = (_c = post.record) === null || _c === void 0 ? void 0 : _c.reply) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.uri) || null,
88
+ hasImages: !!((_f = post.embed) === null || _f === void 0 ? void 0 : _f.images),
89
+ hasVideo: !!((_g = post.embed) === null || _g === void 0 ? void 0 : _g.video),
90
+ hasExternalLink: !!((_h = post.embed) === null || _h === void 0 ? void 0 : _h.external)
91
+ }
92
+ }
93
+ };
94
+ })
95
+ .sort((a, b) => b.epochMilliSeconds - a.epochMilliSeconds);
96
+ }
97
+ catch (error) {
98
+ console.warn('Failed to fetch author posts:', error instanceof Error ? error.message : 'Unknown error');
99
+ return [];
100
+ }
101
+ })
102
+ };
103
+ exports.newPostsByAuthor = (0, pieces_framework_1.createTrigger)({
104
+ auth: auth_1.blueskyAuth,
105
+ name: 'newPostsByAuthor',
106
+ displayName: 'New Posts by Author',
107
+ description: 'Triggers when a selected author creates a new post',
108
+ aiMetadata: {
109
+ description: 'Fires when a chosen Bluesky author (picked from your following list or by handle) publishes a new post; each event represents one new post by that author, optionally including their replies and reposts.',
110
+ },
111
+ props: {
112
+ authorSelection: pieces_framework_1.Property.StaticDropdown({
113
+ displayName: 'How to select author?',
114
+ description: 'Choose how to select the author',
115
+ required: true,
116
+ defaultValue: 'following',
117
+ options: {
118
+ options: [
119
+ { label: 'From my following list', value: 'following' },
120
+ { label: 'Enter handle manually', value: 'manual' },
121
+ ],
122
+ },
123
+ }),
124
+ authorFromFollowing: pieces_framework_1.Property.Dropdown({
125
+ auth: auth_1.blueskyAuth,
126
+ displayName: 'Select Author',
127
+ description: 'Choose from accounts you follow',
128
+ required: false,
129
+ refreshers: ['auth'],
130
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
131
+ try {
132
+ if (!auth)
133
+ return { options: [] };
134
+ const agent = yield (0, client_1.createBlueskyAgent)(auth.props);
135
+ const session = agent.session;
136
+ if (!(session === null || session === void 0 ? void 0 : session.did)) {
137
+ return { options: [{ label: 'Please authenticate first', value: '' }] };
138
+ }
139
+ const followingResponse = yield agent.getFollows({
140
+ actor: session.did,
141
+ limit: 100
142
+ });
143
+ return {
144
+ options: followingResponse.data.follows.map(follow => ({
145
+ label: `${follow.displayName || follow.handle} (@${follow.handle})`,
146
+ value: follow.handle
147
+ }))
148
+ };
149
+ }
150
+ catch (error) {
151
+ return {
152
+ options: [{ label: 'Error loading following list', value: '' }]
153
+ };
154
+ }
155
+ })
156
+ }),
157
+ authorHandle: pieces_framework_1.Property.ShortText({
158
+ displayName: 'Author Handle',
159
+ description: 'Enter the Bluesky username (e.g., username.bsky.social)',
160
+ required: false
161
+ }),
162
+ includeReplies: pieces_framework_1.Property.Checkbox({
163
+ displayName: 'Include Replies',
164
+ description: 'Include reply posts by this author',
165
+ required: false,
166
+ defaultValue: false
167
+ }),
168
+ includeReposts: pieces_framework_1.Property.Checkbox({
169
+ displayName: 'Include Reposts',
170
+ description: 'Include posts that this author reposted',
171
+ required: false,
172
+ defaultValue: false
173
+ })
174
+ },
175
+ sampleData: {
176
+ uri: 'at://did:plc:example123/app.bsky.feed.post/example456',
177
+ cid: 'bafyreib2rxk3vcfbqij7y6kzgy4knknc7ff4t5jn2m5fbn6jdl7czfqyqe',
178
+ author: {
179
+ did: 'did:plc:example123',
180
+ handle: 'author.bsky.social',
181
+ displayName: 'Example Author',
182
+ avatar: 'https://cdn.bsky.app/img/avatar/plain/did:plc:example123/example@jpeg',
183
+ followersCount: 1500,
184
+ followsCount: 300,
185
+ postsCount: 250,
186
+ viewer: {
187
+ muted: false,
188
+ blockedBy: false,
189
+ following: 'at://following-record-uri'
190
+ }
191
+ },
192
+ record: {
193
+ $type: 'app.bsky.feed.post',
194
+ createdAt: '2024-01-01T12:00:00.000Z',
195
+ text: 'Just posted something new! Excited to share this with everyone.',
196
+ langs: ['en']
197
+ },
198
+ indexedAt: '2024-01-01T12:00:00.000Z',
199
+ replyCount: 3,
200
+ repostCount: 8,
201
+ likeCount: 25,
202
+ quoteCount: 2,
203
+ labels: [],
204
+ viewer: {
205
+ repost: null,
206
+ like: null
207
+ },
208
+ embed: null,
209
+ postContext: {
210
+ authorHandle: 'author.bsky.social',
211
+ isReply: false,
212
+ isRepost: false,
213
+ replyTo: null,
214
+ hasImages: false,
215
+ hasVideo: false,
216
+ hasExternalLink: false
217
+ }
218
+ },
219
+ type: pieces_framework_1.TriggerStrategy.POLLING,
220
+ test(context) {
221
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
222
+ return yield pieces_common_1.pollingHelper.test(polling, context);
223
+ });
224
+ },
225
+ onEnable(context) {
226
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
227
+ const { store, auth, propsValue } = context;
228
+ yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
229
+ });
230
+ },
231
+ onDisable(context) {
232
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
233
+ const { store, auth, propsValue } = context;
234
+ yield pieces_common_1.pollingHelper.onDisable(polling, { store, auth, propsValue });
235
+ });
236
+ },
237
+ run(context) {
238
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
239
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
240
+ });
241
+ },
242
+ });
243
+ //# sourceMappingURL=new-posts-by-author.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-posts-by-author.js","sourceRoot":"","sources":["../../../src/lib/triggers/new-posts-by-author.ts"],"names":[],"mappings":";;;;AAAA,8GAA8G;AAC9G,qEAAqE;AACrE,gEAA8I;AAC9I,0DAAgF;AAChF,yCAA8D;AAC9D,6CAAsD;AACtD,0DAA0B;AAE1B,MAAM,OAAO,GAMR;IACH,QAAQ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,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACrE,CAAC;KAAA;IAEK,SAAS,CAAC,OAAO;;YACrB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC5C,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACtE,CAAC;KAAA;IAEK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ export declare const newTimelinePosts: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
3
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
4
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
5
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
6
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, 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
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").CustomAuthProperty<{
11
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
12
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
13
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
14
+ }>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
15
+ pdsHost: import("@agnocon/pieces-framework").ShortTextProperty<false>;
16
+ identifier: import("@agnocon/pieces-framework").ShortTextProperty<true>;
17
+ password: import("@agnocon/pieces-framework").SecretTextProperty<true>;
18
+ }>, {}>;
19
+ //# sourceMappingURL=new-timeline-posts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-timeline-posts.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/new-timeline-posts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAA2D,MAAM,2BAA2B,CAAC;AAoEpI,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;OAwE3B,CAAC"}