Use scim-patch package

This commit is contained in:
adrinr 2023-03-14 10:15:44 +01:00
parent 3500aabc8a
commit 40a1921f02
4 changed files with 28 additions and 18 deletions

View File

@ -29,5 +29,8 @@
"koa-body": "4.2.0", "koa-body": "4.2.0",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"typescript": "4.7.3" "typescript": "4.7.3"
},
"dependencies": {
"scim-patch": "^0.7.0"
} }
} }

View File

@ -1,11 +1,11 @@
export interface ScimUserResponse { import { ScimResource, ScimMeta, ScimPatchOperation } from "scim-patch"
export interface ScimUserResponse extends ScimResource {
schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"] schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"]
id: string id: string
externalId: string externalId: string
meta: { meta: ScimMeta & {
resourceType: "User" resourceType: "User"
created: string
lastModified: string
} }
userName: string userName: string
name: { name: {
@ -51,13 +51,7 @@ export interface ScimCreateUserRequest {
export interface ScimUpdateRequest { export interface ScimUpdateRequest {
schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"] schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
Operations: [ Operations: ScimPatchOperation[]
{
op: "add" | "replace" | "remove"
path: string
value: string
}
]
} }
interface ScimListResponse<T> { interface ScimListResponse<T> {

View File

@ -487,6 +487,11 @@ escalade@^3.1.1:
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==
fast-deep-equal@3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
follow-redirects@^1.15.0: follow-redirects@^1.15.0:
version "1.15.2" version "1.15.2"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
@ -743,6 +748,19 @@ rxjs@^7.0.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
scim-patch@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/scim-patch/-/scim-patch-0.7.0.tgz#3f6d94256c07be415a74a49c0ff48dc91e4e0219"
integrity sha512-wXKcsZl+aLfE0yId7MjiOd91v8as6dEYLFvm1gGu3yJxSPhl1Fl3vWiNN4V3D68UKpqO/umK5rwWc8wGpBaOHw==
dependencies:
fast-deep-equal "3.1.3"
scim2-parse-filter "0.2.8"
scim2-parse-filter@0.2.8:
version "0.2.8"
resolved "https://registry.yarnpkg.com/scim2-parse-filter/-/scim2-parse-filter-0.2.8.tgz#12e836514b9a55ae51218dd6e7fbea91daccfa4d"
integrity sha512-1V+6FIMIiP+gDiFkC3dIw86KfoXhnQRXhfPaiQImeeFukpLtEkTtYq/Vmy1yDgHQcIHQxQQqOWyGLKX0FTvvaA==
setprototypeof@1.2.0: setprototypeof@1.2.0:
version "1.2.0" version "1.2.0"
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424"

View File

@ -271,13 +271,8 @@ describe("/api/global/scim/v2/users", () => {
const expectedScimUser = { ...user } const expectedScimUser = { ...user }
expect(response).toEqual(expectedScimUser) expect(response).toEqual(expectedScimUser)
const persistedUsers = await config.api.scimUsersAPI.get() const persistedUser = await config.api.scimUsersAPI.find(user.id)
expect(persistedUsers).toEqual( expect(persistedUser).toEqual(expectedScimUser)
expect.objectContaining({
totalResults: 1,
Resources: [expectedScimUser],
})
)
}) })
}) })
}) })