fireberry-api-client 1.0.0-beta.2.1 → 1.0.0-beta.2.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/README.md +6 -8
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -188,18 +188,16 @@ await client.batch.delete('1', ['id-1', 'id-2', 'id-3']);
|
|
|
188
188
|
// Get all objects
|
|
189
189
|
const objects = await client.metadata.getObjects();
|
|
190
190
|
|
|
191
|
-
// Get fields for an object
|
|
191
|
+
// Get fields for an object (includes lookup relationships by default)
|
|
192
192
|
const fields = await client.metadata.getFields('1');
|
|
193
193
|
|
|
194
|
-
//
|
|
195
|
-
const
|
|
196
|
-
includeLookupRelations: true
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
// Example: Find related object for a lookup field
|
|
200
|
-
const primaryContact = fieldsWithRelations.fields.find(f => f.fieldName === 'primarycontactid');
|
|
194
|
+
// Find which object a lookup field references
|
|
195
|
+
const primaryContact = fields.fields.find(f => f.fieldName === 'primarycontactid');
|
|
201
196
|
console.log(primaryContact?.relatedObjectType); // 2 (Contact)
|
|
202
197
|
|
|
198
|
+
// Disable lookup relations for faster response (skips additional API call)
|
|
199
|
+
const fieldsOnly = await client.metadata.getFields('1', { includeLookupRelations: false });
|
|
200
|
+
|
|
203
201
|
// Get dropdown values
|
|
204
202
|
const values = await client.metadata.getFieldValues('1', 'statuscode');
|
|
205
203
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -570,23 +570,23 @@ var MetadataAPI = class {
|
|
|
570
570
|
*
|
|
571
571
|
* @param objectType - The object type ID (e.g., '1' for Account)
|
|
572
572
|
* @param options - Optional settings
|
|
573
|
-
* @param options.includeLookupRelations -
|
|
573
|
+
* @param options.includeLookupRelations - Fetches related object types for lookup fields (default: true)
|
|
574
574
|
* @param options.signal - Optional AbortSignal for cancellation
|
|
575
575
|
* @returns List of fields with metadata
|
|
576
576
|
*
|
|
577
577
|
* @example
|
|
578
578
|
* ```typescript
|
|
579
|
+
* // Lookup relations are included by default
|
|
579
580
|
* const result = await client.metadata.getFields('1');
|
|
580
|
-
* console.log(result.fields); // [{ fieldName: 'accountid', label: 'Account ID', ... }, ...]
|
|
581
|
-
*
|
|
582
|
-
* // With lookup relations
|
|
583
|
-
* const result = await client.metadata.getFields('1', { includeLookupRelations: true });
|
|
584
581
|
* console.log(result.fields.find(f => f.fieldName === 'primarycontactid')?.relatedObjectType); // 2
|
|
582
|
+
*
|
|
583
|
+
* // Disable lookup relations for faster response
|
|
584
|
+
* const result = await client.metadata.getFields('1', { includeLookupRelations: false });
|
|
585
585
|
* ```
|
|
586
586
|
*/
|
|
587
587
|
async getFields(objectType, options) {
|
|
588
588
|
const objectTypeStr = String(objectType);
|
|
589
|
-
const opts = options instanceof AbortSignal ? { signal: options, includeLookupRelations:
|
|
589
|
+
const opts = options instanceof AbortSignal ? { signal: options, includeLookupRelations: true } : { signal: options?.signal, includeLookupRelations: options?.includeLookupRelations ?? true };
|
|
590
590
|
if (!opts.includeLookupRelations) {
|
|
591
591
|
const cached = this.client.getCached("fields", objectTypeStr);
|
|
592
592
|
if (cached) {
|