@agnocon/piece-buttondown 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/LICENSE.MIT-AP +24 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +31 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/actions/create-subscriber.d.ts +17 -0
  7. package/dist/lib/actions/create-subscriber.d.ts.map +1 -0
  8. package/dist/lib/actions/create-subscriber.js +155 -0
  9. package/dist/lib/actions/create-subscriber.js.map +1 -0
  10. package/dist/lib/actions/custom-api-call.d.ts +13 -0
  11. package/dist/lib/actions/custom-api-call.d.ts.map +1 -0
  12. package/dist/lib/actions/custom-api-call.js +19 -0
  13. package/dist/lib/actions/custom-api-call.js.map +1 -0
  14. package/dist/lib/actions/list-subscribers.d.ts +11 -0
  15. package/dist/lib/actions/list-subscribers.d.ts.map +1 -0
  16. package/dist/lib/actions/list-subscribers.js +115 -0
  17. package/dist/lib/actions/list-subscribers.js.map +1 -0
  18. package/dist/lib/actions/send-email.d.ts +16 -0
  19. package/dist/lib/actions/send-email.d.ts.map +1 -0
  20. package/dist/lib/actions/send-email.js +147 -0
  21. package/dist/lib/actions/send-email.js.map +1 -0
  22. package/dist/lib/common/auth.d.ts +2 -0
  23. package/dist/lib/common/auth.d.ts.map +1 -0
  24. package/dist/lib/common/auth.js +46 -0
  25. package/dist/lib/common/auth.js.map +1 -0
  26. package/dist/lib/common/client.d.ts +20 -0
  27. package/dist/lib/common/client.d.ts.map +1 -0
  28. package/dist/lib/common/client.js +41 -0
  29. package/dist/lib/common/client.js.map +1 -0
  30. package/dist/lib/common/options.d.ts +22 -0
  31. package/dist/lib/common/options.d.ts.map +1 -0
  32. package/dist/lib/common/options.js +58 -0
  33. package/dist/lib/common/options.js.map +1 -0
  34. package/dist/lib/common/types.d.ts +81 -0
  35. package/dist/lib/common/types.d.ts.map +1 -0
  36. package/dist/lib/common/types.js +3 -0
  37. package/dist/lib/common/types.js.map +1 -0
  38. package/dist/lib/common/webhook.d.ts +36 -0
  39. package/dist/lib/common/webhook.d.ts.map +1 -0
  40. package/dist/lib/common/webhook.js +80 -0
  41. package/dist/lib/common/webhook.js.map +1 -0
  42. package/dist/lib/triggers/email-sent.d.ts +14 -0
  43. package/dist/lib/triggers/email-sent.d.ts.map +1 -0
  44. package/dist/lib/triggers/email-sent.js +43 -0
  45. package/dist/lib/triggers/email-sent.js.map +1 -0
  46. package/dist/lib/triggers/new-subscriber.d.ts +14 -0
  47. package/dist/lib/triggers/new-subscriber.d.ts.map +1 -0
  48. package/dist/lib/triggers/new-subscriber.js +43 -0
  49. package/dist/lib/triggers/new-subscriber.js.map +1 -0
  50. package/dist/lib/triggers/subscriber-confirmed.d.ts +14 -0
  51. package/dist/lib/triggers/subscriber-confirmed.d.ts.map +1 -0
  52. package/dist/lib/triggers/subscriber-confirmed.js +43 -0
  53. package/dist/lib/triggers/subscriber-confirmed.js.map +1 -0
  54. package/package.json +46 -0
  55. package/src/index.ts +26 -0
  56. package/src/lib/actions/create-subscriber.ts +171 -0
  57. package/src/lib/actions/custom-api-call.ts +11 -0
  58. package/src/lib/actions/list-subscribers.ts +125 -0
  59. package/src/lib/actions/send-email.ts +162 -0
  60. package/src/lib/common/auth.ts +58 -0
  61. package/src/lib/common/client.ts +83 -0
  62. package/src/lib/common/options.ts +65 -0
  63. package/src/lib/common/types.ts +141 -0
  64. package/src/lib/common/webhook.ts +105 -0
  65. package/src/lib/triggers/email-sent.ts +39 -0
  66. package/src/lib/triggers/new-subscriber.ts +39 -0
  67. package/src/lib/triggers/subscriber-confirmed.ts +39 -0
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buttondownAuth = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/buttondown/src/lib/common/auth.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_common_1 = require("@agnocon/pieces-common");
8
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
9
+ const client_1 = require("./client");
10
+ exports.buttondownAuth = pieces_framework_1.PieceAuth.SecretText({
11
+ displayName: 'API Key',
12
+ description: 'Create an API key from https://buttondown.com/keys and paste it here.',
13
+ required: true,
14
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
15
+ var _b, _c, _d, _e, _f, _g;
16
+ if (!auth) {
17
+ return {
18
+ valid: false,
19
+ error: 'API key is required.',
20
+ };
21
+ }
22
+ try {
23
+ yield pieces_common_1.httpClient.sendRequest({
24
+ method: pieces_common_1.HttpMethod.GET,
25
+ url: `${client_1.BUTTONDOWN_BASE_URL}/newsletters`,
26
+ headers: {
27
+ Authorization: `Token ${auth}`,
28
+ },
29
+ });
30
+ return {
31
+ valid: true,
32
+ };
33
+ }
34
+ catch (unknownError) {
35
+ const error = unknownError;
36
+ const status = (_b = error.response) === null || _b === void 0 ? void 0 : _b.status;
37
+ const body = (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.body) !== null && _d !== void 0 ? _d : {};
38
+ const message = (_g = (_f = (_e = body.detail) !== null && _e !== void 0 ? _e : body.error) !== null && _f !== void 0 ? _f : body.message) !== null && _g !== void 0 ? _g : (status === 401 ? 'Invalid API key.' : 'Failed to verify the API key.');
39
+ return {
40
+ valid: false,
41
+ error: message,
42
+ };
43
+ }
44
+ }),
45
+ });
46
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,gGAAgG;AAChG,qEAAqE;AACrE,0DAAgE;AAChE,gEAAsD;AACtD,qCAA+C;AAYlC,QAAA,cAAc,GAAG,4BAAS,CAAC,UAAU,CAAC;IACjD,WAAW,EAAE,SAAS;IACtB,WAAW,EACT,uEAAuE;IACzE,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;;QACvB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,sBAAsB;aAC9B,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAyB;gBACnD,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,4BAAmB,cAAc;gBACzC,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,IAAI,EAAE;iBAC/B;aACF,CAAC,CAAC;YACH,OAAO;gBACL,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,YAAqB,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,YAGb,CAAC;YACF,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,CAAC;YACtC,MAAM,IAAI,GAAG,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,mCAAI,EAAE,CAAC;YACxC,MAAM,OAAO,GACX,MAAA,MAAA,MAAA,IAAI,CAAC,MAAM,mCACX,IAAI,CAAC,KAAK,mCACV,IAAI,CAAC,OAAO,mCACZ,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC;YAE1E,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,OAAO;aACf,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { HttpMethod } from '@agnocon/pieces-common';
2
+ export declare const BUTTONDOWN_BASE_URL = "https://api.buttondown.com/v1";
3
+ type QueryValue = string | number | boolean | Array<string | number | boolean> | undefined;
4
+ export interface ButtondownRequest {
5
+ auth: string;
6
+ method: HttpMethod;
7
+ path: string;
8
+ query?: Record<string, QueryValue>;
9
+ body?: unknown;
10
+ headers?: Record<string, string | undefined>;
11
+ }
12
+ export interface ButtondownPagedResponse<T> {
13
+ results: T[];
14
+ count: number;
15
+ next?: string | null;
16
+ previous?: string | null;
17
+ }
18
+ export declare const buttondownRequest: <TResponse>({ auth, method, path, query, body, headers, }: ButtondownRequest) => Promise<TResponse>;
19
+ export {};
20
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/lib/common/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAc,MAAM,wBAAwB,CAAC;AAEhE,eAAO,MAAM,mBAAmB,kCAAkC,CAAC;AAEnE,KAAK,UAAU,GACX,MAAM,GACN,MAAM,GACN,OAAO,GACP,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAChC,SAAS,CAAC;AAEd,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAmCD,eAAO,MAAM,iBAAiB,GAAU,SAAS,iDAO9C,iBAAiB,KAAG,OAAO,CAAC,SAAS,CAevC,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buttondownRequest = exports.BUTTONDOWN_BASE_URL = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/buttondown/src/lib/common/client.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_common_1 = require("@agnocon/pieces-common");
8
+ exports.BUTTONDOWN_BASE_URL = 'https://api.buttondown.com/v1';
9
+ const sanitizeHeaders = (headers = {}) => Object.fromEntries(Object.entries(headers).filter(([, value]) => value !== undefined));
10
+ const serializeQueryParams = (query) => {
11
+ if (!query) {
12
+ return undefined;
13
+ }
14
+ const result = {};
15
+ for (const [key, value] of Object.entries(query)) {
16
+ if (value === undefined) {
17
+ continue;
18
+ }
19
+ if (Array.isArray(value)) {
20
+ if (value.length === 0) {
21
+ continue;
22
+ }
23
+ result[key] = value.map((item) => String(item)).join(',');
24
+ continue;
25
+ }
26
+ result[key] = String(value);
27
+ }
28
+ return Object.keys(result).length > 0 ? result : undefined;
29
+ };
30
+ const buttondownRequest = (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, method, path, query, body, headers, }) {
31
+ const response = yield pieces_common_1.httpClient.sendRequest({
32
+ method,
33
+ url: `${exports.BUTTONDOWN_BASE_URL}${path}`,
34
+ headers: Object.assign({ Authorization: `Token ${auth}`, Accept: 'application/json', 'Content-Type': 'application/json' }, sanitizeHeaders(headers)),
35
+ queryParams: serializeQueryParams(query),
36
+ body,
37
+ });
38
+ return response.body;
39
+ });
40
+ exports.buttondownRequest = buttondownRequest;
41
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/lib/common/client.ts"],"names":[],"mappings":";;;;AAAA,kGAAkG;AAClG,qEAAqE;AACrE,0DAAgE;AAEnD,QAAA,mBAAmB,GAAG,+BAA+B,CAAC;AAyBnE,MAAM,eAAe,GAAG,CAAC,UAA8C,EAAE,EAAE,EAA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,GAAG,EAAE,GAAG,2BAAmB,GAAG,IAAI,EAAE;QACpC,OAAO,kBACL,aAAa,EAAE,SAAS,IAAI,EAAE,EAC9B,MAAM,EAAE,kBAAkB,EAC1B,cAAc,EAAE,kBAAkB,IAC/B,eAAe,CAAC,OAAO,CAAC,CAC5B;QACD,WAAW,EAAE,oBAAoB,CAAC,KAAK,CAAC;QACxC,IAAI;KACL,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAA,CAAC;AAtBW,QAAA,iBAAiB,qBAsB5B"}
@@ -0,0 +1,22 @@
1
+ import { ButtondownSubscriberType, ButtondownSubscriberSource, ButtondownEmailStatus, ButtondownEmailType } from './types';
2
+ export declare const subscriberTypeOptions: {
3
+ label: string;
4
+ value: ButtondownSubscriberType;
5
+ }[];
6
+ export declare const subscriberSourceOptions: {
7
+ label: string;
8
+ value: ButtondownSubscriberSource;
9
+ }[];
10
+ export declare const subscriberOrderingOptions: {
11
+ label: string;
12
+ value: string;
13
+ }[];
14
+ export declare const emailStatusOptions: {
15
+ label: string;
16
+ value: ButtondownEmailStatus;
17
+ }[];
18
+ export declare const emailTypeOptions: {
19
+ label: string;
20
+ value: ButtondownEmailType;
21
+ }[];
22
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/lib/common/options.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,qBAAqB,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,wBAAwB,CAAA;CAAE,EAiBrF,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,0BAA0B,CAAA;CAAE,EAczF,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;GAOrC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,qBAAqB,CAAA;CAAE,EAI/E,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,mBAAmB,CAAA;CAAE,EAO3E,CAAC"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.emailTypeOptions = exports.emailStatusOptions = exports.subscriberOrderingOptions = exports.subscriberSourceOptions = exports.subscriberTypeOptions = void 0;
4
+ exports.subscriberTypeOptions = [
5
+ { label: 'Regular', value: 'regular' },
6
+ { label: 'Premium', value: 'premium' },
7
+ { label: 'Unactivated', value: 'unactivated' },
8
+ { label: 'Paused', value: 'paused' },
9
+ { label: 'Trialed', value: 'trialed' },
10
+ { label: 'Upcoming', value: 'upcoming' },
11
+ { label: 'Churning', value: 'churning' },
12
+ { label: 'Churned', value: 'churned' },
13
+ { label: 'Unsubscribed', value: 'unsubscribed' },
14
+ { label: 'Undeliverable', value: 'undeliverable' },
15
+ { label: 'Blocked', value: 'blocked' },
16
+ { label: 'Complained', value: 'complained' },
17
+ { label: 'Gifted', value: 'gifted' },
18
+ { label: 'Past Due', value: 'past_due' },
19
+ { label: 'Removed', value: 'removed' },
20
+ { label: 'Unpaid', value: 'unpaid' },
21
+ ];
22
+ exports.subscriberSourceOptions = [
23
+ { label: 'Admin', value: 'admin' },
24
+ { label: 'API', value: 'api' },
25
+ { label: 'Carrd', value: 'carrd' },
26
+ { label: 'Comment', value: 'comment' },
27
+ { label: 'Embedded form', value: 'embedded_form' },
28
+ { label: 'Hosted form', value: 'form' },
29
+ { label: 'Import', value: 'import' },
30
+ { label: 'Memberful', value: 'memberful' },
31
+ { label: 'Organic', value: 'organic' },
32
+ { label: 'Patreon', value: 'patreon' },
33
+ { label: 'Stripe', value: 'stripe' },
34
+ { label: 'User portal', value: 'user' },
35
+ { label: 'Zapier', value: 'zapier' },
36
+ ];
37
+ exports.subscriberOrderingOptions = [
38
+ { label: 'Newest first', value: '-creation_date' },
39
+ { label: 'Oldest first', value: 'creation_date' },
40
+ { label: 'Email address (A-Z)', value: 'email_address' },
41
+ { label: 'Email address (Z-A)', value: '-email_address' },
42
+ { label: 'Last opened (recent first)', value: '-last_open_date' },
43
+ { label: 'Last opened (oldest first)', value: 'last_open_date' },
44
+ ];
45
+ exports.emailStatusOptions = [
46
+ { label: 'Send immediately (about_to_send)', value: 'about_to_send' },
47
+ { label: 'Draft', value: 'draft' },
48
+ { label: 'Scheduled', value: 'scheduled' },
49
+ ];
50
+ exports.emailTypeOptions = [
51
+ { label: 'Public', value: 'public' },
52
+ { label: 'Private', value: 'private' },
53
+ { label: 'Premium', value: 'premium' },
54
+ { label: 'Free', value: 'free' },
55
+ { label: 'Churned', value: 'churned' },
56
+ { label: 'Archival', value: 'archival' },
57
+ ];
58
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/lib/common/options.ts"],"names":[],"mappings":";;;AASa,QAAA,qBAAqB,GAAyD;IACzF,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACtC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACtC,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;IAC9C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACpC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACtC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;IACxC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;IACxC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAA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ifted' | 'unactivated' | 'unpaid' | 'undeliverable' | 'premium' | 'past_due' | 'paused' | 'regular' | 'removed' | 'trialed' | 'unsubscribed' | 'upcoming';
2
+ export type ButtondownSubscriberSource = 'admin' | 'api' | 'carrd' | 'comment' | 'embedded_form' | 'form' | 'import' | 'memberful' | 'organic' | 'patreon' | 'stripe' | 'user' | 'zapier';
3
+ export interface ButtondownSubscriber {
4
+ id: string;
5
+ creation_date: string;
6
+ email_address: string;
7
+ type: ButtondownSubscriberType;
8
+ tags: string[];
9
+ metadata: Record<string, unknown>;
10
+ notes?: string;
11
+ referrer_url?: string;
12
+ utm_campaign?: string;
13
+ utm_medium?: string;
14
+ utm_source?: string;
15
+ ip_address?: string;
16
+ source: ButtondownSubscriberSource;
17
+ last_open_date?: string | null;
18
+ last_click_date?: string | null;
19
+ click_rate?: number | null;
20
+ open_rate?: number | null;
21
+ churn_date?: string | null;
22
+ unsubscription_date?: string | null;
23
+ undeliverability_date?: string | null;
24
+ [key: string]: unknown;
25
+ }
26
+ export interface ButtondownSubscriberInput {
27
+ email_address: string;
28
+ notes?: string;
29
+ metadata?: Record<string, unknown>;
30
+ tags?: string[];
31
+ referrer_url?: string;
32
+ utm_campaign?: string;
33
+ utm_medium?: string;
34
+ utm_source?: string;
35
+ referring_subscriber_id?: string;
36
+ type?: ButtondownSubscriberType;
37
+ ip_address?: string;
38
+ }
39
+ export type ButtondownEmailType = 'public' | 'private' | 'premium' | 'free' | 'churned' | 'archival';
40
+ export type ButtondownEmailStatus = 'draft' | 'managed_by_rss' | 'about_to_send' | 'scheduled' | 'in_flight' | 'paused' | 'deleted' | 'errored' | 'sent' | 'imported' | 'throttled' | 'resending' | 'transactional' | 'suppressed';
41
+ export interface ButtondownEmail {
42
+ id: string;
43
+ creation_date: string;
44
+ modification_date: string;
45
+ subject: string;
46
+ body: string;
47
+ status: ButtondownEmailStatus;
48
+ email_type: ButtondownEmailType;
49
+ publish_date?: string | null;
50
+ description?: string;
51
+ canonical_url?: string;
52
+ image?: string;
53
+ metadata?: Record<string, unknown>;
54
+ attachments?: string[];
55
+ [key: string]: unknown;
56
+ }
57
+ export interface ButtondownEmailInput {
58
+ subject: string;
59
+ body?: string;
60
+ status?: ButtondownEmailStatus;
61
+ email_type?: ButtondownEmailType;
62
+ publish_date?: string;
63
+ description?: string;
64
+ canonical_url?: string;
65
+ image?: string;
66
+ metadata?: Record<string, unknown>;
67
+ slug?: string;
68
+ attachments?: string[];
69
+ should_trigger_pay_per_email_billing?: boolean;
70
+ }
71
+ export type ButtondownWebhookEvent = 'subscriber.created' | 'subscriber.confirmed' | 'email.sent';
72
+ export interface ButtondownWebhook {
73
+ id: string;
74
+ creation_date: string;
75
+ url: string;
76
+ event_types: ButtondownWebhookEvent[];
77
+ status?: 'enabled' | 'disabled';
78
+ description?: string;
79
+ signing_key?: string;
80
+ }
81
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/common/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,wBAAwB,GAChC,SAAS,GACT,YAAY,GACZ,UAAU,GACV,SAAS,GACT,QAAQ,GACR,aAAa,GACb,QAAQ,GACR,eAAe,GACf,SAAS,GACT,UAAU,GACV,QAAQ,GACR,SAAS,GACT,SAAS,GACT,SAAS,GACT,cAAc,GACd,UAAU,CAAC;AAEf,MAAM,MAAM,0BAA0B,GAClC,OAAO,GACP,KAAK,GACL,OAAO,GACP,SAAS,GACT,eAAe,GACf,MAAM,GACN,QAAQ,GACR,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,GACR,MAAM,GACN,QAAQ,CAAC;AAEb,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,wBAAwB,CAAC;IAC/B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EA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AAC;IACvB,oCAAoC,CAAC,EAAE,OAAO,CAAC;CAChD;AAED,MAAM,MAAM,sBAAsB,GAC9B,oBAAoB,GACpB,sBAAsB,GACtB,YAAY,CAAC;AAEjB,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,sBAAsB,EAAE,CAAC;IACtC,MAAM,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/common/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,36 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ import { ButtondownWebhookEvent } from './types';
3
+ export interface ButtondownWebhookPayload {
4
+ event_type?: string;
5
+ data?: Record<string, unknown>;
6
+ [key: string]: unknown;
7
+ }
8
+ interface CreateButtondownWebhookTriggerParams {
9
+ name: string;
10
+ displayName: string;
11
+ description: string;
12
+ aiMetadata: {
13
+ description: string;
14
+ };
15
+ eventType: ButtondownWebhookEvent;
16
+ sampleData: unknown;
17
+ enrich?: (params: {
18
+ apiKey: string;
19
+ payload: ButtondownWebhookPayload;
20
+ }) => Promise<Record<string, unknown>>;
21
+ }
22
+ export declare const createButtondownWebhookTrigger: ({ name, displayName, description, aiMetadata, eventType, sampleData, enrich, }: CreateButtondownWebhookTriggerParams) => import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
23
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
24
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
25
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
26
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
27
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
28
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
29
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
30
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
31
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
32
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
33
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
34
+ }>;
35
+ export {};
36
+ //# sourceMappingURL=webhook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../src/lib/common/webhook.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGrF,OAAO,EAAqB,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEpE,MAAM,WAAW,wBAAwB;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,oCAAoC;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE;QACV,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,SAAS,EAAE,sBAAsB,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,wBAAwB,CAAC;KACnC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,8BAA8B,mFAQxC,oCAAoC;;;;;;;;;;;;EAqEnC,CAAC"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createButtondownWebhookTrigger = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/buttondown/src/lib/common/webhook.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_common_1 = require("@agnocon/pieces-common");
8
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
9
+ const auth_1 = require("./auth");
10
+ const client_1 = require("./client");
11
+ const createButtondownWebhookTrigger = ({ name, displayName, description, aiMetadata, eventType, sampleData, enrich, }) => (0, pieces_framework_1.createTrigger)({
12
+ auth: auth_1.buttondownAuth,
13
+ name,
14
+ displayName,
15
+ description,
16
+ aiMetadata,
17
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
18
+ props: {
19
+ webhookDescription: pieces_framework_1.Property.ShortText({
20
+ displayName: 'Webhook Description',
21
+ description: 'Optional description stored with the webhook in Buttondown.',
22
+ required: false,
23
+ }),
24
+ signingKey: pieces_framework_1.Property.ShortText({
25
+ displayName: 'Webhook Signing Key',
26
+ description: 'Optional HMAC signing key to validate webhook requests.',
27
+ required: false,
28
+ }),
29
+ },
30
+ sampleData,
31
+ onEnable(context) {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ const webhook = yield (0, client_1.buttondownRequest)({
34
+ auth: context.auth.secret_text,
35
+ method: pieces_common_1.HttpMethod.POST,
36
+ path: '/webhooks',
37
+ body: {
38
+ url: context.webhookUrl,
39
+ event_types: [eventType],
40
+ description: context.propsValue.webhookDescription,
41
+ signing_key: context.propsValue.signingKey,
42
+ },
43
+ });
44
+ yield context.store.put('webhookId', webhook.id);
45
+ });
46
+ },
47
+ onDisable(context) {
48
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
49
+ const webhookId = yield context.store.get('webhookId');
50
+ if (!webhookId) {
51
+ return;
52
+ }
53
+ yield (0, client_1.buttondownRequest)({
54
+ auth: context.auth.secret_text,
55
+ method: pieces_common_1.HttpMethod.DELETE,
56
+ path: `/webhooks/${webhookId}`,
57
+ });
58
+ });
59
+ },
60
+ run(context) {
61
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ const payload = context.payload.body;
63
+ if ((payload === null || payload === void 0 ? void 0 : payload.event_type) !== eventType) {
64
+ return [];
65
+ }
66
+ let enriched;
67
+ if (enrich) {
68
+ enriched = yield enrich({
69
+ apiKey: context.auth.secret_text,
70
+ payload,
71
+ });
72
+ }
73
+ return [
74
+ Object.assign(Object.assign({}, payload), (enriched !== null && enriched !== void 0 ? enriched : {})),
75
+ ];
76
+ });
77
+ },
78
+ });
79
+ exports.createButtondownWebhookTrigger = createButtondownWebhookTrigger;
80
+ //# sourceMappingURL=webhook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../../src/lib/common/webhook.ts"],"names":[],"mappings":";;;;AAAA,mGAAmG;AACnG,qEAAqE;AACrE,0DAAoD;AACpD,gEAAqF;AACrF,iCAAwC;AACxC,qCAA6C;AAwBtC,MAAM,8BAA8B,GAAG,CAAC,EAC7C,IAAI,EACJ,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,EACV,MAAM,GAC+B,EAAE,EAAE,CACzC,IAAA,gCAAa,EAAC;IACZ,IAAI,EAAE,qBAAc;IACpB,IAAI;IACJ,WAAW;IACX,WAAW;IACX,UAAU;IACV,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE;QACL,kBAAkB,EAAE,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AAC;YACjE,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,MAAK,SAAS,EAAE,CAAC;gBACtC,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,IAAI,QAA6C,CAAC;YAClD,IAAI,MAAM,EAAE,CAAC;gBACX,QAAQ,GAAG,MAAM,MAAM,CAAC;oBACtB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;oBAChC,OAAO;iBACR,CAAC,CAAC;YACL,CAAC;YAED,OAAO;gDAEA,OAAO,GACP,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC;aAEtB,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC;AA7EQ,QAAA,8BAA8B,kCA6EtC"}
@@ -0,0 +1,14 @@
1
+ export declare const buttondownEmailSent: import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
2
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
3
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
4
+ }> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.POLLING, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
5
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
6
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
7
+ }> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
8
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
9
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
10
+ }> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
11
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
12
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
13
+ }>;
14
+ //# sourceMappingURL=email-sent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-sent.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/email-sent.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAiC9B,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buttondownEmailSent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/buttondown/src/lib/triggers/email-sent.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_common_1 = require("@agnocon/pieces-common");
8
+ const client_1 = require("../common/client");
9
+ const webhook_1 = require("../common/webhook");
10
+ exports.buttondownEmailSent = (0, webhook_1.createButtondownWebhookTrigger)({
11
+ name: 'buttondown_email_sent',
12
+ displayName: 'Email Sent',
13
+ description: 'Triggers when an email is sent from Buttondown.',
14
+ aiMetadata: {
15
+ description: 'Fires when an email is dispatched to subscribers from Buttondown. Represents a sent newsletter/email; the payload is enriched with the full email details.',
16
+ },
17
+ eventType: 'email.sent',
18
+ sampleData: {
19
+ event_type: 'email.sent',
20
+ data: {
21
+ email: 'eml_123456789',
22
+ },
23
+ },
24
+ enrich: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ apiKey, payload }) {
25
+ var _b;
26
+ const emailData = (_b = payload.data) === null || _b === void 0 ? void 0 : _b['email'];
27
+ let email;
28
+ if (typeof emailData === 'string') {
29
+ email = yield (0, client_1.buttondownRequest)({
30
+ auth: apiKey,
31
+ method: pieces_common_1.HttpMethod.GET,
32
+ path: `/emails/${encodeURIComponent(emailData)}`,
33
+ });
34
+ }
35
+ else if (emailData && typeof emailData === 'object') {
36
+ email = emailData;
37
+ }
38
+ return {
39
+ email,
40
+ };
41
+ }),
42
+ });
43
+ //# sourceMappingURL=email-sent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-sent.js","sourceRoot":"","sources":["../../../src/lib/triggers/email-sent.ts"],"names":[],"mappings":";;;;AAAA,wGAAwG;AACxG,qEAAqE;AACrE,0DAAoD;AACpD,6CAAqD;AACrD,+CAAmE;AAGtD,QAAA,mBAAmB,GAAG,IAAA,wCAA8B,EAAC;IAChE,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,iDAAiD;IAC9D,UAAU,EAAE;QACV,WAAW,EACT,4JAA4J;KAC/J;IACD,SAAS,EAAE,YAAY;IACvB,UAAU,EAAE;QACV,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE;YACJ,KAAK,EAAE,eAAe;SACvB;KACF;IACD,MAAM,EAAE,KAA4B,EAAE,oDAAvB,EAAE,MAAM,EAAE,OAAO,EAAE;;QAChC,MAAM,SAAS,GAAG,MAAA,OAAO,CAAC,IAAI,0CAAG,OAAO,CAAC,CAAC;QAC1C,IAAI,KAAkC,CAAC;QAEvC,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAClC,KAAK,GAAG,MAAM,IAAA,0BAAiB,EAAkB;gBAC/C,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,WAAW,kBAAkB,CAAC,SAAS,CAAC,EAAE;aACjD,CAAC,CAAC;QACL,CAAC;aAAM,IAAI,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YACtD,KAAK,GAAG,SAA4B,CAAC;QACvC,CAAC;QAED,OAAO;YACL,KAAK;SACN,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const buttondownNewSubscriber: import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
2
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
3
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
4
+ }> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.POLLING, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
5
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
6
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
7
+ }> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
8
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
9
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
10
+ }> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
11
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
12
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
13
+ }>;
14
+ //# sourceMappingURL=new-subscriber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-subscriber.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/new-subscriber.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EAiClC,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buttondownNewSubscriber = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/buttondown/src/lib/triggers/new-subscriber.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_common_1 = require("@agnocon/pieces-common");
8
+ const client_1 = require("../common/client");
9
+ const webhook_1 = require("../common/webhook");
10
+ exports.buttondownNewSubscriber = (0, webhook_1.createButtondownWebhookTrigger)({
11
+ name: 'buttondown_new_subscriber',
12
+ displayName: 'New Subscriber',
13
+ description: 'Triggers when a new subscriber is created.',
14
+ aiMetadata: {
15
+ description: 'Fires when a subscriber is added to the Buttondown newsletter, regardless of confirmation status. Represents a newly created subscriber record; the payload is enriched with the full subscriber details.',
16
+ },
17
+ eventType: 'subscriber.created',
18
+ sampleData: {
19
+ event_type: 'subscriber.created',
20
+ data: {
21
+ subscriber: 'sub_123456789',
22
+ },
23
+ },
24
+ enrich: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ apiKey, payload }) {
25
+ var _b;
26
+ const subscriberData = (_b = payload.data) === null || _b === void 0 ? void 0 : _b['subscriber'];
27
+ let subscriber;
28
+ if (typeof subscriberData === 'string') {
29
+ subscriber = yield (0, client_1.buttondownRequest)({
30
+ auth: apiKey,
31
+ method: pieces_common_1.HttpMethod.GET,
32
+ path: `/subscribers/${encodeURIComponent(subscriberData)}`,
33
+ });
34
+ }
35
+ else if (subscriberData && typeof subscriberData === 'object') {
36
+ subscriber = subscriberData;
37
+ }
38
+ return {
39
+ subscriber,
40
+ };
41
+ }),
42
+ });
43
+ //# sourceMappingURL=new-subscriber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-subscriber.js","sourceRoot":"","sources":["../../../src/lib/triggers/new-subscriber.ts"],"names":[],"mappings":";;;;AAAA,4GAA4G;AAC5G,qEAAqE;AACrE,0DAAoD;AACpD,6CAAqD;AACrD,+CAAmE;AAGtD,QAAA,uBAAuB,GAAG,IAAA,wCAA8B,EAAC;IACpE,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,4CAA4C;IACzD,UAAU,EAAE;QACV,WAAW,EACT,2MAA2M;KAC9M;IACD,SAAS,EAAE,oBAAoB;IAC/B,UAAU,EAAE;QACV,UAAU,EAAE,oBAAoB;QAChC,IAAI,EAAE;YACJ,UAAU,EAAE,eAAe;SAC5B;KACF;IACD,MAAM,EAAE,KAA4B,EAAE,oDAAvB,EAAE,MAAM,EAAE,OAAO,EAAE;;QAChC,MAAM,cAAc,GAAG,MAAA,OAAO,CAAC,IAAI,0CAAG,YAAY,CAAC,CAAC;QACpD,IAAI,UAA4C,CAAC;QAEjD,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YACvC,UAAU,GAAG,MAAM,IAAA,0BAAiB,EAAuB;gBACzD,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,gBAAgB,kBAAkB,CAAC,cAAc,CAAC,EAAE;aAC3D,CAAC,CAAC;QACL,CAAC;aAAM,IAAI,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YAChE,UAAU,GAAG,cAAsC,CAAC;QACtD,CAAC;QAED,OAAO;YACL,UAAU;SACX,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const buttondownSubscriberConfirmed: import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
2
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
3
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
4
+ }> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.POLLING, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
5
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
6
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
7
+ }> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
8
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
9
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
10
+ }> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
11
+ webhookDescription: import("@agnocon/pieces-framework").ShortTextProperty<false>;
12
+ signingKey: import("@agnocon/pieces-framework").ShortTextProperty<false>;
13
+ }>;
14
+ //# sourceMappingURL=subscriber-confirmed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriber-confirmed.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/subscriber-confirmed.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,6BAA6B;;;;;;;;;;;;EAiCxC,CAAC"}