@orchesty/connector-calendly 1.0.0 → 1.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.
Files changed (44) hide show
  1. package/dist/package.json +4 -1
  2. package/package.json +4 -1
  3. package/CHANGELOG.md +0 -7
  4. package/coverage/clover.xml +0 -115
  5. package/coverage/coverage-final.json +0 -6
  6. package/coverage/lcov-report/base.css +0 -224
  7. package/coverage/lcov-report/block-navigation.js +0 -87
  8. package/coverage/lcov-report/favicon.png +0 -0
  9. package/coverage/lcov-report/index.html +0 -161
  10. package/coverage/lcov-report/prettify.css +0 -1
  11. package/coverage/lcov-report/prettify.js +0 -2
  12. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  13. package/coverage/lcov-report/sorter.js +0 -210
  14. package/coverage/lcov-report/src/Batch/CalendlyListEventsBatch.ts.html +0 -316
  15. package/coverage/lcov-report/src/Batch/index.html +0 -116
  16. package/coverage/lcov-report/src/CalendlyApplication.ts.html +0 -334
  17. package/coverage/lcov-report/src/Connector/CalendlyGetUserConnector.ts.html +0 -220
  18. package/coverage/lcov-report/src/Connector/CalendlyInviteUserConnector.ts.html +0 -220
  19. package/coverage/lcov-report/src/Connector/index.html +0 -131
  20. package/coverage/lcov-report/src/index.html +0 -116
  21. package/coverage/lcov-report/test/dataProvider.ts.html +0 -190
  22. package/coverage/lcov-report/test/index.html +0 -116
  23. package/coverage/lcov.info +0 -172
  24. package/jest.config.js +0 -13
  25. package/src/Batch/CalendlyListEventsBatch.ts +0 -77
  26. package/src/Batch/__tests__/CalendlyListEventsBatch.ts +0 -17
  27. package/src/Batch/__tests__/Data/CalendlyListEventsBatch/input.json +0 -6
  28. package/src/Batch/__tests__/Data/CalendlyListEventsBatch/mock.json +0 -45
  29. package/src/Batch/__tests__/Data/CalendlyListEventsBatch/output.json +0 -11
  30. package/src/CalendlyApplication.ts +0 -83
  31. package/src/Connector/CalendlyGetUserConnector.ts +0 -45
  32. package/src/Connector/CalendlyInviteUserConnector.ts +0 -45
  33. package/src/Connector/__tests__/CalendlyGetUserConnector.ts +0 -17
  34. package/src/Connector/__tests__/CalendlyInviteUserConnector.ts +0 -17
  35. package/src/Connector/__tests__/Data/CalendlyGetUserConnector/input.json +0 -8
  36. package/src/Connector/__tests__/Data/CalendlyGetUserConnector/mock.json +0 -18
  37. package/src/Connector/__tests__/Data/CalendlyGetUserConnector/output.json +0 -19
  38. package/src/Connector/__tests__/Data/CalendlyInviteUserConnector/input.json +0 -9
  39. package/src/Connector/__tests__/Data/CalendlyInviteUserConnector/mock.json +0 -15
  40. package/src/Connector/__tests__/Data/CalendlyInviteUserConnector/output.json +0 -16
  41. package/test/dataProvider.ts +0 -35
  42. package/tsconfig.json +0 -8
  43. package/tsconfig.prod.json +0 -13
  44. package/tsconfig.prod.tsbuildinfo +0 -1
