Skip to content

Commit 84ce6ba

Browse files
authored
feat(types): Add tailor.idp namespace type definitions (#128)
1 parent 303d467 commit 84ce6ba

2 files changed

Lines changed: 131 additions & 0 deletions

File tree

.changeset/add-idp-types.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@tailor-platform/function-types": patch
3+
---
4+
5+
feat: Add tailor.idp namespace type definitions

packages/types/tailor.d.ts

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,132 @@ interface TailorDBFileAPI {
277277
): Promise<FileStreamIterator>;
278278
}
279279

280+
declare namespace tailor.idp {
281+
/**
282+
* Configuration for creating an IDP Client
283+
*/
284+
interface ClientConfig {
285+
namespace: string;
286+
}
287+
288+
/**
289+
* User object returned from IDP operations
290+
*/
291+
interface User {
292+
id: string;
293+
name: string;
294+
disabled: boolean;
295+
createdAt?: string;
296+
updatedAt?: string;
297+
}
298+
299+
/**
300+
* Query options for filtering users
301+
*/
302+
interface UserQuery {
303+
/** Filter by user IDs */
304+
ids?: string[];
305+
/** Filter by user names */
306+
names?: string[];
307+
}
308+
309+
/**
310+
* Options for listing users
311+
*/
312+
interface ListUsersOptions {
313+
/** Maximum number of users to return */
314+
first?: number;
315+
/** Page token for pagination */
316+
after?: string;
317+
/** Query filter for users */
318+
query?: UserQuery;
319+
}
320+
321+
/**
322+
* Response from listing users
323+
*/
324+
interface ListUsersResponse {
325+
users: User[];
326+
nextPageToken: string | null;
327+
totalCount: number;
328+
}
329+
330+
/**
331+
* Input for creating a new user
332+
*/
333+
interface CreateUserInput {
334+
/** The user's name (typically email) */
335+
name: string;
336+
/** The user's password */
337+
password: string;
338+
/** Whether the user is disabled */
339+
disabled?: boolean;
340+
}
341+
342+
/**
343+
* Input for updating an existing user
344+
*/
345+
interface UpdateUserInput {
346+
/** The user's ID */
347+
id: string;
348+
/** New name for the user */
349+
name?: string;
350+
/** New password for the user */
351+
password?: string;
352+
/** New disabled status for the user */
353+
disabled?: boolean;
354+
}
355+
356+
/**
357+
* Input for sending a password reset email
358+
*/
359+
interface SendPasswordResetEmailInput {
360+
/** The ID of the user */
361+
userId: string;
362+
/** The URI to redirect to after password reset */
363+
redirectUri: string;
364+
}
365+
366+
/**
367+
* IDP Client for user management operations
368+
*/
369+
class Client {
370+
constructor(config: ClientConfig);
371+
372+
/**
373+
* List users in the namespace with optional filtering and pagination.
374+
*/
375+
users(options?: ListUsersOptions): Promise<ListUsersResponse>;
376+
377+
/**
378+
* Get a user by ID.
379+
*/
380+
user(userId: string): Promise<User>;
381+
382+
/**
383+
* Create a new user.
384+
*/
385+
createUser(input: CreateUserInput): Promise<User>;
386+
387+
/**
388+
* Update an existing user.
389+
*/
390+
updateUser(input: UpdateUserInput): Promise<User>;
391+
392+
/**
393+
* Delete a user by ID.
394+
* @returns True if successful
395+
*/
396+
deleteUser(userId: string): Promise<boolean>;
397+
398+
/**
399+
* Send a password reset email to a user.
400+
* @returns True if successful
401+
*/
402+
sendPasswordResetEmail(input: SendPasswordResetEmailInput): Promise<boolean>;
403+
}
404+
}
405+
280406
declare namespace tailor.workflow {
281407
/**
282408
* Specifies the machine user that should be used to execute the workflow.

0 commit comments

Comments
 (0)