cf-service-sdk 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/dist/sdk.js ADDED
@@ -0,0 +1,604 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CloudForgeSDK = void 0;
4
+ const client_1 = require("./client");
5
+ const mutations_1 = require("./mutations");
6
+ const queries_1 = require("./queries");
7
+ class CloudForgeSDK {
8
+ constructor(options) {
9
+ this.client = new client_1.CloudForgeClient(options);
10
+ this.apolloClient = this.client.getClient();
11
+ }
12
+ // Authentication
13
+ setToken(token) {
14
+ this.client.setToken(token);
15
+ this.apolloClient = this.client.getClient();
16
+ }
17
+ logout() {
18
+ this.client.logout();
19
+ this.apolloClient = this.client.getClient();
20
+ }
21
+ // Mutations
22
+ async acceptInvitation(input) {
23
+ return this.apolloClient.mutate({
24
+ mutation: mutations_1.ACCEPT_INVITATION,
25
+ variables: { ...input }
26
+ });
27
+ }
28
+ async addContactsToSegment(segmentId, contactIds) {
29
+ return this.apolloClient.mutate({
30
+ mutation: mutations_1.ADD_CONTACTS_TO_SEGMENT,
31
+ variables: { segmentId, contactIds }
32
+ });
33
+ }
34
+ async addSegmentToCallCampaign(callCampaignId, segmentId) {
35
+ return this.apolloClient.mutate({
36
+ mutation: mutations_1.ADD_SEGMENT_TO_CALL_CAMPAIGN,
37
+ variables: { callCampaignId, segmentId }
38
+ });
39
+ }
40
+ async addSegmentToCampaign(campaignId, segmentId) {
41
+ return this.apolloClient.mutate({
42
+ mutation: mutations_1.ADD_SEGMENT_TO_CAMPAIGN,
43
+ variables: { campaignId, segmentId }
44
+ });
45
+ }
46
+ async cancelCampaign(id) {
47
+ return this.apolloClient.mutate({
48
+ mutation: mutations_1.CANCEL_CAMPAIGN,
49
+ variables: { id }
50
+ });
51
+ }
52
+ async cancelInvitation(input) {
53
+ return this.apolloClient.mutate({
54
+ mutation: mutations_1.CANCEL_INVITATION,
55
+ variables: { ...input }
56
+ });
57
+ }
58
+ async changePassword(input) {
59
+ return this.apolloClient.mutate({
60
+ mutation: mutations_1.CHANGE_PASSWORD,
61
+ variables: { ...input }
62
+ });
63
+ }
64
+ async completeCampaign(id) {
65
+ return this.apolloClient.mutate({
66
+ mutation: mutations_1.COMPLETE_CAMPAIGN,
67
+ variables: { id }
68
+ });
69
+ }
70
+ async createCallCampaign(input) {
71
+ return this.apolloClient.mutate({
72
+ mutation: mutations_1.CREATE_CALL_CAMPAIGN,
73
+ variables: { ...input }
74
+ });
75
+ }
76
+ async createCallCampaignLog(input) {
77
+ return this.apolloClient.mutate({
78
+ mutation: mutations_1.CREATE_CALL_CAMPAIGN_LOG,
79
+ variables: { ...input }
80
+ });
81
+ }
82
+ async createCampaign(input) {
83
+ return this.apolloClient.mutate({
84
+ mutation: mutations_1.CREATE_CAMPAIGN,
85
+ variables: { ...input }
86
+ });
87
+ }
88
+ async createCompany(input) {
89
+ return this.apolloClient.mutate({
90
+ mutation: mutations_1.CREATE_COMPANY,
91
+ variables: { ...input }
92
+ });
93
+ }
94
+ async createContact(input) {
95
+ return this.apolloClient.mutate({
96
+ mutation: mutations_1.CREATE_CONTACT,
97
+ variables: { ...input }
98
+ });
99
+ }
100
+ async createEmailTemplate(input) {
101
+ return this.apolloClient.mutate({
102
+ mutation: mutations_1.CREATE_EMAIL_TEMPLATE,
103
+ variables: { ...input }
104
+ });
105
+ }
106
+ async createNotification(input) {
107
+ return this.apolloClient.mutate({
108
+ mutation: mutations_1.CREATE_NOTIFICATION,
109
+ variables: { ...input }
110
+ });
111
+ }
112
+ async createSegment(input) {
113
+ return this.apolloClient.mutate({
114
+ mutation: mutations_1.CREATE_SEGMENT,
115
+ variables: { ...input }
116
+ });
117
+ }
118
+ async createTask(input) {
119
+ return this.apolloClient.mutate({
120
+ mutation: mutations_1.CREATE_TASK,
121
+ variables: { ...input }
122
+ });
123
+ }
124
+ async deleteCallCampaign(id) {
125
+ return this.apolloClient.mutate({
126
+ mutation: mutations_1.DELETE_CALL_CAMPAIGN,
127
+ variables: { id }
128
+ });
129
+ }
130
+ async deleteCampaign(id) {
131
+ return this.apolloClient.mutate({
132
+ mutation: mutations_1.DELETE_CAMPAIGN,
133
+ variables: { id }
134
+ });
135
+ }
136
+ async deleteCompany(id) {
137
+ return this.apolloClient.mutate({
138
+ mutation: mutations_1.DELETE_COMPANY,
139
+ variables: { id }
140
+ });
141
+ }
142
+ async deleteContact(id) {
143
+ return this.apolloClient.mutate({
144
+ mutation: mutations_1.DELETE_CONTACT,
145
+ variables: { id }
146
+ });
147
+ }
148
+ async deleteEmailTemplate(uuid) {
149
+ return this.apolloClient.mutate({
150
+ mutation: mutations_1.DELETE_EMAIL_TEMPLATE,
151
+ variables: { uuid }
152
+ });
153
+ }
154
+ async deleteNotification(notificationId) {
155
+ return this.apolloClient.mutate({
156
+ mutation: mutations_1.DELETE_NOTIFICATION,
157
+ variables: { notificationId }
158
+ });
159
+ }
160
+ async deleteSegment(id) {
161
+ return this.apolloClient.mutate({
162
+ mutation: mutations_1.DELETE_SEGMENT,
163
+ variables: { id }
164
+ });
165
+ }
166
+ async deleteTask(id) {
167
+ return this.apolloClient.mutate({
168
+ mutation: mutations_1.DELETE_TASK,
169
+ variables: { id }
170
+ });
171
+ }
172
+ async disconnectNylasIntegration() {
173
+ return this.apolloClient.mutate({
174
+ mutation: mutations_1.DISCONNECT_NYLAS_INTEGRATION,
175
+ });
176
+ }
177
+ async forgotPassword(email) {
178
+ return this.apolloClient.mutate({
179
+ mutation: mutations_1.FORGOT_PASSWORD,
180
+ variables: { email }
181
+ });
182
+ }
183
+ async inviteUser(input) {
184
+ return this.apolloClient.mutate({
185
+ mutation: mutations_1.INVITE_USER,
186
+ variables: { ...input }
187
+ });
188
+ }
189
+ async login(email, password) {
190
+ return this.apolloClient.mutate({
191
+ mutation: mutations_1.LOGIN,
192
+ variables: { email, password }
193
+ });
194
+ }
195
+ async loginWithGoogle(token, user) {
196
+ return this.apolloClient.mutate({
197
+ mutation: mutations_1.LOGIN_WITH_GOOGLE,
198
+ variables: { token, user }
199
+ });
200
+ }
201
+ async loginWithMicrosoft(accessToken, userData) {
202
+ return this.apolloClient.mutate({
203
+ mutation: mutations_1.LOGIN_WITH_MICROSOFT,
204
+ variables: { accessToken, userData }
205
+ });
206
+ }
207
+ async markAllNotificationsAsRead() {
208
+ return this.apolloClient.mutate({
209
+ mutation: mutations_1.MARK_ALL_NOTIFICATIONS_AS_READ,
210
+ });
211
+ }
212
+ async markNotificationAsRead(input) {
213
+ return this.apolloClient.mutate({
214
+ mutation: mutations_1.MARK_NOTIFICATION_AS_READ,
215
+ variables: { ...input }
216
+ });
217
+ }
218
+ async pauseCampaign(id) {
219
+ return this.apolloClient.mutate({
220
+ mutation: mutations_1.PAUSE_CAMPAIGN,
221
+ variables: { id }
222
+ });
223
+ }
224
+ async previewCampaignEmail(input) {
225
+ return this.apolloClient.mutate({
226
+ mutation: mutations_1.PREVIEW_CAMPAIGN_EMAIL,
227
+ variables: { ...input }
228
+ });
229
+ }
230
+ async rejectInvitation(input) {
231
+ return this.apolloClient.mutate({
232
+ mutation: mutations_1.REJECT_INVITATION,
233
+ variables: { ...input }
234
+ });
235
+ }
236
+ async removeContactsFromSegment(segmentId, contactIds) {
237
+ return this.apolloClient.mutate({
238
+ mutation: mutations_1.REMOVE_CONTACTS_FROM_SEGMENT,
239
+ variables: { segmentId, contactIds }
240
+ });
241
+ }
242
+ async removeMember(input) {
243
+ return this.apolloClient.mutate({
244
+ mutation: mutations_1.REMOVE_MEMBER,
245
+ variables: { ...input }
246
+ });
247
+ }
248
+ async removeSegmentFromCallCampaign(callCampaignId, segmentId) {
249
+ return this.apolloClient.mutate({
250
+ mutation: mutations_1.REMOVE_SEGMENT_FROM_CALL_CAMPAIGN,
251
+ variables: { callCampaignId, segmentId }
252
+ });
253
+ }
254
+ async removeSegmentFromCampaign(campaignId, segmentId) {
255
+ return this.apolloClient.mutate({
256
+ mutation: mutations_1.REMOVE_SEGMENT_FROM_CAMPAIGN,
257
+ variables: { campaignId, segmentId }
258
+ });
259
+ }
260
+ async saveNylasConnection(input) {
261
+ return this.apolloClient.mutate({
262
+ mutation: mutations_1.SAVE_NYLAS_CONNECTION,
263
+ variables: { ...input }
264
+ });
265
+ }
266
+ async scheduleCampaign(input) {
267
+ return this.apolloClient.mutate({
268
+ mutation: mutations_1.SCHEDULE_CAMPAIGN,
269
+ variables: { ...input }
270
+ });
271
+ }
272
+ async sendEmailToContact(input) {
273
+ return this.apolloClient.mutate({
274
+ mutation: mutations_1.SEND_EMAIL_TO_CONTACT,
275
+ variables: { ...input }
276
+ });
277
+ }
278
+ async sendTestEmail(input) {
279
+ return this.apolloClient.mutate({
280
+ mutation: mutations_1.SEND_TEST_EMAIL,
281
+ variables: { ...input }
282
+ });
283
+ }
284
+ async signup(input) {
285
+ return this.apolloClient.mutate({
286
+ mutation: mutations_1.SIGNUP,
287
+ variables: { ...input }
288
+ });
289
+ }
290
+ async startCampaign(id) {
291
+ return this.apolloClient.mutate({
292
+ mutation: mutations_1.START_CAMPAIGN,
293
+ variables: { id }
294
+ });
295
+ }
296
+ async submitFeedback(input) {
297
+ return this.apolloClient.mutate({
298
+ mutation: mutations_1.SUBMIT_FEEDBACK,
299
+ variables: { ...input }
300
+ });
301
+ }
302
+ async unsubscribeFromEmails(input) {
303
+ return this.apolloClient.mutate({
304
+ mutation: mutations_1.UNSUBSCRIBE_FROM_EMAILS,
305
+ variables: { ...input }
306
+ });
307
+ }
308
+ async updateCallCampaign(id, input) {
309
+ return this.apolloClient.mutate({
310
+ mutation: mutations_1.UPDATE_CALL_CAMPAIGN,
311
+ variables: { ...input, id }
312
+ });
313
+ }
314
+ async updateCallCampaignLog(input) {
315
+ return this.apolloClient.mutate({
316
+ mutation: mutations_1.UPDATE_CALL_CAMPAIGN_LOG,
317
+ variables: { ...input }
318
+ });
319
+ }
320
+ async updateCampaign(input) {
321
+ return this.apolloClient.mutate({
322
+ mutation: mutations_1.UPDATE_CAMPAIGN,
323
+ variables: { ...input }
324
+ });
325
+ }
326
+ async updateCompany(input) {
327
+ return this.apolloClient.mutate({
328
+ mutation: mutations_1.UPDATE_COMPANY,
329
+ variables: { ...input }
330
+ });
331
+ }
332
+ async updateContact(input) {
333
+ return this.apolloClient.mutate({
334
+ mutation: mutations_1.UPDATE_CONTACT,
335
+ variables: { ...input }
336
+ });
337
+ }
338
+ async updateEmailTemplate(input, uuid) {
339
+ return this.apolloClient.mutate({
340
+ mutation: mutations_1.UPDATE_EMAIL_TEMPLATE,
341
+ variables: { ...input, uuid }
342
+ });
343
+ }
344
+ async updateSegment(input) {
345
+ return this.apolloClient.mutate({
346
+ mutation: mutations_1.UPDATE_SEGMENT,
347
+ variables: { ...input }
348
+ });
349
+ }
350
+ async updateTask(input) {
351
+ return this.apolloClient.mutate({
352
+ mutation: mutations_1.UPDATE_TASK,
353
+ variables: { ...input }
354
+ });
355
+ }
356
+ async updateUserProfile(input) {
357
+ return this.apolloClient.mutate({
358
+ mutation: mutations_1.UPDATE_USER_PROFILE,
359
+ variables: { ...input }
360
+ });
361
+ }
362
+ async uploadFile(input) {
363
+ var _a;
364
+ const result = await this.apolloClient.mutate({
365
+ mutation: mutations_1.UPLOAD_FILE,
366
+ variables: { ...input }
367
+ });
368
+ return (_a = result.data) === null || _a === void 0 ? void 0 : _a.uploadFile;
369
+ }
370
+ async validateOtpAndResetPassword(input) {
371
+ return this.apolloClient.mutate({
372
+ mutation: mutations_1.VALIDATE_OTP_AND_RESET_PASSWORD,
373
+ variables: { ...input }
374
+ });
375
+ }
376
+ // Queries
377
+ async accountMembers() {
378
+ return this.apolloClient.query({
379
+ query: queries_1.ACCOUNT_MEMBERS,
380
+ });
381
+ }
382
+ async businessProfile() {
383
+ return this.apolloClient.query({
384
+ query: queries_1.BUSINESS_PROFILE,
385
+ });
386
+ }
387
+ async callCampaign(id) {
388
+ return this.apolloClient.query({
389
+ query: queries_1.CALL_CAMPAIGN,
390
+ variables: { id }
391
+ });
392
+ }
393
+ async callCampaignAnalytics(callCampaignId, fromDate, toDate) {
394
+ return this.apolloClient.query({
395
+ query: queries_1.CALL_CAMPAIGN_ANALYTICS,
396
+ variables: { callCampaignId, fromDate, toDate }
397
+ });
398
+ }
399
+ async callCampaignLog(id) {
400
+ return this.apolloClient.query({
401
+ query: queries_1.CALL_CAMPAIGN_LOG,
402
+ variables: { id }
403
+ });
404
+ }
405
+ async callCampaignLogs(callCampaignId, pagination) {
406
+ return this.apolloClient.query({
407
+ query: queries_1.CALL_CAMPAIGN_LOGS,
408
+ variables: { callCampaignId, pagination }
409
+ });
410
+ }
411
+ async callCampaigns(pagination) {
412
+ return this.apolloClient.query({
413
+ query: queries_1.CALL_CAMPAIGNS,
414
+ variables: { pagination }
415
+ });
416
+ }
417
+ async campaign(id) {
418
+ return this.apolloClient.query({
419
+ query: queries_1.CAMPAIGN,
420
+ variables: { id }
421
+ });
422
+ }
423
+ async campaignAnalytics(callCampaignId, fromDate, toDate) {
424
+ return this.apolloClient.query({
425
+ query: queries_1.CAMPAIGN_ANALYTICS,
426
+ variables: { callCampaignId, fromDate, toDate }
427
+ });
428
+ }
429
+ async campaignLogs(callCampaignId, pagination) {
430
+ return this.apolloClient.query({
431
+ query: queries_1.CAMPAIGN_LOGS,
432
+ variables: { callCampaignId, pagination }
433
+ });
434
+ }
435
+ async campaignStats(fromDate, toDate) {
436
+ return this.apolloClient.query({
437
+ query: queries_1.CAMPAIGN_STATS,
438
+ variables: { fromDate, toDate }
439
+ });
440
+ }
441
+ async campaigns(pagination) {
442
+ return this.apolloClient.query({
443
+ query: queries_1.CAMPAIGNS,
444
+ variables: { pagination }
445
+ });
446
+ }
447
+ async companies(filters, pagination, sort) {
448
+ return this.apolloClient.query({
449
+ query: queries_1.COMPANIES,
450
+ variables: { filters, pagination, sort }
451
+ });
452
+ }
453
+ async company(id) {
454
+ return this.apolloClient.query({
455
+ query: queries_1.COMPANY,
456
+ variables: { id }
457
+ });
458
+ }
459
+ async contact(id) {
460
+ return this.apolloClient.query({
461
+ query: queries_1.CONTACT,
462
+ variables: { id }
463
+ });
464
+ }
465
+ async contacts() {
466
+ return this.apolloClient.query({
467
+ query: queries_1.CONTACTS,
468
+ });
469
+ }
470
+ async contactsInSegment(segmentId, pagination) {
471
+ return this.apolloClient.query({
472
+ query: queries_1.CONTACTS_IN_SEGMENT,
473
+ variables: { segmentId, pagination }
474
+ });
475
+ }
476
+ async currentAccount() {
477
+ return this.apolloClient.query({
478
+ query: queries_1.CURRENT_ACCOUNT,
479
+ });
480
+ }
481
+ async emailTemplate() {
482
+ return this.apolloClient.query({
483
+ query: queries_1.EMAIL_TEMPLATE,
484
+ });
485
+ }
486
+ async emailTemplates(campaignType, campaignTypes) {
487
+ return this.apolloClient.query({
488
+ query: queries_1.EMAIL_TEMPLATES,
489
+ variables: { campaignType, campaignTypes }
490
+ });
491
+ }
492
+ async employeeSizes() {
493
+ return this.apolloClient.query({
494
+ query: queries_1.EMPLOYEE_SIZES,
495
+ });
496
+ }
497
+ async industrySectors() {
498
+ return this.apolloClient.query({
499
+ query: queries_1.INDUSTRY_SECTORS,
500
+ });
501
+ }
502
+ async industryTypes() {
503
+ return this.apolloClient.query({
504
+ query: queries_1.INDUSTRY_TYPES,
505
+ });
506
+ }
507
+ async metalGrades() {
508
+ return this.apolloClient.query({
509
+ query: queries_1.METAL_GRADES,
510
+ });
511
+ }
512
+ async metalTypes() {
513
+ return this.apolloClient.query({
514
+ query: queries_1.METAL_TYPES,
515
+ });
516
+ }
517
+ async myInvitations() {
518
+ return this.apolloClient.query({
519
+ query: queries_1.MY_INVITATIONS,
520
+ });
521
+ }
522
+ async notification(id) {
523
+ return this.apolloClient.query({
524
+ query: queries_1.NOTIFICATION,
525
+ variables: { id }
526
+ });
527
+ }
528
+ async notifications() {
529
+ return this.apolloClient.query({
530
+ query: queries_1.NOTIFICATIONS,
531
+ });
532
+ }
533
+ async nylasConnection() {
534
+ return this.apolloClient.query({
535
+ query: queries_1.NYLAS_CONNECTION,
536
+ });
537
+ }
538
+ async pendingInvitations() {
539
+ return this.apolloClient.query({
540
+ query: queries_1.PENDING_INVITATIONS,
541
+ });
542
+ }
543
+ async productCategories() {
544
+ return this.apolloClient.query({
545
+ query: queries_1.PRODUCT_CATEGORIES,
546
+ });
547
+ }
548
+ async productTypes() {
549
+ return this.apolloClient.query({
550
+ query: queries_1.PRODUCT_TYPES,
551
+ });
552
+ }
553
+ async recentNotifications() {
554
+ return this.apolloClient.query({
555
+ query: queries_1.RECENT_NOTIFICATIONS,
556
+ });
557
+ }
558
+ async searchContacts(filters, pagination, sort) {
559
+ return this.apolloClient.query({
560
+ query: queries_1.SEARCH_CONTACTS,
561
+ variables: { filters, pagination, sort }
562
+ });
563
+ }
564
+ async segment(id) {
565
+ return this.apolloClient.query({
566
+ query: queries_1.SEGMENT,
567
+ variables: { id }
568
+ });
569
+ }
570
+ async segments(pagination, filters, includeSystemTemplates) {
571
+ return this.apolloClient.query({
572
+ query: queries_1.SEGMENTS,
573
+ variables: { pagination, filters, includeSystemTemplates }
574
+ });
575
+ }
576
+ async task(id) {
577
+ return this.apolloClient.query({
578
+ query: queries_1.TASK,
579
+ variables: { id }
580
+ });
581
+ }
582
+ async tasks(filters) {
583
+ return this.apolloClient.query({
584
+ query: queries_1.TASKS,
585
+ variables: { filters }
586
+ });
587
+ }
588
+ async unreadNotificationsCount() {
589
+ return this.apolloClient.query({
590
+ query: queries_1.UNREAD_NOTIFICATIONS_COUNT,
591
+ });
592
+ }
593
+ async usStates() {
594
+ return this.apolloClient.query({
595
+ query: queries_1.US_STATES,
596
+ });
597
+ }
598
+ async userProfile() {
599
+ return this.apolloClient.query({
600
+ query: queries_1.USER_PROFILE,
601
+ });
602
+ }
603
+ }
604
+ exports.CloudForgeSDK = CloudForgeSDK;
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "cf-service-sdk",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "description": "TypeScript SDK for the Cloud Forge Service",
8
+ "keywords": [
9
+ "cloud forge sdk",
10
+ "sdk",
11
+ "typescript",
12
+ "graphql"
13
+ ],
14
+ "author": "",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/CloudForge-Software/cf-typescript-sdk.git"
19
+ },
20
+ "scripts": {
21
+ "build": "tsc --project tsconfig.json",
22
+ "update-schema": "node src/update-schema.js",
23
+ "generate": "graphql-codegen --config codegen.yml",
24
+ "generate-sdk": "node generate-sdk.js",
25
+ "prepare": "source ../cf-service/venv/bin/activate && npm run update-schema && npm run generate && npm run generate-sdk && npm run build",
26
+ "prepublishOnly": "npm run prepare",
27
+ "publish": "npm publish --access public",
28
+ "test": "echo \"Error: no test specified\" && exit 1"
29
+ },
30
+ "dependencies": {
31
+ "@apollo/client": "^3.13.8",
32
+ "@types/node": "^24.2.0",
33
+ "graphql": "^16.11.0",
34
+ "react": "^18.0.0"
35
+ },
36
+ "peerDependencies": {
37
+ "react": "^18.0.0",
38
+ "react-dom": "^18.0.0"
39
+ },
40
+ "devDependencies": {
41
+ "@graphql-codegen/cli": "^5.0.0",
42
+ "@graphql-codegen/typescript": "^4.1.6",
43
+ "@graphql-codegen/typescript-operations": "^4.6.1",
44
+ "@graphql-codegen/typescript-react-apollo": "^4.3.2",
45
+ "@types/babel__core": "^7.20.5",
46
+ "@types/babel__generator": "^7.27.0",
47
+ "@types/babel__template": "^7.4.4",
48
+ "@types/babel__traverse": "^7.28.0",
49
+ "@types/graceful-fs": "^4.1.9",
50
+ "@types/istanbul-lib-coverage": "^2.0.6",
51
+ "@types/istanbul-lib-report": "^3.0.3",
52
+ "@types/istanbul-reports": "^3.0.4",
53
+ "@types/stack-utils": "^2.0.3",
54
+ "@types/yargs": "^17.0.33",
55
+ "@types/yargs-parser": "^21.0.3",
56
+ "typescript": "^5.9.2"
57
+ },
58
+ "files": [
59
+ "dist"
60
+ ]
61
+ }