Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit a5c922e

Browse files
authored
2.4.0 (#346)
* ADF-2789 alfresco-js-api downlaodapi documentation is missing * Publish the release 2.3.1 for compatibility reason (#327) * add missing search typings (#328) * Update index.d.ts * Update index.d.ts * fix enums usage/imports in TypeScript (#329) * fix enums usage/imports in TypeScript * enum fixes * update test script * test against release (master) * Revert "test against release (master)" This reverts commit 7e2a9b1. * restore the script * use master for tests * temp workaround for sort enum * [ADF-2563] Update node content (#331) * Update node content * change log update * [ADF-3037] Add newly introduced isFavorite property to Nodes (#332) * add new isFavorite property * update changelog * [ADF-2573] remove duplicate listeners and add error event (#333) * remove duplicate listeners add error event * test error handler * [ADF-2481] disable timeout (#334) * disable timeout * changelog * change timeout settings * fix typings error * remove non-existing parameter * missing property on declaration * remove client timeout * added nodeId property (#335) * [ADF-2603] getVersionContent type definition missing parameters (#336) * update versioning typings * update changelog * [ADF-SSO] Implicit flow login for oauth2 sso (#337) * implicit flow oauth2 * oauth part 2 * check valid access token * silent refresh token * fix refresh token remove * clean local token after logout * documentation * fix test * improve storage * add scope as required parameter add more test * skip login form * storage static * init storage * fix declaration file * fix storage * improve implicit flow using session storage * redirect logout optional * make check provider methods public * remove trailing white space * skipLoginForm rename to silentLogin * remove secret mandatory * fix declaration and implicit login * create configuration change option * fix metadata context update changelog * fix oauth2 hash problems (#339) * authType property * fix check islogin * [ADF-3224] move logic store ticket in alfresco-js-api (#341) * invalidate session * changelog add * invalidate session at logout * rename clear storage in invalidateSession * invalidate not oauth2 sessions only if needed * missing space * move to local storage * exclude logout emc/bpm in oauth * Fix type definition for TaskFormsApi.getTaskFormVariables (#342) * [ADF-3184] grant type password KEYCLOAK fix * Dev build fix (#345) * fix travis script * fix test and build * travis script new conf * Enforce the isBpm/isEcm loggedIn method checking the current provider… (#344) * Enforce the isBpm/isEcm loggedIn method checking the current provider (BPM/ECM/ALL) * Update alfrescoApi.js * fix reference problem isEcmBpmConfiguration * bump version
1 parent 6e63688 commit a5c922e

24 files changed

+1506
-454
lines changed

.jshintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"Modernizr": false,
3838
"Handlebars": false,
3939
"spa": true,
40-
"ActiveXObject": false
40+
"ActiveXObject": false,
41+
"window": true
4142
}
4243
}

.travis.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ node_js:
66

77
addons:
88
chrome: stable
9+
910
before_script:
1011
- "sudo chown root /opt/google/chrome/chrome-sandbox"
1112
- "sudo chmod 4755 /opt/google/chrome/chrome-sandbox"
@@ -16,21 +17,23 @@ before_install:
1617
- sh -e /etc/init.d/xvfb start
1718
- npm install -g grunt-cli
1819

19-
20-
install: npm install
21-
2220
cache:
2321
directories:
2422
- node_modules
2523

2624
env:
2725
matrix:
28-
- MODULE=alfresco-js-api
26+
- MODULE=jsapi
27+
28+
install:
29+
- npm install
2930

3031
script:
31-
- if ([ "$MODULE" == "alfresco-js-api" ]); then
32-
npm run test
33-
fi
32+
- npm run clean-build
33+
- grunt
34+
- npm run tslint || exit 1
35+
- npm run test || exit 1
36+
- npm run webpack
3437

3538
jobs:
3639
include:

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,29 @@
33
</p>
44

