@activepieces/piece-mastodon 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # pieces-mastodon
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Running lint
6
+
7
+ Run `nx lint pieces-mastodon` to execute the lint via [ESLint](https://eslint.org/).
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@activepieces/piece-mastodon",
3
+ "version": "0.0.1",
4
+ "dependencies": {
5
+ "@sinclair/typebox": "0.26.3",
6
+ "axios": "1.2.4",
7
+ "nanoid": "3.3.4",
8
+ "@activepieces/framework": "0.3.5",
9
+ "@activepieces/shared": "0.3.3",
10
+ "tslib": "2.4.1"
11
+ },
12
+ "main": "./src/index.js",
13
+ "types": "./src/index.d.ts"
14
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const mastodon: import("@activepieces/framework").Piece;
package/src/index.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mastodon = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const framework_1 = require("@activepieces/framework");
6
+ const package_json_1 = tslib_1.__importDefault(require("../package.json"));
7
+ const post_status_1 = require("./lib/actions/post-status");
8
+ exports.mastodon = (0, framework_1.createPiece)({
9
+ name: 'mastodon',
10
+ displayName: 'Mastodon',
11
+ logoUrl: 'https://cdn.activepieces.com/pieces/mastodon.png',
12
+ version: package_json_1.default.version,
13
+ minimumSupportedRelease: '0.3.9',
14
+ authors: [
15
+ "abuaboud"
16
+ ],
17
+ actions: [
18
+ post_status_1.postStatus
19
+ ],
20
+ triggers: [],
21
+ });
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/mastodon/src/index.ts"],"names":[],"mappings":";;;;AACA,uDAAsD;AACtD,2EAA0C;AAC1C,2DAAuD;AAE1C,QAAA,QAAQ,GAAG,IAAA,uBAAW,EAAC;IAClC,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,UAAU;IACvB,OAAO,EAAE,kDAAkD;IAC3D,OAAO,EAAE,sBAAW,CAAC,OAAO;IAC5B,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE;QACP,UAAU;KACX;IACD,OAAO,EAAE;QACP,wBAAU;KACX;IACD,QAAQ,EAAE,EACT;CACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const postStatus: import("@activepieces/framework").Action;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.postStatus = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const framework_1 = require("@activepieces/framework");
6
+ exports.postStatus = (0, framework_1.createAction)({
7
+ name: 'post_status',
8
+ displayName: 'Post Status',
9
+ description: 'Post a status to Mastodon',
10
+ sampleData: {},
11
+ props: {
12
+ authentication: framework_1.Property.CustomAuth({
13
+ displayName: "Authentication",
14
+ props: {
15
+ base_url: framework_1.Property.ShortText({
16
+ displayName: 'Base URL',
17
+ description: 'The base URL of your Mastodon instance',
18
+ defaultValue: "https://mastodon.social/",
19
+ required: true,
20
+ }),
21
+ access_token: framework_1.Property.ShortText({
22
+ displayName: 'Access Token',
23
+ description: 'The access token for your Mastodon account, check the documentation for how to get this',
24
+ required: true
25
+ })
26
+ },
27
+ required: true
28
+ }),
29
+ status: framework_1.Property.LongText({
30
+ displayName: 'Status',
31
+ description: 'The text of your status',
32
+ required: true,
33
+ })
34
+ },
35
+ run(context) {
36
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
37
+ const token = context.propsValue.authentication.access_token;
38
+ const status = context.propsValue.status;
39
+ // Remove trailing slash from base_url
40
+ const baseUrl = context.propsValue.authentication.base_url.replace(/\/$/, "");
41
+ return yield framework_1.httpClient.sendRequest({
42
+ url: `${baseUrl}/api/v1/statuses`,
43
+ method: framework_1.HttpMethod.POST,
44
+ authentication: {
45
+ type: framework_1.AuthenticationType.BEARER_TOKEN,
46
+ token,
47
+ },
48
+ body: {
49
+ status,
50
+ }
51
+ });
52
+ });
53
+ },
54
+ });
55
+ //# sourceMappingURL=post-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-status.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/mastodon/src/lib/actions/post-status.ts"],"names":[],"mappings":";;;;AAAA,uDAA6G;AAGhG,QAAA,UAAU,GAAG,IAAA,wBAAY,EAAC;IACnC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,2BAA2B;IACxC,UAAU,EAAE,EAAE;IACd,KAAK,EAAE;QACH,cAAc,EAAE,oBAAQ,CAAC,UAAU,CAAC;YAChC,WAAW,EAAE,gBAAgB;YAC7B,KAAK,EAAE;gBACH,QAAQ,EAAE,oBAAQ,CAAC,SAAS,CAAC;oBACzB,WAAW,EAAE,UAAU;oBACvB,WAAW,EAAE,wCAAwC;oBACrD,YAAY,EAAE,0BAA0B;oBACxC,QAAQ,EAAE,IAAI;iBACjB,CAAC;gBACF,YAAY,EAAE,oBAAQ,CAAC,SAAS,CAAC;oBAC7B,WAAW,EAAE,cAAc;oBAC3B,WAAW,EAAE,yFAAyF;oBACtG,QAAQ,EAAE,IAAI;iBACjB,CAAC;aACL;YACD,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,MAAM,EAAE,oBAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,YAAY,CAAC;YAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;YACzC,sCAAsC;YACtC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC9E,OAAO,MAAM,sBAAU,CAAC,WAAW,CAAC;gBAChC,GAAG,EAAE,GAAG,OAAO,kBAAkB;gBACjC,MAAM,EAAE,sBAAU,CAAC,IAAI;gBACvB,cAAc,EAAE;oBACZ,IAAI,EAAE,8BAAkB,CAAC,YAAY;oBACrC,KAAK;iBACR;gBACD,IAAI,EAAE;oBACF,MAAM;iBACT;aACJ,CAAC,CAAA;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}