@activepieces/piece-fathom-analytics 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/package.json +17 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +40 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-event.d.ts +4 -0
- package/src/lib/actions/create-event.js +43 -0
- package/src/lib/actions/create-event.js.map +1 -0
- package/src/lib/actions/get-aggregation.d.ts +15 -0
- package/src/lib/actions/get-aggregation.js +142 -0
- package/src/lib/actions/get-aggregation.js.map +1 -0
- package/src/lib/actions/get-site.d.ts +3 -0
- package/src/lib/actions/get-site.js +34 -0
- package/src/lib/actions/get-site.js.map +1 -0
- package/src/lib/actions/list-events.d.ts +6 -0
- package/src/lib/actions/list-events.js +58 -0
- package/src/lib/actions/list-events.js.map +1 -0
- package/src/lib/actions/list-sites.d.ts +5 -0
- package/src/lib/actions/list-sites.js +53 -0
- package/src/lib/actions/list-sites.js.map +1 -0
- package/src/lib/auth.d.ts +2 -0
- package/src/lib/auth.js +38 -0
- package/src/lib/auth.js.map +1 -0
- package/src/lib/common.d.ts +16 -0
- package/src/lib/common.js +37 -0
- package/src/lib/common.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-fathom-analytics",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@activepieces/pieces-common": "0.12.0",
|
|
9
|
+
"@activepieces/pieces-framework": "0.26.0",
|
|
10
|
+
"@activepieces/shared": "0.46.0",
|
|
11
|
+
"tslib": "2.6.2"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
15
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fathomAnalytics: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fathomAnalytics = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const shared_1 = require("@activepieces/shared");
|
|
7
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
+
const auth_1 = require("./lib/auth");
|
|
9
|
+
const list_sites_1 = require("./lib/actions/list-sites");
|
|
10
|
+
const get_site_1 = require("./lib/actions/get-site");
|
|
11
|
+
const create_event_1 = require("./lib/actions/create-event");
|
|
12
|
+
const list_events_1 = require("./lib/actions/list-events");
|
|
13
|
+
const get_aggregation_1 = require("./lib/actions/get-aggregation");
|
|
14
|
+
exports.fathomAnalytics = (0, pieces_framework_1.createPiece)({
|
|
15
|
+
displayName: 'Fathom Analytics',
|
|
16
|
+
description: 'Privacy-focused website analytics. Query your site traffic, manage sites and events, and generate custom reports.',
|
|
17
|
+
minimumSupportedRelease: '0.30.0',
|
|
18
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/fathom-analytics.png',
|
|
19
|
+
categories: [shared_1.PieceCategory.MARKETING, shared_1.PieceCategory.BUSINESS_INTELLIGENCE],
|
|
20
|
+
auth: auth_1.fathomAuth,
|
|
21
|
+
actions: [
|
|
22
|
+
list_sites_1.listSites,
|
|
23
|
+
get_site_1.getSite,
|
|
24
|
+
create_event_1.createEvent,
|
|
25
|
+
list_events_1.listEvents,
|
|
26
|
+
get_aggregation_1.getAggregation,
|
|
27
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
28
|
+
auth: auth_1.fathomAuth,
|
|
29
|
+
baseUrl: () => auth_1.FATHOM_API_BASE,
|
|
30
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
+
return ({
|
|
32
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
33
|
+
});
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
],
|
|
37
|
+
authors: ['Harmatta', 'sanket-a11y'],
|
|
38
|
+
triggers: [],
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,iDAAqD;AACrD,+DAAwE;AACxE,qCAAyD;AACzD,yDAAqD;AACrD,qDAAiD;AACjD,6DAAyD;AACzD,2DAAuD;AACvD,mEAA+D;AAElD,QAAA,eAAe,GAAG,IAAA,8BAAW,EAAC;IACzC,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,mHAAmH;IACrH,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,0DAA0D;IACnE,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,EAAE,sBAAa,CAAC,qBAAqB,CAAC;IAC1E,IAAI,EAAE,iBAAU;IAChB,OAAO,EAAE;QACP,sBAAS;QACT,kBAAO;QACP,0BAAW;QACX,wBAAU;QACV,gCAAc;QACd,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,iBAAU;YAChB,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAe;YAC9B,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;iBAC5C,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,OAAO,EAAE,CAAC,UAAU,EAAC,aAAa,CAAC;IACnC,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const createEvent: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
site_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createEvent = 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 auth_1 = require("../auth");
|
|
8
|
+
exports.createEvent = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'create_event',
|
|
10
|
+
displayName: 'Create Event',
|
|
11
|
+
description: 'Create a custom event (goal) for a specific site.',
|
|
12
|
+
auth: auth_1.fathomAuth,
|
|
13
|
+
props: {
|
|
14
|
+
site_id: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Site ID',
|
|
16
|
+
description: 'The unique identifier for the Fathom site.',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
name: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Event Name',
|
|
21
|
+
description: 'The name of the event/goal (e.g., "Signup", "Purchase").',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
run(context) {
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const { auth, propsValue } = context;
|
|
28
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
29
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
30
|
+
url: `${auth_1.FATHOM_API_BASE}/sites/${propsValue.site_id}/events`,
|
|
31
|
+
headers: {
|
|
32
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
33
|
+
'Content-Type': 'application/json',
|
|
34
|
+
},
|
|
35
|
+
body: {
|
|
36
|
+
name: propsValue.name,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
return response.body;
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=create-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-event.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-event.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAsD;AAEzC,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,mDAAmD;IAChE,IAAI,EAAE,iBAAU;IAChB,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAErC,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAM1C;gBACD,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,sBAAe,UAAU,UAAU,CAAC,OAAO,SAAS;gBAC5D,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;oBAC3C,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,UAAU,CAAC,IAAI;iBACtB;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const getAggregation: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
entity: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
3
|
+
entity_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
site_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
entity_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
aggregates: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, true>;
|
|
7
|
+
date_grouping: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
8
|
+
field_grouping: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
+
date_from: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
date_to: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
timezone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
sort_by: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
14
|
+
filters: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAggregation = 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 auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.getAggregation = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'get_aggregation',
|
|
11
|
+
displayName: 'Get Aggregation',
|
|
12
|
+
description: 'Generate a custom analytics aggregation report. Supports flexible grouping, filtering, and date ranges.',
|
|
13
|
+
auth: auth_1.fathomAuth,
|
|
14
|
+
props: {
|
|
15
|
+
entity: pieces_framework_1.Property.StaticDropdown({
|
|
16
|
+
displayName: 'Entity Type',
|
|
17
|
+
description: 'Whether to aggregate pageviews or events.',
|
|
18
|
+
required: true,
|
|
19
|
+
options: {
|
|
20
|
+
options: common_1.ENTITY_OPTIONS,
|
|
21
|
+
},
|
|
22
|
+
defaultValue: 'pageview',
|
|
23
|
+
}),
|
|
24
|
+
entity_id: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'Site ID (for Pageviews)',
|
|
26
|
+
description: 'The Fathom site ID to query (e.g., CDBUGS). Required when Entity Type is "Pageview".',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
site_id: pieces_framework_1.Property.ShortText({
|
|
30
|
+
displayName: 'Site ID (for Events)',
|
|
31
|
+
description: 'The Fathom site ID that owns the event. Required when Entity Type is "Event".',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
entity_name: pieces_framework_1.Property.ShortText({
|
|
35
|
+
displayName: 'Event ID',
|
|
36
|
+
description: 'The ID of the specific event to aggregate. Required when Entity Type is "Event". Find event IDs via the List Events action.',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
aggregates: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
40
|
+
displayName: 'Aggregates',
|
|
41
|
+
description: 'The metrics to include in the report.',
|
|
42
|
+
required: true,
|
|
43
|
+
options: {
|
|
44
|
+
options: common_1.AGGREGATION_OPTIONS,
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
date_grouping: pieces_framework_1.Property.StaticDropdown({
|
|
48
|
+
displayName: 'Date Grouping',
|
|
49
|
+
description: 'Group results by this time unit.',
|
|
50
|
+
required: false,
|
|
51
|
+
options: {
|
|
52
|
+
options: common_1.DATE_GROUPING_OPTIONS,
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
field_grouping: pieces_framework_1.Property.StaticDropdown({
|
|
56
|
+
displayName: 'Field Grouping',
|
|
57
|
+
description: 'Group results by this field (e.g., pathname, browser). Makes the report actionable by breaking down totals.',
|
|
58
|
+
required: false,
|
|
59
|
+
options: {
|
|
60
|
+
options: common_1.FIELD_GROUPING_OPTIONS,
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
date_from: pieces_framework_1.Property.ShortText({
|
|
64
|
+
displayName: 'Date From',
|
|
65
|
+
description: 'Start date for the report in ISO 8601 format (e.g., 2024-01-01T00:00:00.000000Z).',
|
|
66
|
+
required: false,
|
|
67
|
+
}),
|
|
68
|
+
date_to: pieces_framework_1.Property.ShortText({
|
|
69
|
+
displayName: 'Date To',
|
|
70
|
+
description: 'End date for the report in ISO 8601 format (e.g., 2024-12-31T23:59:59.999999Z).',
|
|
71
|
+
required: false,
|
|
72
|
+
}),
|
|
73
|
+
timezone: pieces_framework_1.Property.ShortText({
|
|
74
|
+
displayName: 'Timezone',
|
|
75
|
+
description: 'Timezone for the report (e.g., "America/New_York", "Europe/London"). Defaults to UTC.',
|
|
76
|
+
required: false,
|
|
77
|
+
}),
|
|
78
|
+
sort_by: pieces_framework_1.Property.ShortText({
|
|
79
|
+
displayName: 'Sort By',
|
|
80
|
+
description: 'Field and direction to sort by (e.g., "pageviews:desc" or "uniques:asc").',
|
|
81
|
+
required: false,
|
|
82
|
+
}),
|
|
83
|
+
limit: pieces_framework_1.Property.Number({
|
|
84
|
+
displayName: 'Limit',
|
|
85
|
+
description: 'Maximum number of results to return.',
|
|
86
|
+
required: false,
|
|
87
|
+
defaultValue: 20,
|
|
88
|
+
}),
|
|
89
|
+
filters: pieces_framework_1.Property.Json({
|
|
90
|
+
displayName: 'Filters',
|
|
91
|
+
description: 'Optional array of filter objects. Example: [{"property": "pathname", "operator": "is", "value": "/blog"}]',
|
|
92
|
+
required: false,
|
|
93
|
+
}),
|
|
94
|
+
},
|
|
95
|
+
run(context) {
|
|
96
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const { auth, propsValue } = context;
|
|
98
|
+
const queryParams = {
|
|
99
|
+
entity: propsValue.entity,
|
|
100
|
+
aggregates: Array.isArray(propsValue.aggregates)
|
|
101
|
+
? propsValue.aggregates.join(',')
|
|
102
|
+
: String(propsValue.aggregates),
|
|
103
|
+
};
|
|
104
|
+
if (propsValue.entity === 'event') {
|
|
105
|
+
if (propsValue.site_id)
|
|
106
|
+
queryParams['site_id'] = propsValue.site_id;
|
|
107
|
+
if (propsValue.entity_name)
|
|
108
|
+
queryParams['entity_name'] = propsValue.entity_name;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
if (propsValue.entity_id)
|
|
112
|
+
queryParams['entity_id'] = propsValue.entity_id;
|
|
113
|
+
}
|
|
114
|
+
if (propsValue.date_grouping)
|
|
115
|
+
queryParams['date_grouping'] = propsValue.date_grouping;
|
|
116
|
+
if (propsValue.field_grouping)
|
|
117
|
+
queryParams['field_grouping'] = propsValue.field_grouping;
|
|
118
|
+
if (propsValue.date_from)
|
|
119
|
+
queryParams['date_from'] = propsValue.date_from;
|
|
120
|
+
if (propsValue.date_to)
|
|
121
|
+
queryParams['date_to'] = propsValue.date_to;
|
|
122
|
+
if (propsValue.timezone)
|
|
123
|
+
queryParams['timezone'] = propsValue.timezone;
|
|
124
|
+
if (propsValue.sort_by)
|
|
125
|
+
queryParams['sort_by'] = propsValue.sort_by;
|
|
126
|
+
if (propsValue.limit != null)
|
|
127
|
+
queryParams['limit'] = String(propsValue.limit);
|
|
128
|
+
if (propsValue.filters)
|
|
129
|
+
queryParams['filters'] = JSON.stringify(propsValue.filters);
|
|
130
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
131
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
132
|
+
url: `${auth_1.FATHOM_API_BASE}/aggregations`,
|
|
133
|
+
headers: {
|
|
134
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
135
|
+
},
|
|
136
|
+
queryParams,
|
|
137
|
+
});
|
|
138
|
+
return response.body;
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
//# sourceMappingURL=get-aggregation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-aggregation.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-aggregation.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAsD;AACtD,sCAKmB;AAEN,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EACT,yGAAyG;IAC3G,IAAI,EAAE,iBAAU;IAChB,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,2CAA2C;YACxD,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,uBAAc;aACxB;YACD,YAAY,EAAE,UAAU;SACzB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,yBAAyB;YACtC,WAAW,EACT,sFAAsF;YACxF,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,sBAAsB;YACnC,WAAW,EACT,+EAA+E;YACjF,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,UAAU;YACvB,WAAW,EACT,6HAA6H;YAC/H,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,yBAA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AW,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC;YACvE,IAAI,UAAU,CAAC,OAAO;gBAAE,WAAW,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC;YACpE,IAAI,UAAU,CAAC,KAAK,IAAI,IAAI;gBAC1B,WAAW,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAClD,IAAI,UAAU,CAAC,OAAO;gBACpB,WAAW,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAE9D,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAE3C;gBACA,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,sBAAe,eAAe;gBACtC,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;iBAC5C;gBACD,WAAW;aACZ,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSite = 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 auth_1 = require("../auth");
|
|
8
|
+
exports.getSite = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'get_site',
|
|
10
|
+
displayName: 'Get Site',
|
|
11
|
+
description: 'Retrieve details for a specific site by its ID.',
|
|
12
|
+
auth: auth_1.fathomAuth,
|
|
13
|
+
props: {
|
|
14
|
+
site_id: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Site ID',
|
|
16
|
+
description: 'The unique identifier for the Fathom site (e.g., CDBUGS).',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
},
|
|
20
|
+
run(context) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const { auth, propsValue } = context;
|
|
23
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
24
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
25
|
+
url: `${auth_1.FATHOM_API_BASE}/sites/${propsValue.site_id}`,
|
|
26
|
+
headers: {
|
|
27
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
return response.body;
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=get-site.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-site.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-site.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAsD;AAEzC,QAAA,OAAO,GAAG,IAAA,+BAAY,EAAC;IAClC,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,iDAAiD;IAC9D,IAAI,EAAE,iBAAU;IAChB,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,2DAA2D;YACxE,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAErC,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAM1C;gBACD,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,sBAAe,UAAU,UAAU,CAAC,OAAO,EAAE;gBACrD,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;iBAC5C;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const listEvents: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
site_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
4
|
+
starting_after: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
ending_before: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listEvents = 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 auth_1 = require("../auth");
|
|
8
|
+
exports.listEvents = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'list_events',
|
|
10
|
+
displayName: 'List Events',
|
|
11
|
+
description: 'List all custom events (goals) for a specific site.',
|
|
12
|
+
auth: auth_1.fathomAuth,
|
|
13
|
+
props: {
|
|
14
|
+
site_id: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Site ID',
|
|
16
|
+
description: 'The unique identifier for the Fathom site.',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
limit: pieces_framework_1.Property.Number({
|
|
20
|
+
displayName: 'Limit',
|
|
21
|
+
description: 'Number of events to return (1–100). Default is 10.',
|
|
22
|
+
required: false,
|
|
23
|
+
defaultValue: 10,
|
|
24
|
+
}),
|
|
25
|
+
starting_after: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Starting After (Cursor)',
|
|
27
|
+
description: 'Cursor for forward pagination — the last event ID from the previous page.',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
ending_before: pieces_framework_1.Property.ShortText({
|
|
31
|
+
displayName: 'Ending Before (Cursor)',
|
|
32
|
+
description: 'Cursor for backward pagination — the first event ID from the previous page.',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
run(context) {
|
|
37
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const { auth, propsValue } = context;
|
|
39
|
+
const params = {};
|
|
40
|
+
if (propsValue.limit != null)
|
|
41
|
+
params['limit'] = String(propsValue.limit);
|
|
42
|
+
if (propsValue.starting_after)
|
|
43
|
+
params['starting_after'] = propsValue.starting_after;
|
|
44
|
+
if (propsValue.ending_before)
|
|
45
|
+
params['ending_before'] = propsValue.ending_before;
|
|
46
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
47
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
48
|
+
url: `${auth_1.FATHOM_API_BASE}/sites/${propsValue.site_id}/events`,
|
|
49
|
+
headers: {
|
|
50
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
51
|
+
},
|
|
52
|
+
queryParams: params,
|
|
53
|
+
});
|
|
54
|
+
return response.body;
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=list-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-events.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-events.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAsD;AAEzC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,qDAAqD;IAClE,IAAI,EAAE,iBAAU;IAChB,KAAK,EAAE;QACL,O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E,MAAM;aACpB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const listSites: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
3
|
+
starting_after: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
ending_before: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listSites = 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 auth_1 = require("../auth");
|
|
8
|
+
exports.listSites = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'list_sites',
|
|
10
|
+
displayName: 'List Sites',
|
|
11
|
+
description: 'Return a list of all sites this API key has access to.',
|
|
12
|
+
auth: auth_1.fathomAuth,
|
|
13
|
+
props: {
|
|
14
|
+
limit: pieces_framework_1.Property.Number({
|
|
15
|
+
displayName: 'Limit',
|
|
16
|
+
description: 'Number of sites to return (1–100). Default is 10.',
|
|
17
|
+
required: false,
|
|
18
|
+
defaultValue: 10,
|
|
19
|
+
}),
|
|
20
|
+
starting_after: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Starting After (Cursor)',
|
|
22
|
+
description: 'Cursor for forward pagination — the last site ID from the previous page.',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
ending_before: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Ending Before (Cursor)',
|
|
27
|
+
description: 'Cursor for backward pagination — the first site ID from the previous page.',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
run(context) {
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const { auth, propsValue } = context;
|
|
34
|
+
const params = {};
|
|
35
|
+
if (propsValue.limit != null)
|
|
36
|
+
params['limit'] = String(propsValue.limit);
|
|
37
|
+
if (propsValue.starting_after)
|
|
38
|
+
params['starting_after'] = propsValue.starting_after;
|
|
39
|
+
if (propsValue.ending_before)
|
|
40
|
+
params['ending_before'] = propsValue.ending_before;
|
|
41
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
42
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
43
|
+
url: `${auth_1.FATHOM_API_BASE}/sites`,
|
|
44
|
+
headers: {
|
|
45
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
46
|
+
},
|
|
47
|
+
queryParams: params,
|
|
48
|
+
});
|
|
49
|
+
return response.body;
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=list-sites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-sites.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-sites.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAsD;AAEzC,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,wDAAwD;IACrE,IAAI,EAAE,iBAAU;IAChB,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SACjB,CAAC;QACF,cAAc,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,yBAAyB;YACtC,WAAW,EAAE,0EAA0E;YACvF,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,wBAAwB;YACrC,WAAW,EAAE,4EAA4E;YACzF,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YACrC,MAAM,MAAM,GAA2B,EAAE,CAAC;YAE1C,IAAI,UAAU,CAAC,KAAK,IAAI,IAAI;gBAAE,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACzE,IAAI,UAAU,CAAC,cAAc;gBAAE,MAAM,CAAC,gBAAgB,CAAC,GAAG,UAAU,CAAC,cAAc,CAAC;YACpF,IAAI,UAAU,CAAC,aAAa;gBAAE,MAAM,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC,aAAa,CAAC;YAEjF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAS1C;gBACD,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,sBAAe,QAAQ;gBAC/B,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;iBAC5C;gBACD,WAAW,EAAE,MAAM;aACpB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
package/src/lib/auth.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fathomAuth = exports.FATHOM_API_BASE = 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
|
+
exports.FATHOM_API_BASE = 'https://api.usefathom.com/v1';
|
|
8
|
+
exports.fathomAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
9
|
+
displayName: 'API Token',
|
|
10
|
+
description: `
|
|
11
|
+
To create an API token:
|
|
12
|
+
1. Go to [https://app.usefathom.com/api](https://app.usefathom.com/api)
|
|
13
|
+
2. Click **Create new**
|
|
14
|
+
3. Give your token a name and set permissions (Admin, Read Only, or site-specific)
|
|
15
|
+
4. Click **Save changes**
|
|
16
|
+
5. Copy your API token — you won't be able to retrieve it again after navigating away
|
|
17
|
+
`,
|
|
18
|
+
required: true,
|
|
19
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
20
|
+
try {
|
|
21
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
22
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
23
|
+
url: `${exports.FATHOM_API_BASE}/account`,
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: `Bearer ${auth}`,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return { valid: true };
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
return {
|
|
32
|
+
valid: false,
|
|
33
|
+
error: 'Invalid API token. Please check your Fathom API credentials.',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAqE;AAExD,QAAA,eAAe,GAAG,8BAA8B,CAAC;AAEjD,QAAA,UAAU,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC7C,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE;;;;;;;GAOZ;IACD,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,uBAAe,UAAU;gBACjC,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,EAAE;iBAChC;aACF,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,8DAA8D;aACtE,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const ENTITY_OPTIONS: {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}[];
|
|
5
|
+
export declare const AGGREGATION_OPTIONS: {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare const DATE_GROUPING_OPTIONS: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
export declare const FIELD_GROUPING_OPTIONS: {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FIELD_GROUPING_OPTIONS = exports.DATE_GROUPING_OPTIONS = exports.AGGREGATION_OPTIONS = exports.ENTITY_OPTIONS = void 0;
|
|
4
|
+
exports.ENTITY_OPTIONS = [
|
|
5
|
+
{ label: 'Pageview', value: 'pageview' },
|
|
6
|
+
{ label: 'Event', value: 'event' },
|
|
7
|
+
];
|
|
8
|
+
exports.AGGREGATION_OPTIONS = [
|
|
9
|
+
{ label: 'Pageviews', value: 'pageviews' },
|
|
10
|
+
{ label: 'Visits', value: 'visits' },
|
|
11
|
+
{ label: 'Uniques', value: 'uniques' },
|
|
12
|
+
{ label: 'Avg Duration', value: 'avg_duration' },
|
|
13
|
+
{ label: 'Bounce Rate', value: 'bounce_rate' },
|
|
14
|
+
];
|
|
15
|
+
exports.DATE_GROUPING_OPTIONS = [
|
|
16
|
+
{ label: 'Hour', value: 'hour' },
|
|
17
|
+
{ label: 'Day', value: 'day' },
|
|
18
|
+
{ label: 'Month', value: 'month' },
|
|
19
|
+
{ label: 'Year', value: 'year' },
|
|
20
|
+
];
|
|
21
|
+
exports.FIELD_GROUPING_OPTIONS = [
|
|
22
|
+
{ label: 'Pathname', value: 'pathname' },
|
|
23
|
+
{ label: 'Hostname', value: 'hostname' },
|
|
24
|
+
{ label: 'Referrer Hostname', value: 'referrer_hostname' },
|
|
25
|
+
{ label: 'Referrer Pathname', value: 'referrer_pathname' },
|
|
26
|
+
{ label: 'Browser', value: 'browser' },
|
|
27
|
+
{ label: 'Browser Version', value: 'browser_version' },
|
|
28
|
+
{ label: 'Device Type', value: 'device_type' },
|
|
29
|
+
{ label: 'Country Code', value: 'country_code' },
|
|
30
|
+
{ label: 'City', value: 'city' },
|
|
31
|
+
{ label: 'UTM Source', value: 'utm_source' },
|
|
32
|
+
{ label: 'UTM Medium', value: 'utm_medium' },
|
|
33
|
+
{ label: 'UTM Campaign', value: 'utm_campaign' },
|
|
34
|
+
{ label: 'UTM Term', value: 'utm_term' },
|
|
35
|
+
{ label: 'UTM Content', value: 'utm_content' },
|
|
36
|
+
];
|
|
37
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/lib/common.ts"],"names":[],"mappings":";;;AACa,QAAA,cAAc,GAAG;IAC5B,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;IACxC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAA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