@activepieces/piece-livesession 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-livesession
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build pieces-livesession` to build the library.
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@activepieces/piece-livesession",
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.1",
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 @@
1
+ export declare const livesession: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
package/src/index.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.livesession = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("./lib/common/auth");
7
+ const session_event_1 = require("./lib/triggers/session-event");
8
+ const pieces_common_1 = require("@activepieces/pieces-common");
9
+ const shared_1 = require("@activepieces/shared");
10
+ exports.livesession = (0, pieces_framework_1.createPiece)({
11
+ displayName: 'LiveSession',
12
+ auth: auth_1.livesessionAuth,
13
+ minimumSupportedRelease: '0.36.1',
14
+ description: 'LLiveSession is the analytics platform that helps businesses scale up based on data.',
15
+ categories: [shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE],
16
+ logoUrl: 'https://cdn.activepieces.com/pieces/livesession.png',
17
+ authors: ['sanket-a11y'],
18
+ actions: [
19
+ (0, pieces_common_1.createCustomApiCallAction)({
20
+ auth: auth_1.livesessionAuth,
21
+ baseUrl: () => 'https://api.livesession.io/v1',
22
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
23
+ return {
24
+ Authorization: `Bearer ${auth.secret_text}`,
25
+ };
26
+ }),
27
+ }),
28
+ ],
29
+ triggers: [session_event_1.sessionEvent],
30
+ });
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/livesession/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,4CAAoD;AACpD,gEAA4D;AAC5D,+DAAwE;AACxE,iDAAqD;AAExC,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACrC,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,sBAAe;IACrB,uBAAuB,EAAE,QAAQ;IACjC,WAAW,EACT,sFAAsF;IACxF,UAAU,EAAE,CAAC,sBAAa,CAAC,uBAAuB,CAAC;IACnD,OAAO,EAAE,qDAAqD;IAC9D,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,OAAO,EAAE;QACP,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,sBAAe;YACrB,OAAO,EAAE,GAAG,EAAE,CAAC,+BAA+B;YAC9C,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;iBAC5C,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,CAAC,4BAAY,CAAC;CACzB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const livesessionAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.livesessionAuth = void 0;
4
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
+ exports.livesessionAuth = pieces_framework_1.PieceAuth.SecretText({
6
+ displayName: 'API Key',
7
+ description: `r LiveSession API authentication.
8
+
9
+ **How to get your API Key:**
10
+ 1. Go to [LiveSession settings](https://app.livesession.io/app/settings/api?tab=api_tokens)
11
+ 2. Click **API Tokens** from the left menu
12
+ 3. Click the creation button in the upper-right corner
13
+ 4. Give your token a descriptive name
14
+ 5. Select the website you want to access through the REST API
15
+ 6. Select the scopes you'd like to grant this token e.g webhooks:read, webhooks:write, sessions:read, recordings:read etc.
16
+ 7. Click confirm `,
17
+ required: true,
18
+ });
19
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/livesession/src/lib/common/auth.ts"],"names":[],"mappings":";;;AAAA,qEAA2D;AAE9C,QAAA,eAAe,GAAG,4BAAS,CAAC,UAAU,CAAC;IAClD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE;;;;;;;;;kBASG;IAChB,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const sessionEvent: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
+ website_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ api_version: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
6
+ website_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ api_version: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
+ website_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ api_version: import("@activepieces/pieces-framework").ShortTextProperty<false>;
11
+ }>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sessionEvent = 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 pieces_common_1 = require("@activepieces/pieces-common");
8
+ exports.sessionEvent = (0, pieces_framework_1.createTrigger)({
9
+ auth: auth_1.livesessionAuth,
10
+ name: 'sessionEvent',
11
+ displayName: 'Session Event',
12
+ description: 'Triggered when a session event occurs in LiveSession',
13
+ props: {
14
+ website_id: pieces_framework_1.Property.ShortText({
15
+ displayName: 'Website ID',
16
+ description: 'The website ID to listen for session events',
17
+ required: true,
18
+ }),
19
+ api_version: pieces_framework_1.Property.ShortText({
20
+ displayName: 'API Version',
21
+ description: 'API version (e.g., v1.0)',
22
+ required: false,
23
+ defaultValue: 'v1.0',
24
+ }),
25
+ },
26
+ sampleData: {
27
+ event: 'session_event',
28
+ session_id: 'example-session-id',
29
+ website_id: 'example-website-id',
30
+ timestamp: 1234567890,
31
+ },
32
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
33
+ onEnable(context) {
34
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
+ var _a;
36
+ const { website_id, api_version } = context.propsValue;
37
+ const apiKey = context.auth.secret_text;
38
+ const response = yield pieces_common_1.httpClient.sendRequest({
39
+ method: pieces_common_1.HttpMethod.POST,
40
+ url: 'https://api.livesession.io/v1/webhooks',
41
+ headers: {
42
+ Authorization: `Bearer ${apiKey}`,
43
+ 'Content-Type': 'application/json',
44
+ Accept: 'application/json',
45
+ },
46
+ body: {
47
+ url: context.webhookUrl,
48
+ website_id,
49
+ version: api_version,
50
+ },
51
+ });
52
+ if (response.body.webhook_id === undefined) {
53
+ throw new Error(`Failed to create webhook: ${response.body}`);
54
+ }
55
+ yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('webhook_id', response.body.webhook_id));
56
+ });
57
+ },
58
+ onDisable(context) {
59
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
60
+ var _a, _b;
61
+ const apiKey = context.auth.secret_text;
62
+ const webhook_id = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('webhook_id'));
63
+ if (!webhook_id) {
64
+ return;
65
+ }
66
+ yield pieces_common_1.httpClient.sendRequest({
67
+ method: pieces_common_1.HttpMethod.DELETE,
68
+ url: `https://api.livesession.io/v1/webhooks/${webhook_id}`,
69
+ headers: {
70
+ Authorization: `Bearer ${apiKey}`,
71
+ Accept: 'application/json',
72
+ },
73
+ });
74
+ yield ((_b = context.store) === null || _b === void 0 ? void 0 : _b.delete('webhook_id'));
75
+ });
76
+ },
77
+ run(context) {
78
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
79
+ return [context.payload.body];
80
+ });
81
+ },
82
+ });
83
+ //# sourceMappingURL=session-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-event.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/livesession/src/lib/triggers/session-event.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,yCAAiD;AACjD,+DAAqE;AAExD,QAAA,YAAY,GAAG,IAAA,gCAAa,EAAC;IACxC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,sDAAsD;IACnE,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAA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