@ericbutera/kaleido 0.1.12 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{components/admin/AdminLayout.d.ts → admin/components/Layout.d.ts} +1 -1
- package/dist/admin/components/Route.d.ts +1 -0
- package/dist/{components → admin/components}/tasks/List.d.ts +1 -2
- package/dist/admin/components/tasks/Modal.d.ts +7 -0
- package/dist/admin/components/users/List.d.ts +7 -0
- package/dist/admin/components/users/Modal.d.ts +8 -0
- package/dist/admin/components/users/index.d.ts +2 -0
- package/dist/admin/index.d.ts +7 -0
- package/dist/admin/pages/Dashboard.d.ts +1 -0
- package/dist/admin/pages/Users.d.ts +1 -0
- package/dist/{lib/params/adminTasksParams.d.ts → admin/params/TasksParams.d.ts} +7 -8
- package/dist/admin/params/UsersParams.d.ts +18 -0
- package/dist/auth/components/ProtectedRoute.d.ts +3 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/lib/useAuth.d.ts +8 -0
- package/dist/components/index.d.ts +1 -4
- package/dist/configureKaleido.d.ts +26 -0
- package/dist/index.d.ts +11 -8
- package/dist/index.js +4056 -2684
- package/dist/kaleido.d.ts +44 -0
- package/dist/lib/apiHelpers.d.ts +15 -0
- package/dist/openapi/createKaleidoOpenApiAdapters.d.ts +44 -0
- package/dist/openapi/createKaleidoOpenApiAuthClient.d.ts +35 -0
- package/dist/openapi/index.d.ts +2 -0
- package/dist/tasks/index.d.ts +2 -0
- package/dist/tasks/useTasks.d.ts +27 -0
- package/dist/users/index.d.ts +2 -0
- package/dist/users/useUsers.d.ts +74 -0
- package/package.json +3 -1
- package/dist/components/admin/tasks/List.d.ts +0 -1
- package/dist/components/admin/tasks/Modal.d.ts +0 -1
- package/dist/components/tasks/Modal.d.ts +0 -7
- package/dist/lib/openapi/react-query/api.d.ts +0 -1
- package/dist/lib/queries.d.ts +0 -6
- package/dist/lib/tasksApi.d.ts +0 -13
- package/dist/pages/index.d.ts +0 -2
- /package/dist/{components/admin → admin/components}/adminLayoutConfig.d.ts +0 -0
- /package/dist/{pages/admin → admin/pages}/FeatureFlags.d.ts +0 -0
- /package/dist/{pages/admin → admin/pages}/Tasks.d.ts +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AuthApiClient, User } from './auth';
|
|
2
|
+
type OpenApiClientLike = {
|
|
3
|
+
useQuery: (...args: any[]) => any;
|
|
4
|
+
useMutation: (...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
type QueryClientLike = {
|
|
7
|
+
invalidateQueries: (args: {
|
|
8
|
+
queryKey: any[];
|
|
9
|
+
}) => unknown;
|
|
10
|
+
refetchQueries: (args: {
|
|
11
|
+
queryKey: any[];
|
|
12
|
+
}) => unknown;
|
|
13
|
+
clear: () => unknown;
|
|
14
|
+
};
|
|
15
|
+
export type KaleidoToggleConfig = {
|
|
16
|
+
auth?: boolean;
|
|
17
|
+
featureFlags?: boolean;
|
|
18
|
+
tasks?: boolean;
|
|
19
|
+
adminUsers?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type KaleidoRuntimeConfig = {
|
|
22
|
+
api: OpenApiClientLike;
|
|
23
|
+
useQueryClient: () => QueryClientLike;
|
|
24
|
+
toast?: {
|
|
25
|
+
success?: (message: string) => unknown;
|
|
26
|
+
};
|
|
27
|
+
mapCurrentUser?: (rawUser: any) => User | null;
|
|
28
|
+
};
|
|
29
|
+
export type KaleidoAppConfig = KaleidoRuntimeConfig & KaleidoToggleConfig;
|
|
30
|
+
declare class KaleidoApp {
|
|
31
|
+
private authClient;
|
|
32
|
+
configure(config: KaleidoAppConfig): void;
|
|
33
|
+
createAuthApiClient(): AuthApiClient;
|
|
34
|
+
useAuth(): {
|
|
35
|
+
readonly user: User | null;
|
|
36
|
+
readonly isLoading: boolean;
|
|
37
|
+
readonly signIn: (email: string, password: string) => Promise<void>;
|
|
38
|
+
readonly signUp: (email: string, password: string, name?: string) => Promise<void>;
|
|
39
|
+
readonly signOut: () => Promise<void>;
|
|
40
|
+
readonly completeOAuthLogin: (_userData?: unknown) => Promise<boolean>;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
declare const kaleido: KaleidoApp;
|
|
44
|
+
export default kaleido;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { default as createFetchClientOrig } from 'openapi-fetch';
|
|
3
|
+
export type ApiError = {
|
|
4
|
+
status: "error";
|
|
5
|
+
message?: string;
|
|
6
|
+
errors?: Record<string, string[]>;
|
|
7
|
+
};
|
|
8
|
+
export declare function handleApiError(err: any): ApiError;
|
|
9
|
+
export declare function newQueryClient(): QueryClient;
|
|
10
|
+
export declare const fetchWithCredentials: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
11
|
+
export declare function createFetchClient(opts: {
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
fetch?: typeof fetch;
|
|
14
|
+
}): import('openapi-fetch').Client<{}, `${string}/${string}`>;
|
|
15
|
+
export declare function createClient<T extends {}>(fetchClient: ReturnType<typeof createFetchClientOrig>): import('openapi-react-query').OpenapiQueryClient<T, `${string}/${string}`>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { KaleidoFeatureAdapters } from '../configureKaleido';
|
|
2
|
+
import { User } from '../users/useUsers';
|
|
3
|
+
type OpenApiClientLike = {
|
|
4
|
+
useQuery: (...args: any[]) => any;
|
|
5
|
+
useMutation: (...args: any[]) => any;
|
|
6
|
+
};
|
|
7
|
+
type QueryClientLike = {
|
|
8
|
+
invalidateQueries: (args: {
|
|
9
|
+
queryKey: any[];
|
|
10
|
+
}) => unknown;
|
|
11
|
+
};
|
|
12
|
+
export interface FeatureFlagsOpenApiMapping {
|
|
13
|
+
listPath: string;
|
|
14
|
+
adminListPath: string;
|
|
15
|
+
updatePath: string;
|
|
16
|
+
extractListData?: (responseData: any) => any[];
|
|
17
|
+
}
|
|
18
|
+
export interface TasksOpenApiMapping {
|
|
19
|
+
listPath: string;
|
|
20
|
+
detailPath: string;
|
|
21
|
+
}
|
|
22
|
+
export interface UsersOpenApiMapping {
|
|
23
|
+
listPath: string;
|
|
24
|
+
detailPath: string;
|
|
25
|
+
createPath: string;
|
|
26
|
+
updatePath: string;
|
|
27
|
+
resendForgotPasswordPath: string;
|
|
28
|
+
resendConfirmationPath: string;
|
|
29
|
+
disablePath: string;
|
|
30
|
+
extractListData?: (responseData: any) => User[];
|
|
31
|
+
extractDetailData?: (responseData: any) => User | null;
|
|
32
|
+
}
|
|
33
|
+
export interface CreateKaleidoOpenApiAdaptersOptions {
|
|
34
|
+
api: OpenApiClientLike;
|
|
35
|
+
useQueryClient: () => QueryClientLike;
|
|
36
|
+
toast?: {
|
|
37
|
+
success?: (message: string) => unknown;
|
|
38
|
+
};
|
|
39
|
+
featureFlags?: Partial<FeatureFlagsOpenApiMapping>;
|
|
40
|
+
tasks?: Partial<TasksOpenApiMapping>;
|
|
41
|
+
users?: Partial<UsersOpenApiMapping>;
|
|
42
|
+
}
|
|
43
|
+
export declare function createKaleidoOpenApiAdapters(options: CreateKaleidoOpenApiAdaptersOptions): Pick<KaleidoFeatureAdapters, "tasks" | "featureFlags" | "users">;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AuthApiClient, User } from '../auth/lib/types';
|
|
2
|
+
type OpenApiClientLike = {
|
|
3
|
+
useQuery: (...args: any[]) => any;
|
|
4
|
+
useMutation: (...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
type QueryClientLike = {
|
|
7
|
+
invalidateQueries: (args: {
|
|
8
|
+
queryKey: any[];
|
|
9
|
+
}) => unknown;
|
|
10
|
+
refetchQueries: (args: {
|
|
11
|
+
queryKey: any[];
|
|
12
|
+
}) => unknown;
|
|
13
|
+
clear: () => unknown;
|
|
14
|
+
};
|
|
15
|
+
export interface AuthOpenApiMapping {
|
|
16
|
+
currentPath: string;
|
|
17
|
+
loginPath: string;
|
|
18
|
+
registerPath: string;
|
|
19
|
+
forgotPath: string;
|
|
20
|
+
resetPath: string;
|
|
21
|
+
verifyPath: string;
|
|
22
|
+
resendConfirmationPath: string;
|
|
23
|
+
logoutPath: string;
|
|
24
|
+
refreshPath: string;
|
|
25
|
+
}
|
|
26
|
+
export interface CreateKaleidoOpenApiAuthClientOptions {
|
|
27
|
+
api: OpenApiClientLike;
|
|
28
|
+
useQueryClient: () => QueryClientLike;
|
|
29
|
+
paths?: Partial<AuthOpenApiMapping>;
|
|
30
|
+
currentUserQueryKey?: any[];
|
|
31
|
+
sellerMeQueryKey?: any[];
|
|
32
|
+
mapCurrentUser?: (rawUser: any) => User | null;
|
|
33
|
+
}
|
|
34
|
+
export declare function createKaleidoOpenApiAuthClient(options: CreateKaleidoOpenApiAuthClientOptions): AuthApiClient;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { createKaleidoOpenApiAdapters, type CreateKaleidoOpenApiAdaptersOptions, type FeatureFlagsOpenApiMapping, type TasksOpenApiMapping, } from './createKaleidoOpenApiAdapters';
|
|
2
|
+
export { createKaleidoOpenApiAuthClient, type AuthOpenApiMapping, type CreateKaleidoOpenApiAuthClientOptions, } from './createKaleidoOpenApiAuthClient';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PaginatedQueryResult } from '../lib/paginatedQuery';
|
|
2
|
+
export interface Task {
|
|
3
|
+
id: string | number;
|
|
4
|
+
task_type?: string;
|
|
5
|
+
status?: "pending" | "running" | "completed" | "failed" | string;
|
|
6
|
+
attempts?: number;
|
|
7
|
+
max_attempts?: number;
|
|
8
|
+
error?: string | null;
|
|
9
|
+
created_at?: string;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
export interface UseTasksResult extends PaginatedQueryResult<Task> {
|
|
13
|
+
refetch?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export interface TasksConfig {
|
|
16
|
+
useTasks: (params?: any) => UseTasksResult;
|
|
17
|
+
useTask?: (id: string | null) => {
|
|
18
|
+
data: Task | null;
|
|
19
|
+
isLoading: boolean;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare function configureTasks(cfg: TasksConfig): void;
|
|
23
|
+
export declare function useTasks(params?: any): UseTasksResult;
|
|
24
|
+
export declare function useTask(id: string | null): {
|
|
25
|
+
data: Task | null;
|
|
26
|
+
isLoading: boolean;
|
|
27
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { configureUsers, useCreateUser, useDisableUserAccount, useResendConfirmationEmail, useResendForgotPassword, useUpdateUser, useUser, useUsers, } from './useUsers';
|
|
2
|
+
export type { CreateUserInput, DisableUserInput, UpdateUserInput, User, UserActionInput, UserFormData, UsersConfig, UsersMutation, UseUsersResult, } from './useUsers';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { PaginatedQueryResult } from '../lib/paginatedQuery';
|
|
2
|
+
export interface User {
|
|
3
|
+
id: string | number;
|
|
4
|
+
email?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
is_admin?: boolean;
|
|
7
|
+
verified?: boolean;
|
|
8
|
+
email_verified_at?: string | null;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
is_disabled?: boolean;
|
|
11
|
+
active?: boolean;
|
|
12
|
+
created_at?: string;
|
|
13
|
+
updated_at?: string;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export interface UseUsersResult extends PaginatedQueryResult<User> {
|
|
17
|
+
refetch?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export type UsersMutation<TInput = any, TResult = any> = {
|
|
20
|
+
mutateAsync: (input: TInput) => Promise<TResult>;
|
|
21
|
+
isPending: boolean;
|
|
22
|
+
};
|
|
23
|
+
export interface CreateUserInput {
|
|
24
|
+
email: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
password?: string;
|
|
27
|
+
is_admin?: boolean;
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
export type UserFormData = Omit<CreateUserInput, "is_admin"> & {
|
|
31
|
+
is_admin: boolean;
|
|
32
|
+
};
|
|
33
|
+
export interface UpdateUserInput {
|
|
34
|
+
email?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
is_admin?: boolean;
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
}
|
|
39
|
+
export interface UserActionInput {
|
|
40
|
+
id: string;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
43
|
+
export interface DisableUserInput extends UserActionInput {
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface UsersConfig {
|
|
47
|
+
useUsers: (params?: any) => UseUsersResult;
|
|
48
|
+
useUser?: (id: string | null) => {
|
|
49
|
+
data: User | null;
|
|
50
|
+
isLoading: boolean;
|
|
51
|
+
};
|
|
52
|
+
useCreateUser: () => UsersMutation<CreateUserInput, any>;
|
|
53
|
+
useUpdateUser: () => UsersMutation<{
|
|
54
|
+
id: string;
|
|
55
|
+
data: UpdateUserInput;
|
|
56
|
+
}, any>;
|
|
57
|
+
useResendForgotPassword: () => UsersMutation<UserActionInput, any>;
|
|
58
|
+
useResendConfirmationEmail: () => UsersMutation<UserActionInput, any>;
|
|
59
|
+
useDisableUserAccount: () => UsersMutation<DisableUserInput, any>;
|
|
60
|
+
}
|
|
61
|
+
export declare function configureUsers(cfg: UsersConfig): void;
|
|
62
|
+
export declare function useUsers(params?: any): UseUsersResult;
|
|
63
|
+
export declare function useUser(id: string | null): {
|
|
64
|
+
data: User | null;
|
|
65
|
+
isLoading: boolean;
|
|
66
|
+
};
|
|
67
|
+
export declare function useCreateUser(): UsersMutation<CreateUserInput, any>;
|
|
68
|
+
export declare function useUpdateUser(): UsersMutation<{
|
|
69
|
+
id: string;
|
|
70
|
+
data: UpdateUserInput;
|
|
71
|
+
}, any>;
|
|
72
|
+
export declare function useResendForgotPassword(): UsersMutation<UserActionInput, any>;
|
|
73
|
+
export declare function useResendConfirmationEmail(): UsersMutation<UserActionInput, any>;
|
|
74
|
+
export declare function useDisableUserAccount(): UsersMutation<DisableUserInput, any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ericbutera/kaleido",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared UI components and framework utilities for Kaleido",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@fortawesome/free-brands-svg-icons": "^7.2.0",
|
|
31
|
+
"openapi-fetch": "^0.17.0",
|
|
32
|
+
"openapi-react-query": "^0.5.4",
|
|
31
33
|
"@types/lodash-es": "^4.17.12",
|
|
32
34
|
"lodash-es": "^4.17.23",
|
|
33
35
|
"qrcode.react": "^4.2.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '../../tasks/List';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '../../tasks/Modal';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { components } from '../../lib/openapi/react-query/api';
|
|
2
|
-
interface ModalProps {
|
|
3
|
-
selectedTask: components["schemas"]["AdminTaskResponse"] | null;
|
|
4
|
-
setSelectedTask: (task: components["schemas"]["AdminTaskResponse"] | null) => void;
|
|
5
|
-
}
|
|
6
|
-
export default function Modal({ selectedTask, setSelectedTask }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type components = Record<string, any>;
|
package/dist/lib/queries.d.ts
DELETED
package/dist/lib/tasksApi.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PaginatedQueryResult } from './paginatedQuery';
|
|
2
|
-
export interface Task {
|
|
3
|
-
id: string | number;
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
}
|
|
6
|
-
export interface TasksApiClient {
|
|
7
|
-
useList: (params: any) => PaginatedQueryResult<Task>;
|
|
8
|
-
useGet: (id: string | null) => {
|
|
9
|
-
data: Task | null;
|
|
10
|
-
isLoading: boolean;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export declare function useTasksApi(): TasksApiClient;
|
package/dist/pages/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|