Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CmisSession

The session is the entry point for all cmis requests

example usage:

 // typescript/es6
 let session = new cmis.CmisSession('http://localhost:18080/alfresco/cmisbrowser');
 session.setCredentials(username, password).loadRepositories()
     .then(() => session.query("select * from cmis:document"))
     .then(data => console.log(data));

 // javascript/es5
 var session = new cmis.CmisSession('http://localhost:18080/alfresco/cmisbrowser');
 session.setCredentials(username, password).loadRepositories().then(function(){
       return session.query("select * from cmis:document"));
 }).then(function(data) {console.log(data);});

Hierarchy

  • CmisSession

Index

Constructors

constructor

Properties

Private charset

charset: string

defaultRepository

defaultRepository: any

Private errorHandler

errorHandler: function

Type declaration

    • (err: Error): void
    • Parameters

      • err: Error

      Returns void

Private password

password: string

repositories

repositories: Array<any>

Private token

token: string

Private url

url: string

Private username

username: string

Methods

addObjectToFolder

  • addObjectToFolder(objectId: string, folderId: string, allVersions?: boolean, options?: object): Promise<any>
  • Adds specified object to folder

    Parameters

    • objectId: string
    • folderId: string
    • Default value allVersions: boolean = false
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

appendContentStream

  • appendContentStream(objectId: string, content: string | Blob | Buffer, isLastChunk?: boolean, filename?: string, options?: object): Promise<any>
  • Appends content to document

    Parameters

    • objectId: string
    • content: string | Blob | Buffer
    • Default value isLastChunk: boolean = false
    • Optional filename: string
    • Default value options: object = {}
      • Optional changeToken?: string
      • Optional succinct?: boolean

    Returns Promise<any>

applyACL

  • applyACL(objectId: string, addACEs?: object, removeACEs?: object, propagation?: string): Promise<any>
  • applies ACL to object

    Parameters

    • objectId: string
    • Optional addACEs: object
      • [k: string]: string
    • Optional removeACEs: object
      • [k: string]: string
    • Optional propagation: string

    Returns Promise<any>

applyPolicy

  • applyPolicy(objectId: string, policyId: string, options?: object): Promise<any>
  • applies policy to object

    Parameters

    • objectId: string
    • policyId: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

bulkUpdateProperties

  • bulkUpdateProperties(objectIds: string[], properties?: object, addSecondaryTypeIds?: string[], removeSecondaryTypeIds?: string[]): Promise<any>
  • Updates properties of specified objects

    Parameters

    • objectIds: string[]
    • Default value properties: object = {}
      • [k: string]: string | string[] | number | number[] | Date | Date[]
    • Default value addSecondaryTypeIds: string[] = []
    • Default value removeSecondaryTypeIds: string[] = []

    Returns Promise<any>

cancelCheckOut

  • cancelCheckOut(objectId: string): Promise<Response>
  • cancels a check out

    Parameters

    • objectId: string

    Returns Promise<Response>

checkIn

  • checkIn(objectId: string, major?: boolean, input: string | object, content: string | Blob | Buffer, mimeTypeExtension?: string, comment?: string, policies?: string[], addACEs?: object, removeACEs?: object, options?: object): Promise<any>
  • checks in a document

    Parameters

    • objectId: string
    • Default value major: boolean = false
    • input: string | object
    • content: string | Blob | Buffer
    • Optional mimeTypeExtension: string
    • Optional comment: string
    • Optional policies: string[]
    • Optional addACEs: object
      • [k: string]: string
    • Optional removeACEs: object
      • [k: string]: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

checkOut

  • checkOut(objectId: string, options?: object): Promise<any>
  • checks out a document

    Parameters

    • objectId: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

createDocument

  • createDocument(parentId: string, content: string | Blob | Buffer, input: string | object, mimeTypeExtension?: string, versioningState?: "none" | "major" | "minor" | "checkedout", policies?: string[], addACEs?: object, removeACEs?: object, options?: object): Promise<any>
  • creates a new document

    if input is a string it's used as the document name, otherwise as the document properties

    use mimeTypeExtension if your filename does not have a standard extension (tested only with Alfresco) example: 'pdf', 'png', 'jpg'

    Parameters

    • parentId: string
    • content: string | Blob | Buffer
    • input: string | object
    • Optional mimeTypeExtension: string
    • Optional versioningState: "none" | "major" | "minor" | "checkedout"
    • Optional policies: string[]
    • Optional addACEs: object
      • [k: string]: string
    • Optional removeACEs: object
      • [k: string]: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

