Best JavaScript code snippet using playwright-internal
cmis.js
Source:cmis.js
...114 * includeAllowableActions, includeRelationships, includeACL,115 * includePolicyIds, succinct, token)116 */117 session.getObject = function(objectId, returnVersion, options) {118 options = _fill(options);119 options.cmisselector = 'object';120 options.objectId = objectId;121 if (returnVersion && returnVersion != 'this') {122 options.major = (returnVersion == 'latestmajor');123 }124 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));125 };126 /**127 * gets an object by path128 * 129 * @param {String}130 * path131 * @param {Object}132 * options133 */134 session.getObjectByPath = function(path, options) {135 options = _fill(options);136 options.cmisselector = 'object';137 new CmisRequest(_get(session.defaultRepository.rootFolderUrl + path, options));138 };139 /**140 * creates a new folder141 * 142 * @param {String}143 * parentId144 * @param {String/Object}145 * input if `input` is a string used as the folder name, if146 * `input` is an object it must contain required properties:147 * {'cmis:name': 'aFolder', 'cmis:objectTypeId':148 * 'cmis:folder'}149 */150 session.createFolder = function(parentId, input, policies, addACEs, removeACEs, options) {151 var options = _fill(options);152 if ('string' == typeof input) {153 input = {154 'cmis:name' : input155 };156 }157 var properties = input || {};158 if (!properties['cmis:objectTypeId']) {159 properties['cmis:objectTypeId'] = 'cmis:folder';160 }161 options.objectId = parentId;162 _setProps(properties, options);163 _setACEs(addACEs, 'add', options);164 _setACEs(removeACEs, 'remove', options);165 options.repositoryId = session.defaultRepository.repositoryId;166 options.cmisaction = 'createFolder';167 new CmisRequest(_post(session.defaultRepository.rootFolderUrl, options));168 };169 /**170 * deletes an object171 * 172 * @param {String}173 * objectId174 * @param {Boolean}175 * allVersions176 * @param {Object}177 * options (possible options: token)178 */179 session.deleteObject = function(objectId, allVersions, options) {180 var options = _fill(options);181 options.repositoryId = session.defaultRepository.repositoryId;182 options.cmisaction = 'delete';183 options.objectId = objectId;184 options.allVersions = !!allVersions;185 new CmisRequest(_post(session.defaultRepository.rootFolderUrl, options));186 };187 /**188 * gets repository informations189 * 190 * @param {Object}191 * options (possible options: token)192 */193 session.getRepositoryInfo = function(options) {194 var options = _fill(options);195 options.cmisselector = 'repositoryInfo';196 return new CmisRequest(_get(session.defaultRepository.repositoryUrl, options));197 };198 /**199 * gets the types that are immediate children of the specified typeId,200 * or the base types if no typeId is provided201 * 202 * @param {String}203 * typeId204 * @param {Boolean}205 * includePropertyDefinitions206 * @param {Object}207 * options (possible options: maxItems, skipCount, token)208 */209 session.getTypeChildren = function(typeId, includePropertyDefinitions, options) {210 options = _fill(options);211 if (typeId) {212 options.typeId = typeId;213 }214 options.includePropertyDefinitions = includePropertyDefinitions;215 options.cmisselector = 'typeChildren'216 new CmisRequest(_get(session.defaultRepository.repositoryUrl, options));217 };218 /**219 * gets all types descended from the specified typeId, or all the types220 * in the repository if no typeId is provided221 * 222 * @param {String}223 * typeId224 * @param {Integer}225 * depth226 * @param {Boolean}227 * includePropertyDefinitions228 * @param {Object}229 * options (possible options: token)230 */231 session.getTypeDescendants = function(typeId, depth, includePropertyDefinitions, options) {232 options = _fill(options);233 if (typeId) {234 options.typeId = typeId;235 }236 options.depth = depth || 1;237 options.includePropertyDefinitions = includePropertyDefinitions;238 options.cmisselector = 'typeDescendants'239 new CmisRequest(_get(session.defaultRepository.repositoryUrl, options));240 };241 /**242 * gets definition of the specified type243 * 244 * @param {String}245 * typeId246 * @param {Object}247 * options (possible options: token)248 */249 session.getTypeDefinition = function(typeId, options) {250 options = _fill(options);251 options.typeId = typeId;252 options.cmisselector = 'typeDefinition'253 new CmisRequest(_get(session.defaultRepository.repositoryUrl, options));254 };255 /**256 * gets the documents that have been checked out in the repository257 * 258 * @param {String}259 * objectId260 * @param {Object}261 * options (possible options: filter, maxItems, skipCount,262 * orderBy, renditionFilter, includeAllowableActions,263 * includeRelationships, succinct, token)264 */265 session.getCheckedOutDocs = function(objectId, options) {266 options = _fill(options);267 if (objectId) {268 options.objectId = objectId;269 }270 options.cmisselector = 'checkedOut'271 new CmisRequest(_get(session.defaultRepository.repositoryUrl, options));272 };273 /**274 * creates a new document275 * 276 * @param {String}277 * parentId278 * @param {String/Buffer/Blob}279 * content280 * @param {String/Object}281 * input if `input` is a string used as the document name, if282 * `input` is an object it must contain required properties:283 * {'cmis:name': 'docName', 'cmis:objectTypeId':284 * 'cmis:document'}285 * @param {String}286 * mimeType287 * @param {String}288 * versioningState (if set must be one of: "none", "major",289 * "minor", "checkedout")290 * @param {Object}291 * policies292 * @param {Object}293 * addACEs294 * @param {Object}295 * removeACEs296 * @param {Object}297 * options (possible options: succinct, token)298 */299 session.createDocument = function(parentId, file, input, mimeType, versioningState, policies, addACEs, removeACEs, options) {300 var options = _fill(options);301 if ('string' == typeof input) {302 input = {303 'cmis:name' : input304 };305 }306 var properties = input || {};307 if (!properties['cmis:objectTypeId']) {308 properties['cmis:objectTypeId'] = 'cmis:document';309 }310 if (versioningState) {311 options.versioningState = versioningState;312 }313 options.objectId = parentId;314 _setProps(properties, options);315 if (addACEs) {316 _setACEs(addACEs, 'add', options);317 }318 if (policies) {319 _setPolicies(policies, options);320 }321 if (removeACEs) {322 _removeACEs(removeACEs, 'remove', options);323 }324 options.repositoryId = session.defaultRepository.repositoryId;325 options.cmisaction = 'createDocument';326 new CmisRequest(_postMultipart(session.defaultRepository.rootFolderUrl, options, file, mimeType, properties['cmis:name']));327 };328 /**329 * creates a document object as a copy of the given source document330 * 331 * @param {String}332 * parentId333 * @param {String}334 * sourceId335 * @param {String/Buffer/Blob}336 * content337 * @param {String/Object}338 * input if `input` is a string used as the document name, if339 * `input` is an object it must contain required properties:340 * {'cmis:name': 'docName', 'cmis:objectTypeId':341 * 'cmis:document'}342 * @param {Stirng}343 * mimeType344 * @param {String}345 * versioningState (if set must be one of: "none", "major",346 * "minor", "checkedout")347 * @param {Array}348 * policies349 * @param {Object}350 * addACEs351 * @param {Object}352 * removeACEs353 * @param {Object}354 * options (possible options: succinct, token)355 */356 session.createDocumentFromSource = function(parentId, sourceId, content, input, mimeType, versioningState, policies, addACEs, removeACEs, options) {357 var options = _fill(options);358 if ('string' == typeof input) {359 input = {360 'cmis:name' : input361 };362 }363 var properties = input || {};364 if (!properties['cmis:objectTypeId']) {365 properties['cmis:objectTypeId'] = 'cmis:document';366 }367 if (versioningState) {368 options.versioningState = versioningState;369 }370 options.objectId = parentId;371 options.sourceId = sourceId;372 _setProps(properties, options);373 if (addACEs) {374 _setACEs(addACEs, 'add', options);375 }376 if (removeACEs) {377 _removeACEs(removeACEs, 'remove', options);378 }379 if (policies) {380 _setPolicies(policies, options);381 }382 options.repositoryId = session.defaultRepository.repositoryId;383 options.cmisaction = 'createDocumentFromSource';384 new CmisRequest(_postMultipart(session.defaultRepository.rootFolderUrl, options, content, mimeType, properties['cmis:name']));385 };386 /**387 * Creates a relationship388 * 389 * @param {Object}390 * properties391 * @param {Object}392 * policies393 * @param {Object}394 * addACEs395 * @param {Object}396 * removeACEs397 * @param {Object}398 * options (possible options: succinct, token)399 */400 session.createRelationship = function(properties, policies, addACES, removeACEs, options) {401 options = _fill(options);402 _setProps(properties, options);403 if (addACEs) {404 _setACEs(addACEs, 'add', options);405 }406 if (removeACEs) {407 _removeACEs(removeACEs, 'remove', options);408 }409 if (policies) {410 _setPolicies(policies, options);411 }412 options.cmisaction = 'createRelationship';413 new CmisRequest(_post(session.defaultRepository.repositoryUrl, options));414 };415 /**416 * Creates a policy417 * 418 * @param {String}419 * folderId420 * @param {Object}421 * properties422 * @param {Object}423 * policies424 * @param {Object}425 * addACEs426 * @param {Object}427 * removeACEs428 * @param {Object}429 * options (possible options: succinct, token)430 */431 session.createPolicy = function(folderId, properties, policies, addACES, removeACEs, options) {432 options = _fill(options);433 options.objectId = folderId;434 _setProps(properties, options);435 if (addACEs) {436 _setACEs(addACEs, 'add', options);437 }438 if (removeACEs) {439 _removeACEs(removeACEs, 'remove', options);440 }441 if (policies) {442 _setPolicies(policies, options);443 }444 options.cmisaction = 'createPolicy';445 return new CmisRequest(_post(session.defaultRepository.rootFolderUrl).send(options));446 };447 /**448 * Creates an item449 * 450 * @param {String}451 * folderId452 * @param {Object}453 * properties454 * @param {Object}455 * policies456 * @param {Object}457 * addACEs458 * @param {Object}459 * removeACEs460 * @param {Object}461 * options (possible options: succinct, token)462 */463 session.createItem = function(folderId, properties, policies, addACEs, removeACEs, options) {464 options = _fill(options);465 options.objectId = folderId;466 _setProps(properties, options);467 if (addACEs) {468 _setACEs(addACEs, 'add', options);469 }470 if (removeACEs) {471 _removeACEs(removeACEs, 'remove', options);472 }473 if (policies) {474 _setPolicies(policies, options);475 }476 options.cmisaction = 'createItem';477 new CmisRequest(_post(session.defaultRepository.rootFolderUrl, options));478 };479 /**480 * Updates properties of specified objects481 * 482 * @param {Array}483 * objectIds484 * @param {Object}485 * properties486 * @param {Array}487 * addSecondaryTypeIds488 * @param {Array}489 * removeSecondaryTypeIds490 * @param {Options}491 * options (possible options: token)492 */493 session.bulkUpdateProperties = function(objectIds, properties, addSecondaryTypeIds, removeSecondaryTypeIds, options) {494 var options = _fill(options);495 for (var i = objectIds.length - 1; i >= 0; i--) {496 options['objectId[' + i + ']'] = objectIds[i];497 }498 options.objectIds = objectIds;499 _setProps(properties, options);500 if (addSecondaryTypeIds) {501 _setSecondaryTypeIds(addSecondaryTypeIds, 'add', options);502 }503 if (removeSecondaryTypeIds) {504 _setSecondaryTypeIds(removeSecondaryTypeIds, 'remove', options);505 }506 options.cmisaction = 'bulkUpdate';507 new CmisRequest(_post(session.defaultRepository.repositoryUrl, options));508 };509 /**510 * performs a cmis query against the repository511 * 512 * @param {String}513 * statement514 * @param {Boolean}515 * searchAllversions516 * @param {Object}517 * options (possible options: maxItems, skipCount, orderBy,518 * renditionFilter, includeAllowableActions,519 * includeRelationships, succinct, token)520 */521 session.query = function(statement, searchAllversions, options) {522 options = _fill(options);523 options.cmisaction = 'query';524 options.q = statement;525 options.searchAllversions = !!searchAllversions;526 new CmisRequest(_post(session.defaultRepository.repositoryUrl, options));527 };528 /**529 * gets the changed objects, the list object should contain the next530 * change log token.531 * 532 * @param {String}533 * changeLogToken534 * @param {Boolean}535 * includeProperties536 * @param {Boolean}537 * includePolicyIds538 * @param {Boolean}539 * includeACL540 * @param {Object}541 * options (possible options: maxItems, succinct, token)542 */543 session.getContentChanges = function(changeLogToken, includeProperties, includePolicyIds, includeACL, options) {544 options = _fill(options);545 options.cmisselector = 'contentChanges';546 if (changeLogToken) {547 options.changeLogToken = changeLogToken;548 }549 options.includeProperties = !!includeProperties;550 options.includePolicyIds = !!includePolicyIds;551 options.includeACL = !!includeACL;552 new CmisRequest(_get(session.defaultRepository.repositoryUrl, options));553 };554 /**555 * Creates a new type556 * 557 * @param {Object}558 * type559 * @param {Object}560 * options (possible options: token)561 * 562 */563 session.createType = function(type, options) {564 options = _fill(options);565 options.cmisaction = 'createType';566 options.type = JSON.stringify(type);567 return new CmisRequest(_post(session.defaultRepository.repositoryUrl).send(options));568 };569 /**570 * Updates a type definition571 * 572 * @param {Object}573 * type574 * @param {Object}575 * options (possible options: token)576 */577 session.updateType = function(type, options) {578 options = _fill(options);579 options.cmisaction = 'updateType';580 options.type = JSON.stringify(type);581 return new CmisRequest(_post(session.defaultRepository.repositoryUrl).send(options));582 };583 /**584 * Deletes specified type585 * 586 * @param {String}587 * typeId588 * @param {Object}589 * options (possible options: token)590 */591 session.deleteType = function(typeId, options) {592 options = _fill(options);593 options.cmisaction = 'deleteType';594 options.typeId = typeId;595 return new CmisRequest(_post(session.defaultRepository.repositoryUrl).send(options));596 };597 /**598 * gets last result599 * 600 * @param {Object}601 * options (possible options: token)602 */603 session.getLastResult = function(options) {604 options = _fill(options);605 options.cmisaction = 'lastResult';606 new CmisRequest(_get(session.defaultRepository.repositoryUrl, options));607 };608 /**609 * Returns children of object specified by id610 * 611 * @param {String}612 * objectId613 * @param {Object}614 * options (possible options: maxItems, skipCount, filter,615 * orderBy, renditionFilter, includeAllowableActions,616 * includeRelationships, includePathSegment, succinct, token)617 */618 session.getChildren = function(objectId, options) {619 options = _fill(options);620 options.cmisselector = 'children';621 options.objectId = objectId;622 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));623 };624 /**625 * Gets all descendants of specified folder626 * 627 * @param {String}628 * folderId629 * @param {Integer}630 * depth631 * @param {Object}632 * options (possible options: filter, renditionFilter,633 * includeAllowableActions, includeRelationships,634 * includePathSegment, succinct, token)635 */636 session.getDescendants = function(folderId, depth, options) {637 options = _fill(options);638 options.cmisselector = 'descendants';639 if (depth) {640 options.depth = depth;641 }642 options.objectId = folderId;643 return new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));644 };645 /**646 * Gets the folder tree of the specified folder647 * 648 * @param {String}649 * folderId650 * @param {Integer}651 * depth652 * @param {Object}653 * options (possible options: filter, renditionFilter,654 * includeAllowableActions, includeRelationships,655 * includePathSegment, succinct, token)656 */657 session.getFolderTree = function(folderId, depth, options) {658 options = _fill(options);659 options.cmisselector = 'folderTree';660 if (depth) {661 options.depth = depth;662 }663 options.objectId = folderId;664 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));665 };666 /**667 * Gets the parent folder of the specified folder668 * 669 * @param {String}670 * folderId671 * @param {Object}672 * options (possible options: succinct, token)673 */674 session.getFolderParent = function(folderId, options) {675 options = _fill(options);676 options.cmisselector = 'parent';677 options.objectId = folderId;678 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));679 };680 /**681 * Gets the folders that are the parents of the specified object682 * 683 * @param {String}684 * folderId685 * @param {Object}686 * options (possible options: filter, renditionFilter,687 * includeAllowableActions, includeRelationships,688 * includePathSegment, succinct, token)689 */690 session.getParents = function(objectId, options) {691 options = _fill(options);692 options.cmisselector = 'parents';693 options.objectId = objectId;694 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));695 };696 /**697 * Gets the allowable actions of the specified object698 * 699 * @param {String}700 * objectId701 * @param {Object}702 * options (possible options: filter, maxItems, skipCount,703 * orderBy, renditionFilter, includeAllowableActions,704 * includeRelationships, succinct, token)705 */706 session.getAllowableActions = function(objectId, options) {707 options = _fill(options);708 options.cmisselector = 'allowableActions';709 options.objectId = objectId;710 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));711 };712 /**713 * Gets the properties of the specified object714 * 715 * @param {String}716 * objectId717 * @param {String}718 * returnVersion (if set must be one of 'this', latest' or719 * 'latestmajor')720 * @param {Object}721 * options (possible options: filter, succinct, token)722 */723 session.getProperties = function(objectId, returnVersion, options) {724 options = _fill(options);725 options.cmisselector = 'properties';726 options.objectId = objectId;727 if (returnVersion && returnVersion != 'this') {728 options.major = (returnVersion == 'latestmajor');729 }730 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));731 };732 /**733 * Gets document content, WARNING: will not work for binary files734 * (images, documents, ecc..)735 * 736 * @param {String}737 * objectId738 * @param {Boolean}739 * download740 * @param {Object}741 * options (possible options: token)742 */743 session.getContentStream = function(objectId, download, options) {744 options = _fill(options);745 options.cmisselector = 'content';746 options.objectId = objectId;747 options.download = download;748 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options), true);749 };750 /**751 * Gets document content URL752 * 753 * @param {String}754 * objectId755 * @param {Boolean}756 * download757 * @param {Object}758 * options (possible options: token)759 * @return String760 */761 session.getContentStreamURL = function(objectId, download, options) {762 options = _fill(options);763 options.cmisselector = 'content';764 options.objectId = objectId;765 options.download = download;766 var pairs = [];767 for ( var key in options) {768 pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(options[key]));769 }770 var query = pairs.join('&');771 return session.defaultRepository.rootFolderUrl + '?' + query;772 };773 /**774 * gets document renditions775 * 776 * @param {String}777 * objectId778 * @param {Object}779 * options (possible options: renditionFilter, maxItems,780 * skipCount, token)781 */782 session.getRenditions = function(objectId, options) {783 options = _fill(options);784 options.cmisselector = 'renditions';785 options.objectId = objectId;786 options.renditionFilter = options.renditionFilter || '*';787 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));788 };789 /**790 * Updates properties of specified object791 * 792 * @param {Object}793 * properties794 * @param {Options}795 * options (possible options: changeToken, succinct, token)796 */797 session.updateProperties = function(objectId, properties, options) {798 var options = _fill(options);799 options.objectId = objectId;800 _setProps(properties, options);801 options.cmisaction = 'update';802 // We first need to get properties to check if there is a change803 // token or not804 session.getProperties(objectId, 'this', {805 request : {806 success : function(data) {807 if (data["cmis:changeToken"] != null && data["cmis:changeToken"].value != null) {808 options.changeToken = data["cmis:changeToken"].value;809 }810 new CmisRequest(_post(session.defaultRepository.rootFolderUrl + "?objectId=" + objectId, options));811 }812 }813 });814 };815 /**816 * Moves an object817 * 818 * @param {String}819 * objectId820 * @param {String}821 * targeFolderId822 * @param {String}823 * sourceFolderId824 * @param {Object}825 * options (possible options: succinct, token)826 */827 session.moveObject = function(objectId, sourceFolderId, targetFolderId, options) {828 var options = _fill(options);829 options.objectId = objectId;830 options.cmisaction = 'move';831 options.targetFolderId = targetFolderId;832 options.sourceFolderId = sourceFolderId;833 new CmisRequest(_post(session.defaultRepository.rootFolderUrl, options));834 };835 /**836 * Deletes a folfder tree837 * 838 * @param {String}839 * objectId840 * @param {Boolean}841 * allVersions842 * @param {String}843 * unfileObjects (if set must be one of 'unfile',844 * 'deletesinglefiled', 'delete')845 * @param {Boolean}846 * continueOnFailure847 * @param {Object}848 * options (possible options: token)849 */850 session.deleteTree = function(objectId, allVersions, unfileObjects, continueOnFailure, options) {851 var options = _fill(options);852 options.repositoryId = session.defaultRepository.repositoryId;853 options.cmisaction = 'deleteTree';854 options.objectId = objectId;855 options.allVersions = !!allVersions;856 if (unfileObjects) {857 options.unfileObjects = unfileObjects;858 }859 options.continueOnFailure = !!continueOnFailure;860 new CmisRequest(_post(session.defaultRepository.rootFolderUrl, options));861 };862 /**863 * Updates content of document864 * 865 * @param {String}866 * objectId867 * @param {String/Buffer}868 * content869 * @param {Boolean}870 * overwriteFlag871 * @param {String}872 * mimeType873 * @param changeToken874 * @param {Object}875 * options (possible options: changeToken, succinct, token)876 */877 session.setContentStream = function(objectId, content, overwriteFlag, mimeType, options) {878 var options = _fill(options);879 options.objectId = objectId;880 options.overwriteFlag = !!overwriteFlag;881 options.cmisaction = 'setContent';882 // We first need to get properties to check if there is a change883 // token or not884 session.getProperties(objectId, 'this', {885 request : {886 success : function(data) {887 if (data["cmis:changeToken"] != null && data["cmis:changeToken"].value != null) {888 options.changeToken = data["cmis:changeToken"].value;889 new CmisRequest(_postMultipart(session.defaultRepository.rootFolderUrl, options, content, mimeType));890 }891 }892 }893 });894 };895 /**896 * Appends content to document897 * 898 * @param {String}899 * objectId900 * @param {String/Buffer}901 * content902 * @param {Boolean}903 * isLastChunk904 * @param {Object}905 * options906 * @return {CmisRequest} (possible options: changeToken, succinct,907 * token)908 */909 session.appendContentStream = function(objectId, content, isLastChunk, options) {910 var options = _fill(options);911 options.objectId = objectId;912 options.cmisaction = 'appendContent';913 options.isLastChunk = !!isLastChunk;914 new CmisRequest(_postMultipart(session.defaultRepository.rootFolderUrl, options, content));915 };916 /**917 * deletes object content918 * 919 * @param {String}920 * objectId921 * @param {Object}922 * options (possible options: changeToken, succinct, token)923 */924 session.deleteContentStream = function(objectId, options) {925 var options = _fill(options);926 options.objectId = objectId;927 options.cmisaction = 'deleteContent';928 return new CmisRequest(_post(session.defaultRepository.rootFolderUrl).send(options));929 };930 /**931 * Adds specified object to folder932 * 933 * @param {String}934 * objectId935 * @param {String}936 * folderId937 * @param {Boolean}938 * allVersions939 * @param {Object}940 * options (possible options: succinct, token)941 */942 session.addObjectToFolder = function(objectId, folderId, allVersions, options) {943 var options = _fill(options);944 options.objectId = objectId;945 options.cmisaction = 'addObjectToFolder';946 options.allVersions = !!allVersions;947 options.folderId = folderId;948 new CmisRequest(_post(session.defaultRepository.rootFolderUrl, options));949 };950 /**951 * Removes specified object from folder952 * 953 * @param {String}954 * objectId955 * @param {String}956 * folderId957 * @param {Object}958 * options (possible options: succinct, token)959 */960 session.removeObjectFromFolder = function(objectId, folderId, options) {961 var options = _fill(options);962 options.objectId = objectId;963 options.cmisaction = 'removeObjectFromFolder';964 options.folderId = folderId;965 new CmisRequest(_post(session.defaultRepository.rootFolderUrl, options));966 };967 /**968 * checks out a document969 * 970 * @param {String}971 * objectId972 * @param {Object}973 * options974 */975 session.checkOut = function(objectId, options) {976 var options = _fill(options);977 options.objectId = objectId;978 options.cmisaction = 'checkOut';979 new CmisRequest(_post(session.defaultRepository.rootFolderUrl, options));980 };981 /**982 * cancels a check out983 * 984 * @param {String}985 * objectId986 * @param {Object}987 * options (possible options: token)988 */989 session.cancelCheckOut = function(objectId, options) {990 var options = _fill(options);991 options.objectId = objectId;992 options.cmisaction = 'cancelCheckOut';993 new CmisRequest(_post(session.defaultRepository.rootFolderUrl, options));994 };995 /**996 * checks in a document, if needed mimetype may be specified as997 * input['cmis:contentStreamMimeType'] or as option.mimeType998 * 999 * @param {String}1000 * objectId1001 * @param {Boolean}1002 * major1003 * @param {String/Object}1004 * input if `input` is a string used as the document name, if1005 * `input` is an object it must contain required properties:1006 * {'cmis:name': 'docName'}1007 * @param {String/Buffer}1008 * content1009 * @param {String}1010 * comment1011 * @param {Array}1012 * policies1013 * @param {Object}1014 * addACEs1015 * @param {Object}1016 * removeACEs1017 * @param {Object}1018 * options1019 */1020 session.checkIn = function(objectId, major, input, content, comment, policies, addACEs, removeACEs, options) {1021 var options = _fill(options);1022 if ('string' == typeof input) {1023 input = {1024 'cmis:name' : input1025 };1026 }1027 var properties = input || {};1028 if (comment) {1029 options.checkInComment = comment;1030 }1031 options.major = !!major;1032 options.objectId = objectId;1033 _setProps(properties, options);1034 if (addACEs) {1035 _setACEs(addACEs, 'add', options);1036 }1037 if (removeACEs) {1038 _setACEs(removeACEs, 'remove', options);1039 }1040 if (policies) {1041 _setPolicies(policies, options);1042 }1043 options.cmisaction = 'checkIn';1044 new CmisRequest(_postMultipart(session.defaultRepository.rootFolderUrl, options, content, options.mimeType || properties['cmis:contentStreamMimeType'], properties['cmis:name']));1045 };1046 /**1047 * gets versions of object1048 * 1049 * @param {Object}1050 * options (possible options: filter,1051 * includeAllowableActions, succinct, token)1052 */1053 session.getAllVersions = function(objectId, options) {1054 var options = _fill(options);1055 options.objectId = objectId;1056 options.cmisselector = 'versions';1057 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));1058 };1059 /**1060 * gets object relationships1061 * 1062 * @param {String}1063 * objectId1064 * @param {Boolean}1065 * includeSubRelationshipTypes1066 * @param {String}1067 * relationshipDirection1068 * @param {String}1069 * typeId1070 * @param {Object}1071 * options (possible options: maxItems, skipCount,1072 * includeAllowableActions, filter, succinct, token)1073 */1074 session.getObjectRelationships = function(objectId, includeSubRelationshipTypes, relationshipDirection, typeId, options) {1075 var options = _fill(options);1076 options.objectId = objectId;1077 options.includeSubRelationshipTypes = !!includeSubRelationshipTypes;1078 options.relationshipDirection = relationshipDirection || 'either';1079 if (typeId) {1080 options.typeId = typeId;1081 }1082 options.cmisselector = 'relationships';1083 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));1084 };1085 /**1086 * gets object applied policies1087 * 1088 * @param {String}1089 * objectId1090 * @param {Object}1091 * options (possible options: filter, succinct, token)1092 */1093 session.getAppliedPolicies = function(objectId, options) {1094 var options = _fill(options);1095 options.objectId = objectId;1096 options.cmisselector = 'policies';1097 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));1098 };1099 /**1100 * applies policy to object1101 * 1102 * @param {String}1103 * objectId1104 * @param {String}1105 * policyId1106 * @param {Object}1107 * options (possible options: succinct, token)1108 */1109 session.applyPolicy = function(objectId, policyId, options) {1110 var options = _fill(options);1111 options.objectId = objectId;1112 options.policyId = policyId;1113 options.cmisaction = 'applyPolicy';1114 new CmisRequest(_post(session.defaultRepository.rootFolderUrl, options));1115 };1116 /**1117 * removes policy from object1118 * 1119 * @param {String}1120 * objectId1121 * @param {String}1122 * policyId1123 * @param {Object}1124 * options (possible options: succinct, token)1125 */1126 session.removePolicy = function(objectId, policyId, options) {1127 var options = _fill(options);1128 options.objectId = objectId;1129 options.policyId = policyId;1130 options.cmisaction = 'removePolicy';1131 return new CmisRequest(_post(session.defaultRepository.rootFolderUrl).send(options));1132 };1133 /**1134 * applies ACL to object1135 * 1136 * @param {String}1137 * objectId1138 * @param {Object}1139 * addACEs1140 * @param {Object}1141 * removeACEs1142 * @param {String}1143 * propagation1144 * @param {Object}1145 * options (possible options: token)1146 */1147 session.applyACL = function(objectId, addACEs, removeACEs, propagation, options) {1148 var options = _fill(options);1149 options.objectId = objectId;1150 options.propagation = propagation;1151 options.cmisaction = 'applyACL';1152 _setACEs(addACEs, 'add', options);1153 _setACEs(removeACEs, 'remove', options);1154 new CmisRequest(_post(session.defaultRepository.rootFolderUrl, options));1155 };1156 /**1157 * gets object ACL1158 * 1159 * @param {String}1160 * objectId1161 * @param {Boolean}1162 * onlyBasicPermissions1163 * @param {Object}1164 * options (possible options: token)1165 */1166 session.getACL = function(objectId, onlyBasicPermissions, options) {1167 var options = _fill(options);1168 options.objectId = objectId;1169 options.onlyBasicPermissions = !!onlyBasicPermissions;1170 options.cmisselector = 'acl';1171 new CmisRequest(_get(session.defaultRepository.rootFolderUrl, options));1172 };1173 /**1174 * @class CmisRequest jQuery wrapper used to manage async requests1175 */1176 function CmisRequest(req) {1177 $.ajax(req);1178 }1179 // Private members and methods1180 var _url = url;1181 var _token = null;...
git-host.js
Source:git-host.js
...14 hash () {15 return this.committish ? `#${this.committish}` : ''16 }17 ssh (opts) {18 return this._fill(this.sshtemplate, opts)19 }20 _fill (template, opts) {21 if (typeof template === 'function') {22 const options = { ...this, ...this.opts, ...opts }23 // the path should always be set so we don't end up with 'undefined' in urls24 if (!options.path) {25 options.path = ''26 }27 // template functions will insert the leading slash themselves28 if (options.path.startsWith('/')) {29 options.path = options.path.slice(1)30 }31 if (options.noCommittish) {32 options.committish = null33 }34 const result = template(options)35 return options.noGitPlus && result.startsWith('git+') ? result.slice(4) : result36 }37 return null38 }39 sshurl (opts) {40 return this._fill(this.sshurltemplate, opts)41 }42 browse (path, fragment, opts) {43 // not a string, treat path as opts44 if (typeof path !== 'string') {45 return this._fill(this.browsetemplate, path)46 }47 if (typeof fragment !== 'string') {48 opts = fragment49 fragment = null50 }51 return this._fill(this.browsefiletemplate, { ...opts, fragment, path })52 }53 docs (opts) {54 return this._fill(this.docstemplate, opts)55 }56 bugs (opts) {57 return this._fill(this.bugstemplate, opts)58 }59 https (opts) {60 return this._fill(this.httpstemplate, opts)61 }62 git (opts) {63 return this._fill(this.gittemplate, opts)64 }65 shortcut (opts) {66 return this._fill(this.shortcuttemplate, opts)67 }68 path (opts) {69 return this._fill(this.pathtemplate, opts)70 }71 tarball (opts) {72 return this._fill(this.tarballtemplate, { ...opts, noCommittish: false })73 }74 file (path, opts) {75 return this._fill(this.filetemplate, { ...opts, path })76 }77 getDefaultRepresentation () {78 return this.default79 }80 toString (opts) {81 if (this.default && typeof this[this.default] === 'function') {82 return this[this.default](opts)83 }84 return this.sshurl(opts)85 }86}...
video.js
Source:video.js
1/* eslint-disable */2var icon = require('vue-svgicon')3icon.register({4 'video': {5 width: 16,6 height: 16,7 viewBox: '0 0 64 64',8 data: `<path pid="0" d="M5.4 49.6h53.4v10.7H5.4z"/><path pid="1" _fill="#00f" d="M48 3.8h10.7v45.6H48z"/><path pid="2" _fill="#ff0080" d="M37.3 3.8H48v45.6H37.3z"/><path pid="3" _fill="#ff0" d="M15.9 3.8h10.7v45.6H15.9z"/><path pid="4" _fill="#00ff80" d="M26.6 3.8h10.7v45.6H26.6z"/><path pid="5" _fill="#dedede" d="M5.2 3.9h10.7v45.6H5.2z"/><g><path pid="6" _fill="#fff" d="M16 49.5h10.7v10.7H16z"/></g><g><path pid="7" _fill="#231f20" d="M59.2 60.7H4.8V3.4H16l10.7-.1h32.5v46.1h-1V4.3H26.7L16 4.4H5.8v55.3h52.4V49.5h1z"/></g>`9 }...
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.fill('input[placeholder="Search"]', 'Hello World');6 await page.screenshot({ path: `example.png` });7 await browser.close();8})();9const { chromium }
Using AI Code Generation
1const { _fill } = require('playwright/lib/server/chromium/crPage');2async function fill(page, selector, value) {3 const handle = await page.$(selector);4 await _fill(handle, value);5 await handle.dispose();6}7const { _fill } = require('playwright/lib/server/chromium/crPage');8async function fill(page, selector, value) {9 const handle = await page.$(selector);10 await _fill(handle, value);11 await handle.dispose();12}13const { _fill } = require('playwright/lib/server/chromium/crPage');14async function fill(page, selector, value) {15 const handle = await page.$(selector);16 await _fill(handle, value);17 await handle.dispose();18}19const { _fill } = require('playwright/lib/server/chromium/crPage');20async function fill(page, selector, value) {21 const handle = await page.$(selector);22 await _fill(handle, value);23 await handle.dispose();24}25const { _fill } = require('playwright/lib/server/chromium/crPage');26async function fill(page, selector, value) {27 const handle = await page.$(selector);28 await _fill(handle, value);29 await handle.dispose();30}31const { _fill } = require('playwright/lib/server/chromium/crPage');32async function fill(page, selector, value) {33 const handle = await page.$(selector);34 await _fill(handle, value);35 await handle.dispose();36}37const { _fill } = require('playwright/lib/server/chromium/crPage');38async function fill(page, selector, value) {
Using AI Code Generation
1const { _fill } = require(‘playwright/lib/server/dom.js’);2const { _fill } = require(‘playwright/lib/server/dom.js’);3_fill(document.querySelector(‘input’), ‘Hello World’);4const { _fill } = require(‘playwright/lib/server/dom.js’);5const { _fill } = require(‘playwright/lib/server/dom.js’);6Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\username\AppData\Local\Yarn\Data\global\node_modules\playwright\lib\server\dom.js
Using AI Code Generation
1const { _fill } = require('playwright/lib/server/chromium/crPage');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await _fill(page, "input[name='q']", "Hello World");7 await browser.close();8})();9The _fill() method is not documented because it is an internal method. It is not meant to be used by the end
Using AI Code Generation
1const { _fill } = require('playwright/lib/server/dom.js');2await _fill(page, 'input', 'hello');3const { _fill } = require('playwright/lib/server/dom.js');4await _fill(page, 'input', 'hello');5const { _fill } = require('playwright/lib/server/dom.js');6await _fill(page, 'input', 'hello');7const { _fill } = require('playwright/lib/server/dom.js');8await _fill(page, 'input', 'hello');9const { _fill } = require('playwright/lib/server/dom.js');10await _fill(page, 'input', 'hello');11const { _fill } = require('playwright/lib/server/dom.js');12await _fill(page, 'input', 'hello');13const { _fill } = require('playwright/lib/server/dom.js');14await _fill(page, 'input', 'hello');15const { _fill } = require('playwright/lib/server/dom.js');16await _fill(page, 'input', 'hello');17const { _fill } = require('playwright/lib/server/dom.js');18await _fill(page, 'input', 'hello');19const { _fill } = require('playwright/lib/server/dom.js');20await _fill(page, 'input', 'hello');21const { _fill } = require('playwright/lib/server/dom.js');22await _fill(page, 'input', 'hello');23const {
Using AI Code Generation
1await page._fill('#id', 'value');2await page.evaluate((selector, value) => {3 return document.querySelector(selector)._fill(value);4}, '#id', 'value');5await page.evaluate((selector, value) => {6 return document.querySelector(selector)._fill(value);7}, '#id', 'value');8await page.evaluate((selector, value) => {9 return document.querySelector(selector)._fill(value);10}, '#id', 'value');11await page.evaluate((selector, value) => {12 return document.querySelector(selector)._fill(value);13}, '#id', 'value');14await page.evaluate((selector, value) => {15 return document.querySelector(selector)._fill(value);16}, '#id', 'value');17await page.evaluate((selector, value) => {18 return document.querySelector(selector)._fill(value);19}, '#id', 'value');20await page.evaluate((selector, value) => {21 return document.querySelector(selector)._fill(value);22}, '#id', 'value');23await page.evaluate((selector
Using AI Code Generation
1const playwright = require('playwright');2class InternalMethods {3 async _fill(page, selector, value) {4 const handle = await page.$(selector);5 await handle.evaluate((element, value) => element.value = value, value);6 }7}8module.exports = new InternalMethods();9const internalMethods = require('./internalMethods');10const internalMethodsInstance = new internalMethods();11test('Internal methods', async ({ page }) => {12 await internalMethodsInstance._fill(page, 'input', 'Hello World!');13 await page.click('button');14});15The above code imports the internalMethods.js file and creates a new instance of the InternalMethods class. Then, it uses the internal method _fill to set the value of the input
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!