contensis-management-api
Advanced tools
Comparing version 1.0.0-beta.15 to 1.0.0-beta.16
@@ -305,3 +305,3 @@ import * as Contensis from '../index'; | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(defaultUsers[1].userName); | ||
}); | ||
@@ -318,3 +318,3 @@ it('by group name', async () => { | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(defaultUsers[1].userName); | ||
}); | ||
@@ -321,0 +321,0 @@ }); |
@@ -0,15 +1,20 @@ | ||
export interface CredentialsProvider { | ||
type: string; | ||
name: string; | ||
} | ||
export interface UserCredentials { | ||
password: string; | ||
provider: CredentialsProvider; | ||
} | ||
export interface UserStatus { | ||
active: boolean; | ||
suspended: boolean; | ||
locked: boolean; | ||
passwordExpired: boolean; | ||
passwordResetRequired: boolean; | ||
} | ||
export interface User { | ||
id: string; | ||
username: string; | ||
userName: string; | ||
email: string; | ||
firstname: string; | ||
lastname: string; | ||
firstName: string; | ||
lastName: string; | ||
avatarUrl: string; | ||
@@ -16,0 +21,0 @@ timezone: string; |
const defaultRootUrl = 'http://my-website.com/'; | ||
export const defaultUsers = [{ | ||
id: 'IIIIII1', | ||
username: 'UUUUUU1', | ||
userName: 'UUUUUU1', | ||
email: 'EEEEEE1@test.com' | ||
@@ -9,3 +9,3 @@ }, | ||
id: 'IIIIII2', | ||
username: 'UUUUUU2', | ||
userName: 'UUUUUU2', | ||
email: 'EEEEEE2@test.com' | ||
@@ -48,3 +48,3 @@ }]; | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json' | ||
'Content-Type': method === 'PATCH' ? 'application/merge-patch+json; charset=utf-8' : 'application/json' | ||
} | ||
@@ -51,0 +51,0 @@ }); |
@@ -88,4 +88,4 @@ import { UrlBuilder } from 'contensis-core-api'; | ||
return this.httpClient.request(url, { | ||
headers: this.contensisClient.getHeaders(), | ||
method: 'PUT', | ||
headers: this.contensisClient.getHeaders('application/merge-patch+json; charset=utf-8'), | ||
method: 'PATCH', | ||
body: JSON.stringify(user) | ||
@@ -92,0 +92,0 @@ }); |
@@ -42,11 +42,11 @@ import * as Contensis from '../index'; | ||
let client = Zengenti.Contensis.Client.create(getDefaultConfig()); | ||
let user = await client.users.getByUsername(defaultUsers[0].username); | ||
let user = await client.users.getByUsername(defaultUsers[0].userName); | ||
expect(global.fetch).toHaveBeenCalledTimes(2); | ||
expect(global.fetch.calls.first().args[0]).toEqual(getDefaultAuthenticateUrl()); | ||
expect(global.fetch.calls.mostRecent().args).toEqual([ | ||
`http://my-website.com/api/management/security/users/${defaultUsers[0].username}`, | ||
`http://my-website.com/api/management/security/users/${defaultUsers[0].userName}`, | ||
getDefaultRequest() | ||
]); | ||
expect(user).not.toBeNull(); | ||
expect(user.username).toEqual(defaultUsers[0].username); | ||
expect(user.userName).toEqual(defaultUsers[0].userName); | ||
}); | ||
@@ -89,3 +89,3 @@ it('by email', async () => { | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(defaultUsers[1].userName); | ||
}); | ||
@@ -106,3 +106,3 @@ it('with specific options', async () => { | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(defaultUsers[1].userName); | ||
}); | ||
@@ -122,3 +122,3 @@ it('with specific options and no query', async () => { | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(defaultUsers[1].userName); | ||
}); | ||
@@ -162,3 +162,3 @@ }); | ||
`http://my-website.com/api/management/security/users/${defaultUsers[0].id}`, | ||
getDefaultRequest('PUT', null, JSON.stringify(defaultUsers[0])) | ||
getDefaultRequest('PATCH', null, JSON.stringify(defaultUsers[0])) | ||
]); | ||
@@ -165,0 +165,0 @@ expect(user).not.toBeNull(); |
@@ -7,2 +7,6 @@ # Changelog | ||
## [1.0.0-beta.16] - 2020-07-13 | ||
### Changed | ||
- users api: use PATCH instead of PUT for *update()* , updated *User* property names | ||
## [1.0.0-beta.15] - 2020-07-08 | ||
@@ -9,0 +13,0 @@ ### Added |
@@ -307,3 +307,3 @@ "use strict"; | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(specs_utils_spec_1.defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(specs_utils_spec_1.defaultUsers[1].userName); | ||
}); | ||
@@ -320,3 +320,3 @@ it('by group name', async () => { | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(specs_utils_spec_1.defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(specs_utils_spec_1.defaultUsers[1].userName); | ||
}); | ||
@@ -323,0 +323,0 @@ }); |
@@ -0,15 +1,20 @@ | ||
export interface CredentialsProvider { | ||
type: string; | ||
name: string; | ||
} | ||
export interface UserCredentials { | ||
password: string; | ||
provider: CredentialsProvider; | ||
} | ||
export interface UserStatus { | ||
active: boolean; | ||
suspended: boolean; | ||
locked: boolean; | ||
passwordExpired: boolean; | ||
passwordResetRequired: boolean; | ||
} | ||
export interface User { | ||
id: string; | ||
username: string; | ||
userName: string; | ||
email: string; | ||
firstname: string; | ||
lastname: string; | ||
firstName: string; | ||
lastName: string; | ||
avatarUrl: string; | ||
@@ -16,0 +21,0 @@ timezone: string; |
@@ -6,3 +6,3 @@ "use strict"; | ||
id: 'IIIIII1', | ||
username: 'UUUUUU1', | ||
userName: 'UUUUUU1', | ||
email: 'EEEEEE1@test.com' | ||
@@ -12,3 +12,3 @@ }, | ||
id: 'IIIIII2', | ||
username: 'UUUUUU2', | ||
userName: 'UUUUUU2', | ||
email: 'EEEEEE2@test.com' | ||
@@ -53,3 +53,3 @@ }]; | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json' | ||
'Content-Type': method === 'PATCH' ? 'application/merge-patch+json; charset=utf-8' : 'application/json' | ||
} | ||
@@ -56,0 +56,0 @@ }); |
@@ -90,4 +90,4 @@ "use strict"; | ||
return this.httpClient.request(url, { | ||
headers: this.contensisClient.getHeaders(), | ||
method: 'PUT', | ||
headers: this.contensisClient.getHeaders('application/merge-patch+json; charset=utf-8'), | ||
method: 'PATCH', | ||
body: JSON.stringify(user) | ||
@@ -94,0 +94,0 @@ }); |
@@ -45,11 +45,11 @@ "use strict"; | ||
let client = Zengenti.Contensis.Client.create(specs_utils_spec_1.getDefaultConfig()); | ||
let user = await client.users.getByUsername(specs_utils_spec_1.defaultUsers[0].username); | ||
let user = await client.users.getByUsername(specs_utils_spec_1.defaultUsers[0].userName); | ||
expect(global.fetch).toHaveBeenCalledTimes(2); | ||
expect(global.fetch.calls.first().args[0]).toEqual(specs_utils_spec_1.getDefaultAuthenticateUrl()); | ||
expect(global.fetch.calls.mostRecent().args).toEqual([ | ||
`http://my-website.com/api/management/security/users/${specs_utils_spec_1.defaultUsers[0].username}`, | ||
`http://my-website.com/api/management/security/users/${specs_utils_spec_1.defaultUsers[0].userName}`, | ||
specs_utils_spec_1.getDefaultRequest() | ||
]); | ||
expect(user).not.toBeNull(); | ||
expect(user.username).toEqual(specs_utils_spec_1.defaultUsers[0].username); | ||
expect(user.userName).toEqual(specs_utils_spec_1.defaultUsers[0].userName); | ||
}); | ||
@@ -92,3 +92,3 @@ it('by email', async () => { | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(specs_utils_spec_1.defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(specs_utils_spec_1.defaultUsers[1].userName); | ||
}); | ||
@@ -109,3 +109,3 @@ it('with specific options', async () => { | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(specs_utils_spec_1.defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(specs_utils_spec_1.defaultUsers[1].userName); | ||
}); | ||
@@ -125,3 +125,3 @@ it('with specific options and no query', async () => { | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(specs_utils_spec_1.defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(specs_utils_spec_1.defaultUsers[1].userName); | ||
}); | ||
@@ -165,3 +165,3 @@ }); | ||
`http://my-website.com/api/management/security/users/${specs_utils_spec_1.defaultUsers[0].id}`, | ||
specs_utils_spec_1.getDefaultRequest('PUT', null, JSON.stringify(specs_utils_spec_1.defaultUsers[0])) | ||
specs_utils_spec_1.getDefaultRequest('PATCH', null, JSON.stringify(specs_utils_spec_1.defaultUsers[0])) | ||
]); | ||
@@ -168,0 +168,0 @@ expect(user).not.toBeNull(); |
{ | ||
"name": "contensis-management-api", | ||
"version": "1.0.0-beta.15", | ||
"version": "1.0.0-beta.16", | ||
"description": "Contensis Javascript Management API", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -424,3 +424,3 @@ import * as Contensis from '../index'; | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(defaultUsers[1].userName); | ||
}); | ||
@@ -441,3 +441,3 @@ | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(defaultUsers[1].userName); | ||
}); | ||
@@ -444,0 +444,0 @@ }); |
@@ -0,10 +1,16 @@ | ||
export interface CredentialsProvider { | ||
type: string; | ||
name: string; | ||
} | ||
export interface UserCredentials { | ||
password: string; | ||
provider: CredentialsProvider; | ||
} | ||
export interface UserStatus { | ||
active: boolean; | ||
// deactivationReason: string; | ||
suspended: boolean; | ||
locked: boolean; | ||
passwordExpired: boolean; | ||
passwordResetRequired: boolean; | ||
// suspensionReason: string; | ||
} | ||
@@ -14,6 +20,6 @@ | ||
id: string; | ||
username: string; | ||
userName: string; | ||
email: string; | ||
firstname: string; | ||
lastname: string; | ||
firstName: string; | ||
lastName: string; | ||
avatarUrl: string; | ||
@@ -20,0 +26,0 @@ timezone: string; |
@@ -7,3 +7,3 @@ import { Config, User, Group } from './models'; | ||
id: 'IIIIII1', | ||
username: 'UUUUUU1', | ||
userName: 'UUUUUU1', | ||
email: 'EEEEEE1@test.com' | ||
@@ -13,3 +13,3 @@ }, | ||
id: 'IIIIII2', | ||
username: 'UUUUUU2', | ||
userName: 'UUUUUU2', | ||
email: 'EEEEEE2@test.com' | ||
@@ -56,3 +56,3 @@ }] as Partial<User>[]; | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json' | ||
'Content-Type': method === 'PATCH' ? 'application/merge-patch+json; charset=utf-8' : 'application/json' | ||
} | ||
@@ -59,0 +59,0 @@ }); |
@@ -62,3 +62,3 @@ import * as Contensis from '../index'; | ||
let user = await client.users.getByUsername(defaultUsers[0].username); | ||
let user = await client.users.getByUsername(defaultUsers[0].userName); | ||
@@ -70,3 +70,3 @@ expect(global.fetch).toHaveBeenCalledTimes(2); | ||
expect((global.fetch as any).calls.mostRecent().args).toEqual([ | ||
`http://my-website.com/api/management/security/users/${defaultUsers[0].username}`, | ||
`http://my-website.com/api/management/security/users/${defaultUsers[0].userName}`, | ||
getDefaultRequest() | ||
@@ -76,3 +76,3 @@ ]); | ||
expect(user).not.toBeNull(); | ||
expect(user.username).toEqual(defaultUsers[0].username); | ||
expect(user.userName).toEqual(defaultUsers[0].userName); | ||
}); | ||
@@ -127,3 +127,3 @@ | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(defaultUsers[1].userName); | ||
}); | ||
@@ -148,3 +148,3 @@ | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(defaultUsers[1].userName); | ||
}); | ||
@@ -168,3 +168,3 @@ | ||
expect(users.items.length).toEqual(2); | ||
expect(users.items[1].username).toEqual(defaultUsers[1].username); | ||
expect(users.items[1].userName).toEqual(defaultUsers[1].userName); | ||
}); | ||
@@ -224,3 +224,3 @@ }); | ||
`http://my-website.com/api/management/security/users/${defaultUsers[0].id}`, | ||
getDefaultRequest('PUT', null, JSON.stringify(defaultUsers[0])) | ||
getDefaultRequest('PATCH', null, JSON.stringify(defaultUsers[0])) | ||
]); | ||
@@ -227,0 +227,0 @@ |
@@ -111,4 +111,4 @@ import { ContensisClient, IUserOperations, User, UserListOptions, Group, UserGroupsOptions, UserUpdatePasswordOptions } from '../models'; | ||
return this.httpClient.request<User>(url, { | ||
headers: this.contensisClient.getHeaders(), | ||
method: 'PUT', | ||
headers: this.contensisClient.getHeaders('application/merge-patch+json; charset=utf-8'), | ||
method: 'PATCH', | ||
body: JSON.stringify(user) | ||
@@ -115,0 +115,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
513564
11490