Compare commits

..

4 Commits

7 changed files with 3852 additions and 2770 deletions

24
changelog.md Normal file
View File

@ -0,0 +1,24 @@
# Changelog
## 2024-08-27 - 1.1.0 - feat(core)
Add delete user functionality and necessary tests
- Implemented delete method in ZitadelUser class.
- Extended tests to cover user deletion functionality.
- Refactored createUser method to return a ZitadelUser instance.
## 2024-08-26 - 1.0.9 - fix(dependencies)
Update dependencies to latest versions
- Updated @git.zone/tsbuild from ^2.1.25 to ^2.1.84
- Updated @git.zone/tsrun from ^1.2.46 to ^1.2.49
- Updated @push.rocks/tapbundle from ^5.0.15 to ^5.0.24
- Updated @types/node from ^20.8.7 to ^22.5.0
- Updated @tsclass/tsclass from ^4.0.54 to ^4.1.2
- Updated @zitadel/node from ^2.0.8 to 2.0.17
## 2024-05-02 to 2024-05-03 - 1.0.1 to 1.0.8 - Fixes and Updates
General updates and fixes to the core functionality across multiple versions.
- Various fixes in core functionality
- Incremental improvements and updates

View File

@ -1,6 +1,6 @@
{ {
"name": "@apiclient.xyz/zitadel", "name": "@apiclient.xyz/zitadel",
"version": "1.0.8", "version": "1.1.0",
"private": false, "private": false,
"description": "An unofficial client for interacting with Zitadel API, enabling user and project management functionalities.", "description": "An unofficial client for interacting with Zitadel API, enabling user and project management functionalities.",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@ -14,17 +14,17 @@
"buildDocs": "(tsdoc)" "buildDocs": "(tsdoc)"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^2.1.25", "@git.zone/tsbuild": "^2.1.84",
"@git.zone/tsbundle": "^2.0.5", "@git.zone/tsbundle": "^2.0.5",
"@git.zone/tsrun": "^1.2.46", "@git.zone/tsrun": "^1.2.49",
"@git.zone/tstest": "^1.0.44", "@git.zone/tstest": "^1.0.44",
"@push.rocks/qenv": "^6.0.5", "@push.rocks/qenv": "^6.0.5",
"@push.rocks/tapbundle": "^5.0.15", "@push.rocks/tapbundle": "^5.0.24",
"@types/node": "^20.8.7" "@types/node": "^22.5.0"
}, },
"dependencies": { "dependencies": {
"@tsclass/tsclass": "^4.0.54", "@tsclass/tsclass": "^4.1.2",
"@zitadel/node": "^2.0.8" "@zitadel/node": "2.0.17"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

6548
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -24,15 +24,24 @@ tap.test('should list users', async () => {
const users = await testZitadel.listUsers(); const users = await testZitadel.listUsers();
expect(users).toBeArray(); expect(users).toBeArray();
expect(users[0]).toBeInstanceOf(zitadel.ZitaldelUser); expect(users[0]).toBeInstanceOf(zitadel.ZitaldelUser);
console.log(users); console.log(JSON.stringify(users, null, 2));
}) })
tap.test('should invite user', async () => { const createUserTest = tap.test('should invite user', async (toolsArg) => {
await testZitadel.createUser({ const user = await testZitadel.createUser({
email: await testQenv.getEnvVarOnDemand('ZITADEL_TEST_EMAIL'), email: await testQenv.getEnvVarOnDemand('ZITADEL_TEST_EMAIL'),
firstName: 'firstname', firstName: 'firstname',
lastName: 'lastname', lastName: 'lastname',
}) })
await toolsArg.delayFor(5000);
return user;
})
tap.test('should delete user', async () => {
const createdUser: zitadel.ZitaldelUser = (await createUserTest.testResultPromise) as any;
expect(createdUser).toBeInstanceOf(zitadel.ZitaldelUser);
await createdUser.delete();
}) })
export default tap.start() export default tap.start()

View File

@ -1,8 +1,8 @@
/** /**
* autocreated commitinfo by @pushrocks/commitinfo * autocreated commitinfo by @push.rocks/commitinfo
*/ */
export const commitinfo = { export const commitinfo = {
name: '@apiclient.xyz/zitadel', name: '@apiclient.xyz/zitadel',
version: '1.0.8', version: '1.1.0',
description: 'An unofficial client for interacting with Zitadel API, enabling user and project management functionalities.' description: 'An unofficial client for interacting with Zitadel API, enabling user and project management functionalities.'
} }

View File

@ -79,6 +79,12 @@ export class ZitaldelClient {
familyName: optionsArg.lastName, familyName: optionsArg.lastName,
} }
}); });
console.log(response); // const allUsers = await this.listUsers();
// console.log(JSON.stringify(allUsers, null, 2));
return new ZitaldelUser(this, {
id: response.userId,
lastLogin: null,
username: optionsArg.email,
});
} }
} }

View File

@ -64,4 +64,13 @@ export class ZitaldelUser {
userId: this.data.id, userId: this.data.id,
}); });
} }
/**
* deletes the user
*/
public async delete() {
const response = await this.zitadelclientRef.userClient.deleteUser({
userId: this.data.id,
});
}
} }