@taskmagic/apps-seek-table 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 +7 -0
- package/package.json +48 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +37 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/share-report-email.action.d.ts +9 -0
- package/src/lib/actions/share-report-email.action.js +131 -0
- package/src/lib/actions/share-report-email.action.js.map +1 -0
- package/src/lib/actions/upload-csv.action.d.ts +5 -0
- package/src/lib/actions/upload-csv.action.js +56 -0
- package/src/lib/actions/upload-csv.action.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +41 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +8 -0
- package/src/lib/common/client.js +24 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/props.d.ts +5 -0
- package/src/lib/common/props.js +56 -0
- package/src/lib/common/props.js.map +1 -0
- package/src/lib/triggers/new-csv-cube.trigger.d.ts +2 -0
- package/src/lib/triggers/new-csv-cube.trigger.js +79 -0
- package/src/lib/triggers/new-csv-cube.trigger.js.map +1 -0
- package/src/lib/triggers/new-report.trigger.d.ts +2 -0
- package/src/lib/triggers/new-report.trigger.js +77 -0
- package/src/lib/triggers/new-report.trigger.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taskmagic/apps-seek-table",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@anthropic-ai/sdk": "0.33.1",
|
|
6
|
+
"@sinclair/typebox": "0.34.11",
|
|
7
|
+
"axios": "1.17.0",
|
|
8
|
+
"axios-retry": "4.4.1",
|
|
9
|
+
"deepmerge-ts": "7.1.0",
|
|
10
|
+
"form-data": "4.0.5",
|
|
11
|
+
"mime-types": "2.1.35",
|
|
12
|
+
"nanoid": "3.3.8",
|
|
13
|
+
"openai": "4.67.1",
|
|
14
|
+
"replicate": "0.34.1",
|
|
15
|
+
"semver": "7.6.0",
|
|
16
|
+
"zod": "3.25.76",
|
|
17
|
+
"@taskmagic/pieces-common": "0.4.4",
|
|
18
|
+
"@taskmagic/pieces-framework": "0.7.46",
|
|
19
|
+
"@taskmagic/shared": "0.10.171",
|
|
20
|
+
"tslib": "1.14.1"
|
|
21
|
+
},
|
|
22
|
+
"overrides": {
|
|
23
|
+
"cross-spawn": "7.0.6",
|
|
24
|
+
"elliptic": "^6.6.1",
|
|
25
|
+
"fast-xml-parser": "^4.4.1",
|
|
26
|
+
"protobufjs": "^7.5.5",
|
|
27
|
+
"tmp": "^0.2.4",
|
|
28
|
+
"koa": "^2.16.4",
|
|
29
|
+
"picomatch": "^4.0.4",
|
|
30
|
+
"langsmith": "^0.6.0",
|
|
31
|
+
"serialize-javascript": "^6.0.2",
|
|
32
|
+
"elevenlabs": {
|
|
33
|
+
"form-data": "^4.0.4"
|
|
34
|
+
},
|
|
35
|
+
"@tryfabric/martian": {
|
|
36
|
+
"@notionhq/client": "$@notionhq/client"
|
|
37
|
+
},
|
|
38
|
+
"vite": {
|
|
39
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"resolutions": {
|
|
43
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
44
|
+
},
|
|
45
|
+
"types": "./src/index.d.ts",
|
|
46
|
+
"main": "./src/index.js",
|
|
47
|
+
"type": "commonjs"
|
|
48
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.seekTable = exports.seekTableAuth = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
5
|
+
const shared_1 = require("@taskmagic/shared");
|
|
6
|
+
const auth_1 = require("./lib/common/auth");
|
|
7
|
+
Object.defineProperty(exports, "seekTableAuth", { enumerable: true, get: function () { return auth_1.seekTableAuth; } });
|
|
8
|
+
const new_csv_cube_trigger_1 = require("./lib/triggers/new-csv-cube.trigger");
|
|
9
|
+
const new_report_trigger_1 = require("./lib/triggers/new-report.trigger");
|
|
10
|
+
const upload_csv_action_1 = require("./lib/actions/upload-csv.action");
|
|
11
|
+
const share_report_email_action_1 = require("./lib/actions/share-report-email.action");
|
|
12
|
+
exports.seekTable = (0, pieces_framework_1.createPiece)({
|
|
13
|
+
displayName: 'SeekTable',
|
|
14
|
+
description: 'Generate and automate reports from SeekTable.',
|
|
15
|
+
auth: auth_1.seekTableAuth,
|
|
16
|
+
minimumSupportedRelease: '0.30.0',
|
|
17
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/seek-table.png',
|
|
18
|
+
categories: [shared_1.PieceCategory.BUSINESS_INTELLIGENCE],
|
|
19
|
+
authors: ['onyedikachi-david'],
|
|
20
|
+
ai: {
|
|
21
|
+
description: 'Automate SeekTable reporting: upload CSV data into cubes, email pivot reports with exports, and trigger flows when new cubes or reports appear.',
|
|
22
|
+
keywords: [
|
|
23
|
+
'seektable',
|
|
24
|
+
'pivot table',
|
|
25
|
+
'report',
|
|
26
|
+
'csv cube',
|
|
27
|
+
'business intelligence',
|
|
28
|
+
'data analytics',
|
|
29
|
+
'export report',
|
|
30
|
+
'upload csv',
|
|
31
|
+
'share report',
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
actions: [upload_csv_action_1.uploadCsvAction, share_report_email_action_1.shareReportEmailAction],
|
|
35
|
+
triggers: [new_csv_cube_trigger_1.newCsvCubeTrigger, new_report_trigger_1.newReportTrigger],
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/seek-table/src/index.ts"],"names":[],"mappings":";;;AAAA,kEAA0D;AAC1D,8CAAkD;AAClD,4CAAkD;AAMzC,8FANA,oBAAa,OAMA;AALtB,8EAAwE;AACxE,0EAAqE;AACrE,uEAAkE;AAClE,uFAAiF;AAIpE,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACnC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,+CAA+C;IAC5D,IAAI,EAAE,oBAAa;IACnB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,oDAAoD;IAC7D,UAAU,EAAE,CAAC,sBAAa,CAAC,qBAAqB,CAAC;IACjD,OAAO,EAAE,CAAC,mBAAmB,CAAC;IAC9B,EAAE,EAAE;QACF,WAAW,EACT,iJAAiJ;QACnJ,QAAQ,EAAE;YACR,WAAW;YACX,aAAa;YACb,QAAQ;YACR,UAAU;YACV,uBAAuB;YACvB,gBAAgB;YAChB,eAAe;YACf,YAAY;YACZ,cAAc;SACf;KACF;IACD,OAAO,EAAE,CAAC,mCAAe,EAAE,kDAAsB,CAAC;IAClD,QAAQ,EAAE,CAAC,wCAAiB,EAAE,qCAAgB,CAAC;CAChD,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const shareReportEmailAction: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
reportId: import("@taskmagic/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
to: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
subject: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
message: import("@taskmagic/pieces-framework").LongTextProperty<false>;
|
|
6
|
+
include_report_html: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
|
|
7
|
+
attach_export: import("@taskmagic/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
|
|
8
|
+
report_parameters: import("@taskmagic/pieces-framework").ObjectProperty<false>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shareReportEmailAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const form_data_1 = tslib_1.__importDefault(require("form-data"));
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const auth_1 = require("../common/auth");
|
|
10
|
+
exports.shareReportEmailAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.seekTableAuth,
|
|
12
|
+
name: 'share_report_email',
|
|
13
|
+
displayName: 'Share Report by Email',
|
|
14
|
+
description: 'Sends report in email body with optional attachments.',
|
|
15
|
+
props: {
|
|
16
|
+
reportId: pieces_framework_1.Property.Dropdown({
|
|
17
|
+
displayName: 'Report',
|
|
18
|
+
description: 'Select the report to share',
|
|
19
|
+
required: true,
|
|
20
|
+
refreshers: ['auth'],
|
|
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 authenticate first',
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const response = (yield (0, client_1.seekTableApiCall)({
|
|
31
|
+
auth: auth,
|
|
32
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
33
|
+
resourceUri: 'api/report',
|
|
34
|
+
}));
|
|
35
|
+
return {
|
|
36
|
+
options: response.map((report) => ({
|
|
37
|
+
label: report.Name,
|
|
38
|
+
value: report.Id,
|
|
39
|
+
})),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return {
|
|
44
|
+
disabled: true,
|
|
45
|
+
options: [],
|
|
46
|
+
placeholder: 'Error loading reports',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
}),
|
|
51
|
+
to: pieces_framework_1.Property.ShortText({
|
|
52
|
+
displayName: 'Recipient Email',
|
|
53
|
+
description: 'Email address of the recipient',
|
|
54
|
+
required: true,
|
|
55
|
+
}),
|
|
56
|
+
subject: pieces_framework_1.Property.ShortText({
|
|
57
|
+
displayName: 'Subject',
|
|
58
|
+
description: 'Email subject line',
|
|
59
|
+
required: true,
|
|
60
|
+
}),
|
|
61
|
+
message: pieces_framework_1.Property.LongText({
|
|
62
|
+
displayName: 'Message (Optional)',
|
|
63
|
+
description: 'Additional text content included in the email body',
|
|
64
|
+
required: false,
|
|
65
|
+
}),
|
|
66
|
+
include_report_html: pieces_framework_1.Property.Checkbox({
|
|
67
|
+
displayName: 'Include Report HTML in Email Body',
|
|
68
|
+
description: 'Place the report HTML directly into the email body',
|
|
69
|
+
required: false,
|
|
70
|
+
defaultValue: true,
|
|
71
|
+
}),
|
|
72
|
+
attach_export: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
73
|
+
displayName: 'Attach Export Files',
|
|
74
|
+
description: 'Select which export formats to attach to the email',
|
|
75
|
+
required: false,
|
|
76
|
+
options: {
|
|
77
|
+
options: [
|
|
78
|
+
{ label: 'PDF', value: 'pdf' },
|
|
79
|
+
{ label: 'CSV', value: 'csv' },
|
|
80
|
+
{ label: 'Excel', value: 'excel' },
|
|
81
|
+
{ label: 'Excel Pivot Table', value: 'excelpivottable' },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
}),
|
|
85
|
+
report_parameters: pieces_framework_1.Property.Object({
|
|
86
|
+
displayName: 'Report Parameters (Optional)',
|
|
87
|
+
description: 'JSON object with report parameters like {"param_name": "value"}',
|
|
88
|
+
required: false,
|
|
89
|
+
}),
|
|
90
|
+
},
|
|
91
|
+
run(context) {
|
|
92
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const { reportId, to, subject, message, include_report_html, attach_export, report_parameters, } = context.propsValue;
|
|
94
|
+
const formData = new form_data_1.default();
|
|
95
|
+
formData.append('to', to);
|
|
96
|
+
formData.append('subject', subject);
|
|
97
|
+
if (message) {
|
|
98
|
+
formData.append('message', message);
|
|
99
|
+
}
|
|
100
|
+
if (include_report_html !== undefined) {
|
|
101
|
+
formData.append('include_report_html', include_report_html ? 'true' : 'false');
|
|
102
|
+
}
|
|
103
|
+
if (attach_export && attach_export.length > 0) {
|
|
104
|
+
formData.append('attach_export', attach_export.join(','));
|
|
105
|
+
}
|
|
106
|
+
if (report_parameters && Object.keys(report_parameters).length > 0) {
|
|
107
|
+
formData.append('report_parameters', JSON.stringify(report_parameters));
|
|
108
|
+
}
|
|
109
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
110
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
111
|
+
url: `${client_1.BASE_URL}api/report/${reportId}/share/email`,
|
|
112
|
+
authentication: {
|
|
113
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
114
|
+
token: context.auth,
|
|
115
|
+
},
|
|
116
|
+
body: formData,
|
|
117
|
+
headers: Object.assign({}, formData.getHeaders()),
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
success: true,
|
|
121
|
+
message: 'Report shared successfully via email',
|
|
122
|
+
details: {
|
|
123
|
+
recipient: to,
|
|
124
|
+
subject: subject,
|
|
125
|
+
reportId: reportId,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
//# sourceMappingURL=share-report-email.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share-report-email.action.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/seek-table/src/lib/actions/share-report-email.action.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAIkC;AAClC,kEAAiC;AACjC,6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E;oBACb,OAAO,EAAE,OAAO;oBAChB,QAAQ,EAAE,QAAQ;iBACnB;aACF,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const uploadCsvAction: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
cubeId: import("@taskmagic/pieces-framework").DropdownProperty<string, false>;
|
|
3
|
+
filename: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
csvFile: import("@taskmagic/pieces-framework").FileProperty<true>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uploadCsvAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const form_data_1 = tslib_1.__importDefault(require("form-data"));
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const auth_1 = require("../common/auth");
|
|
10
|
+
const props_1 = require("../common/props");
|
|
11
|
+
exports.uploadCsvAction = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.seekTableAuth,
|
|
13
|
+
name: 'upload_csv',
|
|
14
|
+
displayName: 'Upload CSV File',
|
|
15
|
+
description: 'Uploads a CSV file and creates new or refreshes existing CSV cube.',
|
|
16
|
+
props: {
|
|
17
|
+
cubeId: props_1.seekTableProps.cubeId,
|
|
18
|
+
filename: props_1.seekTableProps.filename,
|
|
19
|
+
csvFile: props_1.seekTableProps.csvFile,
|
|
20
|
+
},
|
|
21
|
+
run(context) {
|
|
22
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const { cubeId, filename, csvFile } = context.propsValue;
|
|
24
|
+
let url = `${client_1.BASE_URL}api/cube/import/csv`;
|
|
25
|
+
const queryParams = new URLSearchParams();
|
|
26
|
+
if (cubeId) {
|
|
27
|
+
queryParams.append('cubeId', cubeId);
|
|
28
|
+
}
|
|
29
|
+
if (filename) {
|
|
30
|
+
queryParams.append('filename', filename);
|
|
31
|
+
}
|
|
32
|
+
if (queryParams.toString()) {
|
|
33
|
+
url += '?' + queryParams.toString();
|
|
34
|
+
}
|
|
35
|
+
const formData = new form_data_1.default();
|
|
36
|
+
if ((csvFile === null || csvFile === void 0 ? void 0 : csvFile.data) && (csvFile === null || csvFile === void 0 ? void 0 : csvFile.filename)) {
|
|
37
|
+
formData.append('file', csvFile.data, csvFile.filename);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw new Error('CSV file is required');
|
|
41
|
+
}
|
|
42
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
43
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
44
|
+
url: url,
|
|
45
|
+
authentication: {
|
|
46
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
47
|
+
token: context.auth,
|
|
48
|
+
},
|
|
49
|
+
body: formData,
|
|
50
|
+
headers: Object.assign({}, formData.getHeaders()),
|
|
51
|
+
});
|
|
52
|
+
return response.body;
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=upload-csv.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-csv.action.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/seek-table/src/lib/actions/upload-csv.action.ts"],"names":[],"mappings":";;;;AAAA,kEAA2D;AAC3D,4DAIkC;AAClC,kEAAiC;AACjC,6CAA4C;AAC5C,yCAA+C;AAC/C,2CAAiD;AAEpC,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,iBAAiB;IAC9B,WAA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AkB,CAAC,YAAY;oBACrC,KAAK,EAAE,OAAO,CAAC,IAAc;iBAC9B;gBACD,IAAI,EAAE,QAAQ;gBACd,OAAO,oBACF,QAAQ,CAAC,UAAU,EAAE,CACzB;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const seekTableAuth: import("@taskmagic/pieces-framework").SecretTextProperty<true>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.seekTableAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
7
|
+
const client_1 = require("./client");
|
|
8
|
+
function testEndpoint(auth) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
try {
|
|
11
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
12
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
13
|
+
url: `${client_1.BASE_URL}api/user/info`,
|
|
14
|
+
authentication: {
|
|
15
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
16
|
+
token: auth,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
catch (_a) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.seekTableAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
27
|
+
displayName: 'API Key',
|
|
28
|
+
description: 'Get your API key from Manage Account → Get API Key dialog in your SeekTable dashboard.',
|
|
29
|
+
required: true,
|
|
30
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
31
|
+
const isValid = yield testEndpoint(auth);
|
|
32
|
+
if (isValid) {
|
|
33
|
+
return { valid: true };
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
valid: false,
|
|
37
|
+
error: 'Invalid API key',
|
|
38
|
+
};
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/seek-table/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,4DAIkC;AAClC,kEAAwD;AACxD,qCAAoC;AAEpC,SAAe,YAAY,CAAC,IAAY;;QACtC,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,iBAAQ,eAAe;gBAC/B,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,IAAI;iBACZ;aACF,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CAAA;AAEY,QAAA,aAAa,GAAG,4BAAS,CAAC,UAAU,CAAC;IAChD,WAAW,EAAE,SAAS;IACtB,WAAW,EACT,wFAAwF;IAC1F,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,IAAc,CAAC,CAAC;QACnD,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAED,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,iBAAiB;SACzB,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HttpMethod } from '@taskmagic/pieces-common';
|
|
2
|
+
export declare const BASE_URL = "https://www.seektable.com/";
|
|
3
|
+
export declare const seekTableApiCall: ({ auth, method, resourceUri, body, }: {
|
|
4
|
+
auth: string;
|
|
5
|
+
method: HttpMethod;
|
|
6
|
+
resourceUri: string;
|
|
7
|
+
body?: unknown;
|
|
8
|
+
}) => Promise<any>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.seekTableApiCall = exports.BASE_URL = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
6
|
+
exports.BASE_URL = 'https://www.seektable.com/';
|
|
7
|
+
const seekTableApiCall = (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, method, resourceUri, body, }) {
|
|
8
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
9
|
+
method,
|
|
10
|
+
url: `${exports.BASE_URL}${resourceUri}`,
|
|
11
|
+
authentication: {
|
|
12
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
13
|
+
token: auth,
|
|
14
|
+
},
|
|
15
|
+
headers: {
|
|
16
|
+
'Content-Type': 'application/json',
|
|
17
|
+
'Accept-Encoding': 'identity',
|
|
18
|
+
},
|
|
19
|
+
body,
|
|
20
|
+
});
|
|
21
|
+
return response.body;
|
|
22
|
+
});
|
|
23
|
+
exports.seekTableApiCall = seekTableApiCall;
|
|
24
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/seek-table/src/lib/common/client.ts"],"names":[],"mappings":";;;;AAAA,4DAIkC;AAErB,QAAA,QAAQ,GAAG,4BAA4B,CAAC;AAE9C,MAAM,gBAAgB,GAAG,KAU7B,EAAE,oDAVkC,EACrC,IAAI,EACJ,MAAM,EACN,WAAW,EACX,IAAI,GAML;IACC,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;QAC5C,MAAM;QACN,GAAG,EAAE,GAAG,gBAAQ,GAAG,WAAW,EAAE;QAChC,cAAc,EAAE;YACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;YACrC,KAAK,EAAE,IAAI;SACZ;QACD,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,iBAAiB,EAAE,UAAU;SAC9B;QACD,IAAI;KACL,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAA,CAAC;AA1BW,QAAA,gBAAgB,oBA0B3B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.seekTableProps = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const client_1 = require("./client");
|
|
7
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
8
|
+
exports.seekTableProps = {
|
|
9
|
+
cubeId: pieces_framework_1.Property.Dropdown({
|
|
10
|
+
displayName: 'Existing Cube (Optional)',
|
|
11
|
+
description: 'Select an existing CSV cube to refresh, or leave empty to create a new cube',
|
|
12
|
+
required: false,
|
|
13
|
+
refreshers: ['auth'],
|
|
14
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
15
|
+
if (!auth) {
|
|
16
|
+
return {
|
|
17
|
+
disabled: true,
|
|
18
|
+
options: [],
|
|
19
|
+
placeholder: 'Please authenticate first',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const response = (yield (0, client_1.seekTableApiCall)({
|
|
24
|
+
auth: auth,
|
|
25
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
26
|
+
resourceUri: 'api/cube',
|
|
27
|
+
}));
|
|
28
|
+
const csvCubes = response.filter((cube) => cube.SourceTypeId === 'file-csv');
|
|
29
|
+
return {
|
|
30
|
+
options: csvCubes.map((cube) => ({
|
|
31
|
+
label: cube.Name,
|
|
32
|
+
value: cube.Id,
|
|
33
|
+
})),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return {
|
|
38
|
+
disabled: true,
|
|
39
|
+
options: [],
|
|
40
|
+
placeholder: 'Error loading cubes',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
}),
|
|
45
|
+
filename: pieces_framework_1.Property.ShortText({
|
|
46
|
+
displayName: 'Filename (Optional)',
|
|
47
|
+
description: 'Custom filename for the uploaded CSV. Include .gz or .zip extension if the file is compressed.',
|
|
48
|
+
required: false,
|
|
49
|
+
}),
|
|
50
|
+
csvFile: pieces_framework_1.Property.File({
|
|
51
|
+
displayName: 'CSV File',
|
|
52
|
+
description: 'The CSV file to upload. Can be plain CSV or compressed (.gz, .zip)',
|
|
53
|
+
required: true,
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/seek-table/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,kEAAuD;AACvD,qCAA4C;AAC5C,4DAAsD;AAWzC,QAAA,cAAc,GAAG;IAC5B,MAAM,EAAE,2BAAQ,CAAC,QAAQ,CAAC;QACxB,WAAW,EAAE,0BAA0B;QACvC,WAAW,EACT,6EAA6E;QAC/E,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,CAAC,MAAM,CAAC;QACpB,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,2BAA2B;iBACzC,CAAC;YACJ,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAA,yBAAgB,EAAC;oBACvC,IAAI,EAAE,IAAc;oBACpB,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,WAAW,EAAE,UAAU;iBACxB,CAAC,CAAW,CAAC;gBAEd,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAC9B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,KAAK,UAAU,CAC3C,CAAC;gBAEF,OAAO;oBACL,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;wBAC/B,KAAK,EAAE,IAAI,CAAC,IAAI;wBAChB,KAAK,EAAE,IAAI,CAAC,EAAE;qBACf,CAAC,CAAC;iBACJ,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,qBAAqB;iBACnC,CAAC;YACJ,CAAC;QACH,CAAC,CAAA;KACF,CAAC;IACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;QAC3B,WAAW,EAAE,qBAAqB;QAClC,WAAW,EACT,gGAAgG;QAClG,QAAQ,EAAE,KAAK;KAChB,CAAC;IACF,OAAO,EAAE,2BAAQ,CAAC,IAAI,CAAC;QACrB,WAAW,EAAE,UAAU;QACvB,WAAW,EACT,oEAAoE;QACtE,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@taskmagic/pieces-framework';
|
|
2
|
+
export declare const newCsvCubeTrigger: import("@taskmagic/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@taskmagic/pieces-framework").SecretTextProperty<true>, {}> | import("@taskmagic/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@taskmagic/pieces-framework").SecretTextProperty<true>, {}> | import("@taskmagic/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@taskmagic/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newCsvCubeTrigger = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const polling = {
|
|
10
|
+
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
11
|
+
items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
12
|
+
const response = (yield (0, client_1.seekTableApiCall)({
|
|
13
|
+
auth: auth,
|
|
14
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
15
|
+
resourceUri: 'api/cube',
|
|
16
|
+
}));
|
|
17
|
+
return response
|
|
18
|
+
.filter((cube) => cube.SourceTypeId === 'file-csv')
|
|
19
|
+
.map((cube) => ({
|
|
20
|
+
epochMilliSeconds: Date.parse(cube.CreateDate),
|
|
21
|
+
data: cube,
|
|
22
|
+
}));
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
exports.newCsvCubeTrigger = (0, pieces_framework_1.createTrigger)({
|
|
26
|
+
auth: auth_1.seekTableAuth,
|
|
27
|
+
name: 'new_csv_cube',
|
|
28
|
+
displayName: 'New CSV Cube',
|
|
29
|
+
description: 'Triggers when a new CSV cube is added to your SeekTable account.',
|
|
30
|
+
type: pieces_framework_1.TriggerStrategy.POLLING,
|
|
31
|
+
props: {},
|
|
32
|
+
sampleData: {
|
|
33
|
+
Id: '7f74de2546804cf9b12da34d7e5af382',
|
|
34
|
+
Name: 'Superstore Sales',
|
|
35
|
+
SourceType: 'File (CSV)',
|
|
36
|
+
SourceTypeId: 'file-csv',
|
|
37
|
+
SourceFile: 'Superstore Sales.zip',
|
|
38
|
+
CreateDate: '2024-10-19T08:14:50.736952',
|
|
39
|
+
},
|
|
40
|
+
test(context) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
return yield pieces_common_1.pollingHelper.test(polling, {
|
|
43
|
+
store: context.store,
|
|
44
|
+
auth: context.auth,
|
|
45
|
+
propsValue: {},
|
|
46
|
+
files: context.files,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
onEnable(context) {
|
|
51
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
yield pieces_common_1.pollingHelper.onEnable(polling, {
|
|
53
|
+
store: context.store,
|
|
54
|
+
auth: context.auth,
|
|
55
|
+
propsValue: {},
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
onDisable(context) {
|
|
60
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
yield pieces_common_1.pollingHelper.onDisable(polling, {
|
|
62
|
+
store: context.store,
|
|
63
|
+
auth: context.auth,
|
|
64
|
+
propsValue: {},
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
run(context) {
|
|
69
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
return yield pieces_common_1.pollingHelper.poll(polling, {
|
|
71
|
+
store: context.store,
|
|
72
|
+
auth: context.auth,
|
|
73
|
+
propsValue: {},
|
|
74
|
+
files: context.files,
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=new-csv-cube.trigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-csv-cube.trigger.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/seek-table/src/lib/triggers/new-csv-cube.trigger.ts"],"names":[],"mappings":";;;;AAAA,4DAKkC;AAClC,kEAIqC;AACrC,yCAA+C;AAC/C,6CAAoD;AAWpD,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACpB,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAA,yBAAgB,EAAC;YACvC,IAAI,EAAE,IAAc;YACpB,MAAM,EAAE,0BAAU,CAAC,GAAG;YACtB,WAAW,EAAE,UAAU;SACxB,CAAC,CAAW,CAAC;QAEd,OAAO,QAAQ;aACZ,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,KAAK,UAAU,CAAC;aAClD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACd,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;YAC9C,IAAI,EAAE,IAAI;SACX,CAAC,CAAC,CAAC;IACR,CAAC,CAAA;CACF,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAA,gCAAa,EAAC;IAC7C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,kEAAkE;IAC/E,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE,EAAE;IACT,UAAU,EAAE;QACV,EAAE,EAAE,kCAAkC;QACtC,IAAI,EAAE,kBAAkB;QACxB,UAAU,EAAE,YAAY;QACxB,YAAY,EAAE,UAAU;QACxB,UAAU,EAAE,sBAAsB;QAClC,UAAU,EAAE,4BAA4B;KACzC;IACK,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE;gBACvC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,UAAU,EAAE,EAAE;gBACd,KAAK,EAAE,OAAO,CAAC,KAAK;aACrB,CAAC,CAAC;QACL,CAAC;KAAA;IACK,QAAQ,CAAC,OAAO;;YACpB,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE;gBACpC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,UAAU,EAAE,EAAE;aACf,CAAC,CAAC;QACL,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE;gBACrC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,UAAU,EAAE,EAAE;aACf,CAAC,CAAC;QACL,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE;gBACvC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,UAAU,EAAE,EAAE;gBACd,KAAK,EAAE,OAAO,CAAC,KAAK;aACrB,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@taskmagic/pieces-framework';
|
|
2
|
+
export declare const newReportTrigger: import("@taskmagic/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@taskmagic/pieces-framework").SecretTextProperty<true>, {}> | import("@taskmagic/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@taskmagic/pieces-framework").SecretTextProperty<true>, {}> | import("@taskmagic/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@taskmagic/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newReportTrigger = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const polling = {
|
|
10
|
+
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
11
|
+
items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
12
|
+
const response = (yield (0, client_1.seekTableApiCall)({
|
|
13
|
+
auth: auth,
|
|
14
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
15
|
+
resourceUri: 'api/report',
|
|
16
|
+
}));
|
|
17
|
+
return response.map((report) => ({
|
|
18
|
+
epochMilliSeconds: report.CreateDate
|
|
19
|
+
? Date.parse(report.CreateDate)
|
|
20
|
+
: Date.now(),
|
|
21
|
+
data: report,
|
|
22
|
+
}));
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
exports.newReportTrigger = (0, pieces_framework_1.createTrigger)({
|
|
26
|
+
auth: auth_1.seekTableAuth,
|
|
27
|
+
name: 'new_report',
|
|
28
|
+
displayName: 'New Report',
|
|
29
|
+
description: 'Triggers when a new report is added to your SeekTable account.',
|
|
30
|
+
type: pieces_framework_1.TriggerStrategy.POLLING,
|
|
31
|
+
props: {},
|
|
32
|
+
sampleData: {
|
|
33
|
+
Id: 'edb1ee25d81c4acd96d2c9d0f819afde',
|
|
34
|
+
Name: 'Total by Year',
|
|
35
|
+
ReportType: 'pivot',
|
|
36
|
+
Config: '{report_JSON_config}',
|
|
37
|
+
},
|
|
38
|
+
test(context) {
|
|
39
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return yield pieces_common_1.pollingHelper.test(polling, {
|
|
41
|
+
store: context.store,
|
|
42
|
+
auth: context.auth,
|
|
43
|
+
propsValue: {},
|
|
44
|
+
files: context.files,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
onEnable(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
yield pieces_common_1.pollingHelper.onEnable(polling, {
|
|
51
|
+
store: context.store,
|
|
52
|
+
auth: context.auth,
|
|
53
|
+
propsValue: {},
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
onDisable(context) {
|
|
58
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
yield pieces_common_1.pollingHelper.onDisable(polling, {
|
|
60
|
+
store: context.store,
|
|
61
|
+
auth: context.auth,
|
|
62
|
+
propsValue: {},
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
run(context) {
|
|
67
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
return yield pieces_common_1.pollingHelper.poll(polling, {
|
|
69
|
+
store: context.store,
|
|
70
|
+
auth: context.auth,
|
|
71
|
+
propsValue: {},
|
|
72
|
+
files: context.files,
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=new-report.trigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-report.trigger.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/seek-table/src/lib/triggers/new-report.trigger.ts"],"names":[],"mappings":";;;;AAAA,4DAKkC;AAClC,kEAIqC;AACrC,yCAA+C;AAC/C,6CAAoD;AAUpD,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACpB,MAAM,QAAQ,GAAG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