createDocumentFromSource

  • createDocumentFromSource(parentId: string, sourceId: string, content: string | Blob | Buffer, input: string | object, mimeTypeExtension?: string, versioningState?: "none" | "major" | "minor" | "checkedout", policies?: string[], addACEs?: object, removeACEs?: object, options?: object): Promise<any>
  • Parameters

    • parentId: string
    • sourceId: string
    • content: string | Blob | Buffer
    • input: string | object
    • Optional mimeTypeExtension: string
    • Optional versioningState: "none" | "major" | "minor" | "checkedout"
    • Optional policies: string[]
    • Optional addACEs: object
      • [k: string]: string
    • Optional removeACEs: object
      • [k: string]: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

createFolder

  • createFolder(parentId: string, name: string, type?: string, policies?: Array<any>, addACEs?: object, removeACEs?: object): Promise<any>
  • creates a new folder

    Parameters

    • parentId: string
    • name: string
    • Default value type: string = "cmis:folder"
    • Default value policies: Array<any> = []
    • Default value addACEs: object = {}
      • [k: string]: string
    • Default value removeACEs: object = {}
      • [k: string]: string

    Returns Promise<any>

createItem

  • createItem(folderId: string, properties: object, policies?: string[], addACEs?: object, removeACEs?: object, options?: object): Promise<any>
  • Creates an item

    Parameters

    • folderId: string
    • properties: object
      • [k: string]: string | string[] | number | number[] | Date | Date[]
    • Optional policies: string[]
    • Optional addACEs: object
      • [k: string]: string
    • Optional removeACEs: object
      • [k: string]: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

createPolicy

  • createPolicy(folderId: string, properties: object, policies?: string[], addACEs?: object, removeACEs?: object, options?: object): Promise<any>
  • Creates a policy

    Parameters

    • folderId: string
    • properties: object
      • [k: string]: string | string[] | number | number[] | Date | Date[]
    • Optional policies: string[]
    • Optional addACEs: object
      • [k: string]: string
    • Optional removeACEs: object
      • [k: string]: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

createRelationship

  • createRelationship(properties: object, policies?: string[], addACEs?: object, removeACEs?: object, options?: object): Promise<any>
  • Creates a relationship

    Parameters

    • properties: object
      • [k: string]: string | string[] | number | number[] | Date | Date[]
    • Optional policies: string[]
    • Optional addACEs: object
      • [k: string]: string
    • Optional removeACEs: object
      • [k: string]: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

createType

  • createType(type: any): Promise<any>
  • Creates a new type definition

    Parameters

    • type: any

    Returns Promise<any>

deleteContentStream

  • deleteContentStream(objectId: string, options?: object): Promise<any>
  • deletes object content

    Parameters

    • objectId: string
    • Default value options: object = {}
      • Optional changeToken?: string
      • Optional succinct?: boolean

    Returns Promise<any>

deleteObject

  • deleteObject(objectId: string, allVersions?: boolean): Promise<Response>
  • deletes an object

    Parameters

    • objectId: string
    • Default value allVersions: boolean = false

    Returns Promise<Response>

deleteTree

  • deleteTree(objectId: any, allVersions?: boolean, unfileObjects?: "unfile" | "deletesinglefiled" | "delete", continueOnFailure?: boolean): Promise<Response>
  • Deletes a folder tree

    Parameters

    • objectId: any
    • Default value allVersions: boolean = false
    • Optional unfileObjects: "unfile" | "deletesinglefiled" | "delete"
    • Default value continueOnFailure: boolean = false

    Returns Promise<Response>

deleteType

  • deleteType(typeId: string): Promise<any>
  • Deletes a type definition

    Parameters

    • typeId: string

    Returns Promise<any>

Private get

  • get(url: string, options?: Options): Promise<Response>
  • shorthand for http.('GET',...)

    Parameters

    • url: string
    • Optional options: Options

    Returns Promise<Response>

getACL

  • getACL(objectId: string, onlyBasicPermissions?: boolean): Promise<any>
  • gets object ACL

    memberof

    CmisSession

    Parameters

    • objectId: string
    • Default value onlyBasicPermissions: boolean = false

    Returns Promise<any>

getAllVersions

  • getAllVersions(versionSeriesId: string, options?: object): Promise<any>
  • gets versions of object

    Parameters

    • versionSeriesId: string
    • Default value options: object = {}
      • Optional filter?: string
      • Optional includeAllowableActions?: boolean
      • Optional succinct?: boolean

    Returns Promise<any>

