OpenSite/Reference/Commands/Extension commands: Difference between revisions
BathAfrica (talk | contribs) Use BathAfrica sidebar contents without duplicate inline contents box |
BathAfrica (talk | contribs) Link adjacent OpenSite reference pages in reading order |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{OpenSite scope}} | |||
{{BathAfrica Command | {{BathAfrica Command | ||
|id=opensite.extension | |id=opensite.extension | ||
|summary=Create an extension instance from a template, group it, relate it, and remove a member or an object. | |summary=Create an extension instance from a template, group it, relate it, and remove a member or an object. | ||
| Line 34: | Line 34: | ||
: Required document handle and object id. Removing a group leaves its members. Removing a member takes it out of groups and drops relationships that name it. | : Required document handle and object id. Removing a group leaves its members. Removing a member takes it out of groups and drops relationships that name it. | ||
== Try this workflow == | |||
[[OpenSite/Guides/Build a native plugin|Build a native plugin]] — a worked lesson with expected results. | |||
== Documentation basis == | == Documentation basis == | ||
| Line 45: | Line 48: | ||
[[OpenSite|OpenSite overview]] · [[OpenSite/Reference|Reference]] · [[OpenSite/Guides|Guides]] | [[OpenSite|OpenSite overview]] · [[OpenSite/Reference|Reference]] · [[OpenSite/Guides|Guides]] | ||
[[Category:OpenSite documentation]] | [[Category:OpenSite documentation]] | ||
<div class="os-page-nav">{{Docnav|OpenSite/Reference/Commands/Document commands|OpenSite/Reference/Commands/Language commands|OpenSite/Guides|All guides}}</div> | |||
Latest revision as of 14:14, 29 October 2026
Create an extension instance from a template, group it, relate it, and remove a member or an object.
- Stable identifier
opensite.extension
Implementation milestone
Roadmap phase 7A.
Units
A template quantity is copied in canonical SI with the unit id stored on the field. A group membership is an object id. It is not a calculation input.
Terminal example
Python access
opensite.execute('extension.instantiate', {'document': document, 'template': 'sample_native.starter'})
Output
extension.instantiate and extension.create_group return object. extension.add_member and extension.remove_object return no fields.
Errors
command_unavailable when the template or type is not registered. duplicate_id when the member is already in the group. invalid_argument when a group would contain itself. A later document.save keeps the object. Phase 7A refused that save with extension_not_persistent. Phase 9 preserves the payload.
Limitations
These commands mutate the open document; call document.save to persist it. Plugin provider/type/schema and payload are preserved, including a read-only placeholder when the provider is unavailable. Group membership is not a calculation dependency. These are service commands, not automatic GUI-menu contributions.
Verification evidence
Repository evidence references (not rerun for this publication): CTest application.extension and python.development. The script is examples/python/extension_platform.py. docs/verification/Phase-7A-Acceptance.md.
The provider is opensite. Each command uses document.edit and one document transaction. The handler does not commit that transaction.
extension.instantiate- Required document handle and
templateid. Copies the template's input values into a new instance. Returns the object id.
extension.create_group- Required document handle. Optional
label, defaultGroup. Returns the group id. The group type isopensite.document.group.
extension.add_member- Required document handle,
groupid, andmemberid. A repeated member isduplicate_id. A group that would contain itself isinvalid_argument.
extension.remove_member- Required document handle,
groupid, andmemberid. The member object stays in the document. A missing member isunknown_object.
extension.relate- Required document handle,
sourceid, andtargetid. Optionallabel, defaultRelationship. Returns the relationship id. The two ids must differ. A relationship is not a calculation dependency.
extension.remove_object- Required document handle and object id. Removing a group leaves its members. Removing a member takes it out of groups and drops relationships that name it.
Try this workflow
Build a native plugin — a worked lesson with expected results.
Documentation basis
Source-reviewed against development commit 77c3fee13944bcc4b5d487c77eb1f82fbe4c6ea7, branch feature/phase-13c-properties-python-expressions. This review inspected the implementation and repository evidence; it did not run the Windows application or repeat CTest.
src/cli/main.cppsrc/cli/document_commands.cppsrc/cli/preference_commands.cppsrc/application/builtins.cpp