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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { Q as QueryBuilder } from './excludedFields-CGXgZN8Y.cjs';
2
- export { E as EXCLUDED_FIELDS_FOR_STAR_QUERY, F as FIELD_TYPE_IDS, a as FIELD_TYPE_MAPPINGS, O as OBJECT_ID_MAP, b as OBJECT_NAME_MAP, e as escapeQueryValue, s as sanitizeQuery } from './excludedFields-CGXgZN8Y.cjs';
1
+ import { Q as QueryBuilder } from './excludedFields-DSX1EYaT.cjs';
2
+ export { E as EXCLUDED_FIELDS_FOR_STAR_QUERY, F as FIELD_TYPE_IDS, a as FIELD_TYPE_MAPPINGS, O as OBJECT_ID_MAP, b as OBJECT_NAME_MAP, e as escapeQueryValue, s as sanitizeQuery } from './excludedFields-DSX1EYaT.cjs';
3
3
 
4
4
  /**
5
5
  * Configuration options for FireberryClient
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Q as QueryBuilder } from './excludedFields-CGXgZN8Y.js';
2
- export { E as EXCLUDED_FIELDS_FOR_STAR_QUERY, F as FIELD_TYPE_IDS, a as FIELD_TYPE_MAPPINGS, O as OBJECT_ID_MAP, b as OBJECT_NAME_MAP, e as escapeQueryValue, s as sanitizeQuery } from './excludedFields-CGXgZN8Y.js';
1
+ import { Q as QueryBuilder } from './excludedFields-DSX1EYaT.js';
2
+ export { E as EXCLUDED_FIELDS_FOR_STAR_QUERY, F as FIELD_TYPE_IDS, a as FIELD_TYPE_MAPPINGS, O as OBJECT_ID_MAP, b as OBJECT_NAME_MAP, e as escapeQueryValue, s as sanitizeQuery } from './excludedFields-DSX1EYaT.js';
3
3
 
4
4
  /**
5
5
  * Configuration options for FireberryClient
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var init_excludedFields = __esm({
31
31
  EXCLUDED_FIELDS_FOR_STAR_QUERY = {
32
32
  "7": ["deletedon", "deletedby"],
33
33
  // Note
34
- "8": ["deletedon", "deletedby"],
34
+ "8": ["deletedon", "deletedby", "s", "w", "o", "t", "description"],
35
35
  // Competitor
36
36
  "114": ["deletedon", "deletedby"],
37
37
  // Calendar Resource
@@ -186,6 +186,128 @@ function chunkArray(array, size) {
186
186
  return result;
187
187
  }
188
188
 
189
+ // src/constants/objectIds.ts
190
+ var OBJECT_ID_MAP = {
191
+ 1: "accountid",
192
+ // Account
193
+ 2: "contactid",
194
+ // Contact
195
+ 3: "leadid",
196
+ // Lead
197
+ 4: "opportunityid",
198
+ // Opportunity
199
+ 5: "casesid",
200
+ // Cases
201
+ 6: "activityid",
202
+ // Activity
203
+ 7: "noteid",
204
+ // Note
205
+ 8: "competitorid",
206
+ // Competitor
207
+ 9: "crmuserid",
208
+ // CrmUser
209
+ 10: "taskid",
210
+ // Task
211
+ 12: "quoteid",
212
+ // Quote
213
+ 13: "crmorderid",
214
+ // CrmOrder
215
+ 14: "productid",
216
+ // Product
217
+ 17: "crmorderitemid",
218
+ // CrmOrderItem
219
+ 20: "emailtemplateid",
220
+ // EmailTemplate
221
+ 23: "businessunitid",
222
+ // BusinessUnit
223
+ 25: "orgid",
224
+ // Org
225
+ 27: "printtemplateid",
226
+ // PrintTemplate
227
+ 28: "contractid",
228
+ // Contract
229
+ 33: "accountproductid",
230
+ // AccountProduct
231
+ 46: "projectid",
232
+ // Project
233
+ 55: "wfruleid",
234
+ // WFRule
235
+ 58: "mdobjectid",
236
+ // MDObject
237
+ 64: "roleid",
238
+ // Role
239
+ 67: "campaignid",
240
+ // Campaign
241
+ 70: "crmuserloginid",
242
+ // CrmUserLogin
243
+ 73: "systemfieldid",
244
+ // SystemField
245
+ 76: "articleid",
246
+ // Article
247
+ 77: "linkid",
248
+ // Link
249
+ 78: "invoiceid",
250
+ // Invoice
251
+ 80: "invoicereceiptitemid",
252
+ // InvoiceReceiptItem
253
+ 81: "invoiceid",
254
+ // InvoiceNo
255
+ 82: "invoiceid",
256
+ // InvoiceDraft
257
+ 83: "invoiceid",
258
+ // InvoiceReceipt
259
+ 84: "invoiceid",
260
+ // InvoiceReno
261
+ 85: "invoiceid",
262
+ // InvoiceCredit
263
+ 86: "invoiceid",
264
+ // InvoiceDelivery
265
+ 89: "iprestrictionid",
266
+ // IpRestriction
267
+ 90: "transactionitemid",
268
+ // TransactionItem
269
+ 93: "chargeid",
270
+ // Charge
271
+ 100: "calllogid",
272
+ // calllog
273
+ 101: "attendanceclockid",
274
+ // AttendanceClock
275
+ 102: "activitylogid",
276
+ // ActivityLog
277
+ 104: "conversationid",
278
+ // Conversation
279
+ 105: "teaminboxid",
280
+ // TeamInbox
281
+ 106: "texttemplateid",
282
+ // TextTemplate
283
+ 107: "facebookconnectionid",
284
+ // FacebookConnection
285
+ 109: "auditlogid",
286
+ // AuditLog
287
+ 110: "smstemplateid",
288
+ // SMSTemplate
289
+ 111: "providerverificationid",
290
+ // ProviderVerification
291
+ 114: "calendarresourceid",
292
+ // CalendarResource
293
+ 115: "journeyid",
294
+ // Journey
295
+ 116: "profileid",
296
+ // Profile
297
+ 117: "landingpageid"
298
+ // LandingPage
299
+ };
300
+ function getObjectIdFieldName(objectTypeId) {
301
+ const objectTypeNum = typeof objectTypeId === "string" ? parseInt(objectTypeId, 10) : objectTypeId;
302
+ if (OBJECT_ID_MAP[objectTypeNum]) {
303
+ return OBJECT_ID_MAP[objectTypeNum];
304
+ }
305
+ if (objectTypeNum >= 1e3) {
306
+ return `customobject${objectTypeNum}id`;
307
+ }
308
+ return "id";
309
+ }
310
+
189
311
  // src/utils/queryBuilder.ts
190
312
  function escapeQueryValue(value) {
191
313
  if (!value) {
@@ -276,6 +398,34 @@ var QueryBuilder = class {
276
398
  this.currentField = field;
277
399
  return this.createConditionBuilder();
278
400
  }
401
+ /**
402
+ * Adds a WHERE condition for the primary ID field, automatically mapped based on object type
403
+ * @param value - The ID value to match
404
+ * @throws Error if objectType is not set
405
+ *
406
+ * @example
407
+ * ```typescript
408
+ * // Instead of knowing the exact field name:
409
+ * new QueryBuilder(client)
410
+ * .objectType(1)
411
+ * .whereId('abc123') // Automatically uses 'accountid' for object type 1
412
+ * .execute();
413
+ *
414
+ * // Equivalent to:
415
+ * new QueryBuilder(client)
416
+ * .objectType(1)
417
+ * .where('accountid').equals('abc123')
418
+ * .execute();
419
+ * ```
420
+ */
421
+ whereId(value) {
422
+ if (!this.objectTypeId) {
423
+ throw new Error("Object type must be set before using whereId(). Call .objectType() first.");
424
+ }
425
+ const idField = getObjectIdFieldName(this.objectTypeId);
426
+ this.addCondition(idField, "=", String(value));
427
+ return this;
428
+ }
279
429
  /**
280
430
  * Adds an AND logical operator
281
431
  */
