@@ -63,7 +63,7 @@ const blogConfig = globalConfig.includeTypes(['Article']);
63
63
64
64
// Use configurations
65
65
const result = createJsonLdBuilder ()
66
- .applyConfig (homeConfig )
66
+ .mergeConfig (homeConfig . getConfig () )
67
67
.excludeIds ([' runtime:override' ]) // Runtime overrides
68
68
.build ({ prettyPrint: true });
69
69
```
@@ -122,7 +122,7 @@ const config = createJsonLdConfig()
122
122
Creates a new builder that extends the configuration builder with graph processing capabilities.
123
123
124
124
``` typescript
125
- const builder = createJsonLdBuilder ().baseGraph (graph ).applyConfig (config );
125
+ const builder = createJsonLdBuilder ().baseGraph (graph ).mergeConfig (config );
126
126
```
127
127
128
128
### Configuration Methods
@@ -149,6 +149,37 @@ All methods are inherited by the builder from the configuration builder:
149
149
- ` .clearSubgraph() ` - Clear subgraphRoots
150
150
- ` .clearAll() ` - Clear entire configuration (except baseGraph)
151
151
152
+ #### Configuration Merging
153
+
154
+ - ` .mergeConfig(config: JsonLdConfig) ` - Merge with another complete configuration
155
+ - ` .mergeFilters(filters: JsonLdFilterOptions) ` - Merge only the filters part of another configuration
156
+
157
+ ** Available in both config builder and main builder** - These methods work the same way in both classes.
158
+
159
+ ``` typescript
160
+ // Config builder usage
161
+ const baseConfig = createJsonLdConfig ().includeTypes ([' Person' ]);
162
+ const otherConfig = createJsonLdConfig ()
163
+ .includeTypes ([' Organization' ])
164
+ .excludeIds ([' test' ])
165
+ .getConfig ();
166
+ const merged = baseConfig .mergeConfig (otherConfig );
167
+ // Result: includeTypes: ['Person', 'Organization'], excludeIds: ['test']
168
+
169
+ // Main builder usage (processes graph immediately)
170
+ const result = createJsonLdBuilder ()
171
+ .baseGraph (graph )
172
+ .includeTypes ([' Person' ])
173
+ .mergeConfig (otherConfig )
174
+ .build ({ prettyPrint: true });
175
+
176
+ // Merge only filters
177
+ const baseConfig = createJsonLdConfig ().includeTypes ([' Person' ]).addEntities ([entity ]);
178
+ const otherFilters = { includeTypes: [' Organization' ], maxEntities: 10 };
179
+ const merged = baseConfig .mergeFilters (otherFilters );
180
+ // Result: includeTypes: ['Person', 'Organization'], maxEntities: 10, additionalEntities preserved
181
+ ```
182
+
152
183
#### Property Filtering
153
184
154
185
- ` .filterPropertiesByIds(entityIds, rule) ` - Filter properties for specific entity IDs
@@ -175,7 +206,6 @@ All methods are inherited by the builder from the configuration builder:
175
206
176
207
#### Builder-Only Methods
177
208
178
- - ` .applyConfig(config: JsonLdConfig) ` - Apply a pre-built configuration
179
209
- ` .getCurrentGraph() ` - Get the current graph state
180
210
- ` .build(options?: BuildOptions) ` - Build the final JSON-LD output
181
211
0 commit comments