sap-cloud-cmis-client v1.3.1
A JavaScript CMIS Client for SAP Cloud SDK
sap-cloud-cmis-client
is a specialized CMIS client designed for the SAP Cloud SDK (JavaScript) and CAP (NodeJS). It consolidates the SAP-provided OpenAPI specifications into one cohesive package. Additionally, I've baked in some developer-friendly utilities to streamline your integration process and enhance productivity.
š¦ Installation
npm install sap-cloud-cmis-client
š§ Prerequisites
To interface with the SAP Document Management Service, consider one of the two approaches below:
- Destination Setup: Bind your project to an instance of the Destination Service and establish a destination that targets the SDM service.
- SDM Direct Binding: Simply bind your project to an instance of the SDM Service.
In both approaches, destinations are used. The key difference is that for the second method, the destination is generated at runtime. More details here.
š ļø Usage:
Before invoking any other methods, it's essential to call getRepositories
. This ensures a connection to the instance and fetches all available repositories.
TypeScript
import { CmisClient } from 'sap-cloud-cmis-client';
const cmisClient = new CmisClient({ destinationName: 'YOUR_DESTINATION_NAME' });
// Load repositories
await cmisClient.getRepositories();
// Retrieve all descendants from the root folder
const descendants = await cmisClient.getDescendants();
console.log(descendants);
JavaScript
const { CmisClient } = require('sap-cloud-cmis-client');
const cmisClient = new CmisClient({ destinationName: 'YOUR_DESTINATION_NAME' });
// Load repositories
await cmisClient.getRepositories();
// Retrieve all descendants from the root folder
const descendants = await cmisClient.getDescendants();
console.log(descendants);
š Examples
š” Basic CRUD with Cloud Application Programming (CAP)
This example demonstrates basic Create, Read, Update, and Delete operations. It's a great starting point if you are wondering how to start.
Usage:
cd examples/cap-js/
npm install
cds serve
There are also some integration tests available in the /test directory.
API
I've chosen to split the API between the services specified by CMIS 1.1 that are available, and the helpers introduced by SAP to enhance the user experience with SAP DMS.
Table of Contents
CMIS Services
ACL
Adds the given ACEs to the ACL of an object. CMIS 1.1 Reference
Retrieves the current ACL applied to a specific object, optionally expressed using only CMIS-defined permissions. CMIS 1.1 Reference
Removes the given ACEs from the ACL of an object. CMIS 1.1 Reference
Discovery
Executes a CMIS query statement against the contents of the repository. CMIS 1.1 Reference
Navigation
Gets the list of child objects contained in the speciļ¬ed folder. CMIS 1.1 Reference
Gets the set of descendant objects contained in the speciļ¬ed folder or any of its child-folders. CMIS 1.1 Reference
Gets the set of descendant folder objects contained in the speciļ¬ed folder. CMIS 1.1 Reference
Gets the parent folder(s) for the speciļ¬ed ļ¬leable object. CMIS 1.1 Reference
Object
ApAppends to the content stream for the speciļ¬ed document object. CMIS 1.1 Reference
Creates a document object of the speciļ¬ed type (given by the cmis:objectTypeId property) in the (optionally) speciļ¬ed location. CMIS 1.1 Reference
Creates a document object as a copy of the given source document in the (optionally) speciļ¬ed location. CMIS 1.1 Reference
Creates a folder object of the speciļ¬ed type in the speciļ¬ed location. CMIS 1.1 Reference
Deletes the speciļ¬ed object. If the object is a PWC the checkout is discarded. CMIS 1.1 Reference
Deletes the speciļ¬ed folder object and all of its child- and descendant-objects. CMIS 1.1 Reference
Gets the list of allowable actions for an object. CMIS 1.1 Reference
Gets the speciļ¬ed information for the object. CMIS 1.1 Reference
Gets the list of properties for the object. CMIS 1.1 Reference
Moves the speciļ¬ed ļ¬le-able object from one folder to another. CMIS 1.1 Reference
Updates properties and secondary types of the speciļ¬ed object. CMIS 1.1 Reference
Repository
Creates a new type deļ¬nition that is a subtype of an existing speciļ¬ed parent type. CMIS 1.1 Reference
Returns a list of CMIS repositories available from this CMIS service endpoint. CMIS 1.1 Reference
getRepositoryInfo
Returns information about the CMIS repository, the optional capabilities it supports and its access control information if applicable. CMIS 1.1 Reference
Returns the list of object-types deļ¬ned for the repository that are children of the speciļ¬ed type. CMIS 1.1 Reference
Gets the deļ¬nition of the speciļ¬ed object-type. CMIS 1.1 Reference
Returns the set of the descendant object-types deļ¬ned for the Repository under the speciļ¬ed type. CMIS 1.1 Reference
Versioning
Reverses the eļ¬ect of a check-out. Removes the Private Working Copy of the checked-out document, allowing other documents in the version series to be checked out again. If the private working copy has been created by createDocument
, cancelCheckOut
will delete the created document. CMIS 1.1 Reference
Checks-in the Private Working Copy document. CMIS 1.1 Reference
Create a private working copy (PWC) of the document. CMIS 1.1 Reference
SAP DMS Helpers
Creates favorite link object for the specified object if favorites repository is configured. With this call, the server creates a user folder in favorites repositories, creates a sap:link file to the object and applies user ACL.
Creates a folder of sap:share
type under the specified repository. Supported only by Collaboration enabled repositories.
Returns the requested document content directly or redirects to a URL that provides the document content.
Creates a sap:link
type object under a specified repository for which the name and URL for the link should be provided.
Serves as a delete operation in the recycle bin, enabling the permanent deletion of objects from the recycle bin.
Generates a thumbnail for a given document id.
Returns the list of child objects deleted from the specified folder. This is one of the recycle bin APIs that provides information about the immediate children deleted from a specified folder. When the folder objectId is not mentioned, the root is considered by default.
It restores the deleted object. This is one of the recycle bin APIs that recovers deleted objects. The objectId can be of a document or a folder.
Creates a ZIP object temporarily on server which can be downloaded using Zip Content Downloaded API with provided folder/multiple object Ids
Downloads the ZIP that has been created using ZIP Content Creation API for a Folder/ Multiple files on the server for the same session
Creates a folder with the zip name and all the contents inside the zip, folder or document are created inside it. The maximum size that can be uploaded is 4GB and the maximum entries in zip can be 10000.