@orchesty/connector-nutshell 1.0.0 → 2.0.0

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 (50) hide show
  1. package/README.md +82 -0
  2. package/dist/package.json +5 -2
  3. package/package.json +5 -2
  4. package/CHANGELOG.md +0 -7
  5. package/coverage/clover.xml +0 -129
  6. package/coverage/coverage-final.json +0 -7
  7. package/coverage/lcov-report/base.css +0 -224
  8. package/coverage/lcov-report/block-navigation.js +0 -87
  9. package/coverage/lcov-report/favicon.png +0 -0
  10. package/coverage/lcov-report/index.html +0 -146
  11. package/coverage/lcov-report/prettify.css +0 -1
  12. package/coverage/lcov-report/prettify.js +0 -2
  13. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  14. package/coverage/lcov-report/sorter.js +0 -210
  15. package/coverage/lcov-report/src/Connector/NutshellGetAccountConnector.ts.html +0 -532
  16. package/coverage/lcov-report/src/Connector/NutshellNewAccountConnector.ts.html +0 -754
  17. package/coverage/lcov-report/src/Connector/NutshellNewLeadConnector.ts.html +0 -802
  18. package/coverage/lcov-report/src/Connector/NutshellNewTaskConnector.ts.html +0 -406
  19. package/coverage/lcov-report/src/Connector/index.html +0 -161
  20. package/coverage/lcov-report/src/NutshellApplication.ts.html +0 -304
  21. package/coverage/lcov-report/src/index.html +0 -116
  22. package/coverage/lcov-report/test/dataProvider.ts.html +0 -235
  23. package/coverage/lcov-report/test/index.html +0 -116
  24. package/coverage/lcov.info +0 -184
  25. package/jest.config.js +0 -13
  26. package/src/Connector/NutshellGetAccountConnector.ts +0 -149
  27. package/src/Connector/NutshellNewAccountConnector.ts +0 -223
  28. package/src/Connector/NutshellNewLeadConnector.ts +0 -239
  29. package/src/Connector/NutshellNewTaskConnector.ts +0 -107
  30. package/src/Connector/__tests__/Data/NutshellGetAccountConnector/input.json +0 -8
  31. package/src/Connector/__tests__/Data/NutshellGetAccountConnector/mock.json +0 -37
  32. package/src/Connector/__tests__/Data/NutshellGetAccountConnector/output.json +0 -34
  33. package/src/Connector/__tests__/Data/NutshellNewAccountConnector/input.json +0 -10
  34. package/src/Connector/__tests__/Data/NutshellNewAccountConnector/mock.json +0 -34
  35. package/src/Connector/__tests__/Data/NutshellNewAccountConnector/output.json +0 -30
  36. package/src/Connector/__tests__/Data/NutshellNewLeadConnector/input.json +0 -10
  37. package/src/Connector/__tests__/Data/NutshellNewLeadConnector/mock.json +0 -77
  38. package/src/Connector/__tests__/Data/NutshellNewLeadConnector/output.json +0 -74
  39. package/src/Connector/__tests__/Data/NutshellNewTaskConnector/input.json +0 -11
  40. package/src/Connector/__tests__/Data/NutshellNewTaskConnector/mock.json +0 -22
  41. package/src/Connector/__tests__/Data/NutshellNewTaskConnector/output.json +0 -19
  42. package/src/Connector/__tests__/NutshellGetAccountConnector.ts +0 -17
  43. package/src/Connector/__tests__/NutshellNewAccountConnector.ts +0 -17
  44. package/src/Connector/__tests__/NutshellNewLeadConnector.ts +0 -17
  45. package/src/Connector/__tests__/NutshellNewTaskConnector.ts +0 -17
  46. package/src/NutshellApplication.ts +0 -73
  47. package/test/dataProvider.ts +0 -50
  48. package/tsconfig.json +0 -8
  49. package/tsconfig.prod.json +0 -13
  50. package/tsconfig.prod.tsbuildinfo +0 -1
