Skip to content

Add Model.getGraphSettings() to resolve strict graph settings for relation paths (#537) - #540

Merged
lehni merged 1 commit into
mainfrom
feature/537
Oct 25, 2026
Merged

lehni merged 1 commit into
mainfrom
feature/537

Conversation

@lehni

@lehni lehni commented Oct 25, 2026

Copy link
Copy Markdown

Closes #537

Adds a static Model.getGraphSettings(relationPath, options, operation) that resolves the strict mode settings of a relation path from the options of a strict insertGraph() or upsertGraph() call, with the same code as the writer (GraphOptions.getSetting()):

Person.getGraphSettings('movies.actors', options, 'upsert');
// → { removed: 'preserve', added: 'relate', kept: 'patch', created: 'insert' }
  • relationPath is a string like 'movies.actors' or an array of relation names. An empty path gives the root settings.
  • operation is 'insert' or 'upsert', as the defaults differ between the two.
  • Relations that the model doesn't have throw, so a misspelled path doesn't get the defaults. So do non-strict options, unknown operations and options of the other method.
  • GraphOptions.getSettings() returns all four settings of a path. The typings return GraphSettings and InsertGraphSettings, typed per operation.

@lehni
lehni force-pushed the feature/537 branch 3 times, most recently from 3bde2e7 to fe804e2 Compare October 25, 2026 17:50
@lehni
lehni merged commit 1d86247 into main Oct 25, 2026
7 checks passed
@lehni
lehni deleted the feature/537 branch October 25, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export the resolution of strict graph settings for relation paths

1 participant