Skip to content

Commit 8e19fac

Browse files
authored
docs: document ItemDataConfig and full-property examples (#147)
1 parent 08289d3 commit 8e19fac

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,5 @@ resources/frags/test
134134

135135
resources/asdf2.frag
136136
resources/asdf2.json
137+
138+
.DS_Store

packages/fragments/src/FragmentsModels/src/model/fragments-model.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,37 @@ export class FragmentsModel {
445445

446446
/**
447447
* Get all the data of the specified items.
448+
*
449+
* By default, the API returns the item’s built-in attributes only.
450+
* Relations are not traversed unless explicitly enabled via the `config`
451+
* parameter.
452+
*
448453
* @param ids - The IDs of the items to look up.
449454
* @param config - The configuration of the items data.
455+
* Default configuration:
456+
* ```ts
457+
* {
458+
* attributesDefault: true,
459+
* relationsDefault: { attributes: false, relations: false },
460+
* }
461+
* ```
462+
*
463+
* @example
464+
* // Retrieve all built-in attributes and all related entities (full graph)
465+
* await getItemsData(ids, {
466+
* attributesDefault: true,
467+
* relationsDefault: { attributes: true, relations: true },
468+
* });
469+
*
470+
* @example
471+
* // Retrieve built-in attributes and Property Sets only (via IsDefinedBy)
472+
* await getItemsData(ids, {
473+
* attributesDefault: true,
474+
* relations: {
475+
* IsDefinedBy: { attributes: true, relations: true },
476+
* DefinesOccurrence: { attributes: false, relations: false },
477+
* },
478+
* });
450479
*/
451480
async getItemsData(ids: Identifier[], config?: Partial<ItemsDataConfig>) {
452481
return this._itemsManager.getItemsData(this, ids, config);

0 commit comments

Comments
 (0)