55
# Alfresco JS API
6+
7+
<a name="2.4.0"></a>
8+
# [2.4.0](https://github.com/Alfresco/alfresco-js-api/releases/tag/2.4.0) (25-06-2018)
9+
10+
## Features
11+
[Update Content in UplaodAPI](https://issues.alfresco.com/jira/browse/ADF-2563)
12+
[Error rise alfresco-js-api event](https://issues.alfresco.com/jira/browse/ADF-2753)
13+
[Add newly introduced isFavorite property to Nodes](https://issues.alfresco.com/jira/browse/ADF-3037)
14+
[Shared nodeId property](https://issues.alfresco.com/jira/browse/ADF-3063)
15+
[SSO implicit flow](https://issues.alfresco.com/jira/browse/ADF-2795)
16+
17+
18+
## Fixes
19+
[Disable timeout](https://issues.alfresco.com/jira/browse/ADF-2481)
20+
[Missing typings for Search API](https://issues.alfresco.com/jira/browse/ADF-2885)
21+
[getVersionContent type definition missing parameters](https://issues.alfresco.com/jira/browse/ADF-2603)
22+
[gMetadata URL context root is wrong](https://github.com/Alfresco/alfresco-js-api/issues/338)
23+
[Authentication Guard (ACS) does not redirect to Login on page reload](https://issues.alfresco.com/jira/browse/ADF-3224)
24+
25+
<a name="2.3.1"></a>
26+
# [2.3.1](https://github.com/Alfresco/alfresco-js-api/releases/tag/2.3.1) (25-04-2018)
27+
28+
629
<a name="2.3.0"></a>
730
# [2.3.0](https://github.com/Alfresco/alfresco-js-api/releases/tag/2.3.0) (17-04-2018)
831

README.md

Lines changed: 132 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -49,102 +49,110 @@ This project provides a JavaScript client API into the Alfresco REST API and Act
4949
+ [Login with Username and Password BPM](#login-with-username-and-password-bpm)
5050
+ [Example](#example-4)
5151
+ [Login with OAUTH2 Alfresco authorization server](#login-with-oauth2-alfresco-authorization-server)
52+
* [Implicit Flow](#implicit-flow)
53+
- [oauth2 properties](#oauth2-properties)
54+
- [Events](#events)
5255
+ [Example](#example-5)
56+
+ [Example skip login form](#example-skip-login-form)
57+
* [Password Flow](#password-flow)
5358
+ [Example](#example-6)
54-
* [Logout](#logout)
5559
+ [Example](#example-7)
56-
* [isLoggedIn](#isloggedin)
60+
* [Logout](#logout)
5761
+ [Example](#example-8)
62+
* [isLoggedIn](#isloggedin)
63+
+ [Example](#example-9)
5864
* [Get tickets](#get-tickets)
5965
* [Events login/logout](#events-loginlogout)
60-
+ [Example](#example-9)
66+
+ [Example](#example-10)
6167
- [Custom Endpoint](#custom-endpoint)
62-
* [Example](#example-10)
68+
* [Example](#example-11)
6369
- [ECM](#ecm)
6470
* [Get Node content](#get-node--content)
65-
+ [Example](#example-11)
66-
* [Get File or Folder Info](#get-file-or-folder-info)
6771
+ [Example](#example-12)
68-
* [Get Folder Children Info](#get-folder-children-info)
72+
* [Get File or Folder Info](#get-file-or-folder-info)
6973
+ [Example](#example-13)
70-
* [Create Folder](#create-folder)
74+
* [Get Folder Children Info](#get-folder-children-info)
7175
+ [Example](#example-14)
76+
* [Create Folder](#create-folder)
7277
+ [Example](#example-15)
73-
* [Upload File](#upload-file)
7478
+ [Example](#example-16)
75-
* [Events Upload File](#events-upload-file)
79+
* [Upload File](#upload-file)
7680
+ [Example](#example-17)
77-
* [Delete File or Folder](#delete-file-or-folder)
81+
* [Events Upload File](#events-upload-file)
7882
+ [Example](#example-18)
79-
* [Delete File or Folder Permanent](#delete-file-or-folder-permanent)
83+
* [Delete File or Folder](#delete-file-or-folder)
8084
+ [Example](#example-19)
81-
* [Get thumbnail Url](#get-thumbnail-url)
85+
* [Delete File or Folder Permanent](#delete-file-or-folder-permanent)
8286
+ [Example](#example-20)
83-
* [Get preview Url](#get-preview-url)
87+
* [Get thumbnail Url](#get-thumbnail-url)
8488
+ [Example](#example-21)
85-
* [Get content Url](#get-content-url)
89+
* [Get preview Url](#get-preview-url)
8690
+ [Example](#example-22)
91+
* [Get content Url](#get-content-url)
92+
+ [Example](#example-23)
8793
* [Custom web scripts call](#custom-web-scripts-call)
8894
+ [Parameters](#parameters)
8995
- [BPM](#bpm)
9096
* [Task Api](#task-api)
9197
+ [List Task](#list-task)
9298
- [Parameters](#parameters-1)
93-
- [Example](#example-23)
99+
- [Example](#example-24)
94100
+ [Get Task](#get-task)
95101
- [Parameters](#parameters-2)
96-
- [Example](#example-24)
102+
- [Example](#example-25)
97103
+ [Filter Task](#filter-task)
98104
- [Parameters](#parameters-3)
99-
- [Example](#example-25)
105+
- [Example](#example-26)
100106
+ [Complete Task](#complete-task)
101107
- [Parameters](#parameters-4)
102-
- [Example](#example-26)
108+
- [Example](#example-27)
103109
+ [Get Task Form](#get-task-form)
104110
- [Parameters](#parameters-5)
105-
- [Example](#example-27)
111+
- [Example](#example-28)
106112
+ [Complete Task Form](#complete-task-form)
107113
- [Parameters](#parameters-6)
108-
- [Example](#example-28)
114+
- [Example](#example-29)
109115
* [Process Api](#process-api)
110116
+ [Get Process Instances](#get-process-instances)
111117
- [Parameters](#parameters-7)
112-
- [Example](#example-29)
118+
- [Example](#example-30)
113119
* [Models Api](#models-api)
114120
+ [Get Model](#get-model)
115121
- [Parameters](#parameters-8)
116-
- [Example](#example-30)
122+
- [Example](#example-31)
117123
* [Report Api](#report-api)
118124
+ [Create default Reports](#create-default-reports)
119125
- [Parameters](#parameters-9)
120-
- [Example](#example-31)
126+
- [Example](#example-32)
121127
+ [Get Reports](#get-reports)
122128
- [Parameters](#parameters-10)
123-
- [Example](#example-32)
129+
- [Example](#example-33)
124130
+ [Report Params](#report-params)
125131
- [Parameters](#parameters-11)
126-
- [Example](#example-33)
132+
- [Example](#example-34)
127133
* [Report Process Definitions](#report-process-definitions)
128134
- [Parameters](#parameters-12)
129-
- [Example](#example-34)
135+
- [Example](#example-35)
130136
* [Tasks of process definition](#tasks-of-process-definition)
131137
- [Parameters](#parameters-13)
132-
- [Example](#example-35)
138+
- [Example](#example-36)
133139
* [Generate reports](#generate-reports)
134140
- [Parameters](#parameters-14)
135-
- [Example](#example-36)
141+
- [Example](#example-37)
136142
* [Update report details](#update-report-details)
137143
- [Parameters](#parameters-15)
138-
- [Example](#example-37)
144+
- [Example](#example-38)
139145
* [Export to csv](#export-to-csv)
140146
- [Parameters](#parameters-16)
141-
- [Example](#example-38)
147+
- [Example](#example-39)
142148
* [Save Report](#save-report)
143149
- [Parameters](#parameters-17)
144-
- [Example](#example-39)
150+
- [Example](#example-40)
145151
* [Delete report](#delete-report)
146152
- [Parameters](#parameters-18)
147-
- [Example](#example-40)
153+
- [Example](#example-41)
154+
- [Error Events](#error-events)
155+
* [Example](#example-42)
148156
- [Development](#development)
149157
- [Release History](#release-history)
150158

@@ -226,7 +234,8 @@ Property | Description | default value|
226234
------------- | ------------- | -------------|
227235
hostEcm| (Optional value The Ip or Name of the host where your Alfresco instance is running )|http://127.0.0.1:8080 |
228236
hostBpm| (Optional value The Ip or Name of the host where your Activiti instance is running )|http://127.0.0.1:9999 |
229-
oauth2| (Optional configuration object for alfresco authorization server {host:'HOST_OAUTH2_SERVER', clientId:'YOUR_CLIENT_ID', secret:'SECRET', authPath:'my-custom-auth-endpoint/token'} ||
237+
authType| (Optional value can be 'BASIC' or 'OAUTH') | 'BASIC'|
238+
oauth2| (Optional configuration for SSO) ||
230239
contextRoot| (Optional value that define the context Root of the Alfresco ECM API default value is alfresco )|alfresco |
231240
contextRootBpm| (Optional value that define the context Root of the Activiti API default value is activiti-app )|alfresco |
232241
provider| (Optional value default value is ECM. This parameter can accept as value ECM BPM or ALL to use the API and Login in the ECM, Activiti BPM or Both )|alfresco |
@@ -315,7 +324,82 @@ this.alfrescoJsApi.login('admin', 'admin').then(function (data) {
315324
```
316325
### Login with OAUTH2 Alfresco authorization server
317326

318-
If you have installed the Alfresco authorization server you can login with this option.
327+
## Implicit Flow
328+
329+
If your want to be redirect to the authorization server and login there you can use the implicit flow to login
330+
331+
#### oauth2 properties
332+
333+
Property | Description | default value|
334+
------------- | ------------- | -------------|
335+
host| Your oauth2 server URL| null |
336+
clientId| Your clientId oauth2 | null |
337+
secret| Your secret oauth2| null |
338+
scope| Your scope | null |
339+
implicitFlow| true/false | false |
340+
redirectUri| url to be redirect after login| null|
341+
redirectLogout| url to be redirect after logout optional, if is nor present the redirectUri will be used| null|
342+
refreshTokenTimeout| millisecond value, after how many millisecond youw ant refresh the token| 40000|
343+
silentLogin| direct execute the implicit login without the need od call this.alfrescoJsApi.implicitLogin() method| false|
344+
345+
346+
The alfresco-js-api will automatically redirect you to the login page anf refresh the token if necessary
347+
348+
#### Events
349+
350+
Property | Description | default value|
351+
------------- | ------------- | -------------|
352+
implicit_redirect| triggered when the user is redirect to the auth server return url parameter of the redirect | |
353+
discovery| triggered when all the openId discovery url phase is terminated returnl an object with all the discovered url | |
354+
token_issued| triggered when a new token is issued| |
355+
356+
The alfresco-js-api will automatically redirect you to the login page anf refresh the token if necessary
357+
358+
359+
### Example
360+
361+
```javascript
362+
this.alfrescoJsApi = new AlfrescoApi({
363+
oauth2: {
364+
host: 'HOST_OAUTH2_SERVER',
365+
clientId: 'YOUR_CLIENT_ID',
366+
secret: 'SECRET',
367+
scope: 'openid',
368+
implicitFlow: true,
369+
redirectUri: 'YOUR_HOME_APP_URL',
370+
silentRefreshTimeout: '600000' //Optional parameter 10 minutes default value
371+
},
372+
authType: 'OAUTH',
373+
provider: 'ALL'
374+
});
375+
376+
this.alfrescoJsApi.implicitLogin();
377+
378+
```
379+
380+
### Example skip login form
381+
382+
```javascript
383+
this.alfrescoJsApi = new AlfrescoApi({
384+
oauth2: {
385+
host: 'HOST_OAUTH2_SERVER',
386+
clientId: 'YOUR_CLIENT_ID',
387+
secret: 'SECRET',
388+
scope: 'openid',
389+
implicitFlow: true,
390+
redirectUri: 'YOUR_HOME_APP_URL',
391+
silentRefreshTimeout: '600000' //Optional parameter 10 minutes default value,
392+
silentLogin: true
393+
},
394+
authType: 'OAUTH',
395+
provider: 'ALL'
396+
});
397+
398+
```
399+
400+
401+
## Password Flow
402+
319403
If your auth endpoint is different from the standard one "/oauth/token" you can override it through the property authPath
320404

321405
### Example
@@ -327,7 +411,8 @@ this.alfrescoJsApi = new AlfrescoApi({
327411
secret: 'SECRET',
328412
authPath:'my-custom-auth-endpoint/token'
329413
},
330-
provider: 'OAUTH'
414+
authType: 'OAUTH',
415+
provider: 'ALL'
331416
});
332417

333418
this.alfrescoJsApi.login('admin', 'admin').then(function (data) {
@@ -1296,6 +1381,17 @@ var reportId = "1"; // String | reportId
12961381
this.alfrescoJsApi.activiti.reportApi.deleteReport(reportId);
12971382
```
12981383

1384+
# Error Events
1385+
1386+
The alfresco-js-api has an error handler event where you can subscribe
1387+
1388+
## Example
1389+
```javascript
1390+
this.alfrescoJsApi.on('error', (error) => {
1391+
console.log(error)
1392+
})
1393+
```
1394+
12991395
# Development
13001396

13011397
* To run the build

0 commit comments

Comments
 (0)