@activepieces/piece-clicdata 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/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # pieces-clicdata
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build pieces-clicdata` to build the library.
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@activepieces/piece-clicdata",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@sinclair/typebox": "0.34.11",
9
+ "axios": "1.13.1",
10
+ "axios-retry": "4.4.1",
11
+ "deepmerge-ts": "7.1.0",
12
+ "form-data": "4.0.4",
13
+ "mime-types": "2.1.35",
14
+ "nanoid": "3.3.8",
15
+ "semver": "7.6.0",
16
+ "socket.io-client": "4.8.1",
17
+ "tslib": "^2.3.0",
18
+ "zod": "4.1.13",
19
+ "@activepieces/pieces-common": "0.11.0",
20
+ "@activepieces/pieces-framework": "0.23.0",
21
+ "@activepieces/shared": "0.30.4"
22
+ },
23
+ "resolutions": {
24
+ "rollup": "npm:@rollup/wasm-node"
25
+ }
26
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export declare const clicdata: import("@activepieces/pieces-framework").Piece<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ userEmail: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ userPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>)[]>;
package/src/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clicdata = void 0;
4
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
+ const shared_1 = require("@activepieces/shared");
6
+ const auth_1 = require("./lib/common/auth");
7
+ const actions_1 = require("./lib/actions");
8
+ exports.clicdata = (0, pieces_framework_1.createPiece)({
9
+ displayName: "Clicdata",
10
+ auth: auth_1.clicdataAuth,
11
+ minimumSupportedRelease: '0.36.1',
12
+ description: "ClicData enables True Performance with an end-to-end data analytics platform: connect, transform, automate, visualize and share data from 300+ sources.",
13
+ logoUrl: "https://cdn.activepieces.com/pieces/clicdata.png",
14
+ categories: [shared_1.PieceCategory.BUSINESS_INTELLIGENCE],
15
+ authors: ["onyedikachi-david"],
16
+ actions: [actions_1.insertRow, actions_1.refreshTable],
17
+ triggers: [],
18
+ });
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/clicdata/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAA6D;AAC7D,iDAAqD;AACrD,4CAAiD;AACjD,2CAAwD;AAE3C,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,UAAU;IACvB,IAAI,EAAE,mBAAY;IAClB,uBAAuB,EAAE,QAAQ;IACjC,WAAW,EAAE,yJAAyJ;IACtK,OAAO,EAAE,kDAAkD;IAC3D,UAAU,EAAE,CAAC,sBAAa,CAAC,qBAAqB,CAAC;IACjD,OAAO,EAAE,CAAC,mBAAmB,CAAC;IAC9B,OAAO,EAAE,CAAC,mBAAS,EAAE,sBAAY,CAAC;IAClC,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { insertRow } from './insert-row';
2
+ export { refreshTable } from './refresh-table';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.refreshTable = exports.insertRow = void 0;
4
+ var insert_row_1 = require("./insert-row");
5
+ Object.defineProperty(exports, "insertRow", { enumerable: true, get: function () { return insert_row_1.insertRow; } });
6
+ var refresh_table_1 = require("./refresh-table");
7
+ Object.defineProperty(exports, "refreshTable", { enumerable: true, get: function () { return refresh_table_1.refreshTable; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clicdata/src/lib/actions/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA"}
@@ -0,0 +1,13 @@
1
+ export declare const insertRow: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ userEmail: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ userPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>)[], {
6
+ table_id: import("@activepieces/pieces-framework").DropdownProperty<number, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").CustomAuthProperty<{
7
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
+ userEmail: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
+ userPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
10
+ }>)[]>;
11
+ data: import("@activepieces/pieces-framework").JsonProperty<true>;
12
+ apiVersion: import("@activepieces/pieces-framework").ShortTextProperty<false>;
13
+ }>;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertRow = 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 client_1 = require("../common/client");
8
+ const props_1 = require("../common/props");
9
+ const pieces_common_1 = require("@activepieces/pieces-common");
10
+ exports.insertRow = (0, pieces_framework_1.createAction)({
11
+ auth: auth_1.clicdataAuth,
12
+ name: 'insert_row',
13
+ displayName: 'Insert Row',
14
+ description: 'Insert rows into a ClicData table (maximum 500 rows)',
15
+ props: {
16
+ table_id: props_1.clicdataCommonProps.table_id,
17
+ data: pieces_framework_1.Property.Json({
18
+ displayName: 'Row Data',
19
+ description: 'Array of objects representing rows to insert. Each object should have column names as keys. Maximum 500 rows.',
20
+ required: true,
21
+ defaultValue: [
22
+ {
23
+ "Column1": "value1",
24
+ "Column2": "value2"
25
+ }
26
+ ],
27
+ }),
28
+ apiVersion: props_1.clicdataCommonProps.apiVersion,
29
+ },
30
+ run(context) {
31
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ const { table_id, data, apiVersion } = context.propsValue;
33
+ if (!Array.isArray(data)) {
34
+ throw new Error('Data must be an array of objects');
35
+ }
36
+ if (data.length > 500) {
37
+ throw new Error('Maximum 500 rows allowed per request');
38
+ }
39
+ if (data.some(item => typeof item !== 'object' || item === null)) {
40
+ throw new Error('Each row must be an object with column names as keys');
41
+ }
42
+ const response = yield (0, client_1.clicdataApiCall)({
43
+ method: pieces_common_1.HttpMethod.POST,
44
+ path: `/data/${table_id}/insert`,
45
+ auth: context.auth,
46
+ body: {
47
+ data: data,
48
+ },
49
+ apiVersion: apiVersion || undefined,
50
+ });
51
+ return response.result;
52
+ });
53
+ },
54
+ });
55
+ //# sourceMappingURL=insert-row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert-row.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clicdata/src/lib/actions/insert-row.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA8C;AAC9C,6CAAmD;AACnD,2CAAsD;AACtD,+DAAyD;AAE5C,QAAA,SAAS,GA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IAAI,SAAS;aACpC,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,MAAM,CAAC;QACzB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare const refreshTable: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ userEmail: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ userPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>)[], {
6
+ table_id: import("@activepieces/pieces-framework").DropdownProperty<number, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").CustomAuthProperty<{
7
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
+ userEmail: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
+ userPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
10
+ }>)[]>;
11
+ mode: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
12
+ apiVersion: import("@activepieces/pieces-framework").ShortTextProperty<false>;
13
+ }>;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.refreshTable = 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 client_1 = require("../common/client");
8
+ const props_1 = require("../common/props");
9
+ const pieces_common_1 = require("@activepieces/pieces-common");
10
+ exports.refreshTable = (0, pieces_framework_1.createAction)({
11
+ auth: auth_1.clicdataAuth,
12
+ name: 'refresh_table',
13
+ displayName: 'Refresh Table',
14
+ description: 'Refresh the selected table depending on the refresh mode',
15
+ props: {
16
+ table_id: props_1.clicdataCommonProps.table_id,
17
+ mode: pieces_framework_1.Property.StaticDropdown({
18
+ displayName: 'Refresh Mode',
19
+ description: 'Select the refresh mode for the table',
20
+ required: true,
21
+ options: {
22
+ options: [
23
+ {
24
+ label: 'Reload',
25
+ value: 'reload',
26
+ },
27
+ {
28
+ label: 'Rebuild',
29
+ value: 'rebuild',
30
+ },
31
+ {
32
+ label: 'Update',
33
+ value: 'update',
34
+ },
35
+ {
36
+ label: 'Append',
37
+ value: 'append',
38
+ },
39
+ {
40
+ label: 'Update + Append',
41
+ value: 'updateappend',
42
+ },
43
+ ],
44
+ },
45
+ defaultValue: 'reload',
46
+ }),
47
+ apiVersion: props_1.clicdataCommonProps.apiVersion,
48
+ },
49
+ run(context) {
50
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
51
+ const { table_id, mode, apiVersion } = context.propsValue;
52
+ const response = yield (0, client_1.clicdataApiCall)({
53
+ method: pieces_common_1.HttpMethod.POST,
54
+ path: `/table/${table_id}/refresh`,
55
+ auth: context.auth,
56
+ body: {
57
+ mode: mode,
58
+ },
59
+ apiVersion: apiVersion || '2025.3',
60
+ });
61
+ return response.result;
62
+ });
63
+ },
64
+ });
65
+ //# sourceMappingURL=refresh-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh-table.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clicdata/src/lib/actions/refresh-table.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA8C;AAC9C,6CAAmD;AACnD,2CAAsD;AACtD,+DAAyD;AAE5C,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,0DAA0D;IACvE,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAmB,CAAC,QAAQ;QACtC,IAAI,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP;wBACE,KAAK,EAAE,QAAQ;wBACf,KAAK,EAAE,QAAQ;qBAChB;oBACD;wBACE,KAAK,EAAE,SAAS;wBAChB,KAAK,EAAE,SAAS;qBACjB;oBACD;wBACE,KAAK,EAAE,QAAQ;wBACf,KAAK,EAAE,QAAQ;qBAChB;oBACD;wBACE,KAAK,EAAE,QAAQ;wBACf,KAAK,EAAE,QAAQ;qBAChB;oBACD;wBACE,KAAK,EAAE,iBAAiB;wBACxB,KAAK,EAAE,cAAc;qBACtB;iBACF;aACF;YACD,YAAY,EAAE,QAAQ;SACvB,CAAC;QACF,UAAU,EAAE,2BAAmB,CAAC,UAAU;KAC3C;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE1D,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAEnC;gBACD,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,UAAU,QAAQ,UAAU;gBAClC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE;oBACJ,IAAI,EAAE,IAAI;iBACX;gBACD,UAAU,EAAE,UAAU,IAAI,QAAQ;aACnC,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,MAAM,CAAC;QACzB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
2
+ export declare const clicdataAuth: (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").CustomAuthProperty<{
3
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ userEmail: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ userPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
6
+ }>)[];
7
+ export type ClicdataAuthValue = AppConnectionValueForAuthProperty<typeof clicdataAuth>;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clicdataAuth = 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 client_1 = require("./client");
8
+ const shared_1 = require("@activepieces/shared");
9
+ const CLICDATA_SCOPES = [
10
+ 'account_read',
11
+ 'data_read',
12
+ 'data_write',
13
+ 'table_read',
14
+ 'table_write',
15
+ ];
16
+ exports.clicdataAuth = [
17
+ pieces_framework_1.PieceAuth.OAuth2({
18
+ description: 'Connect your ClicData account using OAuth2. Supports both Authorization Code (user-based) and Client Credentials (server-to-server) flows. Configure your preferred flow in ClicData under Account > API Apps.',
19
+ authUrl: 'https://api.clicdata.com/oauth20/authorize',
20
+ tokenUrl: 'https://api.clicdata.com/oauth20/token',
21
+ required: true,
22
+ scope: [...CLICDATA_SCOPES],
23
+ grantType: 'both_client_credentials_and_authorization_code',
24
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
25
+ try {
26
+ yield (0, client_1.clicdataApiCall)({
27
+ method: pieces_common_1.HttpMethod.GET,
28
+ path: '/account',
29
+ auth: {
30
+ type: shared_1.AppConnectionType.OAUTH2,
31
+ access_token: auth.access_token,
32
+ },
33
+ });
34
+ return { valid: true };
35
+ }
36
+ catch (e) {
37
+ return {
38
+ valid: false,
39
+ error: e.message,
40
+ };
41
+ }
42
+ }),
43
+ }),
44
+ pieces_framework_1.PieceAuth.SecretText({
45
+ displayName: 'API Key',
46
+ required: true,
47
+ description: 'API key generated in ClicData under Account > API Apps',
48
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
49
+ try {
50
+ yield (0, client_1.clicdataApiCall)({
51
+ method: pieces_common_1.HttpMethod.GET,
52
+ path: '/account',
53
+ auth: {
54
+ type: shared_1.AppConnectionType.SECRET_TEXT,
55
+ secret_text: auth,
56
+ },
57
+ });
58
+ return { valid: true };
59
+ }
60
+ catch (e) {
61
+ return {
62
+ valid: false,
63
+ error: e.message,
64
+ };
65
+ }
66
+ }),
67
+ }),
68
+ pieces_framework_1.PieceAuth.CustomAuth({
69
+ displayName: 'Basic Auth',
70
+ description: 'Sign in using your ClicData user credentials (used to build the Basic token).',
71
+ required: true,
72
+ props: {
73
+ clientId: pieces_framework_1.Property.ShortText({
74
+ displayName: 'Client ID',
75
+ required: true,
76
+ }),
77
+ userEmail: pieces_framework_1.Property.ShortText({
78
+ displayName: 'User Email',
79
+ required: true,
80
+ }),
81
+ userPassword: pieces_framework_1.PieceAuth.SecretText({
82
+ displayName: 'User Password',
83
+ required: true,
84
+ }),
85
+ },
86
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
87
+ try {
88
+ yield (0, client_1.clicdataApiCall)({
89
+ method: pieces_common_1.HttpMethod.GET,
90
+ path: '/account',
91
+ auth: {
92
+ type: shared_1.AppConnectionType.CUSTOM_AUTH,
93
+ props: {
94
+ clientId: auth.clientId,
95
+ userEmail: auth.userEmail,
96
+ userPassword: auth.userPassword,
97
+ },
98
+ },
99
+ });
100
+ return { valid: true };
101
+ }
102
+ catch (e) {
103
+ return {
104
+ valid: false,
105
+ error: e.message,
106
+ };
107
+ }
108
+ }),
109
+ }),
110
+ ];
111
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clicdata/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,+DAAyD;AACzD,qCAA2C;AAC3C,iDAAyD;AAEzD,MAAM,eAAe,GAAG;IACtB,cAAc;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C;CACH,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { HttpMethod } from '@activepieces/pieces-common';
2
+ import { AppConnectionType } from '@activepieces/shared';
3
+ export type ClicdataAuth = {
4
+ type: AppConnectionType.OAUTH2 | AppConnectionType.CLOUD_OAUTH2 | AppConnectionType.PLATFORM_OAUTH2;
5
+ access_token: string;
6
+ } | {
7
+ type: AppConnectionType.SECRET_TEXT;
8
+ secret_text: string;
9
+ } | {
10
+ type: AppConnectionType.CUSTOM_AUTH;
11
+ props: {
12
+ clientId: string;
13
+ userEmail: string;
14
+ userPassword: string;
15
+ };
16
+ };
17
+ type ClicdataApiSuccessResponse<TResult> = {
18
+ success: true;
19
+ result: TResult;
20
+ pagination?: {
21
+ result_count: number;
22
+ result_total_count?: number;
23
+ current_page: number;
24
+ page_size: number;
25
+ has_more_results?: boolean;
26
+ last_page?: boolean;
27
+ };
28
+ };
29
+ export type ClicdataApiCallParams = {
30
+ method: HttpMethod;
31
+ path: `/${string}`;
32
+ auth: ClicdataAuth;
33
+ query?: Record<string, string | number | boolean | undefined>;
34
+ body?: unknown;
35
+ apiVersion?: string;
36
+ };
37
+ export declare function clicdataApiCall<TResult>({ method, path, auth, query, body, apiVersion, }: ClicdataApiCallParams): Promise<ClicdataApiSuccessResponse<TResult>>;
38
+ export {};
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clicdataApiCall = clicdataApiCall;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const shared_1 = require("@activepieces/shared");
7
+ const DEFAULT_API_VERSION = '2022.01';
8
+ const BASE_URL = 'https://api.clicdata.com';
9
+ function getHeadersFromAuth(auth) {
10
+ if (auth.type === shared_1.AppConnectionType.SECRET_TEXT) {
11
+ return {
12
+ 'CLICDATA-API-KEY': auth.secret_text,
13
+ };
14
+ }
15
+ if (auth.type === shared_1.AppConnectionType.CUSTOM_AUTH) {
16
+ const encodedEmailAndPassword = Buffer.from(`${auth.props.userEmail}:${auth.props.userPassword}`).toString('base64');
17
+ const token = Buffer.from(`${auth.props.clientId}:${encodedEmailAndPassword}`).toString('base64');
18
+ return {
19
+ Authorization: `Basic ${token}`,
20
+ };
21
+ }
22
+ return {};
23
+ }
24
+ function getAuthentication(auth) {
25
+ switch (auth.type) {
26
+ case shared_1.AppConnectionType.OAUTH2:
27
+ case shared_1.AppConnectionType.CLOUD_OAUTH2:
28
+ case shared_1.AppConnectionType.PLATFORM_OAUTH2:
29
+ return {
30
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
31
+ token: auth.access_token,
32
+ };
33
+ case shared_1.AppConnectionType.SECRET_TEXT:
34
+ case shared_1.AppConnectionType.CUSTOM_AUTH:
35
+ return undefined;
36
+ }
37
+ }
38
+ function clicdataApiCall(_a) {
39
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ method, path, auth, query, body, apiVersion, }) {
40
+ var _b, _c;
41
+ const queryParams = {
42
+ api_version: apiVersion !== null && apiVersion !== void 0 ? apiVersion : DEFAULT_API_VERSION,
43
+ };
44
+ if (query) {
45
+ for (const [key, value] of Object.entries(query)) {
46
+ if (value !== undefined) {
47
+ queryParams[key] = String(value);
48
+ }
49
+ }
50
+ }
51
+ const request = {
52
+ method,
53
+ url: `${BASE_URL}${path}`,
54
+ authentication: getAuthentication(auth),
55
+ headers: Object.assign({ 'Content-Type': 'application/json' }, getHeadersFromAuth(auth)),
56
+ queryParams,
57
+ body,
58
+ };
59
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
60
+ if (!response.body.success) {
61
+ const errorMsg = ((_b = response.body.error) === null || _b === void 0 ? void 0 : _b.description) ||
62
+ ((_c = response.body.error) === null || _c === void 0 ? void 0 : _c.code) ||
63
+ 'ClicData API error';
64
+ throw new Error(errorMsg);
65
+ }
66
+ return response.body;
67
+ });
68
+ }
69
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sour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
2
+ apiVersion: import("@activepieces/pieces-framework").ShortTextProperty<false>;
3
+ table_id: import("@activepieces/pieces-framework").DropdownProperty<number, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").CustomAuthProperty<{
4
+ clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ userEmail: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
+ userPassword: import("@activepieces/pieces-framework").SecretTextProperty<true>;
7
+ }>)[]>;
8
+ };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clicdataCommonProps = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const client_1 = require("./client");
7
+ const auth_1 = require("./auth");
8
+ const pieces_common_1 = require("@activepieces/pieces-common");
9
+ exports.clicdataCommonProps = {
10
+ apiVersion: pieces_framework_1.Property.ShortText({
11
+ displayName: 'API Version',
12
+ required: false,
13
+ description: 'Defaults to 2022.01',
14
+ }),
15
+ table_id: pieces_framework_1.Property.Dropdown({
16
+ auth: auth_1.clicdataAuth,
17
+ displayName: 'Table',
18
+ description: 'Select the table to insert data into',
19
+ required: true,
20
+ refreshers: [],
21
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
22
+ if (!auth) {
23
+ return {
24
+ disabled: true,
25
+ options: [],
26
+ placeholder: 'Please connect your account first',
27
+ };
28
+ }
29
+ try {
30
+ const response = yield (0, client_1.clicdataApiCall)({
31
+ method: pieces_common_1.HttpMethod.GET,
32
+ path: '/table',
33
+ auth: auth,
34
+ query: {
35
+ page: 1,
36
+ page_size: 100,
37
+ },
38
+ apiVersion: '2025.3',
39
+ });
40
+ return {
41
+ disabled: false,
42
+ options: response.result.map((table) => ({
43
+ label: table.name,
44
+ value: table.id,
45
+ })),
46
+ };
47
+ }
48
+ catch (error) {
49
+ return {
50
+ disabled: true,
51
+ options: [],
52
+ placeholder: 'Failed to load tables',
53
+ };
54
+ }
55
+ }),
56
+ }),
57
+ };
58
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clicdata/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,qEAA0D;AAC1D,qCAA2C;AAC3C,iCAAsC;AACtC,+DAAyD;AAE5C,QAAA,mBAAmB,GAAG;IACjC,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;QAC7B,WAAW,EAAE,aAAa;QAC1B,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,qBAAqB;KACnC,CAAC;IACF,QAAQ,EAAE,2BAAQ,CAAC,QAAQ,CAAC;QAC1B,IAAI,EAAE,mBAAY;QAClB,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,sCAAsC;QACnD,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;YACtB,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,mCAAmC;iBACjD,CAAC;YACJ,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAIjC;oBACH,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE;wBACL,IAAI,EAAE,CAAC;wBACP,SAAS,EAAE,GAAG;qBACf;oBACD,UAAU,EAAE,QAAQ;iBACrB,CAAC,CAAC;gBAEH,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE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