@activepieces/piece-reddit 0.1.5 → 0.1.7

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 (45) hide show
  1. package/package.json +7 -12
  2. package/src/index.js +14 -53
  3. package/src/index.d.ts +0 -2
  4. package/src/index.d.ts.map +0 -1
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/create-reddit-comment.d.ts +0 -5
  7. package/src/lib/actions/create-reddit-comment.d.ts.map +0 -1
  8. package/src/lib/actions/create-reddit-comment.js +0 -60
  9. package/src/lib/actions/create-reddit-comment.js.map +0 -1
  10. package/src/lib/actions/create-reddit-post.d.ts +0 -6
  11. package/src/lib/actions/create-reddit-post.d.ts.map +0 -1
  12. package/src/lib/actions/create-reddit-post.js +0 -63
  13. package/src/lib/actions/create-reddit-post.js.map +0 -1
  14. package/src/lib/actions/delete-reddit-comment.d.ts +0 -4
  15. package/src/lib/actions/delete-reddit-comment.d.ts.map +0 -1
  16. package/src/lib/actions/delete-reddit-comment.js +0 -53
  17. package/src/lib/actions/delete-reddit-comment.js.map +0 -1
  18. package/src/lib/actions/delete-reddit-post.d.ts +0 -4
  19. package/src/lib/actions/delete-reddit-post.d.ts.map +0 -1
  20. package/src/lib/actions/delete-reddit-post.js +0 -53
  21. package/src/lib/actions/delete-reddit-post.js.map +0 -1
  22. package/src/lib/actions/edit-reddit-comment.d.ts +0 -5
  23. package/src/lib/actions/edit-reddit-comment.d.ts.map +0 -1
  24. package/src/lib/actions/edit-reddit-comment.js +0 -59
  25. package/src/lib/actions/edit-reddit-comment.js.map +0 -1
  26. package/src/lib/actions/edit-reddit-post.d.ts +0 -5
  27. package/src/lib/actions/edit-reddit-post.d.ts.map +0 -1
  28. package/src/lib/actions/edit-reddit-post.js +0 -59
  29. package/src/lib/actions/edit-reddit-post.js.map +0 -1
  30. package/src/lib/actions/fetch-post-comments.d.ts +0 -6
  31. package/src/lib/actions/fetch-post-comments.d.ts.map +0 -1
  32. package/src/lib/actions/fetch-post-comments.js +0 -97
  33. package/src/lib/actions/fetch-post-comments.js.map +0 -1
  34. package/src/lib/actions/get-reddit-post-details.d.ts +0 -4
  35. package/src/lib/actions/get-reddit-post-details.d.ts.map +0 -1
  36. package/src/lib/actions/get-reddit-post-details.js +0 -86
  37. package/src/lib/actions/get-reddit-post-details.js.map +0 -1
  38. package/src/lib/actions/retrieve-reddit-post.d.ts +0 -6
  39. package/src/lib/actions/retrieve-reddit-post.d.ts.map +0 -1
  40. package/src/lib/actions/retrieve-reddit-post.js +0 -67
  41. package/src/lib/actions/retrieve-reddit-post.js.map +0 -1
  42. package/src/lib/auth.d.ts +0 -2
  43. package/src/lib/auth.d.ts.map +0 -1
  44. package/src/lib/auth.js +0 -32
  45. package/src/lib/auth.js.map +0 -1
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteRedditComment = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../auth");
8
- exports.deleteRedditComment = (0, pieces_framework_1.createAction)({
9
- auth: auth_1.redditAuth,
10
- name: 'deleteRedditComment',
11
- displayName: 'Delete Comment',
12
- description: 'Delete a specific Reddit comment by ID.',
13
- audience: 'both',
14
- aiMetadata: { description: 'Deletes a comment owned by the authenticated account, identified by comment ID. Use it to permanently remove a comment you previously posted. Requires the comment ID (with or without the t1_ prefix). Idempotent — once deleted, repeating the call leaves the same end state.', idempotent: true },
15
- props: {
16
- comment_id: pieces_framework_1.Property.ShortText({
17
- displayName: 'Comment ID',
18
- description: 'ID of the Reddit comment to delete (e.g., "def456" or "t1_def456").',
19
- required: true,
20
- }),
21
- },
22
- run(context) {
23
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
- let commentId = context.propsValue.comment_id.trim();
25
- if (commentId.startsWith('t1_')) {
26
- commentId = commentId.slice(3);
27
- }
28
- const url = 'https://oauth.reddit.com/api/del';
29
- const payload = new URLSearchParams({
30
- api_type: 'json',
31
- id: `t1_${commentId}`,
32
- });
33
- const response = yield pieces_common_1.httpClient.sendRequest({
34
- method: pieces_common_1.HttpMethod.POST,
35
- url,
36
- headers: {
37
- 'Authorization': `Bearer ${context.auth.access_token}`,
38
- 'User-Agent': 'ActivePieces Reddit Client',
39
- 'Content-Type': 'application/x-www-form-urlencoded',
40
- },
41
- body: payload.toString(),
42
- });
43
- if (response.status !== 200) {
44
- return {
45
- error: `Failed to delete comment: ${response.status}`,
46
- details: response.body,
47
- };
48
- }
49
- return { success: true, response: response.body };
50
- });
51
- },
52
- });
53
- //# sourceMappingURL=delete-reddit-comment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete-reddit-comment.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-reddit-comment.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAqC;AAExB,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,yCAAyC;IACtD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,kRAAkR,EAAE,UAAU,EAAE,IAAI,EAAE;IACjU,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,qEAAqE;YAClF,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,IAAI,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YACrD,IAAI,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjC,CAAC;YAED,MAAM,GAAG,GAAG,kCAAkC,CAAC;YAC/C,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC;gBAClC,QAAQ,EAAE,MAAM;gBAChB,EAAE,EAAE,MAAM,SAAS,EAAE;aACtB,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG;gBACH,OAAO,EAAE;oBACP,eAAe,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE;oBACtD,YAAY,EAAE,4BAA4B;oBAC1C,cAAc,EAAE,mCAAmC;iBACpD;gBACD,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE;aACzB,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,OAAO;oBACL,KAAK,EAAE,6BAA6B,QAAQ,CAAC,MAAM,EAAE;oBACrD,OAAO,EAAE,QAAQ,CAAC,IAAI;iBACvB,CAAC;YACJ,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpD,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- export declare const deleteRedditPost: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- post_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- }>;
4
- //# sourceMappingURL=delete-reddit-post.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete-reddit-post.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/delete-reddit-post.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB;;EA8C3B,CAAC"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteRedditPost = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../auth");
8
- exports.deleteRedditPost = (0, pieces_framework_1.createAction)({
9
- auth: auth_1.redditAuth,
10
- name: 'deleteRedditPost',
11
- displayName: 'Delete Post',
12
- description: 'Delete a specific Reddit post by ID.',
13
- audience: 'both',
14
- aiMetadata: { description: 'Deletes a post owned by the authenticated account, identified by post ID. Use it to permanently remove a post you previously created. Requires the post ID (with or without the t3_ prefix). Idempotent — once deleted, repeating the call leaves the same end state.', idempotent: true },
15
- props: {
16
- post_id: pieces_framework_1.Property.ShortText({
17
- displayName: 'Post ID',
18
- description: 'ID of the Reddit post to delete (e.g., "abc123" or "t3_abc123").',
19
- required: true,
20
- }),
21
- },
22
- run(context) {
23
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
- let postId = context.propsValue.post_id.trim();
25
- if (postId.startsWith('t3_')) {
26
- postId = postId.slice(3);
27
- }
28
- const url = 'https://oauth.reddit.com/api/del';
29
- const payload = new URLSearchParams({
30
- api_type: 'json',
31
- id: `t3_${postId}`,
32
- });
33
- const response = yield pieces_common_1.httpClient.sendRequest({
34
- method: pieces_common_1.HttpMethod.POST,
35
- url,
36
- headers: {
37
- 'Authorization': `Bearer ${context.auth.access_token}`,
38
- 'User-Agent': 'ActivePieces Reddit Client',
39
- 'Content-Type': 'application/x-www-form-urlencoded',
40
- },
41
- body: payload.toString(),
42
- });
43
- if (response.status !== 200) {
44
- return {
45
- error: `Failed to delete post: ${response.status}`,
46
- details: response.body,
47
- };
48
- }
49
- return { success: true, response: response.body };
50
- });
51
- },
52
- });
53
- //# sourceMappingURL=delete-reddit-post.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete-reddit-post.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-reddit-post.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,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CAAC,MAAM,EAAE;oBAClD,OAAO,EAAE,QAAQ,CAAC,IAAI;iBACvB,CAAC;YACJ,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpD,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- export declare const editRedditComment: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- comment_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- content: import("@activepieces/pieces-framework").LongTextProperty<true>;
4
- }>;
5
- //# sourceMappingURL=edit-reddit-comment.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit-reddit-comment.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/edit-reddit-comment.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB;;;EAoD5B,CAAC"}
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.editRedditComment = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../auth");
8
- exports.editRedditComment = (0, pieces_framework_1.createAction)({
9
- auth: auth_1.redditAuth,
10
- name: 'editRedditComment',
11
- displayName: 'Edit Comment',
12
- description: 'Edits the content of an existing Reddit comment.',
13
- audience: 'both',
14
- aiMetadata: { description: 'Replaces the text of an existing comment owned by the authenticated account, identified by comment ID. Use it to update a comment you previously posted. Requires the comment ID (with or without the t1_ prefix) and the new content. Idempotent — repeating with the same content leaves the comment in the same state.', idempotent: true },
15
- props: {
16
- comment_id: pieces_framework_1.Property.ShortText({
17
- displayName: 'Comment ID',
18
- description: 'ID of the Reddit comment to edit (e.g., "def456" or "t1_def456").',
19
- required: true,
20
- }),
21
- content: pieces_framework_1.Property.LongText({
22
- displayName: 'New Comment Content',
23
- description: 'Updated text content for the comment.',
24
- required: true,
25
- }),
26
- },
27
- run(context) {
28
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
- let commentId = context.propsValue.comment_id.trim();
30
- if (commentId.startsWith('t1_')) {
31
- commentId = commentId.slice(3);
32
- }
33
- const url = 'https://oauth.reddit.com/api/editusertext';
34
- const payload = new URLSearchParams({
35
- api_type: 'json',
36
- thing_id: `t1_${commentId}`,
37
- text: context.propsValue.content,
38
- });
39
- const response = yield pieces_common_1.httpClient.sendRequest({
40
- method: pieces_common_1.HttpMethod.POST,
41
- url,
42
- headers: {
43
- 'Authorization': `Bearer ${context.auth.access_token}`,
44
- 'User-Agent': 'ActivePieces Reddit Client',
45
- 'Content-Type': 'application/x-www-form-urlencoded',
46
- },
47
- body: payload.toString(),
48
- });
49
- if (response.status !== 200) {
50
- return {
51
- error: `Failed to edit comment: ${response.status}`,
52
- details: response.body,
53
- };
54
- }
55
- return response.body;
56
- });
57
- },
58
- });
59
- //# sourceMappingURL=edit-reddit-comment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit-reddit-comment.js","sourceRoot":"","sources":["../../../../src/lib/actions/edit-reddit-comment.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAqC;AAExB,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,kDAAkD;IAC/D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,2TAA2T,EAAE,UAAU,EAAE,IAAI,EAAE;IAC1W,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,mEAAmE;YAChF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,IAAI,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YACrD,IAAI,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjC,CAAC;YAED,MAAM,GAAG,GAAG,2CAA2C,CAAC;YACxD,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC;gBAClC,QAAQ,EAAE,MAAM;gBAChB,QAAQ,EAAE,MAAM,SAAS,EAAE;gBAC3B,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;aACjC,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG;gBACH,OAAO,EAAE;oBACP,eAAe,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE;oBACtD,YAAY,EAAE,4BAA4B;oBAC1C,cAAc,EAAE,mCAAmC;iBACpD;gBACD,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE;aACzB,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,OAAO;oBACL,KAAK,EAAE,2BAA2B,QAAQ,CAAC,MAAM,EAAE;oBACnD,OAAO,EAAE,QAAQ,CAAC,IAAI;iBACvB,CAAC;YACJ,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- export declare const editRedditPost: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- post_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- content: import("@activepieces/pieces-framework").LongTextProperty<true>;
4
- }>;
5
- //# sourceMappingURL=edit-reddit-post.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit-reddit-post.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/edit-reddit-post.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;;;EAoDzB,CAAC"}
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.editRedditPost = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../auth");
8
- exports.editRedditPost = (0, pieces_framework_1.createAction)({
9
- auth: auth_1.redditAuth,
10
- name: 'editRedditPost',
11
- displayName: 'Edit Post',
12
- description: 'Edits the content of an existing Reddit post.',
13
- audience: 'both',
14
- aiMetadata: { description: 'Replaces the text body of an existing self post owned by the authenticated account, identified by post ID. Use it to update a post you previously created; it only edits text posts, not link or media posts. Requires the post ID (with or without the t3_ prefix) and the new content. Idempotent — repeating with the same content leaves the post in the same state.', idempotent: true },
15
- props: {
16
- post_id: pieces_framework_1.Property.ShortText({
17
- displayName: 'Post ID',
18
- description: 'ID of the Reddit post to edit (e.g., "abc123" or "t3_abc123").',
19
- required: true,
20
- }),
21
- content: pieces_framework_1.Property.LongText({
22
- displayName: 'New Post Content',
23
- description: 'Updated text content for the post.',
24
- required: true,
25
- }),
26
- },
27
- run(context) {
28
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
- let postId = context.propsValue.post_id.trim();
30
- if (postId.startsWith('t3_')) {
31
- postId = postId.slice(3);
32
- }
33
- const url = 'https://oauth.reddit.com/api/editusertext';
34
- const payload = new URLSearchParams({
35
- api_type: 'json',
36
- thing_id: `t3_${postId}`,
37
- text: context.propsValue.content,
38
- });
39
- const response = yield pieces_common_1.httpClient.sendRequest({
40
- method: pieces_common_1.HttpMethod.POST,
41
- url,
42
- headers: {
43
- 'Authorization': `Bearer ${context.auth.access_token}`,
44
- 'User-Agent': 'ActivePieces Reddit Client',
45
- 'Content-Type': 'application/x-www-form-urlencoded',
46
- },
47
- body: payload.toString(),
48
- });
49
- if (response.status !== 200) {
50
- return {
51
- error: `Failed to edit post: ${response.status}`,
52
- details: response.body,
53
- };
54
- }
55
- return response.body;
56
- });
57
- },
58
- });
59
- //# sourceMappingURL=edit-reddit-post.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit-reddit-post.js","sourceRoot":"","sources":["../../../../src/lib/actions/edit-reddit-post.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAqC;AAExB,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,+CAA+C;IAC5D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,0WAA0W,EAAE,UAAU,EAAE,IAAI,EAAE;IACzZ,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,gEAAgE;YAC7E,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,IAAI,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAC/C,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;YAED,MAAM,GAAG,GAAG,2CAA2C,CAAC;YACxD,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC;gBAClC,QAAQ,EAAE,MAAM;gBAChB,QAAQ,EAAE,MAAM,MAAM,EAAE;gBACxB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;aACjC,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG;gBACH,OAAO,EAAE;oBACP,eAAe,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE;oBACtD,YAAY,EAAE,4BAA4B;oBAC1C,cAAc,EAAE,mCAAmC;iBACpD;gBACD,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE;aACzB,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,OAAO;oBACL,KAAK,EAAE,wBAAwB,QAAQ,CAAC,MAAM,EAAE;oBAChD,OAAO,EAAE,QAAQ,CAAC,IAAI;iBACvB,CAAC;YACJ,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare const fetchPostComments: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- post_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- sort: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
4
- limit: import("@activepieces/pieces-framework").NumberProperty<false>;
5
- }>;
6
- //# sourceMappingURL=fetch-post-comments.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch-post-comments.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/fetch-post-comments.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB;;;;EA0F5B,CAAC"}
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchPostComments = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../auth");
8
- exports.fetchPostComments = (0, pieces_framework_1.createAction)({
9
- auth: auth_1.redditAuth,
10
- name: 'fetchPostComments',
11
- displayName: 'Fetch Post Comments',
12
- description: 'Fetch comments from a specific Reddit post.',
13
- audience: 'both',
14
- aiMetadata: { description: 'Retrieves the threaded comments of one Reddit post identified by its ID, including nested replies. Use it to read discussion on a known post; the sort option (new, top, hot, best, old, controversial) and a limit on top-level comments are configurable. Accepts the post ID with or without the t3_ prefix. Read-only and idempotent.', idempotent: true },
15
- props: {
16
- post_id: pieces_framework_1.Property.ShortText({
17
- displayName: 'Post ID',
18
- description: 'The ID of the Reddit post (e.g. "abc123" or "t3_abc123").',
19
- required: true,
20
- }),
21
- sort: pieces_framework_1.Property.StaticDropdown({
22
- displayName: 'Sort By',
23
- description: 'Sorting method for comments',
24
- defaultValue: 'new',
25
- required: false,
26
- options: {
27
- options: [
28
- { label: 'New', value: 'new' },
29
- { label: 'Top', value: 'top' },
30
- { label: 'Hot', value: 'hot' },
31
- { label: 'Best', value: 'best' },
32
- { label: 'Old', value: 'old' },
33
- { label: 'Controversial', value: 'controversial' },
34
- ],
35
- },
36
- }),
37
- limit: pieces_framework_1.Property.Number({
38
- displayName: 'Limit',
39
- description: 'Maximum number of top-level comments to fetch',
40
- defaultValue: 10,
41
- required: false,
42
- }),
43
- },
44
- run(context) {
45
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
46
- var _a, _b, _c, _d, _e;
47
- let postId = context.propsValue.post_id.trim();
48
- if (postId.startsWith('t3_')) {
49
- postId = postId.slice(3);
50
- }
51
- const response = yield pieces_common_1.httpClient.sendRequest({
52
- method: pieces_common_1.HttpMethod.GET,
53
- url: `https://oauth.reddit.com/comments/${postId}`,
54
- headers: {
55
- 'Authorization': `Bearer ${context.auth.access_token}`,
56
- 'User-Agent': 'ActivePieces Reddit Client',
57
- 'Content-Type': 'application/json',
58
- },
59
- queryParams: {
60
- sort: (_a = context.propsValue.sort) !== null && _a !== void 0 ? _a : 'new',
61
- limit: ((_b = context.propsValue.limit) !== null && _b !== void 0 ? _b : 10).toString(),
62
- },
63
- });
64
- if (response.status !== 200) {
65
- return {
66
- error: `Failed to retrieve comments: ${response.status}`,
67
- details: response.body,
68
- };
69
- }
70
- function processComments(comments) {
71
- return comments
72
- .filter(c => c.kind === 't1')
73
- .map(c => {
74
- const d = c.data;
75
- return {
76
- id: d.id,
77
- author: d.author,
78
- body: d.body,
79
- score: d.score,
80
- created_utc: d.created_utc,
81
- permalink: d.permalink,
82
- edited: d.edited,
83
- is_submitter: d.is_submitter,
84
- stickied: d.stickied,
85
- replies: d.replies && typeof d.replies === 'object'
86
- ? processComments(d.replies.data.children)
87
- : [],
88
- };
89
- });
90
- }
91
- const data = response.body;
92
- const commentsTree = (_e = (_d = (_c = data[1]) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.children) !== null && _e !== void 0 ? _e : [];
93
- return processComments(commentsTree);
94
- });
95
- },
96
- });
97
- //# sourceMappingURL=fetch-post-comments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch-post-comments.js","sourceRoot":"","sources":["../../../../src/lib/actions/fetch-post-comments.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAqC;AAExB,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,6CAA6C;IAC1D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,W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AAC,CAAC,OAAO,KAAK,QAAQ;4BACjD,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;4BAC1C,CAAC,CAAC,EAAE;qBACP,CAAC;gBACJ,CAAC,CAAC,CAAC;YACP,CAAC;YAED,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;YAC3B,MAAM,YAAY,GAAG,MAAA,MAAA,MAAA,IAAI,CAAC,CAAC,CAAC,0CAAE,IAAI,0CAAE,QAAQ,mCAAI,EAAE,CAAC;YAEnD,OAAO,eAAe,CAAC,YAAY,CAAC,CAAC;QACvC,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- export declare const getRedditPostDetails: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- post_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- }>;
4
- //# sourceMappingURL=get-reddit-post-details.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-reddit-post-details.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-reddit-post-details.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB;;EAoF/B,CAAC"}
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRedditPostDetails = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../auth");
8
- exports.getRedditPostDetails = (0, pieces_framework_1.createAction)({
9
- auth: auth_1.redditAuth,
10
- name: 'getRedditPostDetails',
11
- displayName: 'Get Post Details',
12
- description: 'Fetch detailed information about a specific Reddit post using its ID.',
13
- audience: 'both',
14
- aiMetadata: { description: 'Looks up one specific Reddit post by its ID and returns its full metadata (title, author, body, score, counts, flags). Use it when you already have a post ID and need details for that single post, not to browse a subreddit. Accepts the ID with or without the t3_ prefix. Read-only and idempotent.', idempotent: true },
15
- props: {
16
- post_id: pieces_framework_1.Property.ShortText({
17
- displayName: 'Post ID',
18
- description: 'The ID of the Reddit post (e.g. "t3_abc123" or "abc123")',
19
- required: true,
20
- }),
21
- },
22
- run(context) {
23
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
- var _a, _b, _c;
25
- let postId = context.propsValue.post_id.trim();
26
- if (postId.startsWith('t3_')) {
27
- postId = postId.slice(3);
28
- }
29
- const url = `https://oauth.reddit.com/api/info?id=t3_${postId}`;
30
- const response = yield pieces_common_1.httpClient.sendRequest({
31
- method: pieces_common_1.HttpMethod.GET,
32
- url,
33
- headers: {
34
- 'Authorization': `Bearer ${context.auth.access_token}`,
35
- 'User-Agent': 'ActivePieces Reddit Client',
36
- 'Content-Type': 'application/json',
37
- },
38
- timeout: 5000,
39
- });
40
- if (response.status !== 200) {
41
- return {
42
- error: `Failed to retrieve post details: ${response.status}`,
43
- details: response.body,
44
- };
45
- }
46
- const children = (_c = (_b = (_a = response.body) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.children) !== null && _c !== void 0 ? _c : [];
47
- if (children.length === 0) {
48
- return { error: 'No post found with the given ID' };
49
- }
50
- const data = children[0].data;
51
- const result = {
52
- id: data.id,
53
- title: data.title,
54
- author: data.author,
55
- author_fullname: data.author_fullname,
56
- subreddit: data.subreddit,
57
- subreddit_id: data.subreddit_id,
58
- selftext: data.selftext,
59
- selftext_html: data.selftext_html,
60
- score: data.score,
61
- upvote_ratio: data.upvote_ratio,
62
- created_utc: data.created_utc,
63
- permalink: data.permalink,
64
- url: data.url,
65
- domain: data.domain,
66
- num_comments: data.num_comments,
67
- is_self: data.is_self,
68
- is_video: data.is_video,
69
- is_original_content: data.is_original_content,
70
- over_18: data.over_18,
71
- spoiler: data.spoiler,
72
- locked: data.locked,
73
- stickied: data.stickied,
74
- post_hint: data.post_hint,
75
- };
76
- if (data.media) {
77
- result['media'] = data.media;
78
- }
79
- if (data.gallery_data) {
80
- result['gallery_data'] = data.gallery_data;
81
- }
82
- return result;
83
- });
84
- },
85
- });
86
- //# sourceMappingURL=get-reddit-post-details.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-reddit-post-details.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-reddit-post-details.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAqC;AAExB,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,uEAAuE;IACpF,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,0SAA0S,EAAE,UAAU,EAAE,IAAI,EAAE;IACzV,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,IAAI,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAC/C,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;YAED,MAAM,GAAG,GAAG,2CAA2C,MAAM,EAAE,CAAC;YAEhE,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG;gBACH,OAAO,EAAE;oBACP,eAAe,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE;oBACtD,YAAY,EAAE,4BAA4B;oBAC1C,cAAc,EAAE,kB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AAC,mBAAmB;gBAC7C,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,SAAS,EAAE,IAAI,CAAC,SAAS;aAC1B,CAAC;YAEF,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;YAC/B,CAAC;YAED,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;gBACtB,MAAM,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;YAC7C,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare const retrieveRedditPost: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- post_category: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
3
- subreddit: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- size: import("@activepieces/pieces-framework").NumberProperty<false>;
5
- }>;
6
- //# sourceMappingURL=retrieve-reddit-post.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"retrieve-reddit-post.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/retrieve-reddit-post.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,kBAAkB;;;;EA2D7B,CAAC"}
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.retrieveRedditPost = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../auth");
8
- exports.retrieveRedditPost = (0, pieces_framework_1.createAction)({
9
- auth: auth_1.redditAuth,
10
- name: 'retrieveRedditPost',
11
- displayName: 'Retrieve Post',
12
- description: 'Fetch top posts in a subreddit with optional size limit.',
13
- audience: 'both',
14
- aiMetadata: { description: 'Lists posts from a given subreddit, choosing the listing via a category (hot, new, top, rising, or controversial). Use it to read or monitor a subreddit\'s feed rather than to look up one known post. Requires the subreddit name; an optional size caps how many posts are returned (max 100). Read-only and idempotent.', idempotent: true },
15
- props: {
16
- post_category: pieces_framework_1.Property.StaticDropdown({
17
- displayName: 'Post Category',
18
- description: 'Select the category of posts to retrieve',
19
- required: true,
20
- defaultValue: 'hot',
21
- options: {
22
- options: [
23
- { label: 'Hot', value: 'hot' },
24
- { label: 'New', value: 'new' },
25
- { label: 'Top', value: 'top' },
26
- { label: 'Rising', value: 'rising' },
27
- { label: 'Controversial', value: 'controversial' },
28
- ],
29
- },
30
- }),
31
- subreddit: pieces_framework_1.Property.ShortText({
32
- displayName: 'Subreddit',
33
- description: 'The subreddit to fetch posts from',
34
- required: true,
35
- }),
36
- size: pieces_framework_1.Property.Number({
37
- displayName: 'Number of Posts',
38
- description: 'Number of posts to fetch (max 100)',
39
- required: false,
40
- defaultValue: 10,
41
- }),
42
- },
43
- run(context) {
44
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
- const baseUrl = `https://oauth.reddit.com/r/${context.propsValue.subreddit}/${context.propsValue.post_category}`;
46
- const limit = context.propsValue.size || 10;
47
- const response = yield pieces_common_1.httpClient.sendRequest({
48
- method: pieces_common_1.HttpMethod.GET,
49
- url: baseUrl,
50
- queryParams: {
51
- limit: limit.toString(),
52
- },
53
- headers: {
54
- 'Authorization': `Bearer ${context.auth.access_token}`,
55
- 'User-Agent': 'ActivePieces Reddit Client',
56
- 'Content-Type': 'application/json',
57
- },
58
- timeout: 5000,
59
- });
60
- if (response.status !== 200) {
61
- throw new Error(`Reddit API error: ${response.status} ${JSON.stringify(response.body)}`);
62
- }
63
- return response.body;
64
- });
65
- },
66
- });
67
- //# sourceMappingURL=retrieve-reddit-post.js.map
@@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IACK,GAAG,CAAC,OAAO;;YACf,MAAM,OAAO,GAAG,8BAA8B,OAAO,CAAC,UAAU,CAAC,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;YACjH,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC;YAE5C,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,OAAO;gBACZ,WAAW,EAAE;oBACX,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;iBACxB;gBACD,OAAO,EAAE;oBACP,eAAe,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE;oBACtD,YAAY,EAAE,4BAA4B;oBAC1C,cAAc,EAAE,kBAAkB;iBACnC;gBACD,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC3F,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
package/src/lib/auth.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const redditAuth: import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>;
2
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,UAAU,+GAWrB,CAAC"}
package/src/lib/auth.js DELETED
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.redditAuth = void 0;
4
- const pieces_framework_1 = require("@activepieces/pieces-framework");
5
- const shared_1 = require("@activepieces/shared");
6
- const markdown = `
7
- To obtain your Reddit API credentials:
8
-
9
- 1. Go to https://www.reddit.com/prefs/apps.
10
- 2. Click "create another app..." at the bottom.
11
- 3. Select "script" as the app type.
12
- 4. Fill in the required information:
13
- - name: Your app name
14
- - description: Brief description
15
- - about url: Can be left blank
16
- - redirect uri: as shown in Redirect URL field
17
- 5. Click "create app".
18
- 6. Note down the client ID (under the app name) and client secret.
19
- `;
20
- exports.redditAuth = pieces_framework_1.PieceAuth.OAuth2({
21
- description: markdown,
22
- authUrl: 'https://www.reddit.com/api/v1/authorize',
23
- tokenUrl: 'https://www.reddit.com/api/v1/access_token',
24
- required: true,
25
- scope: ['identity', 'read', 'submit', 'edit', 'history', 'flair'],
26
- authorizationMethod: pieces_framework_1.OAuth2AuthorizationMethod.HEADER,
27
- extra: {
28
- grantType: shared_1.OAuth2GrantType.AUTHORIZATION_CODE,
29
- responseType: 'code'
30
- }
31
- });
32
- //# sourceMappingURL=auth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;AAAA,qEAAsF;AACtF,iDAAuD;AAEvD,MAAM,QAAQ,GAAG;;;;;;;;;;;;;CAahB,CAAC;AAEW,QAAA,UAAU,GAAG,4BAAS,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,yCAAyC;IAClD,QAAQ,EAAE,4CAA4C;IACtD,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC;IACjE,mBAAmB,EAAE,4CAAyB,CAAC,MAAM;IACrD,KAAK,EAAE;QACL,SAAS,EAAE,wBAAe,CAAC,kBAAkB;QAC7C,YAAY,EAAE,MAAM;KACrB;CACF,CAAC,CAAC"}