@activepieces/piece-postiz 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.
Files changed (51) hide show
  1. package/package.json +17 -0
  2. package/src/i18n/fr.json +74 -0
  3. package/src/i18n/translation.json +74 -0
  4. package/src/index.d.ts +6 -0
  5. package/src/index.d.ts.map +1 -0
  6. package/src/index.js +52 -0
  7. package/src/index.js.map +1 -0
  8. package/src/lib/actions/create-post.d.ts +16 -0
  9. package/src/lib/actions/create-post.d.ts.map +1 -0
  10. package/src/lib/actions/create-post.js +96 -0
  11. package/src/lib/actions/create-post.js.map +1 -0
  12. package/src/lib/actions/delete-post.d.ts +7 -0
  13. package/src/lib/actions/delete-post.d.ts.map +1 -0
  14. package/src/lib/actions/delete-post.js +33 -0
  15. package/src/lib/actions/delete-post.js.map +1 -0
  16. package/src/lib/actions/find-available-slot.d.ts +10 -0
  17. package/src/lib/actions/find-available-slot.d.ts.map +1 -0
  18. package/src/lib/actions/find-available-slot.js +31 -0
  19. package/src/lib/actions/find-available-slot.js.map +1 -0
  20. package/src/lib/actions/get-platform-analytics.d.ts +11 -0
  21. package/src/lib/actions/get-platform-analytics.d.ts.map +1 -0
  22. package/src/lib/actions/get-platform-analytics.js +46 -0
  23. package/src/lib/actions/get-platform-analytics.js.map +1 -0
  24. package/src/lib/actions/get-post-analytics.d.ts +8 -0
  25. package/src/lib/actions/get-post-analytics.d.ts.map +1 -0
  26. package/src/lib/actions/get-post-analytics.js +50 -0
  27. package/src/lib/actions/get-post-analytics.js.map +1 -0
  28. package/src/lib/actions/list-integrations.d.ts +5 -0
  29. package/src/lib/actions/list-integrations.d.ts.map +1 -0
  30. package/src/lib/actions/list-integrations.js +39 -0
  31. package/src/lib/actions/list-integrations.js.map +1 -0
  32. package/src/lib/actions/list-posts.d.ts +8 -0
  33. package/src/lib/actions/list-posts.d.ts.map +1 -0
  34. package/src/lib/actions/list-posts.js +54 -0
  35. package/src/lib/actions/list-posts.js.map +1 -0
  36. package/src/lib/actions/upload-file-from-url.d.ts +7 -0
  37. package/src/lib/actions/upload-file-from-url.d.ts.map +1 -0
  38. package/src/lib/actions/upload-file-from-url.js +44 -0
  39. package/src/lib/actions/upload-file-from-url.js.map +1 -0
  40. package/src/lib/common/auth.d.ts +11 -0
  41. package/src/lib/common/auth.d.ts.map +1 -0
  42. package/src/lib/common/auth.js +47 -0
  43. package/src/lib/common/auth.js.map +1 -0
  44. package/src/lib/common/index.d.ts +17 -0
  45. package/src/lib/common/index.d.ts.map +1 -0
  46. package/src/lib/common/index.js +61 -0
  47. package/src/lib/common/index.js.map +1 -0
  48. package/src/lib/triggers/new-post.d.ts +15 -0
  49. package/src/lib/triggers/new-post.d.ts.map +1 -0
  50. package/src/lib/triggers/new-post.js +81 -0
  51. package/src/lib/triggers/new-post.js.map +1 -0
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@activepieces/piece-postiz",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc -p tsconfig.lib.json && cp package.json dist/",
9
+ "lint": "eslint 'src/**/*.ts'"
10
+ },
11
+ "dependencies": {
12
+ "@activepieces/pieces-common": "0.12.0",
13
+ "@activepieces/pieces-framework": "0.26.0",
14
+ "@activepieces/shared": "0.50.0",
15
+ "tslib": "^2.3.0"
16
+ }
17
+ }
@@ -0,0 +1,74 @@
1
+ {
2
+ "Open-source social media scheduling tool supporting 30+ platforms": "Outil open-source de planification de publications sur les réseaux sociaux, compatible avec plus de 30 plateformes",
3
+ "Base URL": "URL de base",
4
+ "API Key": "Clé API",
5
+ "The API base URL. Use `https://api.postiz.com/public/v1` for Postiz Cloud, or `https://your-domain.com/api/public/v1` for self-hosted instances.": "L'URL de base de l'API. Utilisez `https://api.postiz.com/public/v1` pour Postiz Cloud, ou `https://votre-domaine.com/api/public/v1` pour les instances auto-hébergées.",
6
+ "To get your API key:\n1. Log in to your Postiz dashboard\n2. Go to **Settings > Developers > Public API**\n3. Generate a new API key and copy it": "Pour obtenir votre clé API :\n1. Connectez-vous à votre tableau de bord Postiz\n2. Allez dans **Paramètres > Développeurs > API publique**\n3. Générez une nouvelle clé API et copiez-la",
7
+ "Create Post": "Créer une publication",
8
+ "List Posts": "Lister les publications",
9
+ "Delete Post": "Supprimer une publication",
10
+ "List Channels": "Lister les canaux",
11
+ "Find Available Slot": "Trouver un créneau disponible",
12
+ "Get Platform Analytics": "Obtenir les statistiques de la plateforme",
13
+ "Get Post Analytics": "Obtenir les statistiques d'une publication",
14
+ "Upload File from URL": "Téléverser un fichier depuis une URL",
15
+ "Custom API Call": "Appel d'API personnalisé",
16
+ "Create or schedule a post on one or more connected channels": "Créer ou planifier une publication sur un ou plusieurs canaux connectés",
17
+ "Retrieve posts within a date range": "Récupérer les publications dans une plage de dates",
18
+ "Delete a post and all other posts in the same group": "Supprimer une publication et toutes les autres publications du même groupe",
19
+ "List all connected social media channels in your organization": "Lister tous les canaux de réseaux sociaux connectés dans votre organisation",
20
+ "Find the next available posting time slot for a connected channel": "Trouver le prochain créneau de publication disponible pour un canal connecté",
21
+ "Retrieve analytics (followers, impressions, engagement) for a connected channel": "Récupérer les statistiques (abonnés, impressions, engagement) d'un canal connecté",
22
+ "Retrieve analytics (likes, comments, shares, impressions) for a specific published post": "Récupérer les statistiques (mentions j'aime, commentaires, partages, impressions) d'une publication spécifique",
23
+ "Upload a media file from a URL to Postiz. Returns the file path to use when creating posts.": "Téléverser un fichier média depuis une URL vers Postiz. Renvoie le chemin du fichier à utiliser lors de la création de publications.",
24
+ "Make a custom API call to a specific endpoint": "Effectuer un appel d'API personnalisé vers un point de terminaison spécifique",
25
+ "Post Type": "Type de publication",
26
+ "Publish Date": "Date de publication",
27
+ "Channel": "Canal",
28
+ "Content": "Contenu",
29
+ "Media URLs": "URLs des médias",
30
+ "Shorten Links": "Raccourcir les liens",
31
+ "Start Date": "Date de début",
32
+ "End Date": "Date de fin",
33
+ "Post ID": "ID de la publication",
34
+ "Lookback Days": "Nombre de jours",
35
+ "File URL": "URL du fichier",
36
+ "Method": "Méthode",
37
+ "Headers": "En-têtes",
38
+ "Query Parameters": "Paramètres de requête",
39
+ "Body Type": "Type de corps",
40
+ "Body": "Corps",
41
+ "Response is Binary ?": "La réponse est binaire ?",
42
+ "No Error on Failure": "Pas d'erreur en cas d'échec",
43
+ "Timeout (in seconds)": "Délai d'attente (en secondes)",
44
+ "Follow redirects": "Suivre les redirections",
45
+ "Choose whether to publish immediately, schedule for later, or save as draft": "Choisissez de publier immédiatement, de planifier pour plus tard ou d'enregistrer comme brouillon",
46
+ "The date and time to publish the post (ISO 8601 format). Required for scheduled posts.": "La date et l'heure de publication (format ISO 8601). Requis pour les publications planifiées.",
47
+ "Select the connected social media channel": "Sélectionnez le canal de réseau social connecté",
48
+ "The text content of the post": "Le contenu texte de la publication",
49
+ "URLs of images or videos to attach. Upload media first using the \"Upload File from URL\" action, then paste the returned path here.": "URLs des images ou vidéos à joindre. Téléversez d'abord les médias avec l'action « Téléverser un fichier depuis une URL », puis collez le chemin renvoyé ici.",
50
+ "Automatically shorten URLs in the post content": "Raccourcir automatiquement les URLs dans le contenu de la publication",
51
+ "Start of the date range (ISO 8601 format)": "Début de la plage de dates (format ISO 8601)",
52
+ "End of the date range (ISO 8601 format)": "Fin de la plage de dates (format ISO 8601)",
53
+ "The ID of the post to delete. You can get this from the \"List Posts\" or \"New Post\" trigger output.": "L'ID de la publication à supprimer. Vous pouvez l'obtenir depuis la sortie de « Lister les publications » ou du déclencheur « Nouvelle publication ».",
54
+ "Number of days to look back for analytics (e.g. 7, 30, 90)": "Nombre de jours de recul pour les statistiques (ex. 7, 30, 90)",
55
+ "The ID of the published post. You can get this from the \"List Posts\" or \"New Post\" trigger output.": "L'ID de la publication. Vous pouvez l'obtenir depuis la sortie de « Lister les publications » ou du déclencheur « Nouvelle publication ».",
56
+ "The public URL of the image or video to upload": "L'URL publique de l'image ou de la vidéo à téléverser",
57
+ "Authorization headers are injected automatically from your connection.": "Les en-têtes d'autorisation sont injectés automatiquement depuis votre connexion.",
58
+ "Enable for files like PDFs, images, etc.": "Activer pour les fichiers comme les PDF, images, etc.",
59
+ "Schedule for later": "Planifier pour plus tard",
60
+ "Publish now": "Publier maintenant",
61
+ "Save as draft": "Enregistrer comme brouillon",
62
+ "GET": "GET",
63
+ "POST": "POST",
64
+ "PATCH": "PATCH",
65
+ "PUT": "PUT",
66
+ "DELETE": "DELETE",
67
+ "HEAD": "HEAD",
68
+ "None": "Aucun",
69
+ "JSON": "JSON",
70
+ "Form Data": "Données de formulaire",
71
+ "Raw": "Brut",
72
+ "New Published Post": "Nouvelle publication publiée",
73
+ "Triggers when a post is published in Postiz": "Se déclenche lorsqu'une publication est publiée dans Postiz"
74
+ }
@@ -0,0 +1,74 @@
1
+ {
2
+ "Open-source social media scheduling tool supporting 30+ platforms": "Open-source social media scheduling tool supporting 30+ platforms",
3
+ "Base URL": "Base URL",
4
+ "API Key": "API Key",
5
+ "The API base URL. Use `https://api.postiz.com/public/v1` for Postiz Cloud, or `https://your-domain.com/api/public/v1` for self-hosted instances.": "The API base URL. Use `https://api.postiz.com/public/v1` for Postiz Cloud, or `https://your-domain.com/api/public/v1` for self-hosted instances.",
6
+ "To get your API key:\n1. Log in to your Postiz dashboard\n2. Go to **Settings > Developers > Public API**\n3. Generate a new API key and copy it": "To get your API key:\n1. Log in to your Postiz dashboard\n2. Go to **Settings > Developers > Public API**\n3. Generate a new API key and copy it",
7
+ "Create Post": "Create Post",
8
+ "List Posts": "List Posts",
9
+ "Delete Post": "Delete Post",
10
+ "List Channels": "List Channels",
11
+ "Find Available Slot": "Find Available Slot",
12
+ "Get Platform Analytics": "Get Platform Analytics",
13
+ "Get Post Analytics": "Get Post Analytics",
14
+ "Upload File from URL": "Upload File from URL",
15
+ "Custom API Call": "Custom API Call",
16
+ "Create or schedule a post on one or more connected channels": "Create or schedule a post on one or more connected channels",
17
+ "Retrieve posts within a date range": "Retrieve posts within a date range",
18
+ "Delete a post and all other posts in the same group": "Delete a post and all other posts in the same group",
19
+ "List all connected social media channels in your organization": "List all connected social media channels in your organization",
20
+ "Find the next available posting time slot for a connected channel": "Find the next available posting time slot for a connected channel",
21
+ "Retrieve analytics (followers, impressions, engagement) for a connected channel": "Retrieve analytics (followers, impressions, engagement) for a connected channel",
22
+ "Retrieve analytics (likes, comments, shares, impressions) for a specific published post": "Retrieve analytics (likes, comments, shares, impressions) for a specific published post",
23
+ "Upload a media file from a URL to Postiz. Returns the file path to use when creating posts.": "Upload a media file from a URL to Postiz. Returns the file path to use when creating posts.",
24
+ "Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
25
+ "Post Type": "Post Type",
26
+ "Publish Date": "Publish Date",
27
+ "Channel": "Channel",
28
+ "Content": "Content",
29
+ "Media URLs": "Media URLs",
30
+ "Shorten Links": "Shorten Links",
31
+ "Start Date": "Start Date",
32
+ "End Date": "End Date",
33
+ "Post ID": "Post ID",
34
+ "Lookback Days": "Lookback Days",
35
+ "File URL": "File URL",
36
+ "Method": "Method",
37
+ "Headers": "Headers",
38
+ "Query Parameters": "Query Parameters",
39
+ "Body Type": "Body Type",
40
+ "Body": "Body",
41
+ "Response is Binary ?": "Response is Binary ?",
42
+ "No Error on Failure": "No Error on Failure",
43
+ "Timeout (in seconds)": "Timeout (in seconds)",
44
+ "Follow redirects": "Follow redirects",
45
+ "Choose whether to publish immediately, schedule for later, or save as draft": "Choose whether to publish immediately, schedule for later, or save as draft",
46
+ "The date and time to publish the post (ISO 8601 format). Required for scheduled posts.": "The date and time to publish the post (ISO 8601 format). Required for scheduled posts.",
47
+ "Select the connected social media channel": "Select the connected social media channel",
48
+ "The text content of the post": "The text content of the post",
49
+ "URLs of images or videos to attach. Upload media first using the \"Upload File from URL\" action, then paste the returned path here.": "URLs of images or videos to attach. Upload media first using the \"Upload File from URL\" action, then paste the returned path here.",
50
+ "Automatically shorten URLs in the post content": "Automatically shorten URLs in the post content",
51
+ "Start of the date range (ISO 8601 format)": "Start of the date range (ISO 8601 format)",
52
+ "End of the date range (ISO 8601 format)": "End of the date range (ISO 8601 format)",
53
+ "The ID of the post to delete. You can get this from the \"List Posts\" or \"New Post\" trigger output.": "The ID of the post to delete. You can get this from the \"List Posts\" or \"New Post\" trigger output.",
54
+ "Number of days to look back for analytics (e.g. 7, 30, 90)": "Number of days to look back for analytics (e.g. 7, 30, 90)",
55
+ "The ID of the published post. You can get this from the \"List Posts\" or \"New Post\" trigger output.": "The ID of the published post. You can get this from the \"List Posts\" or \"New Post\" trigger output.",
56
+ "The public URL of the image or video to upload": "The public URL of the image or video to upload",
57
+ "Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
58
+ "Enable for files like PDFs, images, etc.": "Enable for files like PDFs, images, etc.",
59
+ "Schedule for later": "Schedule for later",
60
+ "Publish now": "Publish now",
61
+ "Save as draft": "Save as draft",
62
+ "GET": "GET",
63
+ "POST": "POST",
64
+ "PATCH": "PATCH",
65
+ "PUT": "PUT",
66
+ "DELETE": "DELETE",
67
+ "HEAD": "HEAD",
68
+ "None": "None",
69
+ "JSON": "JSON",
70
+ "Form Data": "Form Data",
71
+ "Raw": "Raw",
72
+ "New Published Post": "New Published Post",
73
+ "Triggers when a post is published in Postiz": "Triggers when a post is published in Postiz"
74
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export declare const postiz: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>>;
5
+ export { postizAuth } from './lib/common/auth';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,MAAM;;;GA8BjB,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
package/src/index.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.postizAuth = exports.postiz = 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 shared_1 = require("@activepieces/shared");
8
+ const create_post_1 = require("./lib/actions/create-post");
9
+ const list_posts_1 = require("./lib/actions/list-posts");
10
+ const delete_post_1 = require("./lib/actions/delete-post");
11
+ const list_integrations_1 = require("./lib/actions/list-integrations");
12
+ const find_available_slot_1 = require("./lib/actions/find-available-slot");
13
+ const get_platform_analytics_1 = require("./lib/actions/get-platform-analytics");
14
+ const get_post_analytics_1 = require("./lib/actions/get-post-analytics");
15
+ const upload_file_from_url_1 = require("./lib/actions/upload-file-from-url");
16
+ const new_post_1 = require("./lib/triggers/new-post");
17
+ const auth_1 = require("./lib/common/auth");
18
+ exports.postiz = (0, pieces_framework_1.createPiece)({
19
+ displayName: 'Postiz',
20
+ description: 'Open-source social media scheduling tool supporting 30+ platforms',
21
+ minimumSupportedRelease: '0.36.1',
22
+ logoUrl: 'https://cdn.activepieces.com/pieces/postiz.png',
23
+ categories: [shared_1.PieceCategory.MARKETING],
24
+ auth: auth_1.postizAuth,
25
+ authors: ['bst1n', 'onyedikachi-david'],
26
+ actions: [
27
+ create_post_1.createPost,
28
+ list_posts_1.listPosts,
29
+ delete_post_1.deletePost,
30
+ list_integrations_1.listIntegrations,
31
+ find_available_slot_1.findAvailableSlot,
32
+ get_platform_analytics_1.getPlatformAnalytics,
33
+ get_post_analytics_1.getPostAnalytics,
34
+ upload_file_from_url_1.uploadFileFromUrl,
35
+ (0, pieces_common_1.createCustomApiCallAction)({
36
+ baseUrl: (auth) => {
37
+ const { base_url } = auth.props;
38
+ return base_url === null || base_url === void 0 ? void 0 : base_url.trim().replace(/\/+$/, '');
39
+ },
40
+ auth: auth_1.postizAuth,
41
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
42
+ return ({
43
+ Authorization: auth.props.api_key,
44
+ });
45
+ }),
46
+ }),
47
+ ],
48
+ triggers: [new_post_1.newPost],
49
+ });
50
+ var auth_2 = require("./lib/common/auth");
51
+ Object.defineProperty(exports, "postizAuth", { enumerable: true, get: function () { return auth_2.postizAuth; } });
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,+DAAwE;AACxE,iDAAqD;AACrD,2DAAuD;AACvD,yDAAqD;AACrD,2DAAuD;AACvD,uEAAmE;AACnE,2EAAsE;AACtE,iFAA4E;AAC5E,yEAAoE;AACpE,6EAAuE;AACvE,sDAAkD;AAClD,4CAA+C;AAElC,QAAA,MAAM,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,QAAQ;IACrB,WAAW,EACT,mEAAmE;IACrE,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,gDAAgD;IACzD,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,CAAC;IACrC,IAAI,EAAE,iBAAU;IAChB,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACvC,OAAO,EAAE;QACP,wBAAU;QACV,sBAAS;QACT,wBAAU;QACV,oCAAgB;QAChB,uCAAiB;QACjB,6CAAoB;QACpB,qCAAgB;QAChB,wCAAiB;QACjB,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBAChB,MAAM,EAAE,QAAQ,EAAE,GAAI,IAAyD,CAAC,KAAK,CAAC;gBACtF,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAC9C,CAAC;YACD,IAAI,EAAE,iBAAU;YAChB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAG,IAAyD,CAAC,KAAK,CAAC,OAAO;iBACxF,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE,CAAC,kBAAO,CAAC;CACpB,CAAC,CAAC;AAEH,0CAA+C;AAAtC,kGAAA,UAAU,OAAA"}
@@ -0,0 +1,16 @@
1
+ export declare const createPost: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
6
+ date: import("@activepieces/pieces-framework").DateTimeProperty<false>;
7
+ integration: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
8
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
10
+ }>>;
11
+ content: import("@activepieces/pieces-framework").LongTextProperty<true>;
12
+ media: import("@activepieces/pieces-framework").ArrayProperty<false>;
13
+ shortLink: import("@activepieces/pieces-framework").CheckboxProperty<false>;
14
+ settings: import("@activepieces/pieces-framework").JsonProperty<false>;
15
+ }>;
16
+ //# sourceMappingURL=create-post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-post.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-post.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;EAgGrB,CAAC"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPost = 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("../common/auth");
8
+ const common_1 = require("../common");
9
+ exports.createPost = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.postizAuth,
11
+ name: 'create_post',
12
+ displayName: 'Create Post',
13
+ description: 'Create or schedule a post on one or more connected channels',
14
+ props: {
15
+ type: pieces_framework_1.Property.StaticDropdown({
16
+ displayName: 'Post Type',
17
+ description: 'Choose whether to publish immediately, schedule for later, or save as draft',
18
+ required: true,
19
+ defaultValue: 'schedule',
20
+ options: {
21
+ options: [
22
+ { label: 'Schedule for later', value: 'schedule' },
23
+ { label: 'Publish now', value: 'now' },
24
+ { label: 'Save as draft', value: 'draft' },
25
+ ],
26
+ },
27
+ }),
28
+ date: pieces_framework_1.Property.DateTime({
29
+ displayName: 'Publish Date',
30
+ description: 'The date and time to publish the post (ISO 8601 format). Required for scheduled posts.',
31
+ required: false,
32
+ }),
33
+ integration: common_1.postizCommon.integrationDropdown,
34
+ content: pieces_framework_1.Property.LongText({
35
+ displayName: 'Content',
36
+ description: 'The text content of the post',
37
+ required: true,
38
+ }),
39
+ media: pieces_framework_1.Property.Array({
40
+ displayName: 'Media Paths',
41
+ description: 'File paths of images or videos to attach. Upload media first using the "Upload File from URL" action, then paste the returned path here.',
42
+ required: false,
43
+ }),
44
+ shortLink: pieces_framework_1.Property.Checkbox({
45
+ displayName: 'Shorten Links',
46
+ description: 'Automatically shorten URLs in the post content',
47
+ required: false,
48
+ defaultValue: false,
49
+ }),
50
+ settings: pieces_framework_1.Property.Json({
51
+ displayName: 'Settings',
52
+ description: 'Optional platform-specific settings (e.g. approval workflow overrides)',
53
+ required: false,
54
+ }),
55
+ },
56
+ run(context) {
57
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
58
+ const { type, date, integration, content, media, shortLink, settings } = context.propsValue;
59
+ const auth = context.auth;
60
+ const value = { content };
61
+ if (media && media.length > 0) {
62
+ value['image'] = media.map((path) => ({ path }));
63
+ }
64
+ const postItem = {
65
+ integration: { id: integration },
66
+ value: [value],
67
+ };
68
+ if (settings) {
69
+ postItem['settings'] = settings;
70
+ }
71
+ const body = {
72
+ type,
73
+ shortLink: shortLink !== null && shortLink !== void 0 ? shortLink : false,
74
+ posts: [postItem],
75
+ };
76
+ if (type === 'schedule') {
77
+ if (!date) {
78
+ throw new Error('A Publish Date is required when Post Type is "Schedule for later".');
79
+ }
80
+ body['date'] = date;
81
+ }
82
+ const response = yield (0, common_1.postizApiCall)({
83
+ auth,
84
+ method: pieces_common_1.HttpMethod.POST,
85
+ path: '/posts',
86
+ body,
87
+ });
88
+ const results = response.body;
89
+ if (Array.isArray(results) && results.length === 1) {
90
+ return results[0];
91
+ }
92
+ return results;
93
+ });
94
+ },
95
+ });
96
+ //# sourceMappingURL=create-post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-post.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-post.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,yCAA4C;AAC5C,sCAAwD;AAE3C,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,6DAA6D;IAC1E,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,6EAA6E;YAC1F,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,UAAU;YACxB,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE;oBAClD,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE;oBACtC,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE;iBAC3C;aACF;SACF,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,cAAc;YAC3B,WAAW,EACT,wFAAwF;YAC1F,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,qBAAY,CAAC,mBAAmB;QAC7C,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACpB,WAAW,EAAE,aAAa;YAC1B,WAAW,EACT,0IAA0I;YAC5I,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC3B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,gDAAgD;YAC7D,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,IAAI,CAAC;YACtB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,wEAAwE;YACrF,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC5F,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAE1B,MAAM,KAAK,GAA4B,EAAE,OAAO,EAAE,CAAC;YAEnD,IAAI,KAAK,IAAK,KAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5C,KAAK,CAAC,OAAO,CAAC,GAAI,KAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACjE,CAAC;YAED,MAAM,QAAQ,GAA4B;gBACxC,WAAW,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE;gBAChC,KAAK,EAAE,CAAC,KAAK,CAAC;aACf,CAAC;YAEF,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;YAClC,CAAC;YAED,MAAM,IAAI,GAA4B;gBACpC,IAAI;gBACJ,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,KAAK;gBAC7B,KAAK,EAAE,CAAC,QAAQ,CAAC;aAClB,CAAC;YAEF,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;gBACxB,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;gBACJ,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;YACtB,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAa,EAA4B;gBAC9D,IAAI;gBACJ,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,QAAQ;gBACd,IAAI;aACL,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC;YAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACnD,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;YACpB,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const deletePost: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ postId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
+ }>;
7
+ //# sourceMappingURL=delete-post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-post.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/delete-post.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU;;;;;EAwBrB,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deletePost = 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("../common/auth");
8
+ const common_1 = require("../common");
9
+ exports.deletePost = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.postizAuth,
11
+ name: 'delete_post',
12
+ displayName: 'Delete Post',
13
+ description: 'Delete a post and all other posts in the same group',
14
+ props: {
15
+ postId: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Post ID',
17
+ description: 'The ID of the post to delete. You can get this from the "List Posts" or "New Published Post" trigger output.',
18
+ required: true,
19
+ }),
20
+ },
21
+ run(context) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ const auth = context.auth;
24
+ const response = yield (0, common_1.postizApiCall)({
25
+ auth,
26
+ method: pieces_common_1.HttpMethod.DELETE,
27
+ path: `/posts/${context.propsValue.postId}`,
28
+ });
29
+ return response.body;
30
+ });
31
+ },
32
+ });
33
+ //# sourceMappingURL=delete-post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-post.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-post.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,yCAA4C;AAC5C,sCAAsD;AAEzC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,qDAAqD;IAClE,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EACT,8GAA8G;YAChH,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAE1B,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAa,EAAiB;gBACnD,IAAI;gBACJ,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,IAAI,EAAE,UAAU,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE;aAC5C,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const findAvailableSlot: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ integration: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>>;
9
+ }>;
10
+ //# sourceMappingURL=find-available-slot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-available-slot.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/find-available-slot.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB;;;;;;;;EAsB5B,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findAvailableSlot = 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("../common/auth");
8
+ const common_1 = require("../common");
9
+ exports.findAvailableSlot = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.postizAuth,
11
+ name: 'find_available_slot',
12
+ displayName: 'Find Available Slot',
13
+ description: 'Find the next available posting time slot for a connected channel',
14
+ props: {
15
+ integration: common_1.postizCommon.integrationDropdown,
16
+ },
17
+ run(context) {
18
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
19
+ const auth = context.auth;
20
+ const response = yield (0, common_1.postizApiCall)({
21
+ auth,
22
+ method: pieces_common_1.HttpMethod.GET,
23
+ path: `/find-slot/${context.propsValue.integration}`,
24
+ });
25
+ return {
26
+ next_available_date: response.body.date,
27
+ };
28
+ });
29
+ },
30
+ });
31
+ //# sourceMappingURL=find-available-slot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-available-slot.js","sourceRoot":"","sources":["../../../../src/lib/actions/find-available-slot.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAAyD;AACzD,yCAA4C;AAC5C,sCAAwD;AAE3C,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EACT,mEAAmE;IACrE,KAAK,EAAE;QACL,WAAW,EAAE,qBAAY,CAAC,mBAAmB;KAC9C;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAE1B,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAa,EAAmB;gBACrD,IAAI;gBACJ,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,cAAc,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE;aACrD,CAAC,CAAC;YAEH,OAAO;gBACL,mBAAmB,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI;aACxC,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const getPlatformAnalytics: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ integration: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>>;
9
+ days: import("@activepieces/pieces-framework").NumberProperty<true>;
10
+ }>;
11
+ //# sourceMappingURL=get-platform-analytics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-platform-analytics.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-platform-analytics.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;;;;;;;;;EA2C/B,CAAC"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPlatformAnalytics = 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("../common/auth");
8
+ const common_1 = require("../common");
9
+ exports.getPlatformAnalytics = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.postizAuth,
11
+ name: 'get_platform_analytics',
12
+ displayName: 'Get Platform Analytics',
13
+ description: 'Retrieve analytics (followers, impressions, engagement) for a connected channel',
14
+ props: {
15
+ integration: common_1.postizCommon.integrationDropdown,
16
+ days: pieces_framework_1.Property.Number({
17
+ displayName: 'Lookback Days',
18
+ description: 'Number of days to look back for analytics (e.g. 7, 30, 90)',
19
+ required: true,
20
+ defaultValue: 30,
21
+ }),
22
+ },
23
+ run(context) {
24
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
25
+ const auth = context.auth;
26
+ const response = yield (0, common_1.postizApiCall)({
27
+ auth,
28
+ method: pieces_common_1.HttpMethod.GET,
29
+ path: `/analytics/${context.propsValue.integration}`,
30
+ queryParams: {
31
+ date: String(context.propsValue.days),
32
+ },
33
+ });
34
+ return response.body.map((metric) => {
35
+ var _a, _b;
36
+ return ({
37
+ metric: metric.label,
38
+ total: metric.total,
39
+ percentage_change: metric.percentageChange,
40
+ daily_data: (_b = (_a = metric.data) === null || _a === void 0 ? void 0 : _a.map((d) => `${d.date}:${d.total}`).join(', ')) !== null && _b !== void 0 ? _b : null,
41
+ });
42
+ });
43
+ });
44
+ },
45
+ });
46
+ //# sourceMappingURL=get-platform-analytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-platform-analytics.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-platform-analytics.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,yCAA4C;AAC5C,sCAAwD;AAE3C,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,wBAAwB;IACrC,WAAW,EACT,iFAAiF;IACnF,KAAK,EAAE;QACL,WAAW,EAAE,qBAAY,CAAC,mBAAmB;QAC7C,IAAI,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACpB,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,EAAE;SACjB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAE1B,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAa,EAOlC;gBACA,IAAI;gBACJ,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,cAAc,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE;gBACpD,WAAW,EAAE;oBACX,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;iBACtC;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;;gBAAC,OAAA,CAAC;oBACpC,MAAM,EAAE,MAAM,CAAC,KAAK;oBACpB,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,iBAAiB,EAAE,MAAM,CAAC,gBAAgB;oBAC1C,UAAU,EAAE,MAAA,MAAA,MAAM,CAAC,IAAI,0CACnB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE,EAClC,IAAI,CAAC,IAAI,CAAC,mCAAI,IAAI;iBACtB,CAAC,CAAA;aAAA,CAAC,CAAC;QACN,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const getPostAnalytics: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ postId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
+ days: import("@activepieces/pieces-framework").NumberProperty<true>;
7
+ }>;
8
+ //# sourceMappingURL=get-post-analytics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-post-analytics.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-post-analytics.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;EAgD3B,CAAC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPostAnalytics = 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("../common/auth");
8
+ const common_1 = require("../common");
9
+ exports.getPostAnalytics = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.postizAuth,
11
+ name: 'get_post_analytics',
12
+ displayName: 'Get Post Analytics',
13
+ description: 'Retrieve analytics (likes, comments, shares, impressions) for a specific published post',
14
+ props: {
15
+ postId: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Post ID',
17
+ description: 'The ID of the published post. You can get this from the "List Posts" or "New Published Post" trigger output.',
18
+ required: true,
19
+ }),
20
+ days: pieces_framework_1.Property.Number({
21
+ displayName: 'Lookback Days',
22
+ description: 'Number of days to look back for analytics (e.g. 7, 30, 90)',
23
+ required: true,
24
+ defaultValue: 30,
25
+ }),
26
+ },
27
+ run(context) {
28
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
+ const auth = context.auth;
30
+ const response = yield (0, common_1.postizApiCall)({
31
+ auth,
32
+ method: pieces_common_1.HttpMethod.GET,
33
+ path: `/analytics/post/${context.propsValue.postId}`,
34
+ queryParams: {
35
+ date: String(context.propsValue.days),
36
+ },
37
+ });
38
+ return response.body.map((metric) => {
39
+ var _a, _b;
40
+ return ({
41
+ metric: metric.label,
42
+ total: metric.total,
43
+ percentage_change: metric.percentageChange,
44
+ daily_data: (_b = (_a = metric.data) === null || _a === void 0 ? void 0 : _a.map((d) => `${d.date}:${d.total}`).join(', ')) !== null && _b !== void 0 ? _b : null,
45
+ });
46
+ });
47
+ });
48
+ },
49
+ });
50
+ //# sourceMappingURL=get-post-analytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-post-analytics.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-post-analytics.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,yCAA4C;AAC5C,sCAA0C;AAE7B,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EACT,yFAAyF;IAC3F,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EACT,8GAA8G;YAChH,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACpB,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,EAAE;SACjB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAE1B,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAa,EAOlC;gBACA,IAAI;gBACJ,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,mBAAmB,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE;gBACpD,WAAW,EAAE;oBACX,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;iBACtC;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;;gBAAC,OAAA,CAAC;oBACpC,MAAM,EAAE,MAAM,CAAC,KAAK;oBACpB,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,iBAAiB,EAAE,MAAM,CAAC,gBAAgB;oBAC1C,UAAU,EAAE,MAAA,MAAA,MAAM,CAAC,IAAI,0CACnB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE,EAClC,IAAI,CAAC,IAAI,CAAC,mCAAI,IAAI;iBACtB,CAAC,CAAA;aAAA,CAAC,CAAC;QACN,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const listIntegrations: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {}>;
5
+ //# sourceMappingURL=list-integrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-integrations.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-integrations.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;OAoC3B,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listIntegrations = 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("../common/auth");
8
+ const common_1 = require("../common");
9
+ exports.listIntegrations = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.postizAuth,
11
+ name: 'list_integrations',
12
+ displayName: 'List Channels',
13
+ description: 'List all connected social media channels in your organization',
14
+ props: {},
15
+ run(context) {
16
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
17
+ const auth = context.auth;
18
+ const response = yield (0, common_1.postizApiCall)({
19
+ auth,
20
+ method: pieces_common_1.HttpMethod.GET,
21
+ path: '/integrations',
22
+ });
23
+ return response.body.map((integration) => {
24
+ var _a, _b, _c, _d, _e, _f;
25
+ return ({
26
+ id: integration.id,
27
+ name: integration.name,
28
+ provider: integration.identifier,
29
+ picture: (_a = integration.picture) !== null && _a !== void 0 ? _a : null,
30
+ disabled: integration.disabled,
31
+ profile: (_b = integration.profile) !== null && _b !== void 0 ? _b : null,
32
+ customer_id: (_d = (_c = integration.customer) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : null,
33
+ customer_name: (_f = (_e = integration.customer) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : null,
34
+ });
35
+ });
36
+ });
37
+ },
38
+ });
39
+ //# sourceMappingURL=list-integrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-integrations.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-integrations.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAAyD;AACzD,yCAA4C;AAC5C,sCAAsD;AAEzC,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,+DAA+D;IAC5E,KAAK,EAAE,EAAE;IACH,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAE1B,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAa,EAUlC;gBACA,IAAI;gBACJ,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,eAAe;aACtB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;;gBAAC,OAAA,CAAC;oBACzC,EAAE,EAAE,WAAW,CAAC,EAAE;oBAClB,IAAI,EAAE,WAAW,CAAC,IAAI;oBACtB,QAAQ,EAAE,WAAW,CAAC,UAAU;oBAChC,OAAO,EAAE,MAAA,WAAW,CAAC,OAAO,mCAAI,IAAI;oBACpC,QAAQ,EAAE,WAAW,CAAC,QAAQ;oBAC9B,OAAO,EAAE,MAAA,WAAW,CAAC,OAAO,mCAAI,IAAI;oBACpC,WAAW,EAAE,MAAA,MAAA,WAAW,CAAC,QAAQ,0CAAE,EAAE,mCAAI,IAAI;oBAC7C,aAAa,EAAE,MAAA,MAAA,WAAW,CAAC,QAAQ,0CAAE,IAAI,mCAAI,IAAI;iBAClD,CAAC,CAAA;aAAA,CAAC,CAAC;QACN,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const listPosts: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ startDate: import("@activepieces/pieces-framework").DateTimeProperty<true>;
6
+ endDate: import("@activepieces/pieces-framework").DateTimeProperty<true>;
7
+ }>;
8
+ //# sourceMappingURL=list-posts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-posts.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-posts.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;;EAuDpB,CAAC"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listPosts = 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("../common/auth");
8
+ const common_1 = require("../common");
9
+ exports.listPosts = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.postizAuth,
11
+ name: 'list_posts',
12
+ displayName: 'List Posts',
13
+ description: 'Retrieve posts within a date range',
14
+ props: {
15
+ startDate: pieces_framework_1.Property.DateTime({
16
+ displayName: 'Start Date',
17
+ description: 'Start of the date range (ISO 8601 format)',
18
+ required: true,
19
+ }),
20
+ endDate: pieces_framework_1.Property.DateTime({
21
+ displayName: 'End Date',
22
+ description: 'End of the date range (ISO 8601 format)',
23
+ required: true,
24
+ }),
25
+ },
26
+ run(context) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const auth = context.auth;
29
+ const response = yield (0, common_1.postizApiCall)({
30
+ auth,
31
+ method: pieces_common_1.HttpMethod.GET,
32
+ path: '/posts',
33
+ queryParams: {
34
+ startDate: context.propsValue.startDate,
35
+ endDate: context.propsValue.endDate,
36
+ },
37
+ });
38
+ return response.body.posts.map((post) => {
39
+ var _a, _b, _c, _d, _e, _f, _g;
40
+ return ({
41
+ id: post.id,
42
+ content: post.content,
43
+ publish_date: post.publishDate,
44
+ release_url: (_a = post.releaseURL) !== null && _a !== void 0 ? _a : null,
45
+ state: post.state,
46
+ integration_id: (_c = (_b = post.integration) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : null,
47
+ integration_provider: (_e = (_d = post.integration) === null || _d === void 0 ? void 0 : _d.providerIdentifier) !== null && _e !== void 0 ? _e : null,
48
+ integration_name: (_g = (_f = post.integration) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : null,
49
+ });
50
+ });
51
+ });
52
+ },
53
+ });
54
+ //# sourceMappingURL=list-posts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-posts.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-posts.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,yCAA4C;AAC5C,sCAA0C;AAE7B,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,oCAAoC;IACjD,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC3B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,2CAA2C;YACxD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAE1B,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAa,EAcjC;gBACD,IAAI;gBACJ,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACX,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS;oBACvC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;iBACpC;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;gBAAC,OAAA,CAAC;oBACxC,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,YAAY,EAAE,IAAI,CAAC,WAAW;oBAC9B,WAAW,EAAE,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI;oBACpC,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,cAAc,EAAE,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,EAAE,mCAAI,IAAI;oBAC5C,oBAAoB,EAAE,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,kBAAkB,mCAAI,IAAI;oBAClE,gBAAgB,EAAE,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,mCAAI,IAAI;iBACjD,CAAC,CAAA;aAAA,CAAC,CAAC;QACN,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const uploadFileFromUrl: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
+ }>;
7
+ //# sourceMappingURL=upload-file-from-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-file-from-url.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/upload-file-from-url.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB;;;;;EA0C5B,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploadFileFromUrl = 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("../common/auth");
8
+ const common_1 = require("../common");
9
+ exports.uploadFileFromUrl = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.postizAuth,
11
+ name: 'upload_file_from_url',
12
+ displayName: 'Upload File from URL',
13
+ description: 'Upload a media file from a URL to Postiz. Returns the file path to use when creating posts.',
14
+ props: {
15
+ url: pieces_framework_1.Property.ShortText({
16
+ displayName: 'File URL',
17
+ description: 'The public URL of the image or video to upload',
18
+ required: true,
19
+ }),
20
+ },
21
+ run(context) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ const auth = context.auth;
24
+ const response = yield (0, common_1.postizApiCall)({
25
+ auth,
26
+ method: pieces_common_1.HttpMethod.POST,
27
+ path: '/upload-from-url',
28
+ body: {
29
+ url: context.propsValue.url,
30
+ },
31
+ });
32
+ const file = response.body;
33
+ return {
34
+ id: file.id,
35
+ name: file.name,
36
+ path: file.path,
37
+ organization_id: file.organizationId,
38
+ created_at: file.createdAt,
39
+ updated_at: file.updatedAt,
40
+ };
41
+ });
42
+ },
43
+ });
44
+ //# sourceMappingURL=upload-file-from-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-file-from-url.js","sourceRoot":"","sources":["../../../../src/lib/actions/upload-file-from-url.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,yCAA4C;AAC5C,sCAA0C;AAE7B,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EACT,6FAA6F;IAC/F,KAAK,EAAE;QACL,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,gDAAgD;YAC7D,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAE1B,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAa,EAOjC;gBACD,IAAI;gBACJ,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,kBAAkB;gBACxB,IAAI,EAAE;oBACJ,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG;iBAC5B;aACF,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO;gBACL,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,eAAe,EAAE,IAAI,CAAC,cAAc;gBACpC,UAAU,EAAE,IAAI,CAAC,SAAS;gBAC1B,UAAU,EAAE,IAAI,CAAC,SAAS;aAC3B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const postizAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>;
5
+ export type PostizAuth = {
6
+ props: {
7
+ base_url: string;
8
+ api_key: string;
9
+ };
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":"AAGA,eAAO,MAAM,UAAU;;;EAsCrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.postizAuth = 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
+ exports.postizAuth = pieces_framework_1.PieceAuth.CustomAuth({
8
+ displayName: 'Postiz Connection',
9
+ required: true,
10
+ props: {
11
+ base_url: pieces_framework_1.Property.ShortText({
12
+ displayName: 'Base URL',
13
+ description: 'The API base URL. Use `https://api.postiz.com/public/v1` for Postiz Cloud, or `https://your-domain.com/api/public/v1` for self-hosted instances.',
14
+ required: true,
15
+ defaultValue: 'https://api.postiz.com/public/v1',
16
+ }),
17
+ api_key: pieces_framework_1.PieceAuth.SecretText({
18
+ displayName: 'API Key',
19
+ description: `To get your API key:
20
+ 1. Log in to your Postiz dashboard
21
+ 2. Go to **Settings > Developers > Public API**
22
+ 3. Generate a new API key and copy it`,
23
+ required: true,
24
+ }),
25
+ },
26
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
27
+ var _b;
28
+ try {
29
+ const baseUrl = (_b = auth.base_url) === null || _b === void 0 ? void 0 : _b.trim().replace(/\/+$/, '');
30
+ yield pieces_common_1.httpClient.sendRequest({
31
+ method: pieces_common_1.HttpMethod.GET,
32
+ url: `${baseUrl}/is-connected`,
33
+ headers: {
34
+ Authorization: auth.api_key,
35
+ },
36
+ });
37
+ return { valid: true };
38
+ }
39
+ catch (_c) {
40
+ return {
41
+ valid: false,
42
+ error: 'Invalid API key or base URL. Please check your credentials.',
43
+ };
44
+ }
45
+ }),
46
+ });
47
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAAqE;AACrE,+DAAqE;AAExD,QAAA,UAAU,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC7C,WAAW,EAAE,mBAAmB;IAChC,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EACT,kJAAkJ;YACpJ,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,kCAAkC;SACjD,CAAC;QACF,OAAO,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC5B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE;;;sCAGmB;YAChC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;;QACvB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAC1D,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,OAAO,eAAe;gBAC9B,OAAO,EAAE;oBACP,aAAa,EAAE,IAAI,CAAC,OAAO;iBAC5B;aACF,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,WAAM,CAAC;YACP,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,6DAA6D;aACrE,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { HttpMethod, HttpMessageBody, HttpResponse } from '@activepieces/pieces-common';
2
+ import { PostizAuth } from './auth';
3
+ export declare function postizApiCall<T extends HttpMessageBody>({ auth, method, path, body, queryParams, }: {
4
+ auth: PostizAuth;
5
+ method: HttpMethod;
6
+ path: string;
7
+ body?: unknown;
8
+ queryParams?: Record<string, string>;
9
+ }): Promise<HttpResponse<T>>;
10
+ export declare const postizCommon: {
11
+ integrationDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
12
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
14
+ }>>;
15
+ };
16
+ export type { PostizAuth } from './auth';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,eAAe,EACf,YAAY,EACb,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAc,UAAU,EAAE,MAAM,QAAQ,CAAC;AAYhD,wBAAsB,aAAa,CAAC,CAAC,SAAS,eAAe,EAAE,EAC7D,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,WAAW,GACZ,EAAE;IACD,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAU3B;AAED,eAAO,MAAM,YAAY;;;;;CAoCxB,CAAC;AAEF,YAAY,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.postizCommon = void 0;
4
+ exports.postizApiCall = postizApiCall;
5
+ const tslib_1 = require("tslib");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
8
+ const auth_1 = require("./auth");
9
+ const DEFAULT_BASE_URL = 'https://api.postiz.com/public/v1';
10
+ function buildBaseUrl(auth) {
11
+ var _a;
12
+ const url = (_a = auth.props.base_url) === null || _a === void 0 ? void 0 : _a.trim();
13
+ if (!url) {
14
+ return DEFAULT_BASE_URL;
15
+ }
16
+ return url.replace(/\/+$/, '');
17
+ }
18
+ function postizApiCall(_a) {
19
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, method, path, body, queryParams, }) {
20
+ return yield pieces_common_1.httpClient.sendRequest({
21
+ method,
22
+ url: `${buildBaseUrl(auth)}${path}`,
23
+ headers: {
24
+ Authorization: auth.props.api_key,
25
+ },
26
+ queryParams,
27
+ body,
28
+ });
29
+ });
30
+ }
31
+ exports.postizCommon = {
32
+ integrationDropdown: pieces_framework_1.Property.Dropdown({
33
+ displayName: 'Channel',
34
+ description: 'Select the connected social media channel',
35
+ refreshers: ['auth'],
36
+ required: true,
37
+ auth: auth_1.postizAuth,
38
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
39
+ if (!auth) {
40
+ return {
41
+ disabled: true,
42
+ options: [],
43
+ placeholder: 'Please connect your Postiz account first',
44
+ };
45
+ }
46
+ const response = yield postizApiCall({
47
+ auth: auth,
48
+ method: pieces_common_1.HttpMethod.GET,
49
+ path: '/integrations',
50
+ });
51
+ return {
52
+ disabled: false,
53
+ options: response.body.map((integration) => ({
54
+ label: `${integration.name} (${integration.identifier})`,
55
+ value: integration.id,
56
+ })),
57
+ };
58
+ }),
59
+ }),
60
+ };
61
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":";;;AAmBA,sCAsBC;;AAzCD,+DAKqC;AACrC,qEAA0D;AAC1D,iCAAgD;AAEhD,MAAM,gBAAgB,GAAG,kCAAkC,CAAC;AAE5D,SAAS,YAAY,CAAC,IAAgB;;IACpC,MAAM,GAAG,GAAG,MAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,0CAAE,IAAI,EAAE,CAAC;IACxC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,SAAsB,aAAa;iEAA4B,EAC7D,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,WAAW,GAOZ;QACC,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAI;YACrC,MAAM;YACN,GAAG,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE;YACnC,OAAO,EAAE;gBACP,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;aAClC;YACD,WAAW;YACX,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CAAA;AAEY,QAAA,YAAY,GAAG;IAC1B,mBAAmB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;QACrC,WAAW,EAAE,SAAS;QACtB,WAAW,EAAE,2CAA2C;QACxD,UAAU,EAAE,CAAC,MAAM,CAAC;QACpB,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,iBAAU;QAChB,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;YACtB,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,0CAA0C;iBACxD,CAAC;YACJ,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,aAAa,CAOlC;gBACA,IAAI,EAAE,IAAkB;gBACxB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,eAAe;aACtB,CAAC,CAAC;YACH,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;oBAC3C,KAAK,EAAE,GAAG,WAAW,CAAC,IAAI,KAAK,WAAW,CAAC,UAAU,GAAG;oBACxD,KAAK,EAAE,WAAW,CAAC,EAAE;iBACtB,CAAC,CAAC;aACJ,CAAC;QACJ,CAAC,CAAA;KACF,CAAC;CACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const newPost: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
3
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
9
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
11
+ }>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
12
+ base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
14
+ }>, {}>;
15
+ //# 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":"AAAA,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AA6DxC,eAAO,MAAM,OAAO;;;;;;;;;;;;OA6BlB,CAAC"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newPost = 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("../common/auth");
8
+ const common_1 = require("../common");
9
+ const polling = {
10
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
11
+ items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
12
+ const now = new Date();
13
+ const thirtyDaysAgo = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
14
+ const response = yield (0, common_1.postizApiCall)({
15
+ auth: auth,
16
+ method: pieces_common_1.HttpMethod.GET,
17
+ path: '/posts',
18
+ queryParams: {
19
+ startDate: thirtyDaysAgo.toISOString(),
20
+ endDate: now.toISOString(),
21
+ },
22
+ });
23
+ return response.body.posts
24
+ .filter((post) => post.state === 'PUBLISHED')
25
+ .map((post) => {
26
+ var _a, _b, _c, _d, _e, _f, _g;
27
+ return ({
28
+ epochMilliSeconds: new Date(post.publishDate).getTime(),
29
+ data: {
30
+ id: post.id,
31
+ content: post.content,
32
+ publish_date: post.publishDate,
33
+ release_url: (_a = post.releaseURL) !== null && _a !== void 0 ? _a : null,
34
+ state: post.state,
35
+ integration_id: (_c = (_b = post.integration) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : null,
36
+ integration_provider: (_e = (_d = post.integration) === null || _d === void 0 ? void 0 : _d.providerIdentifier) !== null && _e !== void 0 ? _e : null,
37
+ integration_name: (_g = (_f = post.integration) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : null,
38
+ },
39
+ });
40
+ });
41
+ }),
42
+ };
43
+ exports.newPost = (0, pieces_framework_1.createTrigger)({
44
+ auth: auth_1.postizAuth,
45
+ name: 'new_post',
46
+ displayName: 'New Published Post',
47
+ description: 'Triggers when a post is published in Postiz',
48
+ props: {},
49
+ sampleData: {
50
+ id: 'abc123',
51
+ content: 'Hello world! Check out our latest update.',
52
+ publish_date: '2024-12-15T10:00:00.000Z',
53
+ release_url: 'https://x.com/user/status/123456',
54
+ state: 'PUBLISHED',
55
+ integration_id: 'int_123',
56
+ integration_provider: 'x',
57
+ integration_name: 'My X Account',
58
+ },
59
+ type: pieces_framework_1.TriggerStrategy.POLLING,
60
+ test(context) {
61
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ return yield pieces_common_1.pollingHelper.test(polling, context);
63
+ });
64
+ },
65
+ onEnable(context) {
66
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
67
+ yield pieces_common_1.pollingHelper.onEnable(polling, context);
68
+ });
69
+ },
70
+ onDisable(context) {
71
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
72
+ yield pieces_common_1.pollingHelper.onDisable(polling, context);
73
+ });
74
+ },
75
+ run(context) {
76
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
77
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
78
+ });
79
+ },
80
+ });
81
+ //# sourceMappingURL=new-post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-post.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-post.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,+DAKqC;AACrC,yCAAwD;AACxD,sCAA0C;AAE1C,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACpB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QAEzE,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAa,EAcjC;YACD,IAAI,EAAE,IAAkB;YACxB,MAAM,EAAE,0BAAU,CAAC,GAAG;YACtB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE;gBACX,SAAS,EAAE,aAAa,CAAC,WAAW,EAAE;gBACtC,OAAO,EAAE,GAAG,CAAC,WAAW,EAAE;aAC3B;SACF,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK;aACvB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC;aAC5C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;YAAC,OAAA,CAAC;gBACd,iBAAiB,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE;gBACvD,IAAI,EAAE;oBACJ,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,YAAY,EAAE,IAAI,CAAC,WAAW;oBAC9B,WAAW,EAAE,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI;oBACpC,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,cAAc,EAAE,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,EAAE,mCAAI,IAAI;oBAC5C,oBAAoB,EAAE,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,kBAAkB,mCAAI,IAAI;oBAClE,gBAAgB,EAAE,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,mCAAI,IAAI;iBACjD;aACF,CAAC,CAAA;SAAA,CAAC,CAAC;IACR,CAAC,CAAA;CACF,CAAC;AAEW,QAAA,OAAO,GAAG,IAAA,gCAAa,EAAC;IACnC,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,6CAA6C;IAC1D,KAAK,EAAE,EAAE;IACT,UAAU,EAAE;QACV,EAAE,EAAE,QAAQ;QACZ,OAAO,EAAE,2CAA2C;QACpD,YAAY,EAAE,0BAA0B;QACxC,WAAW,EAAE,kCAAkC;QAC/C,KAAK,EAAE,WAAW;QAClB,cAAc,EAAE,SAAS;QACzB,oBAAoB,EAAE,GAAG;QACzB,gBAAgB,EAAE,cAAc;KACjC;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACK,QAAQ,CAAC,OAAO;;YACpB,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;CACF,CAAC,CAAC"}