@activepieces/piece-editionguard 0.1.0

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 ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@activepieces/piece-editionguard",
3
+ "version": "0.1.0",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@activepieces/pieces-common": "0.12.3",
9
+ "@activepieces/pieces-framework": "0.29.0",
10
+ "@activepieces/shared": "0.82.0",
11
+ "tslib": "2.3.0"
12
+ },
13
+ "scripts": {
14
+ "build": "tsc -p tsconfig.lib.json && cp package.json dist/",
15
+ "lint": "eslint 'src/**/*.ts'"
16
+ }
17
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const editionguard: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,mHAoBvB,CAAC"}
package/src/index.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.editionguard = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const shared_1 = require("@activepieces/shared");
8
+ const auth_1 = require("./lib/common/auth");
9
+ const send_ebook_download_links_1 = require("./lib/actions/send-ebook-download-links");
10
+ exports.editionguard = (0, pieces_framework_1.createPiece)({
11
+ displayName: 'EditionGuard',
12
+ description: 'Secure eBook DRM and fulfillment — protect and deliver EPUB, MOBI, and PDF files with Adobe DRM, Readium LCP, or Social DRM.',
13
+ minimumSupportedRelease: '0.36.1',
14
+ logoUrl: 'https://cdn.activepieces.com/pieces/editionguard.png',
15
+ categories: [shared_1.PieceCategory.CONTENT_AND_FILES],
16
+ auth: auth_1.editionguardAuth,
17
+ authors: ['sanket-a11y'],
18
+ actions: [
19
+ send_ebook_download_links_1.sendEbookDownloadLinks,
20
+ (0, pieces_common_1.createCustomApiCallAction)({
21
+ baseUrl: () => 'https://app.editionguard.com/api/v2',
22
+ auth: auth_1.editionguardAuth,
23
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
24
+ return ({
25
+ Authorization: `token ${auth.secret_text}`,
26
+ });
27
+ }),
28
+ }),
29
+ ],
30
+ triggers: [],
31
+ });
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,+DAAwE;AACxE,iDAAqD;AACrD,4CAAqD;AACrD,uFAAiF;AAEpE,QAAA,YAAY,GAAG,IAAA,8BAAW,EAAC;IACtC,WAAW,EAAE,cAAc;IAC3B,WAAW,EACT,8HAA8H;IAChI,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,sDAAsD;IAC/D,UAAU,EAAE,CAAC,sBAAa,CAAC,iBAAiB,CAAC;IAC7C,IAAI,EAAE,uBAAgB;IACtB,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,OAAO,EAAE;QACP,kDAAsB;QACtB,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,qCAAqC;YACpD,IAAI,EAAE,uBAAgB;YACtB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,SAAS,IAAI,CAAC,WAAW,EAAE;iBAC3C,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const sendEbookDownloadLinks: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ resource_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
3
+ customer_email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ order_number: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ quantity: import("@activepieces/pieces-framework").NumberProperty<false>;
6
+ watermark_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ watermark_email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
+ watermark_phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
9
+ }>;
10
+ //# sourceMappingURL=send-ebook-download-links.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-ebook-download-links.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/send-ebook-download-links.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB;;;;;;;;EAqFjC,CAAC"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendEbookDownloadLinks = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const api_1 = require("../common/api");
8
+ exports.sendEbookDownloadLinks = (0, pieces_framework_1.createAction)({
9
+ auth: auth_1.editionguardAuth,
10
+ name: 'send_ebook_download_links',
11
+ displayName: 'Send eBook Download Links',
12
+ description: 'Creates a transaction for an eBook and sends the download link(s) to your customer. Returns the download link you can deliver by email or any other channel.',
13
+ props: {
14
+ resource_id: pieces_framework_1.Property.Dropdown({
15
+ displayName: 'eBook',
16
+ description: 'Select the eBook to send to your customer.',
17
+ auth: auth_1.editionguardAuth,
18
+ refreshers: [],
19
+ required: true,
20
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
21
+ if (!auth) {
22
+ return { disabled: true, options: [], placeholder: 'Please connect your account first.' };
23
+ }
24
+ try {
25
+ const books = yield api_1.editionguardApi.listBooks({ token: auth.secret_text });
26
+ return {
27
+ disabled: false,
28
+ options: books.map((book) => {
29
+ var _a;
30
+ return ({
31
+ label: `${book.title} (${(_a = book.drm_type) !== null && _a !== void 0 ? _a : 'Unknown DRM'})`,
32
+ value: book.resource_id,
33
+ });
34
+ }),
35
+ };
36
+ }
37
+ catch (_b) {
38
+ return { disabled: true, options: [], placeholder: 'Failed to load eBooks. Check your connection.' };
39
+ }
40
+ }),
41
+ }),
42
+ customer_email: pieces_framework_1.Property.ShortText({
43
+ displayName: 'Customer Email',
44
+ description: "The customer's email address where the download instructions will be sent.",
45
+ required: true,
46
+ }),
47
+ order_number: pieces_framework_1.Property.ShortText({
48
+ displayName: 'Order Number',
49
+ description: 'Your order or transaction reference number (e.g. from your eCommerce platform). Used for tracking and reporting.',
50
+ required: true,
51
+ }),
52
+ quantity: pieces_framework_1.Property.Number({
53
+ displayName: 'Quantity',
54
+ description: 'Number of download links to generate. Use 1 for a single copy. Increase for multi-seat or multi-device licenses.',
55
+ required: false,
56
+ defaultValue: 1,
57
+ }),
58
+ watermark_name: pieces_framework_1.Property.ShortText({
59
+ displayName: "Customer's Full Name (Social DRM)",
60
+ description: "Only applies when the eBook uses **Social DRM (EditionMark)**. The customer's name will be embedded as a visible watermark in the eBook. Leave empty for Adobe DRM or Readium LCP books.",
61
+ required: false,
62
+ }),
63
+ watermark_email: pieces_framework_1.Property.ShortText({
64
+ displayName: "Customer's Email for Watermark (Social DRM)",
65
+ description: "Only applies when the eBook uses **Social DRM (EditionMark)**. This email will be embedded as a watermark. Leave empty for Adobe DRM or Readium LCP books.",
66
+ required: false,
67
+ }),
68
+ watermark_phone: pieces_framework_1.Property.ShortText({
69
+ displayName: "Customer's Phone for Watermark (Social DRM)",
70
+ description: "Only applies when the eBook uses **Social DRM (EditionMark)**. This phone number will be embedded as a watermark. Leave empty for Adobe DRM or Readium LCP books.",
71
+ required: false,
72
+ }),
73
+ },
74
+ run(context) {
75
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
76
+ const { resource_id, customer_email, order_number, quantity, watermark_name, watermark_email, watermark_phone } = context.propsValue;
77
+ const transaction = yield api_1.editionguardApi.createTransaction({
78
+ token: context.auth.secret_text,
79
+ resourceId: resource_id,
80
+ customerEmail: customer_email,
81
+ orderNumber: order_number,
82
+ quantity: quantity !== null && quantity !== void 0 ? quantity : 1,
83
+ watermarkName: watermark_name !== null && watermark_name !== void 0 ? watermark_name : undefined,
84
+ watermarkEmail: watermark_email !== null && watermark_email !== void 0 ? watermark_email : undefined,
85
+ watermarkPhone: watermark_phone !== null && watermark_phone !== void 0 ? watermark_phone : undefined,
86
+ });
87
+ return transaction;
88
+ });
89
+ },
90
+ });
91
+ //# sourceMappingURL=send-ebook-download-links.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-ebook-download-links.js","sourceRoot":"","sources":["../../../../src/lib/actions/send-ebook-download-links.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAkD;AAClD,uCAAgD;AAEnC,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,uBAAgB;IACtB,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EACT,8JAA8J;IAChK,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,4CAA4C;YACzD,IAAI,EAAE,uBAAgB;YACtB,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;gBACtB,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;gBAC5F,CAAC;gBACD,IAAI,CAAC;oBAC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;YAC9J,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAClC,WAAW,EAAE,6CAA6C;YAC1D,WAAW,EACT,mKAAmK;YACrK,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,GAC7G,OAAO,CAAC,UAAU,CAAC;YAErB,MAAM,WAAW,GAAG,MAAM,qBAAe,CAAC,iBAAiB,CAAC;gBAC1D,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC/B,UAAU,EAAE,WAAW;gBACvB,aAAa,EAAE,cAAc;gBAC7B,WAAW,EAAE,YAAY;gBACzB,QAAQ,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,CAAC;gBACvB,aAAa,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,SAAS;gBAC1C,cAAc,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,SAAS;gBAC5C,cAAc,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,SAAS;aAC7C,CAAC,CAAC;YAEH,OAAO,WAAW,CAAA;QACpB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ type Book = {
2
+ resource_id: string;
3
+ title: string;
4
+ drm_type: string;
5
+ };
6
+ type Transaction = {
7
+ id: string;
8
+ resource_id: string;
9
+ download_link: string | null;
10
+ customer_email: string | null;
11
+ order_number: string | null;
12
+ created_at: string;
13
+ status: string;
14
+ };
15
+ declare function listBooks({ token }: {
16
+ token: string;
17
+ }): Promise<Book[]>;
18
+ declare function createTransaction({ token, resourceId, customerEmail, orderNumber, quantity, watermarkName, watermarkEmail, watermarkPhone, }: {
19
+ token: string;
20
+ resourceId: string;
21
+ customerEmail: string;
22
+ orderNumber: string;
23
+ quantity: number;
24
+ watermarkName?: string;
25
+ watermarkEmail?: string;
26
+ watermarkPhone?: string;
27
+ }): Promise<Transaction>;
28
+ export declare const editionguardApi: {
29
+ listBooks: typeof listBooks;
30
+ createTransaction: typeof createTransaction;
31
+ };
32
+ export {};
33
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/api.ts"],"names":[],"mappings":"AAIA,KAAK,IAAI,GAAG;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAMF,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,iBAAe,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAQtE;AAED,iBAAe,iBAAiB,CAAC,EAC/B,KAAK,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,QAAQ,EACR,aAAa,EACb,cAAc,EACd,cAAc,GACf,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,OAAO,CAAC,WAAW,CAAC,CAqBvB;AAED,eAAO,MAAM,eAAe;;;CAAmC,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.editionguardApi = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const BASE_URL = 'https://app.editionguard.com/api/v2';
7
+ function listBooks(_a) {
8
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ token }) {
9
+ const response = yield pieces_common_1.httpClient.sendRequest({
10
+ method: pieces_common_1.HttpMethod.GET,
11
+ url: `${BASE_URL}/book`,
12
+ headers: { Authorization: `token ${token}` },
13
+ queryParams: { page_size: '100000' },
14
+ });
15
+ return response.body.results;
16
+ });
17
+ }
18
+ function createTransaction(_a) {
19
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ token, resourceId, customerEmail, orderNumber, quantity, watermarkName, watermarkEmail, watermarkPhone, }) {
20
+ const body = {
21
+ resource_id: resourceId,
22
+ customer_email: customerEmail,
23
+ order_number: orderNumber,
24
+ quantity,
25
+ };
26
+ if (watermarkName)
27
+ body['watermark_name'] = watermarkName;
28
+ if (watermarkEmail)
29
+ body['watermark_email'] = watermarkEmail;
30
+ if (watermarkPhone)
31
+ body['watermark_phone'] = watermarkPhone;
32
+ const response = yield pieces_common_1.httpClient.sendRequest({
33
+ method: pieces_common_1.HttpMethod.POST,
34
+ url: `${BASE_URL}/transaction`,
35
+ headers: {
36
+ Authorization: `token ${token}`,
37
+ 'Content-Type': 'application/json',
38
+ },
39
+ body,
40
+ });
41
+ return response.body;
42
+ });
43
+ }
44
+ exports.editionguardApi = { listBooks, createTransaction };
45
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/lib/common/api.ts"],"names":[],"mappings":";;;;AAAA,+DAAqE;AAErE,MAAM,QAAQ,GAAG,qCAAqC,CAAC;A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th: import("@activepieces/pieces-framework").SecretTextProperty<true>;
2
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,mEAsB3B,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.editionguardAuth = 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 BASE_URL = 'https://app.editionguard.com/api/v2';
8
+ exports.editionguardAuth = pieces_framework_1.PieceAuth.SecretText({
9
+ displayName: 'API Token',
10
+ description: `Your EditionGuard API token.
11
+
12
+ **How to get your API token:**
13
+ 1. Log in to your [EditionGuard dashboard](https://app.editionguard.com)
14
+ 2. Go to **Settings** (top-bar menu)
15
+ 3. Find the **API** section and copy your **Rest API Token**`,
16
+ required: true,
17
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
18
+ try {
19
+ yield pieces_common_1.httpClient.sendRequest({
20
+ method: pieces_common_1.HttpMethod.GET,
21
+ url: `${BASE_URL}/book`,
22
+ headers: { Authorization: `token ${auth}` },
23
+ queryParams: { page_size: '1' },
24
+ });
25
+ return { valid: true };
26
+ }
27
+ catch (_b) {
28
+ return { valid: false, error: 'Invalid API token. Please check your credentials.' };
29
+ }
30
+ }),
31
+ });
32
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAqE;AAErE,MAAM,QAAQ,GAAG,qCAAqC,CAAC;AAE1C,QAAA,gBAAgB,GAAG,4BAAS,CAAC,UAAU,CAAC;IACnD,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE;;;;;6DAK8C;IAC3D,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,QAAQ,OAAO;gBACvB,OAAO,EAAE,EAAE,aAAa,EAAE,SAAS,IAAI,EAAE,EAAE;gBAC3C,WAAW,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE;aAChC,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mDAAmD,EAAE,CAAC;QACtF,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}