Repository navigation
One editor for a task type's statuses, priorities and custom fields - #26
Merged
Merged
Conversation
patchTaskNotesMdbaseTypeSettings now takes statuses, priorities and custom field changes and rewrites every copy of them in the type together, giving what the generator writes for the same settings. The app and the Obsidian plugin each had their own way to do this. Also: read a configuration from a tasknotes.task implementation without the type document, report copies of the vocabulary that disagree, read values only the schema allows, share custom field names through the property title, and read the camel-case spellings early bindings used. 0.3.0-rc.21
The editor rewrote the status condition of every allOf rule, and the disagreement check compared each one with the completed statuses. Only a rule that requires the completion date is the generated completion rule.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Three pieces of code each rewrote a TaskNotes task type when its vocabulary changed: the Obsidian plugin regenerates the type from its settings and merges, the TaskNotes app patched the type itself (
task-type-vocabulary.ts), and this package'spatchTaskNotesMdbaseTypeSettingsrefused anything that changed the schema's vocabulary. A type states its statuses in up to seven places (schema enum and default, completion rule, read defaults, and the binding'svalues,completed_values,definitions), so three editors is three chances to leave them disagreeing.What changes
patchTaskNotesMdbaseTypeSettingsacceptsstatuses,prioritiesanduserFields(add/rename/remove) and rewrites every copy together. A test asserts the result deep-equals whatbuildTaskNotesMdbaseResourcesgenerates for the same settings, for canonical and migrated-v0.2 types, and that undoing the edit restores the generated type.@tasknotes/model/mdbase:taskNotesVocabularyProblem,taskNotesVocabularyInUse,taskNotesVocabularyValue,taskNotesUserFieldKey, the two error classes and name-based guards for them (each package entry is bundled separately, soinstanceofonly holds within one entry).taskNotesMdbaseTypeDisagreementsreports copies of the vocabulary that differ, andreconcileTaskNotesMdbaseTypeVocabularyreturns the type with the copies agreeing, never taking a value away.allOfrule that requires the completion date is treated as the completion rule. A rule a collection wrote itself that tests the status is left as written and is not reported as a disagreement. (The app's own editor, shipped in tasknotes-app#399, rewrote every such rule.)resolveTaskNotesModelConfigFromImplementationreads a configuration fromfields,binding, the type's schema andmatch: what an authority's catalog returns, without the type document.resolveTaskNotesModelConfigFromMdbaseTypedelegates to it.Behaviour changes for existing callers
titleand read from it before the host's remembered name. Until now the name never left the host that set it. The generated starter type has no custom fields, so its document and digest are unchanged (the starter pin test passes).Not in this change
taskNotesVocabularyProblemcould reject settings existing plugin users already have.Testing
npm test(135 pass, 18 new) andnpm run test:package.Used by callumalpass/tasknotes-app#403 and callumalpass/tasknotes#2536, which vendor a build of this branch until it is published.
Version is bumped to 0.3.0-rc.21; nothing is published until a
v0.3.0-rc.21tag is pushed.