@agnocon/piece-bitly 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/LICENSE.MIT-AP +24 -0
  2. package/dist/index.d.ts +4 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +44 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/actions/archive-bitlink.d.ts +11 -0
  7. package/dist/lib/actions/archive-bitlink.d.ts.map +1 -0
  8. package/dist/lib/actions/archive-bitlink.js +54 -0
  9. package/dist/lib/actions/archive-bitlink.js.map +1 -0
  10. package/dist/lib/actions/create-bitlink.d.ts +34 -0
  11. package/dist/lib/actions/create-bitlink.d.ts.map +1 -0
  12. package/dist/lib/actions/create-bitlink.js +134 -0
  13. package/dist/lib/actions/create-bitlink.js.map +1 -0
  14. package/dist/lib/actions/create-qr-code.d.ts +39 -0
  15. package/dist/lib/actions/create-qr-code.d.ts.map +1 -0
  16. package/dist/lib/actions/create-qr-code.js +383 -0
  17. package/dist/lib/actions/create-qr-code.js.map +1 -0
  18. package/dist/lib/actions/get-bitlink-details.d.ts +11 -0
  19. package/dist/lib/actions/get-bitlink-details.d.ts.map +1 -0
  20. package/dist/lib/actions/get-bitlink-details.js +50 -0
  21. package/dist/lib/actions/get-bitlink-details.js.map +1 -0
  22. package/dist/lib/actions/update-bitlink.d.ts +18 -0
  23. package/dist/lib/actions/update-bitlink.d.ts.map +1 -0
  24. package/dist/lib/actions/update-bitlink.js +135 -0
  25. package/dist/lib/actions/update-bitlink.js.map +1 -0
  26. package/dist/lib/common/auth.d.ts +4 -0
  27. package/dist/lib/common/auth.d.ts.map +1 -0
  28. package/dist/lib/common/auth.js +44 -0
  29. package/dist/lib/common/auth.js.map +1 -0
  30. package/dist/lib/common/client.d.ts +13 -0
  31. package/dist/lib/common/client.d.ts.map +1 -0
  32. package/dist/lib/common/client.js +69 -0
  33. package/dist/lib/common/client.js.map +1 -0
  34. package/dist/lib/common/props.d.ts +10 -0
  35. package/dist/lib/common/props.d.ts.map +1 -0
  36. package/dist/lib/common/props.js +118 -0
  37. package/dist/lib/common/props.js.map +1 -0
  38. package/dist/lib/triggers/new-bitlink-created.d.ts +43 -0
  39. package/dist/lib/triggers/new-bitlink-created.d.ts.map +1 -0
  40. package/dist/lib/triggers/new-bitlink-created.js +312 -0
  41. package/dist/lib/triggers/new-bitlink-created.js.map +1 -0
  42. package/package.json +46 -0
  43. package/src/index.ts +38 -0
  44. package/src/lib/actions/archive-bitlink.ts +59 -0
  45. package/src/lib/actions/create-bitlink.ts +158 -0
  46. package/src/lib/actions/create-qr-code.ts +398 -0
  47. package/src/lib/actions/get-bitlink-details.ts +54 -0
  48. package/src/lib/actions/update-bitlink.ts +153 -0
  49. package/src/lib/common/auth.ts +37 -0
  50. package/src/lib/common/client.ts +122 -0
  51. package/src/lib/common/props.ts +123 -0
  52. package/src/lib/triggers/new-bitlink-created.ts +361 -0