getAllowableActions

  • getAllowableActions(objectId: string, options?: object): Promise<any>
  • Gets the allowable actions of the specified object

    Parameters

    • objectId: string
    • Default value options: object = {}
      • Optional filter?: string
      • Optional includeAllowableActions?: boolean
      • Optional includeRelationships?: "none" | "source" | "target" | "both"
      • Optional maxItems?: number
      • Optional orderBy?: string
      • Optional renditionFilter?: string
      • Optional skipCount?: number
      • Optional succinct?: boolean

    Returns Promise<any>

getAppliedPolicies

  • getAppliedPolicies(objectId: string, options?: object): Promise<any>
  • gets object applied policies

    Parameters

    • objectId: string
    • Default value options: object = {}
      • Optional filter?: string
      • Optional succinct?: boolean

    Returns Promise<any>

getCheckedOutDocs

  • getCheckedOutDocs(objectId?: string, options?: object): Promise<any>
  • gets the documents that have been checked out in the repository

    Parameters

    • Optional objectId: string
    • Default value options: object = {}
      • Optional filter?: string
      • Optional includeAllowableActions?: boolean
      • Optional includeRelationships?: "none" | "source" | "target" | "both"
      • Optional maxItems?: number
      • Optional orderBy?: string
      • Optional renditionFilter?: string
      • Optional skipCount?: number
      • Optional succinct?: boolean

    Returns Promise<any>

getChildren

  • getChildren(objectId: string, options?: object): Promise<any>
  • Returns children of object specified by id

    Parameters

    • objectId: string
    • Default value options: object = {}
      • Optional filter?: string
      • Optional includeAllowableActions?: boolean
      • Optional includePathSegment?: boolean
      • Optional includeRelationships?: "none" | "source" | "target" | "both"
      • Optional maxItems?: number
      • Optional orderBy?: string
      • Optional renditionFilter?: string
      • Optional skipCount?: number
      • Optional succinct?: boolean

    Returns Promise<any>

getContentChanges

  • getContentChanges(changeLogToken?: string, includeProperties?: boolean, includePolicyIds?: boolean, includeACL?: boolean, options?: object): Promise<any>
  • gets the changed objects, the list object should contain the next change log token.

    Parameters

    • Optional changeLogToken: string
    • Default value includeProperties: boolean = false
    • Default value includePolicyIds: boolean = false
    • Default value includeACL: boolean = false
    • Default value options: object = {}
      • Optional maxItems?: number
      • Optional succinct?: boolean

    Returns Promise<any>

getContentStream

  • getContentStream(objectId: string, download?: "attachment" | "inline", streamId?: string): Promise<Response>
  • Gets document content

    Parameters

    • objectId: string
    • Default value download: "attachment" | "inline" = "inline"
    • Optional streamId: string

    Returns Promise<Response>

getContentStreamURL

  • getContentStreamURL(objectId: string, download?: "attachment" | "inline", streamId?: string): string
  • Gets document content URL

    Parameters

    • objectId: string
    • Default value download: "attachment" | "inline" = "inline"
    • Optional streamId: string

    Returns string

getDescendants

  • getDescendants(folderId: string, depth?: number, options?: object): Promise<any>
  • Gets all descendants of specified folder

    Parameters

    • folderId: string
    • Optional depth: number
    • Default value options: object = {}
      • Optional filter?: string
      • Optional includeAllowableActions?: boolean
      • Optional includePathSegment?: boolean
      • Optional includeRelationships?: "none" | "source" | "target" | "both"
      • Optional renditionFilter?: string
      • Optional succinct?: boolean

    Returns Promise<any>

getFolderParent

  • getFolderParent(folderId: string, options?: object): Promise<any>
  • Gets the parent folder of the specified folder

    Parameters

    • folderId: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

getFolderTree

  • getFolderTree(folderId: string, depth?: number, options?: object): Promise<any>
  • Gets the folder tree of the specified folder

    Parameters

    • folderId: string
    • Optional depth: number
    • Default value options: object = {}
      • Optional filter?: string
      • Optional includeAllowableActions?: boolean
      • Optional includePathSegment?: boolean
      • Optional includeRelationships?: "none" | "source" | "target" | "both"
      • Optional renditionFilter?: string
      • Optional succinct?: boolean

    Returns Promise<any>

getLastResult

  • getLastResult(): Promise<any>
  • gets last result

    Returns Promise<any>

