@coasy/piece-coasy 0.0.1 → 0.0.2

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 CHANGED
@@ -1,4 +1,19 @@
1
1
  {
2
2
  "name": "@coasy/piece-coasy",
3
- "version": "0.0.1"
3
+ "version": "0.0.2",
4
+ "dependencies": {
5
+ "@sinclair/typebox": "0.26.8",
6
+ "axios": "1.6.7",
7
+ "dayjs": "1.11.9",
8
+ "is-base64": "1.1.0",
9
+ "lodash": "4.17.21",
10
+ "nanoid": "3.3.6",
11
+ "semver": "7.6.0",
12
+ "@activepieces/pieces-common": "0.2.12",
13
+ "@activepieces/pieces-framework": "0.7.29",
14
+ "@activepieces/shared": "0.10.104",
15
+ "tslib": "1.14.1"
16
+ },
17
+ "main": "./src/index.js",
18
+ "type": "commonjs"
4
19
  }
@@ -0,0 +1,7 @@
1
+ export declare class CoasyClient {
2
+ private baseUrl;
3
+ private apiKey;
4
+ constructor(baseUrl: string, apiKey: string);
5
+ action(actionName: string, request: any): Promise<any>;
6
+ request(path: string, requestBody: any): Promise<any>;
7
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CoasyClient = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ class CoasyClient {
7
+ constructor(baseUrl, apiKey) {
8
+ this.baseUrl = baseUrl;
9
+ this.apiKey = apiKey;
10
+ }
11
+ action(actionName, request) {
12
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
+ return this.request(`/apps/actions/${actionName}`, request);
14
+ });
15
+ }
16
+ request(path, requestBody) {
17
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
18
+ const request = {
19
+ method: pieces_common_1.HttpMethod.POST,
20
+ url: `${this.baseUrl}${path}`,
21
+ body: JSON.stringify(requestBody),
22
+ authentication: {
23
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
24
+ token: this.apiKey
25
+ },
26
+ };
27
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
28
+ if (response.status !== 200) {
29
+ throw new Error(`Failed to communicate with Mailjet`);
30
+ }
31
+ else {
32
+ return response.body;
33
+ }
34
+ });
35
+ }
36
+ }
37
+ exports.CoasyClient = CoasyClient;
38
+ //# sourceMappingURL=coasyClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coasyClient.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/coasy/src/coasyClient.ts"],"names":[],"mappings":";;;;AAAA,+DAAsG;AAEtG,MAAa,WAAW;IAItB,YAAY,OAAe,EAAE,MAAc;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAGK,MAAM,CAAC,UAAkB,EAAE,OAAY;;YAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC;KAAA;IAEK,OAAO,CAAC,IAAY,EAAE,WAAgB;;YAC1C,MAAM,OAAO,GAAwB;gBACnC,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE;gBAC7B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBACjC,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,IAAI,CAAC,MAAM;iBACnB;aACF,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAEvD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;YACxD,CAAC;iBAAM,CAAC;gBACN,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;QACH,CAAC;KAAA;CAEF;AAlCD,kCAkCC"}
package/src/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export declare const coasyAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>;
5
+ export declare const coasy: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>>;
package/src/index.js ADDED
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.coasy = exports.coasyAuth = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const createFunnelParticipant_1 = require("./lib/actions/createFunnelParticipant");
7
+ exports.coasyAuth = pieces_framework_1.PieceAuth.CustomAuth({
8
+ required: true,
9
+ description: 'Enter coasy authentication details',
10
+ props: {
11
+ baseUrl: pieces_framework_1.Property.ShortText({
12
+ displayName: 'Base URL',
13
+ description: 'Enter the base URL',
14
+ required: true,
15
+ }),
16
+ apiKey: pieces_framework_1.PieceAuth.SecretText({
17
+ displayName: 'API Key',
18
+ description: 'Enter the api key',
19
+ required: true
20
+ })
21
+ },
22
+ validate: ({ auth }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
23
+ return { valid: true };
24
+ }),
25
+ });
26
+ exports.coasy = (0, pieces_framework_1.createPiece)({
27
+ displayName: 'Coasy',
28
+ auth: exports.coasyAuth,
29
+ description: 'Communicate with Coasy',
30
+ minimumSupportedRelease: '0.20.0',
31
+ logoUrl: 'https://console.achtsamkeitsakademie.de/favicon/apple-icon.png',
32
+ authors: ["christian-schab"],
33
+ actions: [createFunnelParticipant_1.createFunnelParticipant],
34
+ triggers: []
35
+ });
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/coasy/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAkF;AAClF,mFAAgF;AAEnE,QAAA,SAAS,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC5C,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,oCAAoC;IACjD,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,MAAM,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC3B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,mBAAmB;YAChC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,QAAQ,EAAE,CAAO,EAAE,IAAI,EAAE,EAAE,EAAE;QAC3B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC,CAAA;CACF,CAAC,CAAC;AAGU,QAAA,KAAK,GAAG,IAAA,8BAAW,EAAC;IAC/B,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,iBAAS;IACf,WAAW,EAAE,wBAAwB;IACrC,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,gEAAgE;IACzE,OAAO,EAAE,CAAC,iBAAiB,CAAC;IAC5B,OAAO,EAAE,CAAC,iDAAuB,CAAC;IAClC,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const createFunnelParticipant: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ funnelId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
+ firstName: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ lastName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
+ }>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createFunnelParticipant = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const index_1 = require("../../index");
7
+ const coasyClient_1 = require("../../coasyClient");
8
+ exports.createFunnelParticipant = (0, pieces_framework_1.createAction)({
9
+ auth: index_1.coasyAuth,
10
+ name: 'createFunnelParticipant',
11
+ displayName: 'Create Funnel Participant',
12
+ description: 'Create a new funnel participant',
13
+ props: {
14
+ funnelId: pieces_framework_1.Property.ShortText({
15
+ displayName: 'Funnel ID',
16
+ description: 'ID of funnel',
17
+ required: true
18
+ }),
19
+ firstName: pieces_framework_1.Property.ShortText({
20
+ displayName: 'First name',
21
+ description: 'first name of participant',
22
+ required: true
23
+ }),
24
+ lastName: pieces_framework_1.Property.ShortText({
25
+ displayName: 'Last name',
26
+ description: 'last name of participant',
27
+ required: false
28
+ }),
29
+ email: pieces_framework_1.Property.ShortText({
30
+ displayName: 'Email',
31
+ description: 'email address of partipant',
32
+ required: true
33
+ })
34
+ },
35
+ run(configValue) {
36
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
37
+ console.log(`Run createFunnelParticipant`);
38
+ const { propsValue, auth } = configValue;
39
+ console.log(`Loaded PropsValue and Auth`);
40
+ const client = new coasyClient_1.CoasyClient(auth.baseUrl, auth.apiKey);
41
+ console.log(`Built client`);
42
+ const request = {
43
+ email: propsValue.email,
44
+ firstName: propsValue.firstName,
45
+ funnelId: propsValue.funnelId
46
+ };
47
+ console.log(`Built request`, request);
48
+ return client.action('createFunnelParticipant', request);
49
+ });
50
+ }
51
+ });
52
+ //# sourceMappingURL=createFunnelParticipant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFunnelParticipant.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/actions/createFunnelParticipant.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,uCAAwC;AACxC,mDAAgD;AAEnC,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,iBAAS;IACf,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,iCAAiC;IAC9C,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,WAAW;;YACnB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;YAE3C,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC;YACzC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;YAE1C,MAAM,MAAM,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAE5B,MAAM,OAAO,GAAG;gBACd,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,SAAS,EAAE,UAAU,CAAC,SAAS;gBAC/B,QAAQ,EAAE,UAAU,CAAC,QAAQ;aAC9B,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;YAEtC,OAAO,MAAM,CAAC,MAAM,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;QAC3D,CAAC;KAAA;CACF,CAAC,CAAC"}
package/.eslintrc.json DELETED
@@ -1,33 +0,0 @@
1
- {
2
- "extends": [
3
- "../../../../.eslintrc.base.json"
4
- ],
5
- "ignorePatterns": [
6
- "!**/*"
7
- ],
8
- "overrides": [
9
- {
10
- "files": [
11
- "*.ts",
12
- "*.tsx",
13
- "*.js",
14
- "*.jsx"
15
- ],
16
- "rules": {}
17
- },
18
- {
19
- "files": [
20
- "*.ts",
21
- "*.tsx"
22
- ],
23
- "rules": {}
24
- },
25
- {
26
- "files": [
27
- "*.js",
28
- "*.jsx"
29
- ],
30
- "rules": {}
31
- }
32
- ]
33
- }
package/project.json DELETED
@@ -1,38 +0,0 @@
1
- {
2
- "name": "pieces-coasy",
3
- "$schema": "../../../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/pieces/community/coasy/src",
5
- "projectType": "library",
6
- "targets": {
7
- "build": {
8
- "executor": "@nx/js:tsc",
9
- "outputs": [
10
- "{options.outputPath}"
11
- ],
12
- "options": {
13
- "outputPath": "dist/packages/pieces/community/coasy",
14
- "tsConfig": "packages/pieces/community/coasy/tsconfig.lib.json",
15
- "packageJson": "packages/pieces/community/coasy/package.json",
16
- "main": "packages/pieces/community/coasy/src/index.ts",
17
- "assets": [
18
- "packages/pieces/community/coasy/*.md"
19
- ],
20
- "buildableProjectDepsInPackageJsonType": "dependencies",
21
- "updateBuildableProjectDepsInPackageJson": true
22
- }
23
- },
24
- "publish": {
25
- "command": "node tools/scripts/publish.mjs pieces-coasy {args.ver} {args.tag}",
26
- "dependsOn": [
27
- "build"
28
- ]
29
- },
30
- "lint": {
31
- "executor": "@nx/eslint:lint",
32
- "outputs": [
33
- "{options.outputFile}"
34
- ]
35
- }
36
- },
37
- "tags": []
38
- }
@@ -1,37 +0,0 @@
1
- import { AuthenticationType, httpClient, HttpMethod, HttpRequest } from '@activepieces/pieces-common';
2
-
3
- export class CoasyClient {
4
- private baseUrl: string;
5
- private apiKey: string;
6
-
7
- constructor(baseUrl: string, apiKey: string) {
8
- this.baseUrl = baseUrl;
9
- this.apiKey = apiKey;
10
- }
11
-
12
-
13
- async action(actionName: string, request: any) {
14
- return this.request(`/apps/actions/${actionName}`, request);
15
- }
16
-
17
- async request(path: string, requestBody: any) {
18
- const request: HttpRequest<string> = {
19
- method: HttpMethod.POST,
20
- url: `${this.baseUrl}${path}`,
21
- body: JSON.stringify(requestBody),
22
- authentication: {
23
- type: AuthenticationType.BEARER_TOKEN,
24
- token: this.apiKey
25
- },
26
- };
27
-
28
- const response = await httpClient.sendRequest(request);
29
-
30
- if (response.status !== 200) {
31
- throw new Error(`Failed to communicate with Mailjet`);
32
- } else {
33
- return response.body;
34
- }
35
- }
36
-
37
- }
package/src/index.ts DELETED
@@ -1,34 +0,0 @@
1
- import { createPiece, PieceAuth, Property } from '@activepieces/pieces-framework';
2
- import { createFunnelParticipant } from './lib/actions/createFunnelParticipant';
3
-
4
- export const coasyAuth = PieceAuth.CustomAuth({
5
- required: true,
6
- description: 'Enter coasy authentication details',
7
- props: {
8
- baseUrl: Property.ShortText({
9
- displayName: 'Base URL',
10
- description: 'Enter the base URL',
11
- required: true,
12
- }),
13
- apiKey: PieceAuth.SecretText({
14
- displayName: 'API Key',
15
- description: 'Enter the api key',
16
- required: true
17
- })
18
- },
19
- validate: async ({ auth }) => {
20
- return { valid: true };
21
- },
22
- });
23
-
24
-
25
- export const coasy = createPiece({
26
- displayName: 'Coasy',
27
- auth: coasyAuth,
28
- description: 'Communicate with Coasy',
29
- minimumSupportedRelease: '0.20.0',
30
- logoUrl: 'https://console.achtsamkeitsakademie.de/favicon/apple-icon.png',
31
- authors: ["christian-schab"],
32
- actions: [createFunnelParticipant],
33
- triggers: []
34
- });
@@ -1,50 +0,0 @@
1
- import { createAction, Property } from '@activepieces/pieces-framework';
2
- import { coasyAuth } from '../../index';
3
- import { CoasyClient } from '../../coasyClient';
4
-
5
- export const createFunnelParticipant = createAction({
6
- auth: coasyAuth,
7
- name: 'createFunnelParticipant',
8
- displayName: 'Create Funnel Participant',
9
- description: 'Create a new funnel participant',
10
- props: {
11
- funnelId: Property.ShortText({
12
- displayName: 'Funnel ID',
13
- description: 'ID of funnel',
14
- required: true
15
- }),
16
- firstName: Property.ShortText({
17
- displayName: 'First name',
18
- description: 'first name of participant',
19
- required: true
20
- }),
21
- lastName: Property.ShortText({
22
- displayName: 'Last name',
23
- description: 'last name of participant',
24
- required: false
25
- }),
26
- email: Property.ShortText({
27
- displayName: 'Email',
28
- description: 'email address of partipant',
29
- required: true
30
- })
31
- },
32
- async run(configValue) {
33
- console.log(`Run createFunnelParticipant`);
34
-
35
- const { propsValue, auth } = configValue;
36
- console.log(`Loaded PropsValue and Auth`);
37
-
38
- const client = new CoasyClient(auth.baseUrl, auth.apiKey);
39
- console.log(`Built client`);
40
-
41
- const request = {
42
- email: propsValue.email,
43
- firstName: propsValue.firstName,
44
- funnelId: propsValue.funnelId
45
- };
46
- console.log(`Built request`, request);
47
-
48
- return client.action('createFunnelParticipant', request);
49
- }
50
- });
package/tsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "extends": "../../../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "module": "commonjs",
5
- "forceConsistentCasingInFileNames": true,
6
- "strict": true,
7
- "noImplicitOverride": true,
8
- "noPropertyAccessFromIndexSignature": true,
9
- "noImplicitReturns": true,
10
- "noFallthroughCasesInSwitch": true
11
- },
12
- "files": [],
13
- "include": [],
14
- "references": [
15
- {
16
- "path": "./tsconfig.lib.json"
17
- }
18
- ]
19
- }
package/tsconfig.lib.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "module": "commonjs",
5
- "outDir": "../../../../dist/out-tsc",
6
- "declaration": true,
7
- "types": ["node"]
8
- },
9
- "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
10
- "include": ["src/**/*.ts"]
11
- }