Normalised Results
v1 and v2 send the same entities under the same field names. What differs is the envelope around them, and the spec is wrong about that envelope: it types single-item responses as arrays at every level, while real servers send objects.
response.result removes the envelope. response.data is untouched.
const { result: a } = await session.nodes.node(2000); // v2
const { result: b } = await session.nodes.nodeV1(2000); // v1
a.name === b.name; // true
const { result: page } = await session.nodes.children(2000, { limit: 10 });
page.items; // TNode[]
page.paging; // { page, limit, page_total, total_count, range_min, range_max }
result is computed the first time you read it, then kept, so code that only reads data pays nothing. Normalisers never throw: an unrecognised body gives undefined, or an empty page.
What is covered
| Entity | result type |
Methods |
|---|---|---|
| Node | TNode |
nodes.create, addFolder, addItem, copy, addDocument, node, properties, byNickname, and the V1 forms |
| Node list | TPage<TNode> |
nodes.children, allChildren, list, ancestorsV1; members.favorites, favoritesInTab, unsortedFavorites, accessed, reserved; volumes.browse, recycleBin; search.search |
| Version | TNodeVersion / TPage<TNodeVersion> |
versions.list, version, latestV1, update, promote, lock, unlock, and the V1 forms |
| Member | TMember / TPage<TMember> |
members.member, create, search, members, groupsOf, myGroups, and the V1 forms |
| Volume | TVolume / TPage<TVolume> |
volumes.volumeInfo, volumes, and the V1 forms |
| Permission | TPermissionEntry / TPage<TPermissionEntry> |
permissions.list, owner, group, publicAccess, custom, effective |
| Category | TCategory / TPage<TCategory> |
categories.list, category, and the V1 forms |
| Business workspace | TWorkspace / TPage<TWorkspace> |
workspaces.list, workspace, workspaceV1, workspaceRootV1, create, relatedItems |
| Workspace type | TWorkspaceType / TPage<TWorkspaceType> |
workspaces.types, typeV1, typesForLocationV1 |
| Workspace role | TWorkspaceRole / TPage<TWorkspaceRole> |
workspaces.roles, role, workspaceMembers (each role with its members) |
| Role member | TMember / TPage<TMember> |
workspaces.roleMembers, roleMember |
| Business object type | TBusinessObjectType / TPage<TBusinessObjectType> |
workspaces.businessObjectTypes, businessObjectTypeById |
| Workflow | TPage<TWorkflow> / TWorkflowInfo / TWorkflowTasks |
workflow.byStatus, running; statusInfo; taskList |
| Workflow activity | TPage<TWorkflowActivity> |
workflow.activities, processActivities |
| Workflow definition | TWorkflowDefinition |
workflow.definition |
| Assignment | TPage<TAssignment> |
members.assignments |
| Audit event | TPage<TAuditEvent> |
nodes.audit, auditV1 |
| Rendition | TPage<TRendition> |
versions.renditions, latestRenditions, versionRenditions |
| Alpaca form | TPage<TForm> |
every method of forms |
| Follow-up | TPage<TFollowUp> / TFollowUp |
reminders.list; followUp |
| Favourite tab | TPage<TFavoriteTab> |
members.favoriteTabs |
| Search region / slice | TPage<TSearchRegion> / TPage<TSearchSlice> |
search.regionsV1; slicesV1 |
| Release, version category | TPage<TNode> / TPage<TCategory> |
nodes.releases; versions.categories, categoriesV1 |
| WebReports destination / parameter | TWebReportDestination / TPage<TWebReportParameter> |
webreports.destinationV1, destinationByNicknameV1; parametersV1, parametersByIdV1 |
| Perspective | TPage<TPerspectiveEntry> |
perspectives.list, mine |
| Classified item | TPage<TNode> |
classifications.classifiedItems |
| Pulse status | TPage<TPulseStatus> |
pulse.publicTimelineV1 |
| Event Action Center | TPage<TEventActionPlans> / TPage<TEventDefinition> |
eventActionCenter.actionPlans; eventDefinitions |
| RM cross-reference type | TPage<TCrossReferenceType> |
recman.crossReferenceTypesV1 |
| Subtype | TPage<TSubtype> |
office.subtypes |
Renditions, follow-ups and favourite tabs follow the published spec (the 26.1 dev server had none); every other row was measured on a live 26.1 server.
Not normalised, on purpose
These return data only:
- Status, configuration, settings and probes (
admin.*, server info and settings, health,ping*,check*, viewx, WOPI and upload configuration, notification pipelines and settings): configuration documents, not entities. - Action results: what a POST, PUT or DELETE answers.
- Binary or HTML content: content downloads, thumbnails,
viewHtml, zips, the Office link template. - UI helpers: menu items, create info, addable types, columns, facets, display settings, pick lists.
- Entity lists with no shape to measure: the dev server returned them empty and OpenText does not document them - Records Management holds and RSIs, Physical Objects items, boxes and transfers, signature requests, controlled copies, shares, messages and watches, video comments, wiki pages, forum topics, Government inboxes and assignments, Smart Document Types, the remaining Pulse calls, workspace attachment and document-type lists, member sessions and proxies, server messages.
Giving one of these a result later is not a breaking change: TResult<Raw, X> extends the TResponse<Raw> it returns now, and data stays as it is.
The types
Field names are Content Server's own. The common ones are typed for autocompletion; every other field the server sends is kept too. All are optional, because which fields arrive depends on the endpoint, the fields parameter and the generation. For example, v2 adds size and v1 adds guid.
Business workspaces are nodes with workspace details beside them, and each route puts those details somewhere else. TWorkspace collects them into three fields:
workspace_type_id: from v2'sbusiness_properties, a list'swnf_wksp_type_idcolumn, or v1's root lookup. Always a number or absent. v1's single workspace (workspaceV1) sends an error text in that field ("An unknown feature was specified"), so it has no type id there; use the v2 call orworkspaceRootV1for it.workspace_type_name: frombusiness_propertiesor the node'swksp_type_name. Lists carry the id only.wksp_type_icon: on single workspaces.
Workspace types read the same from v2 (wksp_type_id, wksp_type_name, with wksp_info such as in_use alongside) and from the two v1 routes, whose id / name / workspace_type and is_policies_enabled are also given those names. Workspace lists and related items page with a top-level paging object, which paging reads like any other.
Workflows are reported four ways, and TWorkflow reads them alike: byStatus sends process_id, wf_name, status_key; running sends the database columns Work_WorkID, SubWork_SubWorkID, SubWork_Title, Map_MapID; statusInfo sends the same columns in generalInfo beside the steps, comments and audit; taskList sends wf_details (work_workID, status) beside step_list. The canonical process_id, subprocess_id, map_id, wf_name, date_initiated, due_date and status_key are added from whichever name the route used; the originals stay.
Audit reads the same from v2 (results.data.audit, paging in collection.paging) and v1 (data[], paging as top-level page, limit, page_total, total, results_start, results_end).
Renditions of every version come keyed by version number; they are flattened into one page, each rendition carrying its version_number.
Event definitions come grouped by namespace; they are flattened, each carrying its namespace.
Categories are the exception. The two generations send different content, not just different envelopes:
values, keyed like"30421_2": from v2 lists, and from single-category calls in either generation.name: from v1 lists, and from any call made withmetadata.definitions: the category's own entry and one per attribute, when the response includes them.
Normalising bodies yourself
For a body fetched some other way:
import { normalize } from "@ulyxie/cs-rest";
const { data } = await session.get("api/v2/nodes/2000");
normalize.node(data);
Exported readers: node, nodes, ancestors, version, versions, member, members, volume, volumes, permission, permissions, category and categories; for business workspaces workspace, workspaces, workspaceType, workspaceTypes, workspaceRole, workspaceRoles, businessObjectType and businessObjectTypes. A browser app that never imports @ulyxie/cs-rest/workspaces or these readers does not bundle them.
Typing raw responses
The full OpenAPI schema ships with the package:
import type { TOk, TPathOk, TResult, components } from "@ulyxie/cs-rest";
type NodeBody = TOk<"getNode2">; // by operationId
type ViewxConfig = TPathOk<"/v1/viewx/config", "get">; // for operations without one
These are the spec's own types, so they carry its mistakes about envelopes. Prefer result where it exists.
cs-rest 4.0.0
Using it
Working on it