@activepieces/piece-mastodon 0.0.4 → 0.3.0

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/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "@activepieces/piece-mastodon",
3
- "version": "0.0.4",
3
+ "version": "0.3.0",
4
4
  "dependencies": {
5
- "@sinclair/typebox": "0.26.8",
5
+ "@sinclair/typebox": "^0.26.3",
6
6
  "axios": "1.2.4",
7
- "lodash": "4.17.21",
8
- "nanoid": "3.3.4",
9
- "@activepieces/pieces-framework": "0.3.27",
10
- "@activepieces/shared": "0.3.44",
11
- "@activepieces/pieces-common": "0.0.7",
12
- "tslib": "2.5.3"
7
+ "nanoid": "^3.3.4",
8
+ "@activepieces/pieces-common": "0.1.0",
9
+ "@activepieces/pieces-framework": "0.4.0",
10
+ "@activepieces/shared": "0.4.0",
11
+ "tslib": "1.14.1"
13
12
  },
14
13
  "main": "./src/index.js",
15
14
  "types": "./src/index.d.ts"
package/src/index.d.ts CHANGED
@@ -1 +1,8 @@
1
- export declare const mastodon: import("@activepieces/pieces-framework").Piece;
1
+ export declare const mastodonAuth: import("@activepieces/pieces-framework").CustomAuthProperty<true, {
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ access_token: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ }>;
5
+ export declare const mastodon: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
6
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ access_token: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
+ }>>;
package/src/index.js CHANGED
@@ -1,15 +1,44 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mastodon = void 0;
3
+ exports.mastodon = exports.mastodonAuth = void 0;
4
4
  const pieces_framework_1 = require("@activepieces/pieces-framework");
5
5
  const post_status_1 = require("./lib/actions/post-status");
