fireberry-api-client 1.0.0-beta.2.3 → 1.0.0-beta.2.3.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/dist/sdk/index.js CHANGED
@@ -1,3 +1,125 @@
1
+ // src/constants/objectIds.ts
2
+ var OBJECT_ID_MAP = {
3
+ 1: "accountid",
4
+ // Account
5
+ 2: "contactid",
6
+ // Contact
7
+ 3: "leadid",
8
+ // Lead
9
+ 4: "opportunityid",
10
+ // Opportunity
11
+ 5: "casesid",
12
+ // Cases
13
+ 6: "activityid",
14
+ // Activity
15
+ 7: "noteid",
16
+ // Note
17
+ 8: "competitorid",
18
+ // Competitor
19
+ 9: "crmuserid",
20
+ // CrmUser
21
+ 10: "taskid",
22
+ // Task
23
+ 12: "quoteid",
24
+ // Quote
25
+ 13: "crmorderid",
26
+ // CrmOrder
27
+ 14: "productid",
28
+ // Product
29
+ 17: "crmorderitemid",
30
+ // CrmOrderItem
31
+ 20: "emailtemplateid",
32
+ // EmailTemplate
33
+ 23: "businessunitid",
34
+ // BusinessUnit
35
+ 25: "orgid",
36
+ // Org
37
+ 27: "printtemplateid",
38
+ // PrintTemplate
39
+ 28: "contractid",
40
+ // Contract
41
+ 33: "accountproductid",
42
+ // AccountProduct
43
+ 46: "projectid",
44
+ // Project
45
+ 55: "wfruleid",
46
+ // WFRule
47
+ 58: "mdobjectid",
48
+ // MDObject
49
+ 64: "roleid",
50
+ // Role
51
+ 67: "campaignid",
52
+ // Campaign
53
+ 70: "crmuserloginid",
54
+ // CrmUserLogin
55
+ 73: "systemfieldid",
56
+ // SystemField
57
+ 76: "articleid",
58
+ // Article
59
+ 77: "linkid",
60
+ // Link
61
+ 78: "invoiceid",
62
+ // Invoice
63
+ 80: "invoicereceiptitemid",
64
+ // InvoiceReceiptItem
65
+ 81: "invoiceid",
66
+ // InvoiceNo
67
+ 82: "invoiceid",
68
+ // InvoiceDraft
69
+ 83: "invoiceid",
70
+ // InvoiceReceipt
71
+ 84: "invoiceid",
72
+ // InvoiceReno
73
+ 85: "invoiceid",
74
+ // InvoiceCredit
75
+ 86: "invoiceid",
76
+ // InvoiceDelivery
77
+ 89: "iprestrictionid",
78
+ // IpRestriction
79
+ 90: "transactionitemid",
80
+ // TransactionItem
81
+ 93: "chargeid",
82
+ // Charge
83
+ 100: "calllogid",
84
+ // calllog
85
+ 101: "attendanceclockid",
86
+ // AttendanceClock
87
+ 102: "activitylogid",
88
+ // ActivityLog
89
+ 104: "conversationid",
90
+ // Conversation
91
+ 105: "teaminboxid",
92
+ // TeamInbox
93
+ 106: "texttemplateid",
94
+ // TextTemplate
95
+ 107: "facebookconnectionid",
96
+ // FacebookConnection
97
+ 109: "auditlogid",
98
+ // AuditLog
99
+ 110: "smstemplateid",
100
+ // SMSTemplate
101
+ 111: "providerverificationid",
102
+ // ProviderVerification
103
+ 114: "calendarresourceid",
104
+ // CalendarResource
105
+ 115: "journeyid",
106
+ // Journey
107
+ 116: "profileid",
108
+ // Profile
109
+ 117: "landingpageid"
110
+ // LandingPage
111
+ };
112
+ function getObjectIdFieldName(objectTypeId) {
113
+ const objectTypeNum = typeof objectTypeId === "string" ? parseInt(objectTypeId, 10) : objectTypeId;
114
+ if (OBJECT_ID_MAP[objectTypeNum]) {
115
+ return OBJECT_ID_MAP[objectTypeNum];
116
+ }
117
+ if (objectTypeNum >= 1e3) {
118
+ return `customobject${objectTypeNum}id`;
119
+ }
120
+ return "id";
121
+ }
122
+
1
123
  // src/utils/queryBuilder.ts
