@acedatacloud/piece-short-url 0.0.0-stage → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ace Data Cloud
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,15 @@
1
- # Temporary Holding Version
1
+ # Short URL for Activepieces
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Create a shareable short link from a public HTTP or HTTPS URL with an Ace Data Cloud application key. The action returns `shortUrl` for a later step.
4
+
5
+ ## Install and connect
6
+
7
+ 1. In a workspace that allows custom Pieces, install `@acedatacloud/piece-short-url` from npm. The minimum supported Activepieces release is 0.94.0.
8
+ 2. Import [Short URL quickstart](examples/short-url-quickstart.json) or add the **Shorten URL** action manually. Create a connection using a General application key with Short URL access. [Ace Data Cloud applications](https://platform.acedata.cloud/console/applications?utm_source=activepieces&utm_medium=referral&utm_campaign=evergreen)
9
+ 3. Set **Destination URL** to a public page you intend to share, such as `https://example.org/article?view=full#start`, and run the action once. The request keeps the complete destination including query and fragment. [Short URL API](https://platform.acedata.cloud/documents/shorturl)
10
+
11
+ Each invocation sends one API request and may use Credits. Check the original request record before retrying an uncertain result. The sample disables automatic retries. Anyone with the returned short link can follow it. Keep credential-bearing URLs out of this workflow. [Ace Data Cloud privacy policy](https://platform.acedata.cloud/privacy)
12
+
13
+ ## Development
14
+
15
+ Run `npm ci`, `npm test` and `npm pack --dry-run`. The official CE smoke test installs the publisher archive and runs it against synthetic HTTPS data.
@@ -0,0 +1 @@
1
+ export declare const shortUrl: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shortUrl = void 0;
4
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
+ const auth_1 = require("./lib/auth");
6
+ const short_url_1 = require("./lib/actions/short-url");
7
+ exports.shortUrl = (0, pieces_framework_1.createPiece)({
8
+ displayName: 'Short URL',
9
+ description: 'Shorten a public URL for Activepieces through Ace Data Cloud.',
10
+ logoUrl: 'https://cdn.acedata.cloud/4f9642f3b6.svg',
11
+ authors: ['Ace Data Cloud'],
12
+ minimumSupportedRelease: '0.94.0',
13
+ auth: auth_1.aceAuth,
14
+ actions: [short_url_1.shortenUrl],
15
+ triggers: [],
16
+ });
@@ -0,0 +1,3 @@
1
+ export declare const shortenUrl: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ destinationUrl: import("@activepieces/pieces-framework").LongTextProperty<true>;
3
+ }>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shortenUrl = void 0;
4
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
+ const auth_1 = require("../auth");
6
+ const client_1 = require("../client");
7
+ function webUrl(value) {
8
+ const message = 'Enter an absolute HTTP or HTTPS URL without embedded credentials.';
9
+ if (typeof value !== 'string')
10
+ throw new Error(message);
11
+ const input = value.trim();
12
+ if (!input || /[\s\\]/u.test(input) || !URL.canParse(input))
13
+ throw new Error(message);
14
+ const parsed = new URL(input);
15
+ if (!['http:', 'https:'].includes(parsed.protocol) || !parsed.hostname || parsed.username || parsed.password) {
16
+ throw new Error(message);
17
+ }
18
+ return input;
19
+ }
20
+ exports.shortenUrl = (0, pieces_framework_1.createAction)({
21
+ name: 'shorten_url',
22
+ displayName: 'Shorten URL',
23
+ description: 'Create a shareable short link from one public webpage URL.',
24
+ auth: auth_1.aceAuth,
25
+ props: {
26
+ destinationUrl: pieces_framework_1.Property.LongText({ displayName: 'Destination URL', required: true,
27
+ description: 'One public HTTP or HTTPS URL intended for sharing.' }),
28
+ },
29
+ async run({ auth, propsValue }) {
30
+ const result = (0, client_1.record)(await (0, client_1.post)(auth.secret_text, '/shorturl', { content: webUrl(propsValue.destinationUrl) }));
31
+ if (result.success !== true)
32
+ throw new Error('Ace Data Cloud did not return a short link. Check the original request record.');
33
+ try {
34
+ return { shortUrl: webUrl((0, client_1.record)(result.data).url) };
35
+ }
36
+ catch {
37
+ throw new Error('Ace Data Cloud did not return a valid short link. Check the original request record.');
38
+ }
39
+ },
40
+ });
@@ -0,0 +1 @@
1
+ export declare const aceAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aceAuth = void 0;
4
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
+ exports.aceAuth = pieces_framework_1.PieceAuth.SecretText({
6
+ displayName: 'Ace Data Cloud API key',
7
+ description: 'Register or sign in at [Applications](https://platform.acedata.cloud/console/applications?utm_source=activepieces&utm_medium=referral&utm_campaign=evergreen). On the General Application card, click the copy button beside API KEY. For a dedicated key, use Manage Keys → Create. Check service permissions, current pricing and Allowed APIs. If the application balance is low, click Top Up on its card. Paste only the API key without Bearer; a platform management token is not an application API key.',
8
+ required: true,
9
+ });
@@ -0,0 +1,4 @@
1
+ type ApiPath = '/shorturl';
2
+ export declare function post(token: string, path: ApiPath, body: Record<string, unknown>): Promise<unknown>;
3
+ export declare function record(value: unknown): Record<string, unknown>;
4
+ export {};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.post = post;
4
+ exports.record = record;
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const secure_http_1 = require("./secure-http");
7
+ async function post(token, path, body) {
8
+ const response = await secure_http_1.httpClient.sendRequest({
9
+ method: pieces_common_1.HttpMethod.POST,
10
+ url: 'https://api.acedata.cloud' + path,
11
+ headers: {
12
+ Authorization: 'Bearer ' + token,
13
+ Accept: 'application/json',
14
+ 'Content-Type': 'application/json',
15
+ },
16
+ body,
17
+ });
18
+ return response.body;
19
+ }
20
+ function record(value) {
21
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
22
+ ? value
23
+ : {};
24
+ }
@@ -0,0 +1,13 @@
1
+ type Request = {
2
+ method: string;
3
+ url: string;
4
+ headers?: Record<string, string>;
5
+ body?: unknown;
6
+ };
7
+ export declare const httpClient: {
8
+ sendRequest<T>(request: Request): Promise<{
9
+ status: number;
10
+ body: T;
11
+ }>;
12
+ };
13
+ export {};
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.httpClient = void 0;
37
+ const https = __importStar(require("node:https"));
38
+ // Keep credentials on the documented API host and verify TLS even if the host
39
+ // process or an unrelated Piece has changed NODE_TLS_REJECT_UNAUTHORIZED.
40
+ exports.httpClient = {
41
+ async sendRequest(request) {
42
+ const url = new URL(request.url);
43
+ if (url.protocol !== 'https:' || url.hostname !== 'api.acedata.cloud' || url.port) {
44
+ throw new Error('Unsupported Ace Data Cloud API host.');
45
+ }
46
+ const payload = request.body === undefined ? undefined : JSON.stringify(request.body);
47
+ return new Promise((resolve, reject) => {
48
+ const pending = https.request(url, {
49
+ method: request.method,
50
+ rejectUnauthorized: true,
51
+ headers: {
52
+ ...request.headers,
53
+ ...(payload === undefined ? {} : { 'Content-Length': String(Buffer.byteLength(payload)) }),
54
+ },
55
+ }, (response) => {
56
+ let body = '';
57
+ response.setEncoding('utf8');
58
+ response.on('data', (chunk) => { body += chunk; });
59
+ response.on('error', () => reject(new Error('Ace Data Cloud response interrupted. Inspect request history before resubmitting.')));
60
+ response.on('end', () => {
61
+ const status = response.statusCode ?? 0;
62
+ if (status < 200 || status >= 300) {
63
+ const error = new Error(`Ace Data Cloud HTTP ${status}. Inspect request history before resubmitting.`);
64
+ Object.assign(error, { response: { status } });
65
+ reject(error);
66
+ return;
67
+ }
68
+ try {
69
+ resolve({ status, body: JSON.parse(body) });
70
+ }
71
+ catch {
72
+ reject(new Error('Ace Data Cloud returned invalid JSON. Inspect request history before resubmitting.'));
73
+ }
74
+ });
75
+ });
76
+ pending.setTimeout(120_000, () => pending.destroy(new Error('Request timeout')));
77
+ pending.on('error', () => reject(new Error('Ace Data Cloud network or TLS error. Inspect request history before resubmitting.')));
78
+ pending.end(payload);
79
+ });
80
+ },
81
+ };
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "Short URL quickstart",
3
+ "type": "SHARED",
4
+ "summary": "",
5
+ "description": "",
6
+ "tags": [],
7
+ "blogUrl": "",
8
+ "metadata": {
9
+ "externalId": "short-url-quickstart"
10
+ },
11
+ "author": "Ace Data Cloud",
12
+ "categories": [],
13
+ "pieces": [
14
+ "@activepieces/piece-manual-trigger",
15
+ "@acedatacloud/piece-short-url"
16
+ ],
17
+ "flows": [
18
+ {
19
+ "displayName": "Short URL quickstart",
20
+ "trigger": {
21
+ "name": "trigger",
22
+ "valid": true,
23
+ "displayName": "Manual Trigger",
24
+ "nextAction": {
25
+ "name": "step_1",
26
+ "skip": false,
27
+ "type": "PIECE",
28
+ "valid": false,
29
+ "settings": {
30
+ "input": {
31
+ "auth": "",
32
+ "destinationUrl": "https://example.org/article?view=full#start"
33
+ },
34
+ "pieceName": "@acedatacloud/piece-short-url",
35
+ "actionName": "shorten_url",
36
+ "sampleData": {},
37
+ "pieceVersion": "0.1.0",
38
+ "propertySettings": {
39
+ "destinationUrl": {
40
+ "type": "MANUAL"
41
+ }
42
+ },
43
+ "errorHandlingOptions": {
44
+ "retryOnFailure": {
45
+ "value": false
46
+ },
47
+ "continueOnFailure": {
48
+ "value": false
49
+ }
50
+ }
51
+ },
52
+ "displayName": "Short URL",
53
+ "lastUpdatedDate": "2026-10-11T15:40:03.227Z"
54
+ },
55
+ "lastUpdatedDate": "2026-10-11T15:29:17.786Z",
56
+ "type": "PIECE_TRIGGER",
57
+ "settings": {
58
+ "propertySettings": {
59
+ "markdown": {
60
+ "type": "MANUAL"
61
+ }
62
+ },
63
+ "pieceName": "@activepieces/piece-manual-trigger",
64
+ "pieceVersion": "0.0.8",
65
+ "triggerName": "manual_trigger",
66
+ "input": {}
67
+ }
68
+ },
69
+ "valid": true,
70
+ "schemaVersion": "27",
71
+ "notes": []
72
+ }
73
+ ],
74
+ "status": "PUBLISHED"
75
+ }
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@acedatacloud/piece-short-url",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Shorten a public URL for Activepieces through Ace Data Cloud.",
5
+ "type": "commonjs",
6
+ "main": "./dist/src/index.js",
7
+ "types": "./dist/src/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "examples"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsc -p tsconfig.json",
14
+ "test": "npm run build && node --test test/*.test.cjs",
15
+ "pack:check": "npm pack --dry-run"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/AceDataCloud/ShortURLActivepieces.git"
20
+ },
21
+ "homepage": "https://github.com/AceDataCloud/ShortURLActivepieces#readme",
22
+ "bugs": {
23
+ "url": "https://github.com/AceDataCloud/ShortURLActivepieces/issues"
24
+ },
25
+ "license": "MIT",
26
+ "dependencies": {
27
+ "@activepieces/pieces-common": "0.12.5",
28
+ "@activepieces/pieces-framework": "0.32.0"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "24.11.0",
32
+ "typescript": "5.9.3"
33
+ },
34
+ "keywords": [
35
+ "activepieces",
36
+ "piece",
37
+ "acedatacloud",
38
+ "short-url"
39
+ ]
40
+ }