@@ -701,46 +851,6 @@ var MetadataAPI = class {
701
851
  }
702
852
  };
703
853
 
704
- // src/constants/objectIds.ts
705
- var OBJECT_ID_MAP = {
706
- 1: "accountid",
707
- 2: "contactid",
708
- 3: "leadid",
709
- 4: "opportunityid",
710
- 5: "casesid",
711
- 6: "activityid",
712
- 7: "noteid",
713
- 8: "competitorid",
714
- 9: "crmuserid",
715
- 10: "taskid",
716
- 13: "crmorderid",
717
- 14: "productid",
718
- 17: "crmorderitemid",
719
- 20: "emailtemplateid",
720
- 23: "businessunitid",
721
- 27: "printtemplateid",
722
- 28: "contractid",
723
- 33: "accountproductid",
724
- 46: "projectid",
725
- 67: "campaignid",
726
- 76: "articleid",
727
- 86: "invoiceid",
728
- 101: "attendanceclockid",
729
- 102: "activitylogid",
730
- 104: "conversationid",
731
- 114: "calendarresourceid"
732
- };
733
- function getObjectIdFieldName(objectTypeId) {
734
- const objectTypeNum = typeof objectTypeId === "string" ? parseInt(objectTypeId, 10) : objectTypeId;
735
- if (OBJECT_ID_MAP[objectTypeNum]) {
736
- return OBJECT_ID_MAP[objectTypeNum];
737
- }
738
- if (objectTypeNum >= 1e3) {
739
- return `customobject${objectTypeNum}id`;
740
- }
741
- return "id";
742
- }
743
-
744
854
  // src/api/records.ts