6
+ const markdownDescription = `
7
+ **Base Url**: The base url of your Mastodon instance (e.g \`https://mastodon.social\`)
8
+
9
+ **Access Token**: To get your access token, follow the steps below:
10
+
11
+ 1. Go to your **Profile** -> **Preferences** -> **Development** -> **New Application**
12
+ 2. Fill the Information
13
+ 3. Click on **Create Application**
14
+ 4. Copy access token from **Your access token**
15
+ `;
16
+ exports.mastodonAuth = pieces_framework_1.PieceAuth.CustomAuth({
17
+ displayName: "Authentication",
18
+ description: markdownDescription,
19
+ props: {
20
+ base_url: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Base URL',
22
+ description: 'The base URL of your Mastodon instance',
23
+ defaultValue: "https://mastodon.social/",
24
+ required: true,
25
+ }),
26
+ access_token: pieces_framework_1.Property.ShortText({
27
+ displayName: 'Access Token',
28
+ description: 'The access token for your Mastodon account, check the documentation for how to get this',
29
+ required: true
30
+ })
31
+ },
32
+ required: true
33
+ });
6
34
  exports.mastodon = (0, pieces_framework_1.createPiece)({
7
35
  displayName: 'Mastodon',
8
36
  logoUrl: 'https://cdn.activepieces.com/pieces/mastodon.png',
9
- minimumSupportedRelease: '0.3.9',
37
+ minimumSupportedRelease: '0.5.0',
10
38
  authors: [
11
39
  "abuaboud"
12
40
  ],
41
+ auth: exports.mastodonAuth,
13
42
  actions: [
14
43
  post_status_1.postStatus
15
44
  ],
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/mastodon/src/index.ts"],"names":[],"mappings":";;;AACA,qEAA6D;AAC7D,2DAAuD;AAE1C,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,UAAU;IACvB,OAAO,EAAE,kDAAkD;IAC3D,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE;QACP,UAAU;KACX;IACD,OAAO,EAAE;QACP,wBAAU;KACX;IACD,QAAQ,EAAE,EACT;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/mastodon/src/index.ts"],"names":[],"mappings":";;;AACA,qEAAkF;AAClF,2DAAuD;AAEvD,MAAM,mBAAmB,GAAG;;;;;;;;;CAS3B,CAAC;AAEW,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC7C,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,mBAAmB;IAChC,KAAK,EAAE;QACH,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,wCAAwC;YACrD,YAAY,EAAE,0BAA0B;YACxC,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,yFAAyF;YACtG,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IACD,QAAQ,EAAE,IAAI;CACjB,CAAC,CAAA;AAEW,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,UAAU;IAErB,OAAO,EAAE,kDAAkD;IAC3D,uBAAuB,EAAE,OAAO;IAClC,OAAO,EAAE;QACP,UAAU;KACX;IACD,IAAI,EAAE,oBAAY;IAClB,OAAO,EAAE;QACP,wBAAU;KACX;IACD,QAAQ,EAAE,EACT;CACF,CAAC,CAAC"}
@@ -1 +1,6 @@
1
- export declare const postStatus: import("@activepieces/pieces-framework").Action;
1
+ export declare const postStatus: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ access_token: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ }>, {
5
+ status: import("@activepieces/pieces-framework").LongTextProperty<true>;
6
+ }>;
@@ -4,40 +4,14 @@ exports.postStatus = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const pieces_framework_1 = require("@activepieces/pieces-framework");
6
6
  const pieces_common_1 = require("@activepieces/pieces-common");
7
- const markdownDescription = `
8
- **Base Url**: The base url of your Mastodon instance (e.g \`https://mastodon.social\`)
9
-
10
- **Access Token**: To get your access token, follow the steps below:
11
-
12
- 1. Go to your **Profile** -> **Preferences** -> **Development** -> **New Application**
13
- 2. Fill the Information
14
- 3. Click on **Create Application**
15
- 4. Copy access token from **Your access token**
16
- `;
7
+ const __1 = require("../..");
17
8
  exports.postStatus = (0, pieces_framework_1.createAction)({
9
+ auth: __1.mastodonAuth,
18
10
  name: 'post_status',
19
11
  displayName: 'Post Status',
20
12
  description: 'Post a status to Mastodon',
21
13
  sampleData: {},
22
14
  props: {
23
- authentication: pieces_framework_1.Property.CustomAuth({
24
- displayName: "Authentication",
25
- description: markdownDescription,
26
- props: {
27
- base_url: pieces_framework_1.Property.ShortText({
28
- displayName: 'Base URL',
29
- description: 'The base URL of your Mastodon instance',
30
- defaultValue: "https://mastodon.social/",
31
- required: true,
32
- }),
33
- access_token: pieces_framework_1.Property.ShortText({
34
- displayName: 'Access Token',
35
- description: 'The access token for your Mastodon account, check the documentation for how to get this',
36
- required: true
37
- })
38
- },
39
- required: true
40
- }),
41
15
  status: pieces_framework_1.Property.LongText({
42
16
  displayName: 'Status',
43
17
  description: 'The text of your status',
@@ -46,10 +20,10 @@ exports.postStatus = (0, pieces_framework_1.createAction)({
46
20
  },
47
21
  run(context) {
48
22
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
49
- const token = context.propsValue.authentication.access_token;
23
+ const token = context.auth.access_token;
50
24
  const status = context.propsValue.status;
51
25
  // Remove trailing slash from base_url
52
- const baseUrl = context.propsValue.authentication.base_url.replace(/\/$/, "");
26
+ const baseUrl = context.auth.base_url.replace(/\/$/, "");
53
27
  return yield pieces_common_1.httpClient.sendRequest({
54
28
  url: `${baseUrl}/api/v1/statuses`,
55
29
  method: pieces_common_1.HttpMethod.POST,
@@ -1 +1 @@
1
- {"version":3,"file":"post-status.js","sourceRoot":"","sources":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BAChC,GAAG,EAAE,GAAG,OAAO,kBAAkB;gBACjC,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,cAAc,EAAE;oBACZ,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK;iBACR;gBACD,IAAI,EAAE;oBACF,MAAM;iBACT;aACJ,CAAC,CAAA;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"post-status.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/mastodon/src/lib/actions/post-status.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyF;AACzF,6BAAqC;AAExB,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,gBAAY;IACd,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,2BAA2B;IACxC,UAAU,EAAE,EAAE;IACd,KAAK,EAAE;QACH,MAAM,EAAE,2BAAQ,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,IAAI,CAAC,YAAY,CAAC;YACxC,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;YACzC,sCAAsC;YACtC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACzD,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAChC,GAAG,EAAE,GAAG,OAAO,kBAAkB;gBACjC,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,cAAc,EAAE;oBACZ,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK;iBACR;gBACD,IAAI,EAAE;oBACF,MAAM;iBACT;aACJ,CAAC,CAAA;QACN,CAAC;KAAA;CACR,CAAC,CAAC"}