@@ -1,149 +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
- import crypto from 'crypto';
5
-
6
- export const NAME = 'nutshell-get-account-connector';
7
-
8
- export default class NutshellGetAccountConnector extends AConnector {
9
-
10
- public getName(): string {
11
- return NAME;
12
- }
13
-
14
- public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
15
- const appInstall = await this.getApplicationInstallFromProcess(dto);
16
-
17
- const data = {
18
- jsonrpc: '2.0',
19
- method: 'getAccount',
20
- params: dto.getJsonData(),
21
- id: crypto.randomBytes(4).toString('hex'),
22
- };
23
- const req = await this.getApplication().getRequestDto(
24
- dto,
25
- appInstall,
26
- HttpMethods.POST,
27
- undefined,
28
- data,
29
- );
30
-
31
- const resp = await this.getSender().send<IResponse>(req, [200]);
32
- const response = resp.getJsonBody();
33
-
34
- return dto.setNewJsonData(response.result);
35
- }
36
-
37
- }
38
-
39
- /* eslint-disable @typescript-eslint/naming-convention */
40
- interface IResponse {
41
- result: IOutput;
42
- id: string;
43
- jsonrpc: string;
44
- }
45
-
46
- export interface IInput {
47
- accountId: number;
48
- }
49
-
50
- export interface IOutput {
51
- id: number;
52
- entityType: string;
53
- rev: string;
54
- modifiedTime: string;
55
- createdTime: string;
56
- name: string;
57
- htmlUrl: string;
58
- htmlUrlPath: string;
59
- avatarUrl: string;
60
- accountType: {
61
- id: number;
62
- name: string;
63
- };
64
- industry: {
65
- stub: boolean;
66
- id: number;
67
- rev: string;
68
- entityType: string;
69
- name: string;
70
- };
71
- tags: [];
72
- lastContactedDate: string;
73
- contacts: [
74
- {
75
- stub: true;
76
- id: number;
77
- rev: string;
78
- entityType: string;
79
- modifiedTime: string;
80
- createdTime: string;
81
- name: string;
82
- jobTitle: string;
83
- relationship: null;
84
- },
85
- ];
86
- description: null;
87
- legacyId: null;
88
- address: {
89
- main: {
90
- name: null;
91
- location: {
92
- longitude: number;
93
- latitude: number;
94
- };
95
- locationAccuracy: string;
96
- address_1: string;
97
- address_2: null;
98
- address_3: null;
99
- city: string;
100
- state: string;
101
- postalCode: string;
102
- country: string;
103
- timezone: null;
104
- };
105
- primary: {
106
- name: null;
107
- location: {
108
- longitude: number;
109
- latitude: number;
110
- };
111
- locationAccuracy: string;
112
- address_1: string;
113
- address_2: null;
114
- address_3: null;
115
- city: string;
116
- state: string;
117
- postalCode: string;
118
- country: string;
119
- timezone: null;
120
- };
121
- };
122
- notes: [];
123
- leads: [
124
- {
125
- stub: boolean;
126
- id: number;
127
- rev: string;
128
- entityType: string;
129
- modifiedTime: string;
130
- createdTime: string;
131
- name: string;
132
- description: string;
133
- status: number;
134
- completion: number;
135
- value: {
136
- currency: string;
137
- amount: number;
138
- };
139
- primaryAccountName: string;
140
- primaryContactName: string;
141
- isOverdue: false;
142
- lastContactedDate: string;
143
- dueTime: string;
144
- closedTime: string;
145
- },
146
- ];
147
- }
148
-
149
- /* eslint-enable @typescript-eslint/naming-convention */
@@ -1,223 +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
- import crypto from 'crypto';
5
-
6
- export const NAME = 'nutshell-new-account-connector';
7
-
8
- export default class NutshellNewAccountConnector extends AConnector {
9
-
10
- public getName(): string {
11
- return NAME;
12
- }
13
-
14
- public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
15
- const appInstall = await this.getApplicationInstallFromProcess(dto);
16
-
17
- const data = {
18
- jsonrpc: '2.0',
19
- method: 'newAccount',
20
- params: dto.getJsonData(),
21
- id: crypto.randomBytes(4).toString('hex'),
22
- };
23
-
24
- const req = await this.getApplication().getRequestDto(
25
- dto,
26
- appInstall,
27
- HttpMethods.POST,
28
- undefined,
29
- data,
30
- );
31
-
32
- const resp = await this.getSender().send<IResponse>(req, [200]);
33
- const response = resp.getJsonBody();
34
-
35
- return dto.setNewJsonData(response.result);
36
- }
37
-
38
- }
39
-
40
- /* eslint-disable @typescript-eslint/naming-convention */
41
-
42
- interface IResponse {
43
- result: IOutput;
44
- id: string;
45
- jsonrpc: string;
46
-
47
- }
48
-
49
- export interface IInput {
50
- account: {
51
- name: string;
52
- owner?: {
53
- entityType?: string;
54
- id?: number;
55
- };
56
- industryId?: string;
57
- accountTypeId?: string;
58
- territoryId?: string;
59
- url?: string[];
60
- phone?: string[];
61
- leads?: [
62
- {
63
- relationship?: string;
64
- id?: number;
65
- },
66
- ];
67
- contacts?: [
68
- {
69
- relationship?: string;
70
- id?: number;
71
- },
72
- ];
73
- address?: [
74
- {
75
- address_1?: string;
76
- address_2?: string;
77
- address_3?: string;
78
- city?: string;
79
- state?: string;
80
- postalCode?: string;
81
- country?: string;
82
- },
83
- ];
84
- customFields?: {
85
- Number_of_Employees?: string;
86
- };
87
-
88
- };
89
- }
90
-
91
- export interface IOutput {
92
- id: number;
93
- entityType: string;
94
- rev: string;
95
- modifiedTime: string;
96
- createdTime: string;
97
- name: string;
98
- htmlUrl: string;
99
- htmlUrlPath: string;
100
- avatarUrl: string;
101
- accountType: {
102
- id: number;
103
- name: string;
104
- };
105
- industry: {
106
- stub: boolean;
107
- id: number;
108
- rev: string;
109
- entityType: string;
110
- name: string;
111
- };
112
- creator: {
113
- stub: boolean;
114
- id: number;
115
- rev: string;
116
- entityType: string;
117
- modifiedTime: string;
118
- createdTime: string;
119
- name: string;
120
- emails: string[];
121
- isEnabled: boolean;
122
- isAdministrator: boolean;
123
- };
124
- owner: {
125
- stub: boolean;
126
- id: number;
127
- rev: string;
128
- entityType: string;
129
- modifiedTime: string;
130
- createdTime: string;
131
- name: string;
132
- emails: string[];
133
- isEnabled: boolean;
134
- isAdministrator: boolean;
135
- };
136
- tags: [];
137
- lastContactedDate: string;
138
- contacts: [
139
- {
140
- stub: boolean;
141
- id: number;
142
- rev: string;
143
- entityType: string;
144
- modifiedTime: string;
145
- createdTime: string;
146
- name: string;
147
- jobTitle: string;
148
- relationship: string;
149
- }];
150
- description: null;
151
- legacyId: null;
152
- phone: {
153
- '0': {
154
- countryCode: string;
155
- number: string;
156
- extension: null;
157
- numberFormatted: string;
158
- E164: string;
159
- countryCodeAndNumber: string;
160
- };
161
- '1': {
162
- countryCode: string;
163
- number: string;
164
- extension: null;
165
- numberFormatted: string;
166
- E164: string;
167
- countryCodeAndNumber: string;
168
- };
169
- '2': {
170
- countryCode: string;
171
- number: string;
172
- extension: null;
173
- numberFormatted: string;
174
- E164: string;
175
- countryCodeAndNumber: string;
176
- };
177
- '--primary': {
178
- countryCode: string;
179
- number: string;
180
- extension: null;
181
- numberFormatted: string;
182
- E164: string;
183
- countryCodeAndNumber: string;
184
- };
185
- };
186
- url: {
187
- '0': string;
188
- '1': string;
189
- '--primary': string;
190
- };
191
- address: {
192
- '0': {
193
- name: null;
194
- location: null;
195
- locationAccuracy: null;
196
- address_1: string;
197
- address_2: string;
198
- address_3: string;
199
- city: string;
200
- state: string;
201
- postalCode: string;
202
- country: string;
203
- timezone: null;
204
- };
205
- '--primary': {
206
- name: null;
207
- location: null;
208
- locationAccuracy: null;
209
- address_1: string;
210
- address_2: string;
211
- address_3: string;
212
- city: string;
213
- state: string;
214
- postalCode: string;
215
- country: string;
216
- timezone: null;
217
- };
218
- };
219
- notes: [];
220
- leads: [];
221
- }
222
-
223
- /* eslint-enable @typescript-eslint/naming-convention */
@@ -1,239 +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
- import crypto from 'crypto';
5
-
6
- export const NAME = 'nutshell-new-lead-connector';
7
-
8
- export default class NutshellNewLeadConnector extends AConnector {
9
-
10
- public getName(): string {
11
- return NAME;
12
- }
13
-
14
- public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
15
- const appInstall = await this.getApplicationInstallFromProcess(dto);
16
-
17
- const data = {
18
- jsonrpc: '2.0',
19
- method: 'newLead',
20
- params: dto.getJsonData(),
21
- id: crypto.randomBytes(4).toString('hex'),
22
- };
23
- const req = await this.getApplication().getRequestDto(
24
- dto,
25
- appInstall,
26
- HttpMethods.POST,
27
- undefined,
28
- data,
29
- );
30
-
31
- const resp = await this.getSender().send<IResponse>(req, [200]);
32
- const response = resp.getJsonBody();
33
-
34
- return dto.setNewJsonData(response.result);
35
- }
36
-
37
- }
38
-
39
- /* eslint-disable @typescript-eslint/naming-convention */
40
-
41
- interface IResponse {
42
- result: IOutput;
43
- id: string;
44
- jsonrpc: string;
45
- }
46
-
47
- export interface IOutput {
48
- id: number;
49
- entityType: string;
50
- rev: string;
51
- modifiedTime: string;
52
- createdTime: string;
53
- name: string;
54
- description: string;
55
- htmlUrl: string;
56
- htmlUrlPath: string;
57
- avatarUrl: string;
58
- creator: {
59
- stub: boolean;
60
- id: number;
61
- rev: string;
62
- entityType: string;
63
- modifiedTime: string;
64
- createdTime: string;
65
- name: string;
66
- emails: string[];
67
- isEnabled: boolean;
68
- isAdministrator: boolean;
69
- };
70
- primaryAccount: {
71
- stub: boolean;
72
- id: number;
73
- rev: string;
74
- entityType: string;
75
- modifiedTime: string;
76
- createdTime: string;
77
- name: string;
78
- regions: string[];
79
- relationship: null;
80
- description: null;
81
- };
82
- milestone: null;
83
- stageset: {
84
- stub: boolean;
85
- id: number;
86
- entityType: string;
87
- modifiedTime: string;
88
- name: string;
89
- };
90
- activitiesCount: {
91
- '0': number;
92
- '1': number;
93
- '2': number;
94
- '-1': number;
95
- };
96
- status: number;
97
- confidence: number;
98
- completion: number;
99
- urgency: string;
100
- isOverdue: boolean;
101
- lastContactedDate: null;
102
- market: {
103
- stub: boolean;
104
- id: number;
105
- rev: string;
106
- entityType: string;
107
- name: string;
108
- };
109
- assignee: {
110
- stub: boolean;
111
- id: number;
112
- rev: string;
113
- entityType: string;
114
- modifiedTime: string;
115
- createdTime: string;
116
- name: string;
117
- emails: string[];
118
- isEnabled: boolean;
119
- isAdministrator: boolean;
120
- };
121
- sources: [];
122
- competitors: [];
123
- products: [
124
- {
125
- stub: boolean;
126
- id: number;
127
- rev: string;
128
- entityType: string;
129
- modifiedTime: string;
130
- createdTime: string;
131
- name: string;
132
- relationship: string;
133
- price: {
134
- currency: string;
135
- amount: number;
136
- };
137
- quantity: number;
138
- }];
139
- contacts: [];
140
- accounts: [];
141
- tags: string[];
142
- priority: number;
143
- dueTime: string;
144
- value: {
145
- currency: string;
146
- amount: number;
147
- };
148
- normalizedValue: {
149
- currency: string;
150
- amount: number;
151
- };
152
- processes: [];
153
- notes: [
154
- {
155
- stub: number;
156
- id: number;
157
- rev: string;
158
- entityType: string;
159
- createdTime: string;
160
- note: string;
161
- noteMarkup: string;
162
- noteHtml: string;
163
- user: {
164
- stub: boolean;
165
- id: number;
166
- rev: string;
167
- entityType: string;
168
- modifiedTim: string;
169
- createdTime: string;
170
- name: string;
171
- emails: string[];
172
- isEnabled: boolean;
173
- isAdministrator: boolean;
174
- };
175
- originId: number;
176
- date: string;
177
- }];
178
- estimatedValue: {
179
- currency: string;
180
- amount: number;
181
- };
182
- }
183
-
184
- export interface IInput {
185
- lead: {
186
- primaryAccount?: { id: string };
187
- dueTime?: string;
188
- market?: { id: string };
189
- tags?: string[];
190
- description?: string;
191
- accounts?: [
192
- {
193
- id?: number;
194
- },
195
- ];
196
- contacts?: [
197
- {
198
- id?: number;
199
- },
200
- ];
201
- products?: [
202
- {
203
- relationship?: string;
204
- quantity?: number;
205
- price?: {
206
- currency_shortname?: string;
207
- amount?: string;
208
- };
209
- id?: number;
210
- },
211
- ];
212
- competitors?: [
213
- {
214
- status?: number;
215
- relationship?: string;
216
- id?: number;
217
- },
218
- ];
219
- sources?: [
220
- { id?: number },
221
- ];
222
- confidence?: number;
223
- assignee?: {
224
- entityType?: string;
225
- id?: number;
226
- };
227
- customFields?: {
228
- 'Tracking #'?: string;
229
- Discount?: {
230
- currency_shortname?: string;
231
- amount?: string;
232
- };
233
- };
234
- note?: string[];
235
- priority?: number;
236
- };
237
- }
238
-
239
- /* eslint-enable @typescript-eslint/naming-convention */
@@ -1,107 +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
- import crypto from 'crypto';
5
-
6
- export const NAME = 'nutshell-new-task-connector';
7
-
8
- export default class NutshellNewTaskConnector extends AConnector {
9
-
10
- public getName(): string {
11
- return NAME;
12
- }
13
-
14
- public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
15
- const appInstall = await this.getApplicationInstallFromProcess(dto);
16
-
17
- const data = {
18
- jsonrpc: '2.0',
19
- method: 'newTask',
20
- params: dto.getJsonData(),
21
- id: crypto.randomBytes(4).toString('hex'),
22
- };
23
- const req = await this.getApplication().getRequestDto(
24
- dto,
25
- appInstall,
26
- HttpMethods.POST,
27
- undefined,
28
- data,
29
- );
30
-
31
- const resp = await this.getSender().send<IResponse>(req, [200]);
32
- const response = resp.getJsonBody();
33
-
34
- return dto.setNewJsonData(response.result);
35
- }
36
-
37
- }
38
-
39
- interface IResponse {
40
- result: IOutput;
41
- id: string;
42
- jsonrpc: string;
43
- }
44
-
45
- export interface IOutput {
46
- title: string;
47
- id: number;
48
- entityType: string;
49
- rev: string;
50
- createdTime: string;
51
- description: string;
52
- dueTime: string;
53
- completedTime: null;
54
- completedUser: null;
55
- assignee: {
56
- stub: boolean;
57
- id: number;
58
- rev: string;
59
- entityType: string;
60
- modifiedTime: string;
61
- createdTime: string;
62
- name: string;
63
- emails: string[];
64
- isEnabled: boolean;
65
- isAdministrator: boolean;
66
- };
67
- entity: {
68
- stub: boolean;
69
- id: number;
70
- rev: string;
71
- entityType: string;
72
- modifiedTime: string;
73
- createdTime: string;
74
- name: string;
75
- regions: string[];
76
- };
77
- creator: {
78
- stub: boolean;
79
- id: number;
80
- rev: string;
81
- entityType: string;
82
- modifiedTime: string;
83
- createdTime: string;
84
- name: string;
85
- emails: string[];
86
- isEnabled: boolean;
87
- isAdministrator: boolean;
88
- };
89
-
90
- }
91
-
92
- export interface IInput {
93
- task: {
94
- title: string;
95
- description?: string;
96
- dueTime?: string;
97
- assignee?: {
98
- entityType?: string;
99
- id?: number;
100
- };
101
- entity?: {
102
- entityType?: string;
103
- id?: number;
104
- };
105
- };
106
-
107
- }
@@ -1,8 +0,0 @@
1
- {
2
- "headers": {
3
- "user": "TestUser"
4
- },
5
- "data": {
6
- "accountId": 116
7
- }
8
- }