Skip to content

Commit

Permalink
fix(server): export more types
Browse files Browse the repository at this point in the history
  • Loading branch information
jrea committed Oct 17, 2024
1 parent 6c6c4d0 commit 07f0a73
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 40 deletions.
3 changes: 3 additions & 0 deletions packages/server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export * from './types';
export * from './users/types';
export * from './tenants/types';

import create from './Server';

export { default as Nile } from './Server';
Expand Down
5 changes: 1 addition & 4 deletions packages/server/src/tenants/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Config } from '../utils/Config';
import Requester, { NileRequest } from '../utils/Requester';

export interface Tenant {
id: string;
name?: string;
}
import { Tenant } from './types';

export default class Tenants extends Config {
headers?: Headers;
Expand Down
4 changes: 4 additions & 0 deletions packages/server/src/tenants/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface Tenant {
id: string;
name?: string;
}
37 changes: 1 addition & 36 deletions packages/server/src/users/index.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,7 @@
import { Config } from '../utils/Config';
import Requester, { NileRequest } from '../utils/Requester';

export interface CreateBasicUserRequest {
email: string;
password: string;
preferredName?: string;
newTenant?: string;
}
export const LoginUserResponseTokenTypeEnum = {
AccessToken: 'ACCESS_TOKEN',
RefreshToken: 'REFRESH_TOKEN',
IdToken: 'ID_TOKEN',
} as const;
export type LoginUserResponseTokenTypeEnum =
(typeof LoginUserResponseTokenTypeEnum)[keyof typeof LoginUserResponseTokenTypeEnum];

export interface LoginUserResponseToken {
jwt: string;
maxAge: number;
type: LoginUserResponseTokenTypeEnum;
}
export interface LoginUserResponse {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
id: string;
token: LoginUserResponseToken;
}
export interface User {
id: string;
email: string;
name: string | null;
familyName: string | null;
givenName: string | null;
picture: string | null;
created: string;
updated: string;
tenants: { id: string }[];
}
import { CreateBasicUserRequest, User } from './types';

export default class Users extends Config {
headers?: Headers;
Expand Down
36 changes: 36 additions & 0 deletions packages/server/src/users/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
export interface CreateBasicUserRequest {
email: string;
password: string;
preferredName?: string;
newTenant?: string;
}
export const LoginUserResponseTokenTypeEnum = {
AccessToken: 'ACCESS_TOKEN',
RefreshToken: 'REFRESH_TOKEN',
IdToken: 'ID_TOKEN',
} as const;
export type LoginUserResponseTokenTypeEnum =
(typeof LoginUserResponseTokenTypeEnum)[keyof typeof LoginUserResponseTokenTypeEnum];

export interface LoginUserResponseToken {
jwt: string;
maxAge: number;
type: LoginUserResponseTokenTypeEnum;
}
export interface LoginUserResponse {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
id: string;
token: LoginUserResponseToken;
}
export interface User {
id: string;
email: string;
name: string | null;
familyName: string | null;
givenName: string | null;
picture: string | null;
created: string;
updated: string;
tenants: { id: string }[];
}

0 comments on commit 07f0a73

Please sign in to comment.