getObject

  • getObject(objectId: string, returnVersion?: "this" | "latest" | "latestmajor", options?: object): Promise<any>
  • gets an object by objectId

    Parameters

    • objectId: string
    • Optional returnVersion: "this" | "latest" | "latestmajor"
    • Default value options: object = {}
      • Optional filter?: string
      • Optional includeACL?: boolean
      • Optional includeAllowableActions?: boolean
      • Optional includePolicyIds?: boolean
      • Optional includeRelationships?: "none" | "source" | "target" | "both"
      • Optional renditionFilter?: string
      • Optional succinct?: boolean

    Returns Promise<any>

getObjectByPath

  • getObjectByPath(path: string, options?: object): Promise<any>
  • gets an object by path

    Parameters

    • path: string
    • Default value options: object = {}
      • Optional filter?: string
      • Optional includeACL?: boolean
      • Optional includeAllowableActions?: boolean
      • Optional includePolicyIds?: boolean
      • Optional includeRelationships?: "none" | "source" | "target" | "both"
      • Optional renditionFilter?: string
      • Optional succinct?: boolean

    Returns Promise<any>

getObjectOfLatestVersion

  • getObjectOfLatestVersion(versionSeriesId: string, options?: object): Promise<any>
  • Gets the latest document object in the version series

    http://docs.oasis-open.org/cmis/CMIS/v1.1/CMIS-v1.1.html#x1-3360004

    Parameters

    • versionSeriesId: string
    • Default value options: object = { major: false }
      • Optional filter?: string
      • Optional includeACL?: boolean
      • Optional includeAllowableActions?: boolean
      • Optional includePolicyIds?: boolean
      • Optional includeRelationships?: "none" | "source" | "target" | "both"
      • Optional major?: boolean
      • Optional renditionFilter?: string
      • Optional succinct?: boolean

    Returns Promise<any>

getObjectRelationships

  • getObjectRelationships(objectId: string, includeSubRelationshipTypes?: boolean, relationshipDirection?: string, typeId?: string, options?: object): Promise<any>
  • gets object relationships

    Parameters

    • objectId: string
    • Default value includeSubRelationshipTypes: boolean = false
    • Optional relationshipDirection: string
    • Optional typeId: string
    • Default value options: object = {}
      • Optional filter?: string
      • Optional includeAllowableActions?: boolean
      • Optional maxItems?: number
      • Optional skipCount?: number
      • Optional succinct?: boolean

    Returns Promise<any>

getParents

  • getParents(objectId: string, options?: object): Promise<any>
  • Gets the folders that are the parents of the specified object

    Parameters

    • objectId: string
    • Default value options: object = {}
      • Optional filter?: string
      • Optional includeAllowableActions?: boolean
      • Optional includePathSegment?: boolean
      • Optional includeRelationships?: "none" | "source" | "target" | "both"
      • Optional renditionFilter?: string
      • Optional succinct?: boolean

    Returns Promise<any>

getProperties

  • getProperties(objectId: string, returnVersion?: "this" | "latest" | "latestmajor", options?: object): Promise<any>
  • Gets the properties of the specified object

    Parameters

    • objectId: string
    • Optional returnVersion: "this" | "latest" | "latestmajor"
    • Default value options: object = {}
      • Optional filter?: string
      • Optional succinct?: boolean

    Returns Promise<any>

getRenditions

  • getRenditions(objectId: string, options?: object): Promise<any>
  • gets document renditions

    Parameters

    • objectId: string
    • Default value options: object = {renditionFilter: '*'}
      • Optional maxItems?: number
      • renditionFilter: string
      • Optional skipCount?: number

    Returns Promise<any>

getRepositoryInfo

  • getRepositoryInfo(): Promise<any>
  • gets repository informations

    Returns Promise<any>

getTypeChildren

  • getTypeChildren(typeId?: string, includePropertyDefinitions?: boolean, options?: object): Promise<any>
  • gets the types that are immediate children of the specified typeId, or the base types if no typeId is provided

    Parameters

    • Optional typeId: string
    • Optional includePropertyDefinitions: boolean
    • Default value options: object = {}
      • Optional maxItems?: number
      • Optional skipCount?: number

    Returns Promise<any>

getTypeDefinition

  • getTypeDefinition(typeId: string): Promise<any>
  • gets definition of the specified type

    Parameters

    • typeId: string

    Returns Promise<any>

getTypeDescendants

  • getTypeDescendants(typeId?: string, depth?: number, includePropertyDefinitions?: boolean): Promise<any>
  • gets all types descended from the specified typeId, or all the types in the repository if no typeId is provided

    Parameters

    • Optional typeId: string
    • Optional depth: number
    • Optional includePropertyDefinitions: boolean

    Returns Promise<any>