2
124
  function escapeQueryValue(value) {
3
125
  if (!value) {
@@ -88,6 +210,34 @@ var QueryBuilder = class {
88
210
  this.currentField = field;
89
211
  return this.createConditionBuilder();
90
212
  }
213
+ /**
214
+ * Adds a WHERE condition for the primary ID field, automatically mapped based on object type
215
+ * @param value - The ID value to match
216
+ * @throws Error if objectType is not set
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * // Instead of knowing the exact field name:
221
+ * new QueryBuilder(client)
222
+ * .objectType(1)
223
+ * .whereId('abc123') // Automatically uses 'accountid' for object type 1
224
+ * .execute();
225
+ *
226
+ * // Equivalent to:
227
+ * new QueryBuilder(client)
228
+ * .objectType(1)
229
+ * .where('accountid').equals('abc123')
230
+ * .execute();
231
+ * ```
232
+ */
233
+ whereId(value) {
234
+ if (!this.objectTypeId) {
235
+ throw new Error("Object type must be set before using whereId(). Call .objectType() first.");
236
+ }
237
+ const idField = getObjectIdFieldName(this.objectTypeId);
238
+ this.addCondition(idField, "=", String(value));
239
+ return this;
240
+ }
91
241
  /**
92
242
  * Adds an AND logical operator
93
243
  */
@@ -511,46 +661,6 @@ function getLabelFieldForField(fieldName, objectType) {
511
661
  return `${fieldName}name`;
512
662
  }
513
663
 
514
- // src/constants/objectIds.ts
515
- var OBJECT_ID_MAP = {
516
- 1: "accountid",
517
- 2: "contactid",
518
- 3: "leadid",
519
- 4: "opportunityid",
520
- 5: "casesid",
521
- 6: "activityid",
522
- 7: "noteid",
523
- 8: "competitorid",
524
- 9: "crmuserid",
525
- 10: "taskid",
526
- 13: "crmorderid",
527
- 14: "productid",
528
- 17: "crmorderitemid",
529
- 20: "emailtemplateid",
530
- 23: "businessunitid",
531
- 27: "printtemplateid",
532
- 28: "contractid",
533
- 33: "accountproductid",
534
- 46: "projectid",
535
- 67: "campaignid",
536
- 76: "articleid",
537
- 86: "invoiceid",
538
- 101: "attendanceclockid",
539
- 102: "activitylogid",
540
- 104: "conversationid",
541
- 114: "calendarresourceid"
542
- };
543
- function getObjectIdFieldName(objectTypeId) {
544
- const objectTypeNum = typeof objectTypeId === "string" ? parseInt(objectTypeId, 10) : objectTypeId;
545
- if (OBJECT_ID_MAP[objectTypeNum]) {
546
- return OBJECT_ID_MAP[objectTypeNum];
547
- }
548
- if (objectTypeNum >= 1e3) {
549
- return `customobject${objectTypeNum}id`;
550
- }
551
- return "id";
552
- }
553
-
554
664
  // src/constants/objectNames.ts
555
665
  var OBJECT_NAME_MAP = {
556
666
  1: "accountname",
@@ -562,49 +672,105 @@ var OBJECT_NAME_MAP = {
562
672
  4: "name",
563
673
  // Opportunity
564
674
  5: "title",
565
- // Case
675
+ // Cases
566
676
  6: "subject",
567
677
  // Activity
568
- 7: "subject",
678
+ 7: "notetext",
569
679
  // Note
570
- 8: "name",
680
+ 8: "competitorname",
571
681
  // Competitor
572
682
  9: "fullname",
573
- // CRM User
683
+ // CrmUser
574
684
  10: "subject",
575
685
  // Task
576
- 13: "name",
577
- // CRM Order
578
- 14: "productname",
686
+ 12: "quotenumber",
687
+ // Quote
688
+ 13: "crmordernumber",
689
+ // CrmOrder
690
+ 14: "name",
579
691
  // Product
580
692
  17: "productname",
581
- // CRM Order Item
582
- 20: "name",
583
- // Email Template
693
+ // CrmOrderItem
694
+ 20: "title",
695
+ // EmailTemplate
584
696
  23: "name",
585
- // Business Unit
697
+ // BusinessUnit
698
+ 25: "orgname",
699
+ // Org
586
700
  27: "name",
587
- // Print Template
588
- 28: "name",
701
+ // PrintTemplate
702
+ 28: "contractname",
589
703
  // Contract
590
- 33: "productname",
591
- // Account Product
592
- 46: "name",
704
+ 33: "productid",
705
+ // AccountProduct (uses productid as display)
706
+ 46: "projectname",
593
707
  // Project
594
- 67: "name",
708
+ 55: "rulename",
709
+ // WFRule
710
+ 58: "name",
711
+ // MDObject
712
+ 64: "rolename",
713
+ // Role
714
+ 67: "campaignname",
595
715
  // Campaign
596
- 76: "title",
716
+ 70: "browsername",
717
+ // CrmUserLogin
718
+ 73: "label",
719
+ // SystemField (using label as name field)
720
+ 76: "articlename",
597
721
  // Article
598
- 86: "name",
722
+ 77: "linkname",
723
+ // Link
724
+ 78: "invoicenumber",
599
725
  // Invoice
726
+ 80: "documentnumber",
727
+ // InvoiceReceiptItem
728
+ 81: "invoicenumber",
729
+ // InvoiceNo
730
+ 82: "invoicenumber",
731
+ // InvoiceDraft
732
+ 83: "invoicenumber",
733
+ // InvoiceReceipt
734
+ 84: "invoicenumber",
735
+ // InvoiceReno
736
+ 85: "invoicenumber",
737
+ // InvoiceCredit
738
+ 86: "invoicenumber",
739
+ // InvoiceDelivery
740
+ 89: "name",
741
+ // IpRestriction
742
+ 90: "documentnumber",
743
+ // TransactionItem
744
+ 93: "name",
745
+ // Charge
746
+ 100: "callerid",
747
+ // calllog
600
748
  101: "name",
601
- // Attendance Clock
602
- 102: "subject",
603
- // Activity Log
749
+ // AttendanceClock
750
+ 102: "activitylognumber",
751
+ // ActivityLog
604
752
  104: "subject",
605
753
  // Conversation
606
- 114: "name"
607
- // Calendar Resource
754
+ 105: "name",
755
+ // TeamInbox
756
+ 106: "name",
757
+ // TextTemplate
758
+ 107: "name",
759
+ // FacebookConnection
760
+ 109: "name",
761
+ // AuditLog
762
+ 110: "name",
763
+ // SMSTemplate
764
+ 111: "name",
765
+ // ProviderVerification
766
+ 114: "name",
767
+ // CalendarResource
768
+ 115: "name",
769
+ // Journey
770
+ 116: "name",
771
+ // Profile
772
+ 117: "name"
773
+ // LandingPage
608
774
  };
609
775
  function getNameFieldByObjectType(objectTypeId) {
610
776
  const objectTypeNum = typeof objectTypeId === "string" ? parseInt(objectTypeId, 10) : objectTypeId;
@@ -621,7 +787,7 @@ function getNameFieldByObjectType(objectTypeId) {
621
787
  var EXCLUDED_FIELDS_FOR_STAR_QUERY = {
622
788
  "7": ["deletedon", "deletedby"],
623
789
  // Note
624
- "8": ["deletedon", "deletedby"],
790
+ "8": ["deletedon", "deletedby", "s", "w", "o", "t", "description"],
625
791
  // Competitor
626
792
  "114": ["deletedon", "deletedby"],
627
793
  // Calendar Resource