@@ -0,0 +1,4 @@
1
+ export declare const bitlyAuth: import("@agnocon/pieces-framework").CustomAuthProperty<{
2
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
3
+ }>;
4
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS;;EAgCpB,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bitlyAuth = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bitly/src/lib/common/auth.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const client_1 = require("./client");
9
+ const pieces_common_1 = require("@agnocon/pieces-common");
10
+ exports.bitlyAuth = pieces_framework_1.PieceAuth.CustomAuth({
11
+ description: `
12
+ To get your Access Token:
13
+ 1. Log in to your Bitly account.
14
+ 2. Click your profile icon in the top right corner.
15
+ 3. Go to **Profile Settings**.
16
+ 4. Navigate to the **Developer settings** section.
17
+ 5. Click on **API**.
18
+ 6. Click the **Generate token** button and enter your password to get your access token.
19
+ `,
20
+ props: {
21
+ accessToken: pieces_framework_1.PieceAuth.SecretText({
22
+ displayName: 'Access Token',
23
+ required: true,
24
+ }),
25
+ },
26
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
27
+ try {
28
+ yield (0, client_1.bitlyApiCall)({
29
+ method: pieces_common_1.HttpMethod.GET,
30
+ auth,
31
+ resourceUri: '/user',
32
+ });
33
+ return { valid: true };
34
+ }
35
+ catch (e) {
36
+ return {
37
+ valid: false,
38
+ error: 'Invalid Access Token',
39
+ };
40
+ }
41
+ }),
42
+ required: true,
43
+ });
44
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,2FAA2F;AAC3F,qEAAqE;AACrE,gEAAsD;AACtD,qCAAwC;AACxC,0DAAoD;AAEvC,QAAA,SAAS,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC5C,WAAW,EAAE;;;;;;;;GAQZ;IACD,KAAK,EAAE;QACL,WAAW,EAAE,4BAAS,CAAC,UAAU,CAAC;YAChC,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,IAAA,qBAAY,EAAC;gBACjB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI;gBACJ,WAAW,EAAE,OAAO;aACrB,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,sBAAsB;aAC9B,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;IACD,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { HttpMethod, HttpMessageBody } from '@agnocon/pieces-common';
2
+ export type BitlyAuthProps = {
3
+ accessToken: string;
4
+ };
5
+ export type BitlyApiCallParams = {
6
+ method: HttpMethod;
7
+ resourceUri: string;
8
+ query?: Record<string, string | number | string[] | undefined>;
9
+ body?: any;
10
+ auth: BitlyAuthProps;
11
+ };
12
+ export declare function bitlyApiCall<T extends HttpMessageBody>({ method, resourceUri, query, body, auth, }: BitlyApiCallParams): Promise<T>;
13
+ //# 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,EAEL,UAAU,EAEV,eAAe,EAEhB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,cAAc,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IAC/D,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAEF,wBAAsB,YAAY,CAAC,CAAC,SAAS,eAAe,EAAE,EAC5D,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,EACJ,IAAI,GACL,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CA+FjC"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bitlyApiCall = bitlyApiCall;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bitly/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
+ function bitlyApiCall(_a) {
9
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ method, resourceUri, query, body, auth, }) {
10
+ var _b, _c;
11
+ const { accessToken } = auth;
12
+ if (!accessToken) {
13
+ throw new Error('Bitly Access Token is required for authentication');
14
+ }
15
+ const queryParams = {};
16
+ if (query) {
17
+ for (const [key, value] of Object.entries(query)) {
18
+ if (value !== null && value !== undefined) {
19
+ queryParams[key] = String(value);
20
+ }
21
+ }
22
+ }
23
+ const baseUrl = 'https://api-ssl.bitly.com/v4';
24
+ const request = {
25
+ method,
26
+ url: `${baseUrl}${resourceUri}`,
27
+ headers: {
28
+ Authorization: `Bearer ${accessToken}`,
29
+ 'Content-Type': 'application/json',
30
+ },
31
+ queryParams,
32
+ body,
33
+ };
34
+ try {
35
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
36
+ return response.body;
37
+ }
38
+ catch (error) {
39
+ const statusCode = (_b = error.response) === null || _b === void 0 ? void 0 : _b.status;
40
+ const errorData = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data;
41
+ const errorMessage = (errorData === null || errorData === void 0 ? void 0 : errorData.description) || (errorData === null || errorData === void 0 ? void 0 : errorData.message) || 'Unknown error occurred';
42
+ switch (statusCode) {
43
+ case 400:
44
+ throw new Error(`Bad Request: ${errorMessage}. Please check your input parameters.`);
45
+ case 401:
46
+ throw new Error('Authentication Failed: Invalid Access Token. Please verify your Bitly credentials in the connection settings.');
47
+ case 402:
48
+ throw new Error(`Payment Required: ${errorMessage}. Your account has been suspended or you have reached a usage limit.`);
49
+ case 403:
50
+ throw new Error(`Access Forbidden: ${errorMessage}. You do not have permission to access this resource.`);
51
+ case 404:
52
+ throw new Error(`Resource Not Found: ${errorMessage}. The requested resource does not exist.`);
53
+ case 417:
54
+ throw new Error(`Expectation Failed: ${errorMessage}. You must agree to the latest terms of service.`);
55
+ case 422:
56
+ throw new Error(`Unprocessable Entity: ${errorMessage}. The request was well-formed but was unable to be followed due to semantic errors.`);
57
+ case 429:
58
+ throw new Error(`Rate Limit Exceeded: ${errorMessage}. Too many requests. Please wait before trying again.`);
59
+ case 500:
60
+ throw new Error('Internal Server Error: Bitly is experiencing technical difficulties. Please try again later.');
61
+ case 503:
62
+ throw new Error('Service Unavailable: Bitly service is temporarily unavailable. Please try again in a few minutes.');
63
+ default:
64
+ throw new Error(`Bitly API Error (${statusCode || 'Unknown'}): ${errorMessage}`);
65
+ }
66
+ }
67
+ });
68
+ }
69
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/lib/common/client.ts"],"names":[],"mappings":";;AAsBA,oCAqGC;;AA3HD,6FAA6F;AAC7F,qEAAqE;AACrE,0DAMgC;AAchC,SAAsB,YAAY;iEAA4B,EAC5D,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,EACJ,IAAI,GACe;;QACnB,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAE7B,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,WAAW,GAAgB,EAAE,CAAC;QAEpC,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBAC1C,WAAW,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;gBACnC,CA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AY,kDAAkD,CACxF,CAAC;gBAEN,KAAK,GAAG;oBACN,MAAM,IAAI,KAAK,CACX,yBAAyB,YAAY,qFAAqF,CAC7H,CAAC;gBAEJ,KAAK,GAAG;oBACN,MAAM,IAAI,KAAK,CACb,wBAAwB,YAAY,uDAAuD,CAC5F,CAAC;gBAEJ,KAAK,GAAG;oBACN,MAAM,IAAI,KAAK,CACb,8FAA8F,CAC/F,CAAC;gBAEJ,KAAK,GAAG;oBACN,MAAM,IAAI,KAAK,CACb,mGAAmG,CACpG,CAAC;gBAEJ;oBACE,MAAM,IAAI,KAAK,CACb,oBAAoB,UAAU,IAAI,SAAS,MAAM,YAAY,EAAE,CAChE,CAAC;YACN,CAAC;QACH,CAAC;IACH,CAAC;CAAA"}
@@ -0,0 +1,10 @@
1
+ export declare const groupGuid: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
2
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
3
+ }>>;
4
+ export declare const domain: import("@agnocon/pieces-framework").DropdownProperty<string, false, import("@agnocon/pieces-framework").CustomAuthProperty<{
5
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
6
+ }>>;
7
+ export declare const bitlinkDropdown: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
8
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
9
+ }>>;
10
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/lib/common/props.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,SAAS;;GA8BpB,CAAC;AAEH,eAAO,MAAM,MAAM;;GA8BjB,CAAC;AAEH,eAAO,MAAM,eAAe;;GAgC1B,CAAC"}
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bitlinkDropdown = exports.domain = exports.groupGuid = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bitly/src/lib/common/props.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const pieces_common_1 = require("@agnocon/pieces-common");
9
+ const client_1 = require("./client");
10
+ const auth_1 = require("./auth");
11
+ const getBitlyGroups = (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
12
+ const response = yield (0, client_1.bitlyApiCall)({
13
+ auth,
14
+ method: pieces_common_1.HttpMethod.GET,
15
+ resourceUri: '/groups',
16
+ });
17
+ return response.groups || [];
18
+ });
19
+ exports.groupGuid = pieces_framework_1.Property.Dropdown({
20
+ displayName: 'Group',
21
+ description: 'The group where the item will be managed.',
22
+ required: true,
23
+ refreshers: [],
24
+ auth: auth_1.bitlyAuth,
25
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
26
+ if (!auth) {
27
+ return { disabled: true, options: [], placeholder: 'Please connect your Bitly account first.' };
28
+ }
29
+ const { accessToken } = auth.props;
30
+ if (!accessToken) {
31
+ return { disabled: true, options: [], placeholder: 'Please connect your Bitly account first.' };
32
+ }
33
+ try {
34
+ const groups = yield getBitlyGroups({ accessToken });
35
+ if (groups.length === 0) {
36
+ return { disabled: true, options: [], placeholder: 'No groups found in your account.' };
37
+ }
38
+ return {
39
+ disabled: false,
40
+ options: groups.map((group) => ({
41
+ label: group.name,
42
+ value: group.guid,
43
+ })),
44
+ };
45
+ }
46
+ catch (e) {
47
+ return { disabled: true, options: [], placeholder: `Error fetching groups: ${e.message}` };
48
+ }
49
+ }),
50
+ });
51
+ exports.domain = pieces_framework_1.Property.Dropdown({
52
+ auth: auth_1.bitlyAuth,
53
+ displayName: 'Domain',
54
+ description: 'Domain to use for the Bitlink.',
55
+ required: false,
56
+ refreshers: ['group_guid'],
57
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, group_guid }) {
58
+ var _b;
59
+ if (!auth) {
60
+ return { disabled: true, options: [], placeholder: 'Please connect your Bitly account first.' };
61
+ }
62
+ const { accessToken } = auth.props;
63
+ if (!accessToken || !group_guid) {
64
+ return { disabled: true, options: [], placeholder: 'Please select a group first.' };
65
+ }
66
+ try {
67
+ const groups = yield getBitlyGroups({ accessToken });
68
+ const selectedGroup = groups.find(g => g.guid === group_guid);
69
+ const customDomains = ((_b = selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.bsds) === null || _b === void 0 ? void 0 : _b.map(bsd => bsd.domain)) || [];
70
+ const allDomains = ['bit.ly', ...customDomains];
71
+ return {
72
+ disabled: false,
73
+ options: allDomains.map(d => ({
74
+ label: d,
75
+ value: d,
76
+ })),
77
+ };
78
+ }
79
+ catch (e) {
80
+ return { disabled: true, options: [], placeholder: `Error fetching domains: ${e.message}` };
81
+ }
82
+ }),
83
+ });
84
+ exports.bitlinkDropdown = pieces_framework_1.Property.Dropdown({
85
+ displayName: 'Bitlink',
86
+ description: 'Select the Bitlink to modify.',
87
+ required: true,
88
+ refreshers: ['group_guid'],
89
+ auth: auth_1.bitlyAuth,
90
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, group_guid }) {
91
+ if (!auth) {
92
+ return { disabled: true, options: [], placeholder: 'Please connect your Bitly account first.' };
93
+ }
94
+ const { accessToken } = auth.props;
95
+ if (!accessToken)
96
+ return { disabled: true, options: [], placeholder: 'Please connect your Bitly account first.' };
97
+ if (!group_guid)
98
+ return { disabled: true, options: [], placeholder: 'Please select a group first.' };
99
+ try {
100
+ const response = yield (0, client_1.bitlyApiCall)({
101
+ auth: { accessToken },
102
+ method: pieces_common_1.HttpMethod.GET,
103
+ resourceUri: `/groups/${group_guid}/bitlinks`,
104
+ });
105
+ return {
106
+ disabled: false,
107
+ options: response.links.map(link => ({
108
+ label: `${link.title || 'No Title'} (${link.id})`,
109
+ value: link.id
110
+ }))
111
+ };
112
+ }
113
+ catch (e) {
114
+ return { disabled: true, options: [], placeholder: `Error fetching Bitlinks: ${e.message}` };
115
+ }
116
+ })
117
+ });
118
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,4FAA4F;AAC5F,qEAAqE;AACrE,gEAAqD;AACrD,0DAAoD;AACpD,qCAAwC;AAExC,iCAAmC;AAanC,MAAM,cAAc,GAAG,CAAO,IAAoB,EAAyB,EAAE;IACzE,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAY,EAA2B;QAC1D,IAAI;QACJ,MAAM,EAAE,0BAAU,CAAC,GAAG;QACtB,WAAW,EAAE,SAAS;KACzB,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;AACjC,CAAC,CAAA,CAAC;AAEW,QAAA,SAAS,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IACzC,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,2CAA2C;IACxD,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,EAAE;IACd,IAAI,EAAC,gBAAS;IACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;QAClG,CAAC;QACD,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACnC,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;QAClG,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,EAAE,WAAW,EAAE,CAA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AAE,CAAC;QAClG,CAAC;QACD,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACnC,IAAI,CAAC,WAAW;YAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;QAClH,IAAI,CAAC,UAAU;YAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;QAErG,IAAI,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAY,EAAuB;gBACtD,IAAI,EAAE,EAAE,WAAW,EAAE;gBACrB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,WAAW,UAAoB,WAAW;aAC1D,CAAC,CAAC;YACH,OAAO;gBACH,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBACjC,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,KAAK,IAAI,CAAC,EAAE,GAAG;oBACjD,KAAK,EAAE,IAAI,CAAC,EAAE;iBACjB,CAAC,CAAC;aACN,CAAC;QACN,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,4BAA6B,CAAW,CAAC,OAAO,EAAE,EAAE,CAAC;QAC5G,CAAC;IACL,CAAC,CAAA;CACJ,CAAC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ export declare const newBitlinkCreatedTrigger: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
3
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ pollingInterval: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
6
+ group_guid: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
7
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
8
+ }>>;
9
+ titleFilter: import("@agnocon/pieces-framework").ShortTextProperty<false>;
10
+ tagFilter: import("@agnocon/pieces-framework").ShortTextProperty<false>;
11
+ includeArchived: import("@agnocon/pieces-framework").CheckboxProperty<false>;
12
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").CustomAuthProperty<{
13
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
14
+ }>, {
15
+ pollingInterval: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
16
+ group_guid: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
17
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
18
+ }>>;
19
+ titleFilter: import("@agnocon/pieces-framework").ShortTextProperty<false>;
20
+ tagFilter: import("@agnocon/pieces-framework").ShortTextProperty<false>;
21
+ includeArchived: import("@agnocon/pieces-framework").CheckboxProperty<false>;
22
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").CustomAuthProperty<{
23
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
24
+ }>, {
25
+ pollingInterval: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
26
+ group_guid: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
27
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
28
+ }>>;
29
+ titleFilter: import("@agnocon/pieces-framework").ShortTextProperty<false>;
30
+ tagFilter: import("@agnocon/pieces-framework").ShortTextProperty<false>;
31
+ includeArchived: import("@agnocon/pieces-framework").CheckboxProperty<false>;
32
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").CustomAuthProperty<{
33
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
34
+ }>, {
35
+ pollingInterval: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
36
+ group_guid: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
37
+ accessToken: import("@agnocon/pieces-framework").SecretTextProperty<true>;
38
+ }>>;
39
+ titleFilter: import("@agnocon/pieces-framework").ShortTextProperty<false>;
40
+ tagFilter: import("@agnocon/pieces-framework").ShortTextProperty<false>;
41
+ includeArchived: import("@agnocon/pieces-framework").CheckboxProperty<false>;
42
+ }>;
43
+ //# sourceMappingURL=new-bitlink-created.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-bitlink-created.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/new-bitlink-created.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAAY,MAAM,2BAA2B,CAAC;AAQrF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6UnC,CAAC"}
@@ -0,0 +1,312 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newBitlinkCreatedTrigger = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bitly/src/lib/triggers/new-bitlink-created.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const pieces_common_1 = require("@agnocon/pieces-common");
9
+ const auth_1 = require("../common/auth");
10
+ const client_1 = require("../common/client");
11
+ const props_1 = require("../common/props");
12
+ const LAST_BITLINK_IDS_KEY = 'bitly-last-bitlink-ids';
13
+ exports.newBitlinkCreatedTrigger = (0, pieces_framework_1.createTrigger)({
14
+ auth: auth_1.bitlyAuth,
15
+ name: 'new_bitlink_created',
16
+ displayName: 'New Bitlink Created',
17
+ description: 'Fires when a new Bitlink is created.',
18
+ aiMetadata: {
19
+ description: 'Fires when a new Bitlink appears in the selected group, detected by polling. Represents a newly created short link, optionally narrowed to those whose title or tags match a filter and optionally including archived links.',
20
+ },
21
+ type: pieces_framework_1.TriggerStrategy.POLLING,
22
+ props: {
23
+ pollingInterval: pieces_framework_1.Property.StaticDropdown({
24
+ displayName: 'Polling Interval',
25
+ description: 'How frequently to check for new Bitlinks.',
26
+ required: false,
27
+ defaultValue: '5',
28
+ options: {
29
+ disabled: false,
30
+ options: [
31
+ { label: 'Every 1 minute', value: '1' },
32
+ { label: 'Every 5 minutes', value: '5' },
33
+ { label: 'Every 15 minutes', value: '15' },
34
+ { label: 'Every 30 minutes', value: '30' },
35
+ { label: 'Every hour', value: '60' },
36
+ ],
37
+ },
38
+ }),
39
+ group_guid: props_1.groupGuid,
40
+ titleFilter: pieces_framework_1.Property.ShortText({
41
+ displayName: 'Title Filter (Optional)',
42
+ description: 'Only trigger for Bitlinks containing this text in their title.',
43
+ required: false,
44
+ }),
45
+ tagFilter: pieces_framework_1.Property.ShortText({
46
+ displayName: 'Tag Filter (Optional)',
47
+ description: 'Only trigger for Bitlinks containing this tag.',
48
+ required: false,
49
+ }),
50
+ includeArchived: pieces_framework_1.Property.Checkbox({
51
+ displayName: 'Include Archived Bitlinks',
52
+ description: 'Include archived Bitlinks in monitoring.',
53
+ required: false,
54
+ defaultValue: false,
55
+ }),
56
+ },
57
+ onEnable(context) {
58
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
59
+ var _a, _b;
60
+ const { group_guid } = context.propsValue;
61
+ const { accessToken } = context.auth.props;
62
+ try {
63
+ const response = yield (0, client_1.bitlyApiCall)({
64
+ auth: { accessToken },
65
+ method: pieces_common_1.HttpMethod.GET,
66
+ resourceUri: `/groups/${group_guid}/bitlinks`,
67
+ query: {
68
+ size: 50,
69
+ archived: context.propsValue.includeArchived ? 'both' : 'off',
70
+ },
71
+ });
72
+ const linkIds = response.links.map((link) => link.id);
73
+ yield context.store.put(LAST_BITLINK_IDS_KEY, linkIds);
74
+ console.log(`Bitly New Bitlink trigger initialized with ${linkIds.length} existing links`);
75
+ }
76
+ catch (error) {
77
+ if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
78
+ throw new Error('Authentication failed: Please check your access token. Make sure your token has permission to access Bitlinks.');
79
+ }
80
+ if (((_b = error.response) === null || _b === void 0 ? void 0 : _b.status) === 403) {
81
+ throw new Error('Access denied: You do not have permission to list Bitlinks. Please check your Bitly account permissions.');
82
+ }
83
+ throw new Error(`Failed to initialize Bitlink monitoring: ${error.message || 'Unknown error occurred'}. Please check your Bitly connection.`);
84
+ }
85
+ });
86
+ },
87
+ onDisable() {
88
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
89
+ console.log('Bitly New Bitlink trigger disabled and cleaned up');
90
+ });
91
+ },
92
+ run(context) {
93
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
94
+ var _a, _b, _c;
95
+ const { group_guid, titleFilter, tagFilter, includeArchived } = context.propsValue;
96
+ const { accessToken } = context.auth.props;
97
+ try {
98
+ const previousLinkIds = (yield context.store.get(LAST_BITLINK_IDS_KEY)) || [];
99
+ const response = yield (0, client_1.bitlyApiCall)({
100
+ auth: { accessToken },
101
+ method: pieces_common_1.HttpMethod.GET,
102
+ resourceUri: `/groups/${group_guid}/bitlinks`,
103
+ query: {
104
+ size: 50,
105
+ archived: includeArchived ? 'both' : 'off',
106
+ },
107
+ });
108
+ const allLinks = response.links || [];
109
+ const currentLinkIds = allLinks.map((l) => l.id);
110
+ yield context.store.put(LAST_BITLINK_IDS_KEY, currentLinkIds);
111
+ let newLinks = allLinks.filter((link) => !previousLinkIds.includes(link.id));
112
+ if (titleFilter && titleFilter.trim()) {
113
+ const filterText = titleFilter.trim().toLowerCase();
114
+ newLinks = newLinks.filter((link) => link.title && link.title.toLowerCase().includes(filterText));
115
+ }
116
+ if (tagFilter && tagFilter.trim()) {
117
+ const filterTag = tagFilter.trim().toLowerCase();
118
+ newLinks = newLinks.filter((link) => link.tags && Array.isArray(link.tags) &&
119
+ link.tags.some(tag => tag.toLowerCase().includes(filterTag)));
120
+ }
121
+ const processedLinks = newLinks.map((link) => {
122
+ var _a;
123
+ return ({
124
+ id: link.id,
125
+ link: link.link,
126
+ longUrl: link.long_url,
127
+ title: link.title,
128
+ tags: link.tags || [],
129
+ isArchived: link.archived,
130
+ createdAt: link.created_at,
131
+ modifiedAt: link.modified_at,
132
+ customBitlinks: link.custom_bitlinks || [],
133
+ references: {
134
+ group: (_a = link.references) === null || _a === void 0 ? void 0 : _a.group,
135
+ },
136
+ rawLinkData: link,
137
+ triggerInfo: {
138
+ detectedAt: new Date().toISOString(),
139
+ source: 'bitly',
140
+ type: 'new_bitlink',
141
+ },
142
+ });
143
+ });
144
+ return processedLinks;
145
+ }
146
+ catch (error) {
147
+ if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
148
+ throw new Error('Authentication failed: Your access token may have expired. Please check your Bitly authentication.');
149
+ }
150
+ if (((_b = error.response) === null || _b === void 0 ? void 0 : _b.status) === 429) {
151
+ throw new Error('Rate limit exceeded: Bitly API rate limit reached. Consider increasing your polling interval.');
152
+ }
153
+ if (((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === 403) {
154
+ throw new Error('Access denied: You do not have permission to list Bitlinks. Please check your account permissions.');
155
+ }
156
+ throw new Error(`Failed to check for new Bitlinks: ${error.message || 'Unknown error occurred'}. The trigger will retry on the next polling interval.`);
157
+ }
158
+ });
159
+ },
160
+ test(context) {
161
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
162
+ var _a;
163
+ const { group_guid, includeArchived } = context.propsValue;
164
+ const { accessToken } = context.auth.props;
165
+ try {
166
+ const response = yield (0, client_1.bitlyApiCall)({
167
+ auth: { accessToken },
168
+ method: pieces_common_1.HttpMethod.GET,
169
+ resourceUri: `/groups/${group_guid}/bitlinks`,
170
+ query: {
171
+ size: 1,
172
+ archived: includeArchived ? 'both' : 'off',
173
+ },
174
+ });
175
+ const links = response.links || [];
176
+ if (links.length > 0) {
177
+ const testLink = links[0];
178
+ return [
179
+ {
180
+ id: testLink.id,
181
+ link: testLink.link,
182
+ longUrl: testLink.long_url,
183
+ title: testLink.title,
184
+ tags: testLink.tags || [],
185
+ isArchived: testLink.archived,
186
+ createdAt: testLink.created_at,
187
+ modifiedAt: testLink.modified_at,
188
+ customBitlinks: testLink.custom_bitlinks || [],
189
+ references: {
190
+ group: (_a = testLink.references) === null || _a === void 0 ? void 0 : _a.group,
191
+ },
192
+ rawLinkData: testLink,
193
+ triggerInfo: {
194
+ detectedAt: new Date().toISOString(),
195
+ source: 'bitly',
196
+ type: 'new_bitlink',
197
+ },
198
+ },
199
+ ];
200
+ }
201
+ else {
202
+ return [
203
+ {
204
+ id: 'bit.ly/test123',
205
+ link: 'https://bit.ly/test123',
206
+ longUrl: 'https://example.com/very-long-url',
207
+ title: 'Sample Bitlink',
208
+ tags: ['sample', 'test'],
209
+ isArchived: false,
210
+ createdAt: '2025-01-15T10:00:00+0000',
211
+ modifiedAt: '2025-01-15T10:00:00+0000',
212
+ customBitlinks: [],
213
+ references: {
214
+ group: 'Ba1bc23dE4F',
215
+ },
216
+ rawLinkData: {
217
+ id: 'bit.ly/test123',
218
+ link: 'https://bit.ly/test123',
219
+ long_url: 'https://example.com/very-long-url',
220
+ title: 'Sample Bitlink',
221
+ tags: ['sample', 'test'],
222
+ archived: false,
223
+ created_at: '2025-01-15T10:00:00+0000',
224
+ modified_at: '2025-01-15T10:00:00+0000',
225
+ custom_bitlinks: [],
226
+ references: {
227
+ group: 'Ba1bc23dE4F',
228
+ },
229
+ },
230
+ triggerInfo: {
231
+ detectedAt: new Date().toISOString(),
232
+ source: 'bitly',
233
+ type: 'new_bitlink',
234
+ },
235
+ },
236
+ ];
237
+ }
238
+ }
239
+ catch (error) {
240
+ return [
241
+ {
242
+ id: 'bit.ly/test123',
243
+ link: 'https://bit.ly/test123',
244
+ longUrl: 'https://example.com/test-url',
245
+ title: 'Test Bitlink',
246
+ tags: ['test'],
247
+ isArchived: false,
248
+ createdAt: '2025-01-15T10:00:00+0000',
249
+ modifiedAt: '2025-01-15T10:00:00+0000',
250
+ customBitlinks: [],
251
+ references: {
252
+ group: 'Ba1bc23dE4F',
253
+ },
254
+ rawLinkData: {
255
+ id: 'bit.ly/test123',
256
+ link: 'https://bit.ly/test123',
257
+ long_url: 'https://example.com/test-url',
258
+ title: 'Test Bitlink',
259
+ tags: ['test'],
260
+ archived: false,
261
+ created_at: '2025-01-15T10:00:00+0000',
262
+ modified_at: '2025-01-15T10:00:00+0000',
263
+ custom_bitlinks: [],
264
+ references: {
265
+ group: 'Ba1bc23dE4F',
266
+ },
267
+ },
268
+ triggerInfo: {
269
+ detectedAt: new Date().toISOString(),
270
+ source: 'bitly',
271
+ type: 'new_bitlink',
272
+ },
273
+ },
274
+ ];
275
+ }
276
+ });
277
+ },
278
+ sampleData: {
279
+ id: 'bit.ly/3XYZ123',
280
+ link: 'https://bit.ly/3XYZ123',
281
+ longUrl: 'https://example.com/marketing-campaign-landing-page',
282
+ title: 'Marketing Campaign Landing Page',
283
+ tags: ['marketing', 'campaign', '2025'],
284
+ isArchived: false,
285
+ createdAt: '2025-01-15T09:30:00+0000',
286
+ modifiedAt: '2025-01-15T09:30:00+0000',
287
+ customBitlinks: [],
288
+ references: {
289
+ group: 'Ba1bc23dE4F',
290
+ },
291
+ rawLinkData: {
292
+ id: 'bit.ly/3XYZ123',
293
+ link: 'https://bit.ly/3XYZ123',
294
+ long_url: 'https://example.com/marketing-campaign-landing-page',
295
+ title: 'Marketing Campaign Landing Page',
296
+ tags: ['marketing', 'campaign', '2025'],
297
+ archived: false,
298
+ created_at: '2025-01-15T09:30:00+0000',
299
+ modified_at: '2025-01-15T09:30:00+0000',
300
+ custom_bitlinks: [],
301
+ references: {
302
+ group: 'Ba1bc23dE4F',
303
+ },
304
+ },
305
+ triggerInfo: {
306
+ detectedAt: '2025-01-15T09:30:00.000Z',
307
+ source: 'bitly',
308
+ type: 'new_bitlink',
309
+ },
310
+ },
311
+ });
312
+ //# sourceMappingURL=new-bitlink-created.js.map