745
855
  var RecordsAPI = class {
746
856
  constructor(client) {
@@ -1602,49 +1712,105 @@ var OBJECT_NAME_MAP = {
1602
1712
  4: "name",
1603
1713
  // Opportunity
1604
1714
  5: "title",
1605
- // Case
1715
+ // Cases
1606
1716
  6: "subject",
1607
1717
  // Activity
1608
- 7: "subject",
1718
+ 7: "notetext",
1609
1719
  // Note
1610
- 8: "name",
1720
+ 8: "competitorname",
1611
1721
  // Competitor
1612
1722
  9: "fullname",
1613
- // CRM User
1723
+ // CrmUser
1614
1724
  10: "subject",
1615
1725
  // Task
1616
- 13: "name",
1617
- // CRM Order
1618
- 14: "productname",
1726
+ 12: "quotenumber",
1727
+ // Quote
1728
+ 13: "crmordernumber",
1729
+ // CrmOrder
1730
+ 14: "name",
1619
1731
  // Product
1620
1732
  17: "productname",
1621
- // CRM Order Item
1622
- 20: "name",
1623
- // Email Template
1733
+ // CrmOrderItem
1734
+ 20: "title",
1735
+ // EmailTemplate
1624
1736
  23: "name",
1625
- // Business Unit
1737
+ // BusinessUnit
1738
+ 25: "orgname",
1739
+ // Org
1626
1740
  27: "name",
1627
- // Print Template
1628
- 28: "name",
1741
+ // PrintTemplate
1742
+ 28: "contractname",
1629
1743
  // Contract
1630
- 33: "productname",
1631
- // Account Product
1632
- 46: "name",
1744
+ 33: "productid",
1745
+ // AccountProduct (uses productid as display)
1746
+ 46: "projectname",
1633
1747
  // Project
1634
- 67: "name",
1748
+ 55: "rulename",
1749
+ // WFRule
1750
+ 58: "name",
1751
+ // MDObject
1752
+ 64: "rolename",
1753
+ // Role
1754
+ 67: "campaignname",
1635
1755
  // Campaign
1636
- 76: "title",
1756
+ 70: "browsername",
1757
+ // CrmUserLogin
1758
+ 73: "label",
1759
+ // SystemField (using label as name field)
1760
+ 76: "articlename",
1637
1761
  // Article
1638
- 86: "name",
1762
+ 77: "linkname",
1763
+ // Link
1764
+ 78: "invoicenumber",
1639
1765
  // Invoice
1766
+ 80: "documentnumber",
1767
+ // InvoiceReceiptItem
1768
+ 81: "invoicenumber",
1769
+ // InvoiceNo
1770
+ 82: "invoicenumber",
1771
+ // InvoiceDraft
1772
+ 83: "invoicenumber",
1773
+ // InvoiceReceipt
1774
+ 84: "invoicenumber",
1775
+ // InvoiceReno
1776
+ 85: "invoicenumber",
1777
+ // InvoiceCredit
1778
+ 86: "invoicenumber",
1779
+ // InvoiceDelivery
1780
+ 89: "name",
1781
+ // IpRestriction
1782
+ 90: "documentnumber",
1783
+ // TransactionItem
1784
+ 93: "name",
1785
+ // Charge
1786
+ 100: "callerid",
1787
+ // calllog
1640
1788
  101: "name",
1641
- // Attendance Clock
1642
- 102: "subject",
1643
- // Activity Log
1789
+ // AttendanceClock
1790
+ 102: "activitylognumber",
1791
+ // ActivityLog
1644
1792
  104: "subject",
1645
1793
  // Conversation
1646
- 114: "name"
1647
- // Calendar Resource
1794
+ 105: "name",
1795
+ // TeamInbox
1796
+ 106: "name",
1797
+ // TextTemplate
1798
+ 107: "name",
1799
+ // FacebookConnection
1800
+ 109: "name",
1801
+ // AuditLog
1802
+ 110: "name",
1803
+ // SMSTemplate
1804
+ 111: "name",
1805
+ // ProviderVerification
1806
+ 114: "name",
1807
+ // CalendarResource
1808
+ 115: "name",
1809
+ // Journey
1810
+ 116: "name",
1811
+ // Profile
1812
+ 117: "name"
1813
+ // LandingPage
1648
1814
  };
1649
1815
 
1650
1816
  // src/constants/index.ts