Private http

  • http(method: "GET" | "POST", url: string, options: Options, multipartData?: object): Promise<Response>
  • internal method to perform http requests

    Parameters

    • method: "GET" | "POST"
    • url: string
    • options: Options
    • Optional multipartData: object
      • content: string | Blob | Buffer
      • filename: string
      • Optional mimeTypeExtension?: string

    Returns Promise<Response>

loadRepositories

  • loadRepositories(): Promise<void>
  • Connects to a cmis server and retrieves repositories, token or credentils must already be set

    Returns Promise<void>

moveObject

  • moveObject(objectId: string, sourceFolderId: string, targetFolderId: string, options?: object): Promise<any>
  • Moves an object

    Parameters

    • objectId: string
    • sourceFolderId: string
    • targetFolderId: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

Private post

  • post(url: string, options?: Options, multipartData?: object): Promise<Response>
  • shorthand for http.('POST',...)

    Parameters

    • url: string
    • Optional options: Options
    • Optional multipartData: object
      • content: string | Blob | Buffer
      • filename: string
      • Optional mimeTypeExtension?: string

    Returns Promise<Response>

query

  • query(statement: string, searchAllVersions?: boolean, options?: object): Promise<any>
  • performs a cmis query against the repository

    Parameters

    • statement: string
    • Default value searchAllVersions: boolean = false
    • Default value options: object = {}
      • Optional includeAllowableActions?: boolean
      • Optional includeRelationships?: "none" | "source" | "target" | "both"
      • Optional maxItems?: number
      • Optional orderBy?: string
      • Optional renditionFilter?: string
      • Optional skipCount?: number
      • Optional succinct?: boolean

    Returns Promise<any>

removeObjectFromFolder

  • removeObjectFromFolder(objectId: string, folderId: string, options?: object): Promise<any>
  • Removes specified object from folder

    Parameters

    • objectId: string
    • folderId: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

removePolicy

  • removePolicy(objectId: string, policyId: string, options?: object): Promise<any>
  • removes policy from object

    Parameters

    • objectId: string
    • policyId: string
    • Default value options: object = {}
      • Optional succinct?: boolean

    Returns Promise<any>

Private setACEs

  • setACEs(options: Options, ACEs: object, action: "add" | "remove"): void
  • format ACEs for requests

    Parameters

    • options: Options
    • ACEs: object
      • [k: string]: string
    • action: "add" | "remove"

    Returns void

setCharset

setContentStream

  • setContentStream(objectId: string, content: string | Blob | Buffer, overwriteFlag?: boolean, filename?: string, options?: object): Promise<any>
  • Updates content of document

    Parameters

    • objectId: string
    • content: string | Blob | Buffer
    • Default value overwriteFlag: boolean = false
    • Optional filename: string
    • Default value options: object = {}
      • Optional changeToken?: string
      • Optional succinct?: boolean

    Returns Promise<any>

setCredentials

  • setCredentials(username: string, password: string): CmisSession
  • sets credentials for authentication

    Parameters

    • username: string
    • password: string

    Returns CmisSession

setErrorHandler

  • setErrorHandler(handler: function): void
  • sets global error handler

    Parameters

    • handler: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns void

Private setPolicies

  • setPolicies(options: Options, policies: Array<string>): void
  • format policies for requests

    Parameters

    • options: Options
    • policies: Array<string>

    Returns void

Private setProperties

  • setProperties(options: Options, properties: object): void
  • format properties for requests

    memberof

    CmisSession

    Parameters

    • options: Options
    • properties: object
      • [k: string]: string | string[] | number | number[] | Date | Date[]

    Returns void

Private setSecondaryTypeIds

  • setSecondaryTypeIds(options: Options, secondaryTypeIds: Array<string>, action: "add" | "remove"): void
  • format secondaryTypeIds for requests

    Parameters

    • options: Options
    • secondaryTypeIds: Array<string>
    • action: "add" | "remove"

    Returns void

setToken

updateProperties

  • updateProperties(objectId: string, properties: object, options?: object): Promise<any>
  • Updates properties of specified object

    Parameters

    • objectId: string
    • properties: object
      • [k: string]: string | string[] | number | number[] | Date | Date[]
    • Default value options: object = {}
      • Optional changeToken?: string
      • Optional succinct?: boolean

    Returns Promise<any>

updateType

  • updateType(type: any): Promise<any>
  • Updates a type definition

    Parameters

    • type: any

    Returns Promise<any>

Object literals

Private options

options: object

succinct

succinct: boolean = true

Generated using TypeDoc