@@ -1,116 +0,0 @@
1
-
2
- <!doctype html>
3
- <html lang="en">
4
-
5
- <head>
6
- <title>Code coverage report for test</title>
7
- <meta charset="utf-8" />
8
- <link rel="stylesheet" href="../prettify.css" />
9
- <link rel="stylesheet" href="../base.css" />
10
- <link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
11
- <meta name="viewport" content="width=device-width, initial-scale=1" />
12
- <style type='text/css'>
13
- .coverage-summary .sorter {
14
- background-image: url(../sort-arrow-sprite.png);
15
- }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <div class='wrapper'>
21
- <div class='pad1'>
22
- <h1><a href="../index.html">All files</a> test</h1>
23
- <div class='clearfix'>
24
-
25
- <div class='fl pad1y space-right2'>
26
- <span class="strong">100% </span>
27
- <span class="quiet">Statements</span>
28
- <span class='fraction'>17/17</span>
29
- </div>
30
-
31
-
32
- <div class='fl pad1y space-right2'>
33
- <span class="strong">100% </span>
34
- <span class="quiet">Branches</span>
35
- <span class='fraction'>0/0</span>
36
- </div>
37
-
38
-
39
- <div class='fl pad1y space-right2'>
40
- <span class="strong">100% </span>
41
- <span class="quiet">Functions</span>
42
- <span class='fraction'>1/1</span>
43
- </div>
44
-
45
-
46
- <div class='fl pad1y space-right2'>
47
- <span class="strong">100% </span>
48
- <span class="quiet">Lines</span>
49
- <span class='fraction'>17/17</span>
50
- </div>
51
-
52
-
53
- </div>
54
- <p class="quiet">
55
- Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
- </p>
57
- <template id="filterTemplate">
58
- <div class="quiet">
59
- Filter:
60
- <input type="search" id="fileSearch">
61
- </div>
62
- </template>
63
- </div>
64
- <div class='status-line high'></div>
65
- <div class="pad1">
66
- <table class="coverage-summary">
67
- <thead>
68
- <tr>
69
- <th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
70
- <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
71
- <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
72
- <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
73
- <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
74
- <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
75
- <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
76
- <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
77
- <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
78
- <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
79
- </tr>
80
- </thead>
81
- <tbody><tr>
82
- <td class="file high" data-value="dataProvider.ts"><a href="dataProvider.ts.html">dataProvider.ts</a></td>
83
- <td data-value="100" class="pic high">
84
- <div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
85
- </td>
86
- <td data-value="100" class="pct high">100%</td>
87
- <td data-value="17" class="abs high">17/17</td>
88
- <td data-value="100" class="pct high">100%</td>
89
- <td data-value="0" class="abs high">0/0</td>
90
- <td data-value="100" class="pct high">100%</td>
91
- <td data-value="1" class="abs high">1/1</td>
92
- <td data-value="100" class="pct high">100%</td>
93
- <td data-value="17" class="abs high">17/17</td>
94
- </tr>
95
-
96
- </tbody>
97
- </table>
98
- </div>
99
- <div class='push'></div><!-- for sticky footer -->
100
- </div><!-- /wrapper -->
101
- <div class='footer quiet pad2 space-top1 center small'>
102
- Code coverage generated by
103
- <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
104
- at 2026-01-15T09:49:35.227Z
105
- </div>
106
- <script src="../prettify.js"></script>
107
- <script>
108
- window.onload = function () {
109
- prettyPrint();
110
- };
111
- </script>
112
- <script src="../sorter.js"></script>
113
- <script src="../block-navigation.js"></script>
114
- </body>
115
- </html>
116
-
@@ -1,172 +0,0 @@
1
- TN:
2
- SF:src/CalendlyApplication.ts
3
- FN:17,(anonymous_10)
4
- FN:21,(anonymous_11)
5
- FN:25,(anonymous_12)
6
- FN:29,(anonymous_13)
7
- FN:33,(anonymous_14)
8
- FN:37,(anonymous_15)
9
- FN:41,(anonymous_16)
10
- FN:63,(anonymous_17)
11
- FN:71,(anonymous_18)
12
- FN:79,(anonymous_19)
13
- FNF:10
14
- FNH:2
15
- FNDA:6,(anonymous_10)
16
- FNDA:0,(anonymous_11)
17
- FNDA:0,(anonymous_12)
18
- FNDA:0,(anonymous_13)
19
- FNDA:0,(anonymous_14)
20
- FNDA:0,(anonymous_15)
21
- FNDA:3,(anonymous_16)
22
- FNDA:0,(anonymous_17)
23
- FNDA:0,(anonymous_18)
24
- FNDA:0,(anonymous_19)
25
- DA:1,3
26
- DA:3,3
27
- DA:4,3
28
- DA:5,3
29
- DA:6,3
30
- DA:7,3
31
- DA:8,3
32
- DA:9,3
33
- DA:12,3
34
- DA:14,3
35
- DA:15,3
36
- DA:18,6
37
- DA:22,0
38
- DA:26,0
39
- DA:30,0
40
- DA:34,0
41
- DA:38,0
42
- DA:48,3
43
- DA:49,3
44
- DA:50,3
45
- DA:56,3
46
- DA:57,1
47
- DA:60,3
48
- DA:64,0
49
- DA:68,0
50
- DA:72,0
51
- DA:73,0
52
- DA:80,0
53
- LF:28
54
- LH:18
55
- BRDA:49,0,0,3
56
- BRDA:49,0,1,0
57
- BRDA:56,1,0,1
58
- BRDA:56,1,1,2
59
- BRDA:73,2,0,0
60
- BRDA:73,2,1,0
61
- BRDA:73,2,2,0
62
- BRF:7
63
- BRH:3
64
- end_of_record
65
- TN:
66
- SF:src/Batch/CalendlyListEventsBatch.ts
67
- FN:9,(anonymous_1)
68
- FN:13,(anonymous_2)
69
- FNF:2
70
- FNH:2
71
- FNDA:3,(anonymous_1)
72
- FNDA:1,(anonymous_2)
73
- DA:1,3
74
- DA:2,3
75
- DA:5,3
76
- DA:7,3
77
- DA:10,3
78
- DA:14,1
79
- DA:15,1
80
- DA:16,1
81
- DA:22,1
82
- DA:23,1
83
- DA:25,1
84
- DA:26,1
85
- DA:27,0
86
- DA:28,0
87
- DA:31,1
88
- LF:15
89
- LH:13
90
- BRDA:25,0,0,1
91
- BRDA:25,0,1,0
92
- BRDA:26,1,0,0
93
- BRDA:26,1,1,1
94
- BRF:4
95
- BRH:2
96
- end_of_record
97
- TN:
98
- SF:src/Connector/CalendlyGetUserConnector.ts
99
- FN:9,(anonymous_1)
100
- FN:13,(anonymous_2)
101
- FNF:2
102
- FNH:2
103
- FNDA:3,(anonymous_1)
104
- FNDA:1,(anonymous_2)
105
- DA:1,3
106
- DA:2,3
107
- DA:5,3
108
- DA:7,3
109
- DA:10,3
110
- DA:14,1
111
- DA:16,1
112
- DA:17,1
113
- DA:18,1
114
- DA:19,1
115
- DA:21,1
116
- LF:11
117
- LH:11
118
- BRF:0
119
- BRH:0
120
- end_of_record
121
- TN:
122
- SF:src/Connector/CalendlyInviteUserConnector.ts
123
- FN:9,(anonymous_1)
124
- FN:13,(anonymous_2)
125
- FNF:2
126
- FNH:2
127
- FNDA:3,(anonymous_1)
128
- FNDA:1,(anonymous_2)
129
- DA:1,3
130
- DA:2,3
131
- DA:5,3
132
- DA:7,3
133
- DA:10,3
134
- DA:14,1
135
- DA:16,1
136
- DA:17,1
137
- DA:18,1
138
- DA:19,1
139
- DA:21,1
140
- LF:11
141
- LH:11
142
- BRF:0
143
- BRH:0
144
- end_of_record
145
- TN:
146
- SF:test/dataProvider.ts
147
- FN:18,init
148
- FNF:1
149
- FNH:1
150
- FNDA:3,init
151
- DA:1,3
152
- DA:8,3
153
- DA:9,3
154
- DA:10,3
155
- DA:11,3
156
- DA:12,3
157
- DA:13,3
158
- DA:14,3
159
- DA:15,3
160
- DA:16,3
161
- DA:18,3
162
- DA:19,3
163
- DA:29,3
164
- DA:30,3
165
- DA:32,3
166
- DA:33,3
167
- DA:34,3
168
- LF:17
169
- LH:17
170
- BRF:0
171
- BRH:0
172
- end_of_record
package/jest.config.js DELETED
@@ -1,13 +0,0 @@
1
- const baseConfig = require('../../jest.config.js');
2
-
3
- module.exports = {
4
- ...baseConfig,
5
- roots: ["<rootDir>/src"],
6
- setupFiles: ["<rootDir>/../../.jest/testEnvs.ts"],
7
- setupFilesAfterEnv: ["<rootDir>/../../.jest/testLifecycle.ts"],
8
- globalSetup: "<rootDir>/../../.jest/globalSetup.ts",
9
- moduleNameMapper: {
10
- "^@orchesty/nodejs-connectors/test/(.*)$": "<rootDir>/../../test/$1",
11
- "^@orchesty/nodejs-connectors/lib/(.*)$": "<rootDir>/../../lib/$1",
12
- },
13
- }
@@ -1,77 +0,0 @@
1
- import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
2
- import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
3
- import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
4
-
5
- export const NAME = 'calendly-list-events-batch';
6
-
7
- export default class CalendlyListEventsBatch extends ABatchNode {
8
-
9
- public getName(): string {
10
- return NAME;
11
- }
12
-
13
- public async processAction(dto: BatchProcessDto): Promise<BatchProcessDto> {
14
- const token = dto.getBatchCursor('');
15
- const appInstall = await this.getApplicationInstallFromProcess(dto);
16
- const req = await this.getApplication().getRequestDto(
17
- dto,
18
- appInstall,
19
- HttpMethods.GET,
20
- `scheduled_events${token}`,
21
- );
22
- const resp = await this.getSender().send<IResponse>(req, [200]);
23
- const response = resp.getJsonBody();
24
-
25
- dto.setItemList(response.collection ?? []);
26
- if (response.pagination.next_page_token) {
27
- const nextToken = `?page_token=${response.pagination.next_page_token}`;
28
- dto.setBatchCursor(nextToken);
29
- }
30
-
31
- return dto;
32
- }
33
-
34
- }
35
-
36
- /* eslint-disable @typescript-eslint/naming-convention */
37
-
38
- interface IResponse {
39
- collection: IOutput[];
40
- pagination: {
41
- count: number;
42
- next_page: string;
43
- previous_page: string;
44
- next_page_token: string;
45
- previous_page_token: string;
46
- };
47
- }
48
-
49
- interface IOutput {
50
- uri: string;
51
- name: string;
52
- status: string;
53
- start_time: Date;
54
- end_time: Date;
55
- event_type: string;
56
- location: {
57
- type: string;
58
- location: string;
59
- };
60
- invitees_counter: {
61
- total: number;
62
- active: number;
63
- limit: number;
64
- };
65
- created_at: Date;
66
- updated_at: Date;
67
- event_memberships: {
68
- user: string;
69
- }[];
70
- event_guests: {
71
- email: string;
72
- created_at: Date;
73
- updated_at: Date;
74
- }[];
75
- }
76
-
77
- /* eslint-enable @typescript-eslint/naming-convention */
@@ -1,17 +0,0 @@
1
- import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
2
- import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
3
- import init from '../../../test/dataProvider';
4
- import { NAME as CALENDLY_LIST_EVENTS_BATCH } from '../CalendlyListEventsBatch';
5
-
6
- let tester: NodeTester;
7
-
8
- describe('Tests for CalendlyListEventsBatch', () => {
9
- beforeEach(() => {
10
- tester = new NodeTester(container, __filename);
11
- init();
12
- });
13
-
14
- it('process - ok', async () => {
15
- await tester.testBatch(CALENDLY_LIST_EVENTS_BATCH);
16
- });
17
- });
@@ -1,6 +0,0 @@
1
- {
2
- "headers": {
3
- "user": "TestUser"
4
- },
5
- "data": {}
6
- }
@@ -1,45 +0,0 @@
1
- {
2
- "http": "GET https://api.calendly.com/scheduled_events",
3
- "code": 200,
4
- "body": {
5
- "collection": [
6
- {
7
- "uri": "https://api.calendly.com/scheduled_events/GBGBDCAADAEDCRZ2",
8
- "name": "15 Minute Meeting",
9
- "status": "active",
10
- "start_time": "2019-08-24T14:15:22.123456Z",
11
- "end_time": "2019-08-24T14:15:22.123456Z",
12
- "event_type": "https://api.calendly.com/event_types/GBGBDCAADAEDCRZ2",
13
- "location": {
14
- "type": "physical",
15
- "location": "Calendly Office"
16
- },
17
- "invitees_counter": {
18
- "total": 0,
19
- "active": 0,
20
- "limit": 0
21
- },
22
- "created_at": "2019-01-02T03:04:05.092125Z",
23
- "updated_at": "2019-01-02T03:04:05.092125Z",
24
- "event_memberships": [
25
- {
26
- "user": "https://api.calendly.com/users/GBGBDCAADAEDCRZ2"
27
- }
28
- ],
29
- "event_guests": [
30
- {
31
- "email": "user@example.com",
32
- "created_at": "2022-04-21T17:10:48.484945Z",
33
- "updated_at": "2022-04-21T17:11:01.758636Z"
34
- }
35
- ]
36
- }
37
- ],
38
- "pagination": {
39
- "count": 1,
40
- "next_page": "https://api.calendly.com/scheduled_events?count=1&page_token=sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi",
41
- "previous_page": "https://api.calendly.com/scheduled_events?count=1&page_token=VJs2rfDYeY8ahZpq0QI1O114LJkNjd7H",
42
- "previous_page_token": "VJs2rfDYeY8ahZpq0QI1O114LJkNjd7H"
43
- }
44
- }
45
- }
@@ -1,11 +0,0 @@
1
- {
2
- "headers": {
3
- "user": "TestUser"
4
- },
5
- "data": [
6
- {
7
- "body": "{\"uri\":\"https://api.calendly.com/scheduled_events/GBGBDCAADAEDCRZ2\",\"name\":\"15 Minute Meeting\",\"status\":\"active\",\"start_time\":\"2019-08-24T14:15:22.123456Z\",\"end_time\":\"2019-08-24T14:15:22.123456Z\",\"event_type\":\"https://api.calendly.com/event_types/GBGBDCAADAEDCRZ2\",\"location\":{\"type\":\"physical\",\"location\":\"Calendly Office\"},\"invitees_counter\":{\"total\":0,\"active\":0,\"limit\":0},\"created_at\":\"2019-01-02T03:04:05.092125Z\",\"updated_at\":\"2019-01-02T03:04:05.092125Z\",\"event_memberships\":[{\"user\":\"https://api.calendly.com/users/GBGBDCAADAEDCRZ2\"}],\"event_guests\":[{\"email\":\"user@example.com\",\"created_at\":\"2022-04-21T17:10:48.484945Z\",\"updated_at\":\"2022-04-21T17:11:01.758636Z\"}]}",
8
- "headers": {}
9
- }
10
- ]
11
- }
@@ -1,83 +0,0 @@
1
- import CoreFormsEnum, { getFormName } from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
2
- import { ApplicationInstall } from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
3
- import Field from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Field';
4
- import FieldType from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FieldType';
5
- import Form from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Form';
6
- import FormStack from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FormStack';
7
- import AOAuth2Application from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/OAuth2/AOAuth2Application';
8
- import { CLIENT_ID, CLIENT_SECRET } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/OAuth2/IOAuth2Application';
9
- import RequestDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto';
10
- import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
11
- import AProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/AProcessDto';
12
- import { CommonHeaders, JSON_TYPE } from '@orchesty/nodejs-sdk/dist/lib/Utils/Headers';
13
-
14
- export const NAME = 'calendly';
15
- export default class CalendlyApplication extends AOAuth2Application {
16
-
17
- public getName(): string {
18
- return NAME;
19
- }
20
-
21
- public getPublicName(): string {
22
- return 'Calendly';
23
- }
24
-
25
- public getDescription(): string {
26
- return 'Simple scheduling tool for businesses that eliminates email back and forth. It helps save time and increase sales.';
27
- }
28
-
29
- public getLogo(): string {
30
- return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9ImxvZ29zYW5kdHlwZXNfY29tIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiCgkgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTAwIDEwMDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOm5vbmU7fQoJLnN0MXtmaWxsOiMwMDZCRkY7fQoJLnN0MntmaWxsOiMwQUU4RjA7fQo8L3N0eWxlPgo8Zz4KCTxnIGlkPSJMYXllcl8zIj4KCQk8cGF0aCBpZD0iTGF5ZXJfMy0yIiBjbGFzcz0ic3QwIiBkPSJNLTUuNC01LjRoMTEwLjd2MTEwLjdILTUuNFYtNS40eiIvPgoJPC9nPgoJPHBhdGggY2xhc3M9InN0MSIgZD0iTTk2LjgsNTguNmMtMi4xLTEuNS02LjMtMy40LTkuOS00LjZjMC40LTIuMywwLjUtNS4yLTAuMS04LjZoMHYtMC4xaDB2MC4xYzMuNi0wLjYsNy0yLjEsOS45LTQuMwoJCWMyLjgtMi4xLDIuMy00LjUsMS45LTUuOWMtMy41LTExLjMtMTEtMjEuMS0yMS0yNy40Yy0xMC02LjMtMjItOC44LTMzLjgtNy4xQzMyLjIsMi42LDIxLjUsOC41LDEzLjcsMTcuNWMtNy43LDktMTIsMjAuNS0xMiwzMi4zCgkJczQuMywyMy40LDEyLDMyLjNjNy43LDksMTguNSwxNC45LDMwLjIsMTYuN2MxMS43LDEuOCwyMy43LTAuNywzMy44LTcuMWMxMC02LjMsMTcuNS0xNiwyMS0yNy40Qzk5LjEsNjMuMSw5OS43LDYwLjcsOTYuOCw1OC42egoJCSBNOTMuNyw2Mi45QzkwLjUsNzMsODMuOSw4MS43LDc0LjksODcuM2MtOSw1LjYtMTkuNyw3LjktMzAuMSw2LjNjLTEwLjUtMS42LTIwLTYuOS0yNi45LTE0LjlDMTEsNzAuNyw3LjIsNjAuNCw3LjIsNDkuOQoJCVMxMSwyOSwxNy45LDIxYzYuOS04LDE2LjUtMTMuMywyNi45LTE0LjlDNTUuMyw0LjUsNjYsNi44LDc0LjksMTIuNGM5LDUuNiwxNS42LDE0LjMsMTguNywyNC40YzAsMCwwLDAuMSwwLDAuMQoJCWMtMS41LDEuMS01LjEsMi40LTguMiwzLjRsMC0wLjFjLTAuNS0xLjEtMS0yLjItMS42LTMuMmwtNS04LjdjLTIuMy0zLjktNS41LTcuMi05LjQtOS40cy04LjQtMy41LTEyLjktMy41SDQ2LjQKCQljLTQuNSwwLTksMS4yLTEyLjksMy41Yy0zLjksMi4zLTcuMiw1LjUtOS40LDkuNGwtNSw4LjdjLTIuMywzLjktMy41LDguNC0zLjUsMTIuOXMxLjIsOSwzLjUsMTIuOWw1LDguN2MyLjMsMy45LDUuNSw3LjIsOS40LDkuNAoJCWMzLjksMi4zLDguNCwzLjUsMTIuOSwzLjVoMTAuMWM0LjUsMCw5LTEuMiwxMi45LTMuNXM3LjItNS41LDkuNC05LjRsNS04LjdjMC42LTEsMS4xLTIuMSwxLjYtMy4ybDAtMC4xYzAsMCwwLDAsMCwwaDAKCQlDODguNCw1OS45LDkxLjMsNjEuMSw5My43LDYyLjlDOTMuNyw2Mi45LDkzLjcsNjIuOSw5My43LDYyLjl6Ii8+Cgk8cGF0aCBjbGFzcz0ic3QyIiBkPSJNODUuNSw0MC4zYy0xLjEsMC4yLTIuMywwLjMtMy40LDAuM2MtNy41LDAtMTAuMy0yLjUtMTMuNi01LjRjLTMuMi0yLjgtNy4xLTYuMy0xNC4yLTYuM0g1MAoJCWMtNS4yLDAtOS45LDEuOS0xMy4yLDUuM2MtMy4zLDMuMy01LjEsNy45LTUuMSwxMi44djUuOGMwLDQuOSwxLjgsOS41LDUuMSwxMi44YzMuNCwzLjQsOCw1LjMsMTMuMiw1LjNoNC4zCgkJYzcuMSwwLDExLjEtMy41LDE0LjItNi4zYzMuMy0yLjksNi4xLTUuNCwxMy42LTUuNGMxLjEsMCwyLjMsMC4xLDMuNCwwLjNjMC42LTEuNiwxLjYtNS44LDEuNS01LjVjLTEuNy0wLjItMy4zLTAuMS01LTAuMQoJCWMtMTcuMywwLTE2LjQsMTEuNy0yNy44LDExLjdoLTQuM2MtNy45LDAtMTMtNS42LTEzLTEyLjh2LTUuOGMwLTcuMiw1LjItMTIuOCwxMy0xMi44aDQuM2MxMS40LDAsMTAuNSwxMS43LDI3LjgsMTEuNwoJCWMxLjYsMCwzLjMtMC4xLDQuOS0wLjR2LTAuMUM4Ni42LDQzLjYsODYuMSw0MS45LDg1LjUsNDAuM0w4NS41LDQwLjN6Ii8+CjwvZz4KPC9zdmc+Cg==';
31
- }
32
-
33
- public getAuthUrl(): string {
34
- return 'https://auth.calendly.com/oauth/authorize';
35
- }
36
-
37
- public getTokenUrl(): string {
38
- return 'https://auth.calendly.com/oauth/token';
39
- }
40
-
41
- public getRequestDto(
42
- dto: AProcessDto,
43
- applicationInstall: ApplicationInstall,
44
- method: HttpMethods,
45
- _url?: string,
46
- data?: unknown,
47
- ): RequestDto {
48
- const url = `https://api.calendly.com/${_url}`;
49
- const request = new RequestDto(url ?? '', method, dto);
50
- request.setHeaders({
51
- [CommonHeaders.CONTENT_TYPE]: JSON_TYPE,
52
- [CommonHeaders.ACCEPT]: JSON_TYPE,
53
- [CommonHeaders.AUTHORIZATION]: `Bearer ${this.getAccessToken(applicationInstall)}`,
54
- });
55
-
56
- if (data) {
57
- request.setJsonBody(data);
58
- }
59
-
60
- return request;
61
- }
62
-
63
- public getFormStack(): FormStack {
64
- const form = new Form(CoreFormsEnum.AUTHORIZATION_FORM, getFormName(CoreFormsEnum.AUTHORIZATION_FORM))
65
- .addField(new Field(FieldType.TEXT, CLIENT_ID, 'Client Id', null, true))
66
- .addField(new Field(FieldType.TEXT, CLIENT_SECRET, 'Client Secret', null, true));
67
-
68
- return new FormStack().addForm(form);
69
- }
70
-
71
- public isAuthorized(applicationInstall: ApplicationInstall): boolean {
72
- const authorizationForm = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM];
73
- return super.isAuthorized(applicationInstall)
74
- && authorizationForm?.[CLIENT_ID]
75
- && authorizationForm?.[CLIENT_SECRET];
76
- }
77
-
78
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
79
- public getScopes(applicationInstall: ApplicationInstall): string[] {
80
- return [];
81
- }
82
-
83
- }
@@ -1,45 +0,0 @@
1
- import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
2
- import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
3
- import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
4
-
5
- export const NAME = 'calendly-get-user-connector';
6
-
7
- export default class CalendlyGetUserConnector extends AConnector {
8
-
9
- public getName(): string {
10
- return NAME;
11
- }
12
-
13
- public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
14
- const { uuid } = dto.getJsonData();
15
-
16
- const appInstall = await this.getApplicationInstallFromProcess(dto);
17
- const url = `users/${uuid}`;
18
- const req = await this.getApplication().getRequestDto(dto, appInstall, HttpMethods.GET, url);
19
- const resp = await this.getSender().send<IOutput>(req, [200]);
20
-
21
- return dto.setNewJsonData(resp.getJsonBody());
22
- }
23
-
24
- }
25
-
26
- /* eslint-disable @typescript-eslint/naming-convention */
27
-
28
- export interface IInput {
29
- uuid: string;
30
- }
31
-
32
- export interface IOutput {
33
- resource: {
34
- uri: string;
35
- name: string;
36
- slug: string;
37
- email: string;
38
- scheduling_url: string;
39
- timezone: string;
40
- avatar_url: string;
41
- created_at: Date;
42
- updated_at: Date;
43
- current_organization: string;
44
- };
45
- }
@@ -1,45 +0,0 @@
1
- import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
2
- import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
3
- import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
4
-
5
- export const NAME = 'calendly-invite-user-connector';
6
-
7
- export default class CalendlyInviteUserConnector extends AConnector {
8
-
9
- public getName(): string {
10
- return NAME;
11
- }
12
-
13
- public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
14
- const { uuid, ...body } = dto.getJsonData();
15
-
16
- const appInstall = await this.getApplicationInstallFromProcess(dto);
17
- const url = `organizations/${uuid}/invitations`;
18
- const req = await this.getApplication().getRequestDto(dto, appInstall, HttpMethods.POST, url, body);
19
- const resp = await this.getSender().send<IOutput>(req, [201]);
20
-
21
- return dto.setNewJsonData(resp.getJsonBody());
22
- }
23
-
24
- }
25
-
26
- /* eslint-disable @typescript-eslint/naming-convention */
27
-
28
- export interface IInput {
29
- uuid: string;
30
- email: string;
31
- }
32
-
33
- export interface IOutput {
34
- resource: {
35
- created_at: Date;
36
- email: string;
37
- last_sent_at: Date;
38
- organization: string;
39
- status: 'accepted' | 'declined' | 'pending';
40
- updated_at: Date;
41
- uri: string;
42
- };
43
- }
44
-
45
- /* eslint-enable @typescript-eslint/naming-convention */
@@ -1,17 +0,0 @@
1
- import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
2
- import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
3
- import init from '../../../test/dataProvider';
4
- import { NAME as CALENDLY_GET_USER_CONNECTOR } from '../CalendlyGetUserConnector';
5
-
6
- let tester: NodeTester;
7
-
8
- describe('Tests for CalendlyGetUserConnector', () => {
9
- beforeEach(() => {
10
- tester = new NodeTester(container, __filename, true);
11
- init();
12
- });
13
-
14
- it('process - ok', async () => {
15
- await tester.testConnector(CALENDLY_GET_USER_CONNECTOR);
16
- });
17
- });
@@ -1,17 +0,0 @@
1
- import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
2
- import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
3
- import init from '../../../test/dataProvider';
4
- import { NAME as CALENDLY_INVITE_USER_CONNECTOR } from '../CalendlyInviteUserConnector';
5
-
6
- let tester: NodeTester;
7
-
8
- describe('Tests for CalendlyInviteUserConnector', () => {
9
- beforeEach(() => {
10
- tester = new NodeTester(container, __filename, true);
11
- init();
12
- });
13
-
14
- it('process - ok', async () => {
15
- await tester.testConnector(CALENDLY_INVITE_USER_CONNECTOR);
16
- });
17
- });