@activepieces/piece-dub 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -0
- package/src/i18n/translation.json +150 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +42 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-link.d.ts +28 -0
- package/src/lib/actions/create-link.js +222 -0
- package/src/lib/actions/create-link.js.map +1 -0
- package/src/lib/actions/delete-link.d.ts +3 -0
- package/src/lib/actions/delete-link.js +35 -0
- package/src/lib/actions/delete-link.js.map +1 -0
- package/src/lib/actions/get-link.d.ts +7 -0
- package/src/lib/actions/get-link.js +84 -0
- package/src/lib/actions/get-link.js.map +1 -0
- package/src/lib/actions/list-links.d.ts +10 -0
- package/src/lib/actions/list-links.js +105 -0
- package/src/lib/actions/list-links.js.map +1 -0
- package/src/lib/actions/update-link.d.ts +27 -0
- package/src/lib/actions/update-link.js +209 -0
- package/src/lib/actions/update-link.js.map +1 -0
- package/src/lib/auth.d.ts +2 -0
- package/src/lib/auth.js +56 -0
- package/src/lib/auth.js.map +1 -0
- package/src/lib/common/common.d.ts +53 -0
- package/src/lib/common/common.js +26 -0
- package/src/lib/common/common.js.map +1 -0
- package/src/lib/triggers/link-clicked.d.ts +10 -0
- package/src/lib/triggers/link-clicked.js +76 -0
- package/src/lib/triggers/link-clicked.js.map +1 -0
- package/src/lib/triggers/link-created.d.ts +10 -0
- package/src/lib/triggers/link-created.js +62 -0
- package/src/lib/triggers/link-created.js.map +1 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const listLinks: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
domain: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
3
|
+
tagNames: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
4
|
+
search: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
userId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
showArchived: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
+
page: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
pageSize: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
9
|
+
sort: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listLinks = 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("../auth");
|
|
8
|
+
exports.listLinks = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'list_links',
|
|
10
|
+
displayName: 'List Links',
|
|
11
|
+
description: 'Retrieve a paginated list of links in your Dub workspace.',
|
|
12
|
+
auth: auth_1.dubAuth,
|
|
13
|
+
props: {
|
|
14
|
+
domain: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Domain Filter',
|
|
16
|
+
description: 'Filter by a specific domain (e.g. `dub.sh`). Leave empty to return all domains.',
|
|
17
|
+
required: false,
|
|
18
|
+
}),
|
|
19
|
+
tagNames: pieces_framework_1.Property.Array({
|
|
20
|
+
displayName: 'Tag Name Filter',
|
|
21
|
+
description: 'Filter by one or more tag names.',
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
search: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'Search Query',
|
|
26
|
+
description: 'Search links by their URL, title, or slug.',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
userId: pieces_framework_1.Property.ShortText({
|
|
30
|
+
displayName: 'User ID Filter',
|
|
31
|
+
description: 'Filter links created by a specific user ID.',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
showArchived: pieces_framework_1.Property.Checkbox({
|
|
35
|
+
displayName: 'Include Archived Links',
|
|
36
|
+
description: 'Whether to include archived links in the results.',
|
|
37
|
+
required: false,
|
|
38
|
+
defaultValue: false,
|
|
39
|
+
}),
|
|
40
|
+
page: pieces_framework_1.Property.Number({
|
|
41
|
+
displayName: 'Page',
|
|
42
|
+
description: 'Page number for pagination (starts at 1).',
|
|
43
|
+
required: false,
|
|
44
|
+
defaultValue: 1,
|
|
45
|
+
}),
|
|
46
|
+
pageSize: pieces_framework_1.Property.Number({
|
|
47
|
+
displayName: 'Page Size',
|
|
48
|
+
description: 'Number of links to return per page (1–100). Default is 100.',
|
|
49
|
+
required: false,
|
|
50
|
+
defaultValue: 100,
|
|
51
|
+
}),
|
|
52
|
+
sort: pieces_framework_1.Property.StaticDropdown({
|
|
53
|
+
displayName: 'Sort By',
|
|
54
|
+
description: 'Field to sort results by.',
|
|
55
|
+
required: false,
|
|
56
|
+
defaultValue: 'createdAt',
|
|
57
|
+
options: {
|
|
58
|
+
options: [
|
|
59
|
+
{ label: 'Created At (newest first)', value: 'createdAt' },
|
|
60
|
+
{ label: 'Clicks (most clicks first)', value: 'clicks' },
|
|
61
|
+
{ label: 'Last Clicked', value: 'lastClicked' },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
}),
|
|
65
|
+
},
|
|
66
|
+
run(context) {
|
|
67
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const { auth, propsValue } = context;
|
|
69
|
+
// Use URLSearchParams so we can append multiple tagName values
|
|
70
|
+
const params = new URLSearchParams();
|
|
71
|
+
if (propsValue.domain)
|
|
72
|
+
params.set('domain', propsValue.domain);
|
|
73
|
+
if (propsValue.search)
|
|
74
|
+
params.set('search', propsValue.search);
|
|
75
|
+
if (propsValue.userId)
|
|
76
|
+
params.set('userId', propsValue.userId);
|
|
77
|
+
if (propsValue.showArchived)
|
|
78
|
+
params.set('showArchived', 'true');
|
|
79
|
+
if (propsValue.page)
|
|
80
|
+
params.set('page', String(propsValue.page));
|
|
81
|
+
if (propsValue.pageSize)
|
|
82
|
+
params.set('pageSize', String(propsValue.pageSize));
|
|
83
|
+
if (propsValue.sort)
|
|
84
|
+
params.set('sort', propsValue.sort);
|
|
85
|
+
// Append each tag as a separate tagName param so all survive serialisation
|
|
86
|
+
if (propsValue.tagNames && propsValue.tagNames.length > 0) {
|
|
87
|
+
for (const tag of propsValue.tagNames) {
|
|
88
|
+
params.append('tagName', tag);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const queryString = params.toString();
|
|
92
|
+
const url = `${auth_1.DUB_API_BASE}/links${queryString ? `?${queryString}` : ''}`;
|
|
93
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
94
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
95
|
+
url,
|
|
96
|
+
headers: {
|
|
97
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
98
|
+
'Content-Type': 'application/json',
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
return response.body;
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=list-links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-links.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-links.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAgD;AAEnC,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,2DAA2D;IACxE,IAAI,EAAE,cAAO;IACb,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,iFAAiF;YAC9F,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2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CAAC;YACtC,MAAM,GAAG,GAAG,GAAG,mBAAY,SAAS,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YAE3E,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAY;gBACvD,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG;gBACH,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;oBAC3C,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const updateLink: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
linkId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
url: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
key: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
title: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
7
|
+
image: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
video: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
tags: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
10
|
+
folderId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
expiresAt: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
expiredUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
password: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
+
trackConversion: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
15
|
+
proxy: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
16
|
+
rewrite: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
17
|
+
doIndex: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
18
|
+
archived: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
19
|
+
ios: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
20
|
+
android: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
21
|
+
comments: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
22
|
+
utm_source: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
23
|
+
utm_medium: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
24
|
+
utm_campaign: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
25
|
+
utm_term: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
26
|
+
utm_content: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateLink = 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("../auth");
|
|
8
|
+
exports.updateLink = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'update_link',
|
|
10
|
+
displayName: 'Update Link',
|
|
11
|
+
description: 'Update an existing Dub link. Only the fields you fill in will be updated.',
|
|
12
|
+
auth: auth_1.dubAuth,
|
|
13
|
+
props: {
|
|
14
|
+
linkId: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Link ID',
|
|
16
|
+
description: 'The ID of the link to update (e.g. `clv3g2...`). Find this from the Create Link or List Links actions.',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
url: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'New Destination URL',
|
|
21
|
+
description: 'Update the destination URL the link redirects to.',
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
key: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'New Slug',
|
|
26
|
+
description: 'Update the short link slug (the part after the domain).',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
title: pieces_framework_1.Property.ShortText({
|
|
30
|
+
displayName: 'Title',
|
|
31
|
+
description: 'Update the human-readable title.',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
description: pieces_framework_1.Property.LongText({
|
|
35
|
+
displayName: 'Description',
|
|
36
|
+
description: 'Update the link description.',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
image: pieces_framework_1.Property.ShortText({
|
|
40
|
+
displayName: 'OG Image URL',
|
|
41
|
+
description: 'Update the custom link preview image (og:image).',
|
|
42
|
+
required: false,
|
|
43
|
+
}),
|
|
44
|
+
video: pieces_framework_1.Property.ShortText({
|
|
45
|
+
displayName: 'OG Video URL',
|
|
46
|
+
description: 'Update the custom link preview video (og:video).',
|
|
47
|
+
required: false,
|
|
48
|
+
}),
|
|
49
|
+
tags: pieces_framework_1.Property.Array({
|
|
50
|
+
displayName: 'Tag Names',
|
|
51
|
+
description: 'Replace the link\'s tags with this new list of tag names. Send an empty array to clear all tags.',
|
|
52
|
+
required: false,
|
|
53
|
+
}),
|
|
54
|
+
folderId: pieces_framework_1.Property.ShortText({
|
|
55
|
+
displayName: 'Folder ID',
|
|
56
|
+
description: 'Move this link to a different folder by its ID.',
|
|
57
|
+
required: false,
|
|
58
|
+
}),
|
|
59
|
+
expiresAt: pieces_framework_1.Property.ShortText({
|
|
60
|
+
displayName: 'Expires At',
|
|
61
|
+
description: 'ISO 8601 datetime when the link should expire. Set to empty to remove expiration.',
|
|
62
|
+
required: false,
|
|
63
|
+
}),
|
|
64
|
+
expiredUrl: pieces_framework_1.Property.ShortText({
|
|
65
|
+
displayName: 'Expired URL',
|
|
66
|
+
description: 'URL to redirect to after expiration.',
|
|
67
|
+
required: false,
|
|
68
|
+
}),
|
|
69
|
+
password: pieces_framework_1.Property.ShortText({
|
|
70
|
+
displayName: 'Password',
|
|
71
|
+
description: 'Update the password for this link. Leave blank to remove password protection.',
|
|
72
|
+
required: false,
|
|
73
|
+
}),
|
|
74
|
+
trackConversion: pieces_framework_1.Property.Checkbox({
|
|
75
|
+
displayName: 'Track Conversions',
|
|
76
|
+
description: 'Whether to track conversions for this link.',
|
|
77
|
+
required: false,
|
|
78
|
+
}),
|
|
79
|
+
proxy: pieces_framework_1.Property.Checkbox({
|
|
80
|
+
displayName: 'Custom Link Previews',
|
|
81
|
+
description: 'Enable or disable Custom Link Previews (og:title, og:description, og:image) for this link.',
|
|
82
|
+
required: false,
|
|
83
|
+
}),
|
|
84
|
+
rewrite: pieces_framework_1.Property.Checkbox({
|
|
85
|
+
displayName: 'Cloaked URL (URL Rewriting)',
|
|
86
|
+
description: 'Toggle URL cloaking.',
|
|
87
|
+
required: false,
|
|
88
|
+
}),
|
|
89
|
+
doIndex: pieces_framework_1.Property.Checkbox({
|
|
90
|
+
displayName: 'Allow Search Engine Indexing',
|
|
91
|
+
description: 'Allow search engines to index this short link.',
|
|
92
|
+
required: false,
|
|
93
|
+
}),
|
|
94
|
+
archived: pieces_framework_1.Property.Checkbox({
|
|
95
|
+
displayName: 'Archived',
|
|
96
|
+
description: 'Archive or unarchive the link.',
|
|
97
|
+
required: false,
|
|
98
|
+
}),
|
|
99
|
+
ios: pieces_framework_1.Property.ShortText({
|
|
100
|
+
displayName: 'iOS Redirect URL',
|
|
101
|
+
description: 'Update the iOS-specific redirect URL.',
|
|
102
|
+
required: false,
|
|
103
|
+
}),
|
|
104
|
+
android: pieces_framework_1.Property.ShortText({
|
|
105
|
+
displayName: 'Android Redirect URL',
|
|
106
|
+
description: 'Update the Android-specific redirect URL.',
|
|
107
|
+
required: false,
|
|
108
|
+
}),
|
|
109
|
+
comments: pieces_framework_1.Property.LongText({
|
|
110
|
+
displayName: 'Comments',
|
|
111
|
+
description: 'Update internal notes for this link.',
|
|
112
|
+
required: false,
|
|
113
|
+
}),
|
|
114
|
+
utm_source: pieces_framework_1.Property.ShortText({
|
|
115
|
+
displayName: 'UTM Source',
|
|
116
|
+
description: 'Update the UTM source parameter.',
|
|
117
|
+
required: false,
|
|
118
|
+
}),
|
|
119
|
+
utm_medium: pieces_framework_1.Property.ShortText({
|
|
120
|
+
displayName: 'UTM Medium',
|
|
121
|
+
description: 'Update the UTM medium parameter.',
|
|
122
|
+
required: false,
|
|
123
|
+
}),
|
|
124
|
+
utm_campaign: pieces_framework_1.Property.ShortText({
|
|
125
|
+
displayName: 'UTM Campaign',
|
|
126
|
+
description: 'Update the UTM campaign parameter.',
|
|
127
|
+
required: false,
|
|
128
|
+
}),
|
|
129
|
+
utm_term: pieces_framework_1.Property.ShortText({
|
|
130
|
+
displayName: 'UTM Term',
|
|
131
|
+
description: 'Update the UTM term parameter.',
|
|
132
|
+
required: false,
|
|
133
|
+
}),
|
|
134
|
+
utm_content: pieces_framework_1.Property.ShortText({
|
|
135
|
+
displayName: 'UTM Content',
|
|
136
|
+
description: 'Update the UTM content parameter.',
|
|
137
|
+
required: false,
|
|
138
|
+
}),
|
|
139
|
+
},
|
|
140
|
+
run(context) {
|
|
141
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
const { auth, propsValue } = context;
|
|
143
|
+
const { linkId } = propsValue, rest = tslib_1.__rest(propsValue, ["linkId"]);
|
|
144
|
+
const body = {};
|
|
145
|
+
if (rest.url !== undefined && rest.url !== null && rest.url !== '')
|
|
146
|
+
body['url'] = rest.url;
|
|
147
|
+
if (rest.key !== undefined && rest.key !== null && rest.key !== '')
|
|
148
|
+
body['key'] = rest.key;
|
|
149
|
+
if (rest.title !== undefined && rest.title !== null)
|
|
150
|
+
body['title'] = rest.title;
|
|
151
|
+
if (rest.description !== undefined && rest.description !== null)
|
|
152
|
+
body['description'] = rest.description;
|
|
153
|
+
if (rest.image !== undefined && rest.image !== null)
|
|
154
|
+
body['image'] = rest.image;
|
|
155
|
+
if (rest.video !== undefined && rest.video !== null)
|
|
156
|
+
body['video'] = rest.video;
|
|
157
|
+
if (rest.tags !== undefined)
|
|
158
|
+
body['tagNames'] = rest.tags;
|
|
159
|
+
if (rest.folderId !== undefined && rest.folderId !== null)
|
|
160
|
+
body['folderId'] = rest.folderId;
|
|
161
|
+
if (rest.expiresAt !== undefined && rest.expiresAt !== null)
|
|
162
|
+
body['expiresAt'] = rest.expiresAt;
|
|
163
|
+
if (rest.expiredUrl !== undefined && rest.expiredUrl !== null)
|
|
164
|
+
body['expiredUrl'] = rest.expiredUrl;
|
|
165
|
+
if (rest.password !== undefined && rest.password !== null)
|
|
166
|
+
body['password'] = rest.password;
|
|
167
|
+
if (rest.trackConversion !== undefined)
|
|
168
|
+
body['trackConversion'] = rest.trackConversion;
|
|
169
|
+
if (rest.proxy !== undefined)
|
|
170
|
+
body['proxy'] = rest.proxy;
|
|
171
|
+
if (rest.rewrite !== undefined)
|
|
172
|
+
body['rewrite'] = rest.rewrite;
|
|
173
|
+
if (rest.doIndex !== undefined)
|
|
174
|
+
body['doIndex'] = rest.doIndex;
|
|
175
|
+
if (rest.archived !== undefined)
|
|
176
|
+
body['archived'] = rest.archived;
|
|
177
|
+
if (rest.ios !== undefined && rest.ios !== null)
|
|
178
|
+
body['ios'] = rest.ios;
|
|
179
|
+
if (rest.android !== undefined && rest.android !== null)
|
|
180
|
+
body['android'] = rest.android;
|
|
181
|
+
if (rest.comments !== undefined && rest.comments !== null)
|
|
182
|
+
body['comments'] = rest.comments;
|
|
183
|
+
if (rest.utm_source !== undefined && rest.utm_source !== null)
|
|
184
|
+
body['utm_source'] = rest.utm_source;
|
|
185
|
+
if (rest.utm_medium !== undefined && rest.utm_medium !== null)
|
|
186
|
+
body['utm_medium'] = rest.utm_medium;
|
|
187
|
+
if (rest.utm_campaign !== undefined && rest.utm_campaign !== null)
|
|
188
|
+
body['utm_campaign'] = rest.utm_campaign;
|
|
189
|
+
if (rest.utm_term !== undefined && rest.utm_term !== null)
|
|
190
|
+
body['utm_term'] = rest.utm_term;
|
|
191
|
+
if (rest.utm_content !== undefined && rest.utm_content !== null)
|
|
192
|
+
body['utm_content'] = rest.utm_content;
|
|
193
|
+
if (Object.keys(body).length === 0) {
|
|
194
|
+
throw new Error('At least one field must be provided to update.');
|
|
195
|
+
}
|
|
196
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
197
|
+
method: pieces_common_1.HttpMethod.PATCH,
|
|
198
|
+
url: `${auth_1.DUB_API_BASE}/links/${linkId}`,
|
|
199
|
+
headers: {
|
|
200
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
201
|
+
'Content-Type': 'application/json',
|
|
202
|
+
},
|
|
203
|
+
body,
|
|
204
|
+
});
|
|
205
|
+
return response.body;
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
//# sourceMappingURL=update-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-link.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-link.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAgD;AAGnC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,2EAA2E;IACxF,IAAI,EAAE,cAAO;IACb,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,wGAAwG;YACrH,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,KAAK;SAChB,CA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,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI;gBAAE,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;YAC5G,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI;gBAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC5F,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI;gBAAE,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;YAExG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;YACpE,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAU;gBACrD,MAAM,EAAE,0BAAU,CAAC,KAAK;gBACxB,GAAG,EAAE,GAAG,mBAAY,UAAU,MAAM,EAAE;gBACtC,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;oBAC3C,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI;aACL,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
package/src/lib/auth.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dubAuth = exports.DUB_API_BASE = 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.DUB_API_BASE = 'https://api.dub.co';
|
|
8
|
+
const authDescription = `
|
|
9
|
+
To obtain your Dub API key:
|
|
10
|
+
1. Go to [https://app.dub.co/settings/tokens](https://app.dub.co/settings/tokens)
|
|
11
|
+
2. Click **Create API Key**
|
|
12
|
+
3. Give your key a name and select the required scopes
|
|
13
|
+
4. Copy the key — it starts with \`dub_\` (e.g. \`dub_xxxxxxxxxxxxxxxx\`)
|
|
14
|
+
5. Paste it here
|
|
15
|
+
|
|
16
|
+
> **Required scopes:** \`links.read\`, \`links.write\`, \`webhooks.write\` (for triggers)
|
|
17
|
+
`;
|
|
18
|
+
exports.dubAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
19
|
+
displayName: 'API Key',
|
|
20
|
+
description: authDescription,
|
|
21
|
+
required: true,
|
|
22
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
23
|
+
var _b, _c;
|
|
24
|
+
try {
|
|
25
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
26
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
27
|
+
url: `${exports.DUB_API_BASE}/folders`,
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: `Bearer ${auth.trim()}`,
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
return { valid: true };
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
const err = e;
|
|
37
|
+
if (((_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
|
|
38
|
+
return {
|
|
39
|
+
valid: false,
|
|
40
|
+
error: 'Invalid API key. Please check your Dub API credentials.',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (((_c = err === null || err === void 0 ? void 0 : err.response) === null || _c === void 0 ? void 0 : _c.status) === 403) {
|
|
44
|
+
return {
|
|
45
|
+
valid: false,
|
|
46
|
+
error: 'Insufficient scopes. Ensure your API key has links.read, links.write, and webhooks.write permissions.',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
valid: false,
|
|
51
|
+
error: 'Unable to validate API key. Please try again.',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAqE;AAExD,QAAA,YAAY,GAAG,oBAAoB,CAAC;AAEjD,MAAM,eAAe,GAAG;;;;;;;;;CASvB,CAAC;AAEW,QAAA,OAAO,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC1C,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,eAAe;IAC5B,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,oBAAY,UAAU;gBAC9B,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,IAAI,EAAE,EAAE;oBACtC,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACpB,MAAM,GAAG,GAAG,CAAuC,CAAC;YACpD,IAAI,CAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;gBAClC,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,yDAAyD;iBACjE,CAAC;YACJ,CAAC;YACD,IAAI,CAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;gBAClC,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,uGAAuG;iBAC/G,CAAC;YACJ,CAAC;YACD,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,+CAA+C;aACvD,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare function verifyDubSignature(secret: string, rawBody: string, signatureHeader: string): boolean;
|
|
2
|
+
export interface DubLink {
|
|
3
|
+
id: string;
|
|
4
|
+
domain: string;
|
|
5
|
+
key: string;
|
|
6
|
+
url: string;
|
|
7
|
+
shortLink: string;
|
|
8
|
+
qrCode: string;
|
|
9
|
+
trackConversion: boolean;
|
|
10
|
+
externalId: string | null;
|
|
11
|
+
tenantId: string | null;
|
|
12
|
+
programId: string | null;
|
|
13
|
+
partnerId: string | null;
|
|
14
|
+
archived: boolean;
|
|
15
|
+
expiresAt: string | null;
|
|
16
|
+
expiredUrl: string | null;
|
|
17
|
+
disabledAt: string | null;
|
|
18
|
+
password: string | null;
|
|
19
|
+
proxy: boolean;
|
|
20
|
+
title: string | null;
|
|
21
|
+
description: string | null;
|
|
22
|
+
image: string | null;
|
|
23
|
+
video: string | null;
|
|
24
|
+
rewrite: boolean;
|
|
25
|
+
doIndex: boolean;
|
|
26
|
+
ios: string | null;
|
|
27
|
+
android: string | null;
|
|
28
|
+
geo: Record<string, string> | null;
|
|
29
|
+
publicStats: boolean;
|
|
30
|
+
tags: Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
color: string;
|
|
34
|
+
}> | null;
|
|
35
|
+
folderId: string | null;
|
|
36
|
+
webhookIds: string[];
|
|
37
|
+
comments: string | null;
|
|
38
|
+
utm_source: string | null;
|
|
39
|
+
utm_medium: string | null;
|
|
40
|
+
utm_campaign: string | null;
|
|
41
|
+
utm_term: string | null;
|
|
42
|
+
utm_content: string | null;
|
|
43
|
+
userId: string | null;
|
|
44
|
+
workspaceId: string;
|
|
45
|
+
clicks: number;
|
|
46
|
+
leads: number;
|
|
47
|
+
conversions: number;
|
|
48
|
+
sales: number;
|
|
49
|
+
saleAmount: number;
|
|
50
|
+
lastClicked: string | null;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyDubSignature = verifyDubSignature;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const crypto_1 = tslib_1.__importDefault(require("crypto"));
|
|
6
|
+
function verifyDubSignature(secret, rawBody, signatureHeader) {
|
|
7
|
+
try {
|
|
8
|
+
const expected = crypto_1.default
|
|
9
|
+
.createHmac('sha256', secret)
|
|
10
|
+
.update(rawBody, 'utf8')
|
|
11
|
+
.digest('hex');
|
|
12
|
+
const provided = signatureHeader.startsWith('sha256=')
|
|
13
|
+
? signatureHeader.slice(7)
|
|
14
|
+
: signatureHeader;
|
|
15
|
+
const expectedBuf = Buffer.from(expected, 'hex');
|
|
16
|
+
const providedBuf = Buffer.from(provided, 'hex');
|
|
17
|
+
if (expectedBuf.length !== providedBuf.length) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return crypto_1.default.timingSafeEqual(expectedBuf, providedBuf);
|
|
21
|
+
}
|
|
22
|
+
catch (_a) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/lib/common/common.ts"],"names":[],"mappings":";;AAGA,gDAsBC;;AAxBD,4DAA4B;AAE5B,SAAgB,kBAAkB,CAChC,MAAc,EACd,OAAe,EACf,eAAuB;IAEvB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,gBAAM;aACpB,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC;aAC5B,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC;aACvB,MAAM,CAAC,KAAK,CAAC,CAAC;QACjB,MAAM,QAAQ,GAAG,eAAe,CAAC,UAAU,CAAC,SAAS,CAAC;YACpD,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1B,CAAC,CAAC,eAAe,CAAC;QACpB,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjD,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjD,IAAI,WAAW,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,EAAE,CAAC;YAC9C,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,gBAAM,CAAC,eAAe,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC1D,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const linkClicked: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
4
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
+
md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
7
|
+
md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
8
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
9
|
+
md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.linkClicked = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const shared_1 = require("@activepieces/shared");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
exports.linkClicked = (0, pieces_framework_1.createTrigger)({
|
|
9
|
+
auth: auth_1.dubAuth,
|
|
10
|
+
name: 'link_clicked',
|
|
11
|
+
displayName: 'Link Clicked',
|
|
12
|
+
description: 'Triggers in real time whenever one of your Dub short links is clicked.',
|
|
13
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
14
|
+
props: {
|
|
15
|
+
md: pieces_framework_1.Property.MarkDown({
|
|
16
|
+
value: `## Setup Instructions
|
|
17
|
+
|
|
18
|
+
1. Go to your Dub workspace and navigate to **Settings → [Webhooks](https://app.dub.co/settings/webhooks)**.
|
|
19
|
+
2. Click **Create Webhook**.
|
|
20
|
+
3. Give your webhook a name.
|
|
21
|
+
4. Paste the following URL into the **URL** field:
|
|
22
|
+
\`\`\`text
|
|
23
|
+
{{webhookUrl}}
|
|
24
|
+
\`\`\`
|
|
25
|
+
5. Under **Events**, select **link.clicked**.
|
|
26
|
+
6. Click **Create webhook**.`,
|
|
27
|
+
variant: shared_1.MarkdownVariant.INFO,
|
|
28
|
+
}),
|
|
29
|
+
},
|
|
30
|
+
sampleData: {
|
|
31
|
+
id: 'evt_abc123',
|
|
32
|
+
event: 'link.clicked',
|
|
33
|
+
createdAt: '2024-01-15T10:30:00.000Z',
|
|
34
|
+
data: {
|
|
35
|
+
link: {
|
|
36
|
+
id: 'clv3g2xyz',
|
|
37
|
+
domain: 'dub.sh',
|
|
38
|
+
key: 'my-promo',
|
|
39
|
+
url: 'https://example.com/landing',
|
|
40
|
+
shortLink: 'https://dub.sh/my-promo',
|
|
41
|
+
clicks: 42,
|
|
42
|
+
},
|
|
43
|
+
click: {
|
|
44
|
+
id: 'click_abc',
|
|
45
|
+
timestamp: '2024-01-15T10:30:00.000Z',
|
|
46
|
+
identity: 'anonymous',
|
|
47
|
+
url: 'https://dub.sh/my-promo',
|
|
48
|
+
country: 'US',
|
|
49
|
+
city: 'San Francisco',
|
|
50
|
+
region: 'CA',
|
|
51
|
+
continent: 'NA',
|
|
52
|
+
device: 'Desktop',
|
|
53
|
+
browser: 'Chrome',
|
|
54
|
+
os: 'macOS',
|
|
55
|
+
referer: 'https://twitter.com',
|
|
56
|
+
refererUrl: 'https://twitter.com',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
onEnable() {
|
|
61
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
// Webhook is registered manually in the Dub platform
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
onDisable() {
|
|
66
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
// Webhook is removed manually in the Dub platform
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
run(context) {
|
|
71
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
return [context.payload.body];
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=link-clicked.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-clicked.js","sourceRoot":"","sources":["../../../../src/lib/triggers/link-clicked.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,iDAAuD;AACvD,kCAAkC;AAErB,QAAA,WAAW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ategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const linkCreated: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
4
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
+
md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
7
|
+
md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
8
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
9
|
+
md: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
10
|
+
}>;
|