@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.
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.linkCreated = 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.linkCreated = (0, pieces_framework_1.createTrigger)({
9
+ auth: auth_1.dubAuth,
10
+ name: 'link_created',
11
+ displayName: 'Link Created',
12
+ description: 'Triggers in real time whenever a new short link is created in your Dub workspace.',
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.created**.
26
+ 6. Click **Create webhook**.`,
27
+ variant: shared_1.MarkdownVariant.INFO,
28
+ }),
29
+ },
30
+ sampleData: {
31
+ id: 'evt_def456',
32
+ event: 'link.created',
33
+ createdAt: '2024-01-15T10:30:00.000Z',
34
+ data: {
35
+ link: {
36
+ id: 'clv3g2xyz',
37
+ domain: 'dub.sh',
38
+ key: 'new-link',
39
+ url: 'https://example.com/new-page',
40
+ shortLink: 'https://dub.sh/new-link',
41
+ clicks: 0,
42
+ createdAt: '2024-01-15T10:30:00.000Z',
43
+ },
44
+ },
45
+ },
46
+ onEnable() {
47
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
+ // Webhook is registered manually in the Dub platform
49
+ });
50
+ },
51
+ onDisable() {
52
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
+ // Webhook is removed manually in the Dub platform
54
+ });
55
+ },
56
+ run(context) {
57
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
58
+ return [context.payload.body];
59
+ });
60
+ },
61
+ });
62
+ //# sourceMappingURL=link-created.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-created.js","sourceRoot":"","sources":["../../../../src/lib/triggers/link-created.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,iDAAuD;AACvD,kCAAkC;AAErB,QAAA,WAAW,GAAG,IAAA,gCAAa,EAAC;IACvC,IAAI,EAAE,cAAO;IACb,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,mFAAmF;IAChG,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE;QACL,EAAE,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACpB,KAAK,EAAE;;;;;;;;;;6BAUgB;YACvB,OAAO,EAAE,wBAAe,CAAC,IAAI;SAC9B,CAAC;KACH;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,cAAc;QACrB,SAAS,EAAE,0BAA0B;QACrC,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,EAAE,EAAE,WAAW;gBACf,MAAM,EAAE,QAAQ;gBAChB,GAAG,EAAE,UAAU;gBACf,GAAG,EAAE,8BAA8B;gBACnC,SAAS,EAAE,yBAAyB;gBACpC,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,0BAA0B;aACtC;SACF;KACF;IACK,QAAQ;;YACZ,qDAAqD;QACvD,CAAC;KAAA;IACK,SAAS;;YACb,kDAAkD;QACpD,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}