n8n-nodes-klikresi 1.0.3

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) 2025 Klik Resi
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 ADDED
@@ -0,0 +1,105 @@
1
+ # n8n-nodes-klikresi
2
+
3
+ This is an n8n community node that lets you use the [Klik Resi](https://klikresi.com)
4
+ shipping API in your n8n workflows.
5
+
6
+ Track shipments, compare shipping rates, and look up Indonesian locations
7
+ (provinces, cities, districts) across 13 couriers — JNE, J&T, Shopee Express,
8
+ SiCepat, TIKI, and more.
9
+
10
+ API reference: [docs.klikresi.com](https://docs.klikresi.com)
11
+
12
+ ## Pricing
13
+
14
+ The Klik Resi API is billed per request:
15
+
16
+ | Operation | Price |
17
+ |---|---|
18
+ | Tracking (Get) | Rp 15 / request |
19
+ | Rates (all operations) | Rp 5 / request |
20
+ | Location (Search, Provinces, Cities, Districts) | Rp 1 / request |
21
+
22
+ `Return All` on location operations follows pagination cursors automatically —
23
+ each page counts as one billed request.
24
+
25
+ ## Installation
26
+
27
+ ### Community Nodes (recommended)
28
+
29
+ 1. In n8n, go to **Settings** > **Community Nodes**.
30
+ 2. Select **Install**.
31
+ 3. Enter `n8n-nodes-klikresi` as the npm package name.
32
+ 4. Agree to the risks and select **Install**.
33
+
34
+ ### Manual installation
35
+
36
+ To get the latest version, run the following on the machine where n8n runs:
37
+
38
+ ```sh
39
+ cd ~/.n8n/nodes
40
+ npm install n8n-nodes-klikresi
41
+ ```
42
+
43
+ Restart n8n.
44
+
45
+ ## Credentials
46
+
47
+ 1. Create a new **Klik Resi API** credential (type: `Klik Resi API`).
48
+ 2. Paste your API key from the Klik Resi dashboard.
49
+
50
+ The "Test" button only checks the key format — there is no free validation
51
+ endpoint, and every API call is billed.
52
+
53
+ ## Operations
54
+
55
+ ### Tracking
56
+
57
+ - **Get** — track a shipment by AWB number and courier code.
58
+ - `Tracking Number`: the air waybill (resi) number.
59
+ - `Courier`: one of the 13 supported couriers.
60
+ - `Sender Phone Number`: optional. Required by ID Express (`ide`); passed
61
+ through as a query parameter for any courier when provided.
62
+
63
+ ### Rates
64
+
65
+ - **Calculate By ID** — origin/destination district IDs
66
+ (`province.city.district`, e.g. `33.08.20`) plus weight and an optional
67
+ couriers filter.
68
+ - **Calculate By Name** — origin/destination location names (e.g.
69
+ `Secang, Kabupaten Magelang, Jawa Tengah`).
70
+ - **Calculate By Postal Code** — origin/destination postal codes.
71
+
72
+ ### Location
73
+
74
+ - **Search** — find locations by keyword.
75
+ - **Provinces** — list all provinces.
76
+ - **Cities** — list cities within a province ID.
77
+ - **Districts** — list districts within a city ID.
78
+
79
+ All location operations support `Limit` (default 50) and `Return All`
80
+ (auto-pagination; each page is one billed request).
81
+
82
+ ## Development
83
+
84
+ ```sh
85
+ npm install
86
+ npm run dev # develop against a local n8n instance
87
+ npm run lint # n8n community node lint (strict)
88
+ npm run typecheck
89
+ npm test # unit tests (offline, mocked fetch)
90
+ npm run build # build into dist/
91
+ ```
92
+
93
+ ## Release
94
+
95
+ ```sh
96
+ # bump version in package.json, commit, then:
97
+ git tag v1.0.0 && git push origin main --tags
98
+ ```
99
+
100
+ The `publish.yml` workflow publishes to npm with a provenance statement.
101
+ See the workflow file for the one-time Trusted Publisher setup.
102
+
103
+ ## License
104
+
105
+ MIT
@@ -0,0 +1,101 @@
1
+ export declare const KLIKRESI_BASE_URL = "https://klikresi.com";
2
+ export declare const COURIERS: {
3
+ readonly SPX: "spx";
4
+ readonly JNE: "jne";
5
+ readonly JNT: "jnt";
6
+ readonly SICEPAT: "sicepat";
7
+ readonly NINJA: "ninja";
8
+ readonly POS: "pos";
9
+ readonly SAP: "sap";
10
+ readonly LEX: "lex";
11
+ readonly LION: "lion";
12
+ readonly ID_EXPRESS: "ide";
13
+ readonly ANTERAJA: "anteraja";
14
+ readonly WAHANA: "wahana";
15
+ readonly TIKI: "tiki";
16
+ };
17
+ export type CourierCode = (typeof COURIERS)[keyof typeof COURIERS];
18
+ export declare const COURIER_LABELS: Record<CourierCode, string>;
19
+ export type TrackingStatus = 'InfoReceived' | 'InTransit' | 'OutForDelivery' | 'FailedAttempt' | 'Delivered' | 'ReturnToSender' | 'Exception' | 'Expired' | 'Pending';
20
+ export interface Address {
21
+ contact_name: string;
22
+ address: string;
23
+ }
24
+ export interface HistoryEntry {
25
+ status: TrackingStatus;
26
+ message: string;
27
+ date: string;
28
+ }
29
+ export interface TrackingInfo {
30
+ status: TrackingStatus;
31
+ origin: Address;
32
+ destination: Address;
33
+ histories: HistoryEntry[];
34
+ }
35
+ export interface Pricing {
36
+ type: string;
37
+ courier_code: string;
38
+ courier_name: string;
39
+ service: string;
40
+ price: number;
41
+ duration: string;
42
+ }
43
+ export interface RateResult {
44
+ origin: {
45
+ id: string;
46
+ name: string;
47
+ };
48
+ destination: {
49
+ id: string;
50
+ name: string;
51
+ };
52
+ pricing: Pricing[];
53
+ }
54
+ export interface LocationInfo {
55
+ id: string;
56
+ name: string;
57
+ district: string;
58
+ city: string;
59
+ province: string;
60
+ }
61
+ export interface NamedLocation {
62
+ id: string;
63
+ name: string;
64
+ }
65
+ export interface LocationPage {
66
+ data: LocationInfo[];
67
+ next_cursor: string;
68
+ }
69
+ export interface NamedLocationPage {
70
+ data: NamedLocation[];
71
+ next_cursor: string;
72
+ }
73
+ export declare class ApiError extends Error {
74
+ readonly status: number;
75
+ constructor(status: number, message: string);
76
+ }
77
+ /**
78
+ * Minimal, dependency-free client for the Klik Resi API.
79
+ */
80
+ export declare class KlikResiApi {
81
+ private readonly apiKey;
82
+ constructor(apiKey: string);
83
+ private request;
84
+ trackingGet(trackingNumber: string, courierCode: string, options?: {
85
+ number?: string;
86
+ }): Promise<TrackingInfo>;
87
+ ratesById(originId: string, destinationId: string, weight: number, couriers?: CourierCode[]): Promise<RateResult>;
88
+ ratesByName(origin: string, destination: string, weight: number): Promise<RateResult>;
89
+ ratesByPostalCode(originPostalCode: number, destinationPostalCode: number, weight: number): Promise<RateResult>;
90
+ private rates;
91
+ locationSearch(keyword: string, limit?: number, cursor?: string): Promise<LocationPage>;
92
+ provinces(limit?: number, cursor?: string): Promise<NamedLocationPage>;
93
+ cities(provinceId: string, limit?: number, cursor?: string): Promise<NamedLocationPage>;
94
+ districts(cityId: string, limit?: number, cursor?: string): Promise<NamedLocationPage>;
95
+ allLocations(keyword: string, limit?: number): Promise<LocationInfo[]>;
96
+ allProvinces(limit?: number): Promise<NamedLocation[]>;
97
+ allCities(provinceId: string, limit?: number): Promise<NamedLocation[]>;
98
+ allDistricts(cityId: string, limit?: number): Promise<NamedLocation[]>;
99
+ private allNamed;
100
+ private pageQuery;
101
+ }
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KlikResiApi = exports.ApiError = exports.COURIER_LABELS = exports.COURIERS = exports.KLIKRESI_BASE_URL = void 0;
4
+ exports.KLIKRESI_BASE_URL = 'https://klikresi.com';
5
+ const DEFAULT_TIMEOUT_MS = 30_000;
6
+ exports.COURIERS = {
7
+ SPX: 'spx',
8
+ JNE: 'jne',
9
+ JNT: 'jnt',
10
+ SICEPAT: 'sicepat',
11
+ NINJA: 'ninja',
12
+ POS: 'pos',
13
+ SAP: 'sap',
14
+ LEX: 'lex',
15
+ LION: 'lion',
16
+ ID_EXPRESS: 'ide',
17
+ ANTERAJA: 'anteraja',
18
+ WAHANA: 'wahana',
19
+ TIKI: 'tiki',
20
+ };
21
+ exports.COURIER_LABELS = {
22
+ spx: 'Shopee Express',
23
+ jne: 'JNE Express',
24
+ jnt: 'J&T Express',
25
+ sicepat: 'SiCepat Express',
26
+ ninja: 'Ninja Express',
27
+ pos: 'POS Indonesia',
28
+ sap: 'SAP Express',
29
+ lex: 'Lazada Logistics',
30
+ lion: 'Lion Parcel',
31
+ ide: 'ID Express',
32
+ anteraja: 'Anteraja',
33
+ wahana: 'Wahana Prestasi Logistik',
34
+ tiki: 'TIKI',
35
+ };
36
+ class ApiError extends Error {
37
+ status;
38
+ constructor(status, message) {
39
+ super(message || `Klik Resi request failed with HTTP status ${status}`);
40
+ this.name = 'ApiError';
41
+ this.status = status;
42
+ }
43
+ }
44
+ exports.ApiError = ApiError;
45
+ /**
46
+ * Minimal, dependency-free client for the Klik Resi API.
47
+ */
48
+ class KlikResiApi {
49
+ apiKey;
50
+ constructor(apiKey) {
51
+ this.apiKey = apiKey;
52
+ }
53
+ async request(method, path, query, body) {
54
+ const url = new URL(exports.KLIKRESI_BASE_URL + path);
55
+ if (query) {
56
+ for (const [key, value] of Object.entries(query)) {
57
+ if (value !== '') {
58
+ url.searchParams.set(key, value);
59
+ }
60
+ }
61
+ }
62
+ const controller = new AbortController();
63
+ const timeout = AbortSignal.timeout(DEFAULT_TIMEOUT_MS);
64
+ const abort = () => controller.abort();
65
+ timeout.addEventListener('abort', abort);
66
+ try {
67
+ const response = await fetch(url, {
68
+ method,
69
+ headers: {
70
+ 'x-api-key': this.apiKey,
71
+ accept: 'application/json',
72
+ ...(body !== undefined ? { 'content-type': 'application/json' } : {}),
73
+ },
74
+ ...(body !== undefined ? { body: JSON.stringify(body) } : {}),
75
+ signal: controller.signal,
76
+ });
77
+ const text = await response.text();
78
+ const data = text ? JSON.parse(text) : null;
79
+ if (!response.ok) {
80
+ const message = data !== null &&
81
+ typeof data === 'object' &&
82
+ 'message' in data &&
83
+ typeof data.message === 'string'
84
+ ? data.message
85
+ : '';
86
+ throw new ApiError(response.status, message);
87
+ }
88
+ return data;
89
+ }
90
+ finally {
91
+ timeout.removeEventListener('abort', abort);
92
+ }
93
+ }
94
+ async trackingGet(trackingNumber, courierCode, options = {}) {
95
+ const query = {};
96
+ if (options.number) {
97
+ query.number = options.number;
98
+ }
99
+ const path = `/api/trackings/${encodeURIComponent(trackingNumber)}/couriers/${encodeURIComponent(courierCode)}`;
100
+ const envelope = await this.request('GET', path, query);
101
+ return envelope.data;
102
+ }
103
+ async ratesById(originId, destinationId, weight, couriers) {
104
+ const body = {
105
+ origin_id: originId,
106
+ destination_id: destinationId,
107
+ weight,
108
+ };
109
+ if (couriers && couriers.length > 0) {
110
+ body.couriers = couriers;
111
+ }
112
+ return this.rates(body);
113
+ }
114
+ async ratesByName(origin, destination, weight) {
115
+ return this.rates({ origin, destination, weight });
116
+ }
117
+ async ratesByPostalCode(originPostalCode, destinationPostalCode, weight) {
118
+ return this.rates({
119
+ origin_postal_code: originPostalCode,
120
+ destination_postal_code: destinationPostalCode,
121
+ weight,
122
+ });
123
+ }
124
+ async rates(body) {
125
+ const envelope = await this.request('POST', '/api/rates', undefined, body);
126
+ return envelope.data;
127
+ }
128
+ async locationSearch(keyword, limit, cursor) {
129
+ return this.request('GET', '/api/locations', this.pageQuery({ keyword }, limit, cursor));
130
+ }
131
+ async provinces(limit, cursor) {
132
+ return this.request('GET', '/api/provinces', this.pageQuery({}, limit, cursor));
133
+ }
134
+ async cities(provinceId, limit, cursor) {
135
+ return this.request('GET', '/api/cities', this.pageQuery({ province_id: provinceId }, limit, cursor));
136
+ }
137
+ async districts(cityId, limit, cursor) {
138
+ return this.request('GET', '/api/districts', this.pageQuery({ city_id: cityId }, limit, cursor));
139
+ }
140
+ async allLocations(keyword, limit) {
141
+ const all = [];
142
+ let cursor = '';
143
+ for (;;) {
144
+ const page = await this.locationSearch(keyword, limit, cursor);
145
+ all.push(...page.data);
146
+ if (!page.next_cursor || page.next_cursor === cursor) {
147
+ return all;
148
+ }
149
+ cursor = page.next_cursor;
150
+ }
151
+ }
152
+ async allProvinces(limit) {
153
+ return this.allNamed((l, c) => this.provinces(l, c), limit);
154
+ }
155
+ async allCities(provinceId, limit) {
156
+ return this.allNamed((l, c) => this.cities(provinceId, l, c), limit);
157
+ }
158
+ async allDistricts(cityId, limit) {
159
+ return this.allNamed((l, c) => this.districts(cityId, l, c), limit);
160
+ }
161
+ async allNamed(fetchPage, limit) {
162
+ const all = [];
163
+ let cursor = '';
164
+ for (;;) {
165
+ const page = await fetchPage(limit, cursor);
166
+ all.push(...page.data);
167
+ if (!page.next_cursor || page.next_cursor === cursor) {
168
+ return all;
169
+ }
170
+ cursor = page.next_cursor;
171
+ }
172
+ }
173
+ pageQuery(extra, limit, cursor) {
174
+ const query = { ...extra };
175
+ if (limit !== undefined && limit > 0) {
176
+ query.limit = String(limit);
177
+ }
178
+ if (cursor) {
179
+ query.cursor = cursor;
180
+ }
181
+ return query;
182
+ }
183
+ }
184
+ exports.KlikResiApi = KlikResiApi;
185
+ //# sourceMappingURL=klikresi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"klikresi.js","sourceRoot":"","sources":["../../api/klikresi.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,sBAAsB,CAAC;AACxD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAErB,QAAA,QAAQ,GAAG;IACvB,GAAG,EAAE,KAAK;IACV,GAA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AAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACrE,CAAC;IAEO,KAAK,CAAC,QAAQ,CACrB,SAA0E,EAC1E,KAAc;QAEd,MAAM,GAAG,GAAoB,EAAE,CAAC;QAChC,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,SAAS,CAAC;YACT,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAC5C,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,KAAK,MAAM,EAAE,CAAC;gBACtD,OAAO,GAAG,CAAC;YACZ,CAAC;YACD,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC;QAC3B,CAAC;IACF,CAAC;IAEO,SAAS,CAChB,KAA6B,EAC7B,KAAc,EACd,MAAe;QAEf,MAAM,KAAK,GAA2B,EAAE,GAAG,KAAK,EAAE,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACtC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACZ,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AAzLD,kCAyLC"}
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, ICredentialType, INodeProperties, Icon } from 'n8n-workflow';
2
+ export declare class KlikResiApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: Icon;
6
+ documentationUrl: string;
7
+ testedBy: string;
8
+ properties: INodeProperties[];
9
+ authenticate: IAuthenticateGeneric;
10
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KlikResiApi = void 0;
4
+ class KlikResiApi {
5
+ name = 'klikResiApi';
6
+ displayName = 'Klik Resi API';
7
+ icon = { light: 'file:../icons/klikresi.svg', dark: 'file:../icons/klikresi.dark.svg' };
8
+ documentationUrl = 'https://docs.klikresi.com';
9
+ // The credential is validated by the node via methods.credentialTest.
10
+ // There is no free validation endpoint, so no API call is made on test.
11
+ testedBy = 'klikResi';
12
+ properties = [
13
+ {
14
+ displayName: 'API Key',
15
+ name: 'apiKey',
16
+ type: 'string',
17
+ typeOptions: { password: true },
18
+ default: '',
19
+ required: true,
20
+ description: 'Your Klik Resi API key. Every API call is billed: Tracking Rp 15, Rates Rp 5, Location Rp 1 per request.',
21
+ },
22
+ ];
23
+ authenticate = {
24
+ type: 'generic',
25
+ properties: {
26
+ headers: {
27
+ 'x-api-key': '={{$credentials.apiKey}}',
28
+ },
29
+ },
30
+ };
31
+ }
32
+ exports.KlikResiApi = KlikResiApi;
33
+ //# sourceMappingURL=KlikResiApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KlikResiApi.credentials.js","sourceRoot":"","sources":["../../credentials/KlikResiApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IACvB,IAAI,GAAG,aAAa,CAAC;IAErB,WAAW,GAAG,eAAe,CAAC;IAE9B,IAAI,GAAS,EAAE,KAAK,EAAE,4BAA4B,EAAE,IAAI,EAAE,iCAAiC,EAAE,CAAC;IAE9F,gBAAgB,GAAG,2BAA2B,CAAC;IAE/C,sEAAsE;IACtE,wEAAwE;IACxE,QAAQ,GAAG,UAAU,CAAC;IAEtB,UAAU,GAAsB;QAC/B;YACC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/B,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EACV,0GAA0G;SAC3G;KACD,CAAC;IAEF,YAAY,GAAyB;QACpC,IAAI,EAAE,SAAS;QACf,UAAU,EAAE;YACX,OAAO,EAAE;gBACR,WAAW,EAAE,0BAA0B;aACvC;SACD;KACD,CAAC;CACF;AAlCD,kCAkCC"}
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <rect x="2" y="6" width="20" height="14" rx="2" fill="none" stroke="#FF8A5C" stroke-width="2"/>
3
+ <path d="M2 10h20" stroke="#FF8A5C" stroke-width="2"/>
4
+ <path d="M8 14h8" stroke="#FF8A5C" stroke-width="2" stroke-linecap="round"/>
5
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <rect x="2" y="6" width="20" height="14" rx="2" fill="none" stroke="#FF6C37" stroke-width="2"/>
3
+ <path d="M2 10h20" stroke="#FF6C37" stroke-width="2"/>
4
+ <path d="M8 14h8" stroke="#FF6C37" stroke-width="2" stroke-linecap="round"/>
5
+ </svg>
@@ -0,0 +1,14 @@
1
+ import type { IExecuteFunctions, INodeCredentialTestResult, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class KlikResi implements INodeType {
3
+ methods: {
4
+ credentialTest: {
5
+ test(credential: {
6
+ data?: {
7
+ apiKey?: string;
8
+ };
9
+ }): Promise<INodeCredentialTestResult>;
10
+ };
11
+ };
12
+ description: INodeTypeDescription;
13
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
14
+ }
@@ -0,0 +1,505 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KlikResi = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const klikresi_1 = require("../../api/klikresi");
6
+ const courierOptions = Object.values(klikresi_1.COURIERS).map((code) => ({
7
+ name: `${klikresi_1.COURIER_LABELS[code]} (${code})`,
8
+ value: code,
9
+ }));
10
+ class KlikResi {
11
+ methods = {
12
+ credentialTest: {
13
+ async test(credential) {
14
+ const apiKey = credential.data?.apiKey ?? '';
15
+ if (apiKey.trim().length < 8) {
16
+ return {
17
+ status: 'Error',
18
+ message: 'API key is missing or too short.',
19
+ };
20
+ }
21
+ return {
22
+ status: 'OK',
23
+ message: 'API key format looks valid. Note: Klik Resi has no free validation endpoint, so the key is not verified against the API. Every API call is billed: Tracking Rp 15, Rates Rp 5, Location Rp 1 per request.',
24
+ };
25
+ },
26
+ },
27
+ };
28
+ description = {
29
+ displayName: 'Klik Resi',
30
+ name: 'klikResi',
31
+ icon: { light: 'file:../../icons/klikresi.svg', dark: 'file:../../icons/klikresi.dark.svg' },
32
+ group: ['transform'],
33
+ version: 1,
34
+ description: 'Track shipments, calculate shipping rates, and look up Indonesian locations via the Klik Resi API',
35
+ subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
36
+ defaults: {
37
+ name: 'Klik Resi',
38
+ },
39
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
40
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
41
+ usableAsTool: true,
42
+ credentials: [
43
+ {
44
+ name: 'klikResiApi',
45
+ required: true,
46
+ testedBy: 'klikResi',
47
+ },
48
+ ],
49
+ properties: [
50
+ {
51
+ displayName: 'Resource',
52
+ name: 'resource',
53
+ type: 'options',
54
+ noDataExpression: true,
55
+ options: [
56
+ {
57
+ name: 'Tracking',
58
+ value: 'tracking',
59
+ description: 'Track a shipment by AWB number and courier. Billed Rp 15 per request.',
60
+ },
61
+ {
62
+ name: 'Rate',
63
+ value: 'rates',
64
+ description: 'Compare shipping rates across couriers. Billed Rp 5 per request.',
65
+ },
66
+ {
67
+ name: 'Location',
68
+ value: 'location',
69
+ description: 'Search locations, provinces, cities, and districts. Billed Rp 1 per request.',
70
+ },
71
+ ],
72
+ default: 'tracking',
73
+ },
74
+ {
75
+ displayName: 'Operation',
76
+ name: 'operation',
77
+ type: 'options',
78
+ noDataExpression: true,
79
+ displayOptions: {
80
+ show: {
81
+ resource: ['tracking'],
82
+ },
83
+ },
84
+ options: [
85
+ {
86
+ name: 'Get',
87
+ value: 'get',
88
+ description: 'Get tracking information by AWB number and courier code',
89
+ action: 'Get tracking information',
90
+ },
91
+ ],
92
+ default: 'get',
93
+ },
94
+ {
95
+ displayName: 'Operation',
96
+ name: 'operation',
97
+ type: 'options',
98
+ noDataExpression: true,
99
+ displayOptions: {
100
+ show: {
101
+ resource: ['rates'],
102
+ },
103
+ },
104
+ options: [
105
+ {
106
+ name: 'Calculate By ID',
107
+ value: 'byId',
108
+ description: 'Calculate rates using district IDs',
109
+ action: 'Calculate rates by ID',
110
+ },
111
+ {
112
+ name: 'Calculate By Name',
113
+ value: 'byName',
114
+ description: 'Calculate rates using location names',
115
+ action: 'Calculate rates by name',
116
+ },
117
+ {
118
+ name: 'Calculate By Postal Code',
119
+ value: 'byPostalCode',
120
+ description: 'Calculate rates using postal codes',
121
+ action: 'Calculate rates by postal code',
122
+ },
123
+ ],
124
+ default: 'byId',
125
+ },
126
+ {
127
+ displayName: 'Operation',
128
+ name: 'operation',
129
+ type: 'options',
130
+ noDataExpression: true,
131
+ displayOptions: {
132
+ show: {
133
+ resource: ['location'],
134
+ },
135
+ },
136
+ options: [
137
+ {
138
+ name: 'Search',
139
+ value: 'search',
140
+ description: 'Search locations by keyword',
141
+ action: 'Search locations',
142
+ },
143
+ {
144
+ name: 'Provinces',
145
+ value: 'provinces',
146
+ description: 'List provinces',
147
+ action: 'List provinces',
148
+ },
149
+ {
150
+ name: 'Cities',
151
+ value: 'cities',
152
+ description: 'List cities within a province',
153
+ action: 'List cities',
154
+ },
155
+ {
156
+ name: 'Districts',
157
+ value: 'districts',
158
+ description: 'List districts within a city',
159
+ action: 'List districts',
160
+ },
161
+ ],
162
+ default: 'search',
163
+ },
164
+ // Tracking fields
165
+ {
166
+ displayName: 'Tracking Number (AWB)',
167
+ name: 'trackingNumber',
168
+ type: 'string',
169
+ required: true,
170
+ default: '',
171
+ description: 'The air waybill (resi) number to track',
172
+ displayOptions: {
173
+ show: {
174
+ resource: ['tracking'],
175
+ operation: ['get'],
176
+ },
177
+ },
178
+ },
179
+ {
180
+ displayName: 'Courier',
181
+ name: 'courierCode',
182
+ type: 'options',
183
+ noDataExpression: true,
184
+ required: true,
185
+ options: courierOptions,
186
+ default: 'jne',
187
+ description: 'The courier that ships the package',
188
+ displayOptions: {
189
+ show: {
190
+ resource: ['tracking'],
191
+ operation: ['get'],
192
+ },
193
+ },
194
+ },
195
+ {
196
+ displayName: 'Sender Phone Number',
197
+ name: 'number',
198
+ type: 'string',
199
+ default: '',
200
+ description: 'Sender phone number. Required by ID Express (ide). When provided, it is passed through as a query parameter for any courier.',
201
+ displayOptions: {
202
+ show: {
203
+ resource: ['tracking'],
204
+ operation: ['get'],
205
+ },
206
+ },
207
+ },
208
+ // Rates fields
209
+ {
210
+ displayName: 'Weight (Kg)',
211
+ name: 'weight',
212
+ type: 'number',
213
+ typeOptions: {
214
+ minValue: 0.01,
215
+ numberPrecision: 2,
216
+ },
217
+ required: true,
218
+ default: 1,
219
+ description: 'The package weight in kilograms',
220
+ displayOptions: {
221
+ show: {
222
+ resource: ['rates'],
223
+ },
224
+ },
225
+ },
226
+ {
227
+ displayName: 'Origin District ID',
228
+ name: 'originId',
229
+ type: 'string',
230
+ required: true,
231
+ default: '',
232
+ placeholder: '33.08.20',
233
+ description: 'The origin district ID (province.city.district)',
234
+ displayOptions: {
235
+ show: {
236
+ resource: ['rates'],
237
+ operation: ['byId'],
238
+ },
239
+ },
240
+ },
241
+ {
242
+ displayName: 'Destination District ID',
243
+ name: 'destinationId',
244
+ type: 'string',
245
+ required: true,
246
+ default: '',
247
+ placeholder: '32.09.31',
248
+ description: 'The destination district ID (province.city.district)',
249
+ displayOptions: {
250
+ show: {
251
+ resource: ['rates'],
252
+ operation: ['byId'],
253
+ },
254
+ },
255
+ },
256
+ {
257
+ displayName: 'Couriers Filter',
258
+ name: 'couriers',
259
+ type: 'multiOptions',
260
+ noDataExpression: true,
261
+ options: courierOptions,
262
+ default: [],
263
+ description: 'Only return rates from these couriers. Leave empty to return all couriers.',
264
+ displayOptions: {
265
+ show: {
266
+ resource: ['rates'],
267
+ operation: ['byId'],
268
+ },
269
+ },
270
+ },
271
+ {
272
+ displayName: 'Origin Name',
273
+ name: 'originName',
274
+ type: 'string',
275
+ required: true,
276
+ default: '',
277
+ placeholder: 'Secang, Kabupaten Magelang, Jawa Tengah',
278
+ description: 'The origin location name',
279
+ displayOptions: {
280
+ show: {
281
+ resource: ['rates'],
282
+ operation: ['byName'],
283
+ },
284
+ },
285
+ },
286
+ {
287
+ displayName: 'Destination Name',
288
+ name: 'destinationName',
289
+ type: 'string',
290
+ required: true,
291
+ default: '',
292
+ placeholder: 'Depok, Kabupaten Cirebon, Jawa Barat',
293
+ description: 'The destination location name',
294
+ displayOptions: {
295
+ show: {
296
+ resource: ['rates'],
297
+ operation: ['byName'],
298
+ },
299
+ },
300
+ },
301
+ {
302
+ displayName: 'Origin Postal Code',
303
+ name: 'originPostalCode',
304
+ type: 'number',
305
+ typeOptions: {
306
+ numberPrecision: 0,
307
+ },
308
+ required: true,
309
+ default: 0,
310
+ displayOptions: {
311
+ show: {
312
+ resource: ['rates'],
313
+ operation: ['byPostalCode'],
314
+ },
315
+ },
316
+ },
317
+ {
318
+ displayName: 'Destination Postal Code',
319
+ name: 'destinationPostalCode',
320
+ type: 'number',
321
+ typeOptions: {
322
+ numberPrecision: 0,
323
+ },
324
+ required: true,
325
+ default: 0,
326
+ displayOptions: {
327
+ show: {
328
+ resource: ['rates'],
329
+ operation: ['byPostalCode'],
330
+ },
331
+ },
332
+ },
333
+ // Location fields
334
+ {
335
+ displayName: 'Keyword',
336
+ name: 'keyword',
337
+ type: 'string',
338
+ required: true,
339
+ default: '',
340
+ description: 'Search locations by keyword (e.g. "depok")',
341
+ displayOptions: {
342
+ show: {
343
+ resource: ['location'],
344
+ operation: ['search'],
345
+ },
346
+ },
347
+ },
348
+ {
349
+ displayName: 'Province ID',
350
+ name: 'provinceId',
351
+ type: 'string',
352
+ required: true,
353
+ default: '',
354
+ placeholder: '33',
355
+ description: 'The province ID to list cities from',
356
+ displayOptions: {
357
+ show: {
358
+ resource: ['location'],
359
+ operation: ['cities'],
360
+ },
361
+ },
362
+ },
363
+ {
364
+ displayName: 'City ID',
365
+ name: 'cityId',
366
+ type: 'string',
367
+ required: true,
368
+ default: '',
369
+ placeholder: '33.08',
370
+ description: 'The city ID to list districts from',
371
+ displayOptions: {
372
+ show: {
373
+ resource: ['location'],
374
+ operation: ['districts'],
375
+ },
376
+ },
377
+ },
378
+ {
379
+ displayName: 'Return All',
380
+ name: 'returnAll',
381
+ type: 'boolean',
382
+ default: false,
383
+ description: 'Whether to return all results or only up to a given limit',
384
+ displayOptions: {
385
+ show: {
386
+ resource: ['location'],
387
+ },
388
+ },
389
+ },
390
+ {
391
+ displayName: 'Limit',
392
+ name: 'limit',
393
+ type: 'number',
394
+ typeOptions: {
395
+ minValue: 1,
396
+ numberPrecision: 0,
397
+ },
398
+ default: 50,
399
+ description: 'Max number of results to return',
400
+ displayOptions: {
401
+ show: {
402
+ resource: ['location'],
403
+ returnAll: [false],
404
+ },
405
+ },
406
+ },
407
+ ],
408
+ };
409
+ async execute() {
410
+ const items = this.getInputData();
411
+ const returnData = [];
412
+ const resource = this.getNodeParameter('resource', 0);
413
+ const operation = this.getNodeParameter('operation', 0);
414
+ const credentials = await this.getCredentials('klikResiApi');
415
+ const api = new klikresi_1.KlikResiApi(credentials.apiKey);
416
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
417
+ try {
418
+ const responseData = await runOperation.call(this, api, resource, operation, itemIndex);
419
+ returnData.push({
420
+ json: responseData,
421
+ pairedItem: { item: itemIndex },
422
+ });
423
+ }
424
+ catch (error) {
425
+ if (this.continueOnFail()) {
426
+ returnData.push({
427
+ json: {
428
+ error: error instanceof Error ? error.message : String(error),
429
+ },
430
+ pairedItem: { item: itemIndex },
431
+ });
432
+ continue;
433
+ }
434
+ if (error instanceof klikresi_1.ApiError) {
435
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Klik Resi API error (HTTP ${error.status}): ${error.message}`, { itemIndex });
436
+ }
437
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
438
+ }
439
+ }
440
+ return [returnData];
441
+ }
442
+ }
443
+ exports.KlikResi = KlikResi;
444
+ async function runOperation(api, resource, operation, itemIndex) {
445
+ if (resource === 'tracking') {
446
+ if (operation === 'get') {
447
+ const trackingNumber = this.getNodeParameter('trackingNumber', itemIndex);
448
+ const courierCode = this.getNodeParameter('courierCode', itemIndex);
449
+ const number = this.getNodeParameter('number', itemIndex, '');
450
+ const tracking = await api.trackingGet(trackingNumber, courierCode, { number });
451
+ return tracking;
452
+ }
453
+ }
454
+ if (resource === 'rates') {
455
+ const weight = this.getNodeParameter('weight', itemIndex);
456
+ if (operation === 'byId') {
457
+ const originId = this.getNodeParameter('originId', itemIndex);
458
+ const destinationId = this.getNodeParameter('destinationId', itemIndex);
459
+ const couriers = this.getNodeParameter('couriers', itemIndex, []);
460
+ const result = await api.ratesById(originId, destinationId, weight, couriers);
461
+ return result;
462
+ }
463
+ if (operation === 'byName') {
464
+ const originName = this.getNodeParameter('originName', itemIndex);
465
+ const destinationName = this.getNodeParameter('destinationName', itemIndex);
466
+ const result = await api.ratesByName(originName, destinationName, weight);
467
+ return result;
468
+ }
469
+ if (operation === 'byPostalCode') {
470
+ const originPostalCode = this.getNodeParameter('originPostalCode', itemIndex);
471
+ const destinationPostalCode = this.getNodeParameter('destinationPostalCode', itemIndex);
472
+ const result = await api.ratesByPostalCode(originPostalCode, destinationPostalCode, weight);
473
+ return result;
474
+ }
475
+ }
476
+ if (resource === 'location') {
477
+ const returnAll = this.getNodeParameter('returnAll', itemIndex);
478
+ const limit = returnAll ? undefined : this.getNodeParameter('limit', itemIndex);
479
+ if (operation === 'search') {
480
+ const keyword = this.getNodeParameter('keyword', itemIndex);
481
+ return returnAll
482
+ ? (await api.allLocations(keyword, limit))
483
+ : (await api.locationSearch(keyword, limit));
484
+ }
485
+ if (operation === 'provinces') {
486
+ return returnAll
487
+ ? (await api.allProvinces(limit))
488
+ : (await api.provinces(limit));
489
+ }
490
+ if (operation === 'cities') {
491
+ const provinceId = this.getNodeParameter('provinceId', itemIndex);
492
+ return returnAll
493
+ ? (await api.allCities(provinceId, limit))
494
+ : (await api.cities(provinceId, limit));
495
+ }
496
+ if (operation === 'districts') {
497
+ const cityId = this.getNodeParameter('cityId', itemIndex);
498
+ return returnAll
499
+ ? (await api.allDistricts(cityId, limit))
500
+ : (await api.districts(cityId, limit));
501
+ }
502
+ }
503
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not supported for resource "${resource}"`);
504
+ }
505
+ //# sourceMappingURL=KlikResi.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KlikResi.node.js","sourceRoot":"","sources":["../../../nodes/KlikResi/KlikResi.node.ts"],"names":[],"mappings":";;;AAQA,+CAAuE;AAEvE,iDAAqF;AAErF,MAAM,cAAc,GAA2C,MAAM,CAAC,MAAM,CAAC,mBAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACrG,IAAI,EAAE,GAAG,yBAAc,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG;IACzC,KAAK,EAAE,IAAI;CACX,CAAC,CAAC,CAAC;AAEJ,MAAa,QAAQ;IACpB,OAAO,GAAG;QACT,cAAc,EAAE;YACf,KAAK,CAAC,IAAI,CAAC,UAA0C;gBACpD,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC;gBAC7C,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC9B,OAAO;wBACN,MAAM,EAAE,OAAO;wBACf,OAAO,EAAE,kCAAkC;qBAC3C,CAAC;gBACH,CAAC;gBAC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tE,CAAC;QACD,IAAI,SAAS,KAAK,WAAW,EAAE,CAAC;YAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAW,CAAC;YACpE,OAAO,SAAS;gBACf,CAAC,CAAE,CAAC,MAAM,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAA8B;gBACvE,CAAC,CAAE,CAAC,MAAM,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAA4B,CAAC;QACrE,CAAC;IACF,CAAC;IAED,MAAM,IAAI,iCAAkB,CAC3B,IAAI,CAAC,OAAO,EAAE,EACd,kBAAkB,SAAS,oCAAoC,QAAQ,GAAG,CAC1E,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "n8n-nodes-klikresi",
3
+ "version": "1.0.3",
4
+ "description": "n8n community node for the Klik Resi shipping API: shipment tracking, shipping rates, and Indonesian location lookup.",
5
+ "license": "MIT",
6
+ "homepage": "https://docs.klikresi.com",
7
+ "keywords": [
8
+ "n8n-community-node-package",
9
+ "n8n",
10
+ "klikresi",
11
+ "resi",
12
+ "shipping",
13
+ "tracking",
14
+ "courier",
15
+ "ongkir",
16
+ "indonesia"
17
+ ],
18
+ "author": {
19
+ "name": "Klik Resi",
20
+ "email": "support@klikresi.com"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/klikresi/n8n-nodes-klikresi.git"
25
+ },
26
+ "scripts": {
27
+ "build": "n8n-node build",
28
+ "build:watch": "tsc --watch",
29
+ "dev": "n8n-node dev",
30
+ "lint": "n8n-node lint",
31
+ "lint:fix": "n8n-node lint --fix",
32
+ "typecheck": "tsc --noEmit",
33
+ "test": "vitest run",
34
+ "release": "n8n-node release",
35
+ "prepublishOnly": "n8n-node prerelease"
36
+ },
37
+ "files": [
38
+ "dist"
39
+ ],
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "n8n": {
44
+ "n8nNodesApiVersion": 1,
45
+ "strict": true,
46
+ "credentials": [
47
+ "dist/credentials/KlikResiApi.credentials.js"
48
+ ],
49
+ "nodes": [
50
+ "dist/nodes/KlikResi/KlikResi.node.js"
51
+ ]
52
+ },
53
+ "devDependencies": {
54
+ "@n8n/node-cli": "*",
55
+ "eslint": "9.39.4",
56
+ "prettier": "3.8.3",
57
+ "typescript": "5.9.3",
58
+ "vitest": "^3.2.0"
59
+ },
60
+ "peerDependencies": {
61
+ "n8n-workflow": "*"
62
+ },
63
+ "engines": {
64
+ "node": ">=24.0.0"
65
+ }
66
+ }