apache-airflow-providers-edge3 1.1.3rc1__py3-none-any.whl → 1.2.0rc1__py3-none-any.whl
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.
- airflow/providers/edge3/__init__.py +1 -1
- airflow/providers/edge3/cli/worker.py +6 -2
- airflow/providers/edge3/example_dags/integration_test.py +6 -2
- airflow/providers/edge3/example_dags/win_test.py +6 -1
- airflow/providers/edge3/openapi/v2-edge-generated.yaml +1138 -0
- airflow/providers/edge3/plugins/edge_executor_plugin.py +43 -3
- airflow/providers/edge3/plugins/www/.gitignore +27 -0
- airflow/providers/edge3/plugins/www/.prettierignore +6 -0
- airflow/providers/edge3/plugins/www/.prettierrc +13 -0
- airflow/providers/edge3/plugins/www/README.md +141 -0
- airflow/providers/edge3/plugins/www/dist/main.d.ts +1 -0
- airflow/providers/edge3/plugins/www/dist/main.umd.cjs +124 -0
- airflow/providers/edge3/plugins/www/eslint.config.js +54 -0
- airflow/providers/edge3/plugins/www/index.html +13 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/common.ts +33 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/ensureQueryData.ts +16 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/index.ts +4 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/infiniteQueries.ts +2 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/prefetch.ts +16 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/queries.ts +87 -0
- airflow/providers/edge3/plugins/www/openapi-gen/queries/suspense.ts +16 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/ApiError.ts +21 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/ApiRequestOptions.ts +21 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/ApiResult.ts +7 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/CancelablePromise.ts +126 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/OpenAPI.ts +57 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/core/request.ts +347 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/index.ts +7 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/schemas.gen.ts +700 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/services.gen.ts +289 -0
- airflow/providers/edge3/plugins/www/openapi-gen/requests/types.gen.ts +655 -0
- airflow/providers/edge3/plugins/www/package.json +80 -0
- airflow/providers/edge3/plugins/www/pnpm-lock.yaml +6653 -0
- airflow/providers/edge3/plugins/www/src/components/ErrorAlert.tsx +66 -0
- airflow/providers/edge3/plugins/www/src/components/StateBadge.tsx +43 -0
- airflow/providers/edge3/plugins/www/src/components/StateIcon.tsx +58 -0
- airflow/providers/edge3/plugins/www/src/components/WorkerStateBadge.tsx +71 -0
- airflow/providers/edge3/plugins/www/src/components/WorkerStateIcon.tsx +57 -0
- airflow/providers/edge3/plugins/www/src/components/ui/Alert.tsx +62 -0
- airflow/providers/edge3/plugins/www/src/components/ui/CloseButton.tsx +32 -0
- airflow/providers/edge3/plugins/www/src/components/ui/index.ts +20 -0
- airflow/providers/edge3/plugins/www/src/context/colorMode/ColorModeProvider.tsx +24 -0
- airflow/providers/edge3/plugins/www/src/context/colorMode/index.ts +21 -0
- airflow/providers/edge3/plugins/www/src/context/colorMode/useColorMode.tsx +32 -0
- airflow/providers/edge3/plugins/www/src/dev.tsx +29 -0
- airflow/providers/edge3/plugins/www/src/layouts/EdgeLayout.tsx +44 -0
- airflow/providers/edge3/plugins/www/src/layouts/NavTabs.tsx +63 -0
- airflow/providers/edge3/plugins/www/src/main.tsx +58 -0
- airflow/providers/edge3/plugins/www/src/pages/JobsPage.tsx +88 -0
- airflow/providers/edge3/plugins/www/src/pages/WorkerPage.tsx +105 -0
- airflow/providers/edge3/plugins/www/src/res/README.md +24 -0
- airflow/providers/edge3/plugins/www/src/res/cloud-computer-dark.svg +3 -0
- airflow/providers/edge3/plugins/www/src/res/cloud-computer.svg +3 -0
- airflow/providers/edge3/plugins/www/src/theme.ts +176 -0
- airflow/providers/edge3/plugins/www/src/utils/config.ts +23 -0
- airflow/providers/edge3/plugins/www/src/utils/index.ts +22 -0
- airflow/providers/edge3/plugins/www/src/utils/tokenHandler.ts +51 -0
- airflow/providers/edge3/plugins/www/src/utils/useContainerWidth.ts +43 -0
- airflow/providers/edge3/plugins/www/src/vite-env.d.ts +20 -0
- airflow/providers/edge3/plugins/www/testsSetup.ts +19 -0
- airflow/providers/edge3/plugins/www/tsconfig.app.json +31 -0
- airflow/providers/edge3/plugins/www/tsconfig.json +8 -0
- airflow/providers/edge3/plugins/www/tsconfig.lib.json +15 -0
- airflow/providers/edge3/plugins/www/tsconfig.node.json +29 -0
- airflow/providers/edge3/plugins/www/vite.config.ts +95 -0
- airflow/providers/edge3/version_compat.py +1 -0
- airflow/providers/edge3/worker_api/app.py +34 -8
- airflow/providers/edge3/worker_api/datamodels_ui.py +67 -0
- airflow/providers/edge3/worker_api/routes/health.py +1 -1
- airflow/providers/edge3/worker_api/routes/ui.py +102 -0
- {apache_airflow_providers_edge3-1.1.3rc1.dist-info → apache_airflow_providers_edge3-1.2.0rc1.dist-info}/METADATA +7 -8
- apache_airflow_providers_edge3-1.2.0rc1.dist-info/RECORD +103 -0
- apache_airflow_providers_edge3-1.1.3rc1.dist-info/RECORD +0 -41
- {apache_airflow_providers_edge3-1.1.3rc1.dist-info → apache_airflow_providers_edge3-1.2.0rc1.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_edge3-1.1.3rc1.dist-info → apache_airflow_providers_edge3-1.2.0rc1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
/*!
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
13
|
+
* software distributed under the License is distributed on an
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
* KIND, either express or implied. See the License for the
|
16
|
+
* specific language governing permissions and limitations
|
17
|
+
* under the License.
|
18
|
+
*/
|
19
|
+
import js from "@eslint/js";
|
20
|
+
import prettierConfig from "eslint-config-prettier";
|
21
|
+
import perfectionist from "eslint-plugin-perfectionist";
|
22
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
23
|
+
import reactRefresh from "eslint-plugin-react-refresh";
|
24
|
+
import globals from "globals";
|
25
|
+
import tseslint from "typescript-eslint";
|
26
|
+
|
27
|
+
export default tseslint.config(
|
28
|
+
{ ignores: ["**/dist/", "**coverage/", "**/openapi-gen/"] },
|
29
|
+
{
|
30
|
+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
31
|
+
files: ["**/*.{ts,tsx}"],
|
32
|
+
languageOptions: {
|
33
|
+
ecmaVersion: "latest",
|
34
|
+
globals: globals.browser,
|
35
|
+
},
|
36
|
+
plugins: {
|
37
|
+
perfectionist,
|
38
|
+
"react-hooks": reactHooks,
|
39
|
+
"react-refresh": reactRefresh,
|
40
|
+
},
|
41
|
+
rules: {
|
42
|
+
...reactHooks.configs.recommended.rules,
|
43
|
+
"perfectionist/sort-objects": [
|
44
|
+
"error",
|
45
|
+
{
|
46
|
+
type: "natural",
|
47
|
+
order: "asc",
|
48
|
+
},
|
49
|
+
],
|
50
|
+
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
|
51
|
+
},
|
52
|
+
},
|
53
|
+
prettierConfig,
|
54
|
+
);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7
|
+
<title>Edge - Development</title>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div id="root" style="width:100%;height:100%;position:fixed;"></div>
|
11
|
+
<script type="module" src="/src/dev.tsx"></script>
|
12
|
+
</body>
|
13
|
+
</html>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
// generated with @7nohe/openapi-react-query-codegen@1.6.2
|
2
|
+
|
3
|
+
import { UseQueryResult } from "@tanstack/react-query";
|
4
|
+
import { JobsService, LogsService, MonitorService, UiService, WorkerService } from "../requests/services.gen";
|
5
|
+
export type LogsServiceLogfilePathDefaultResponse = Awaited<ReturnType<typeof LogsService.logfilePath>>;
|
6
|
+
export type LogsServiceLogfilePathQueryResult<TData = LogsServiceLogfilePathDefaultResponse, TError = unknown> = UseQueryResult<TData, TError>;
|
7
|
+
export const useLogsServiceLogfilePathKey = "LogsServiceLogfilePath";
|
8
|
+
export const UseLogsServiceLogfilePathKeyFn = ({ authorization, dagId, mapIndex, runId, taskId, tryNumber }: {
|
9
|
+
authorization: string;
|
10
|
+
dagId: string;
|
11
|
+
mapIndex: number;
|
12
|
+
runId: string;
|
13
|
+
taskId: string;
|
14
|
+
tryNumber: number;
|
15
|
+
}, queryKey?: Array<unknown>) => [useLogsServiceLogfilePathKey, ...(queryKey ?? [{ authorization, dagId, mapIndex, runId, taskId, tryNumber }])];
|
16
|
+
export type MonitorServiceHealthDefaultResponse = Awaited<ReturnType<typeof MonitorService.health>>;
|
17
|
+
export type MonitorServiceHealthQueryResult<TData = MonitorServiceHealthDefaultResponse, TError = unknown> = UseQueryResult<TData, TError>;
|
18
|
+
export const useMonitorServiceHealthKey = "MonitorServiceHealth";
|
19
|
+
export const UseMonitorServiceHealthKeyFn = (queryKey?: Array<unknown>) => [useMonitorServiceHealthKey, ...(queryKey ?? [])];
|
20
|
+
export type UiServiceWorkerDefaultResponse = Awaited<ReturnType<typeof UiService.worker>>;
|
21
|
+
export type UiServiceWorkerQueryResult<TData = UiServiceWorkerDefaultResponse, TError = unknown> = UseQueryResult<TData, TError>;
|
22
|
+
export const useUiServiceWorkerKey = "UiServiceWorker";
|
23
|
+
export const UseUiServiceWorkerKeyFn = (queryKey?: Array<unknown>) => [useUiServiceWorkerKey, ...(queryKey ?? [])];
|
24
|
+
export type UiServiceJobsDefaultResponse = Awaited<ReturnType<typeof UiService.jobs>>;
|
25
|
+
export type UiServiceJobsQueryResult<TData = UiServiceJobsDefaultResponse, TError = unknown> = UseQueryResult<TData, TError>;
|
26
|
+
export const useUiServiceJobsKey = "UiServiceJobs";
|
27
|
+
export const UseUiServiceJobsKeyFn = (queryKey?: Array<unknown>) => [useUiServiceJobsKey, ...(queryKey ?? [])];
|
28
|
+
export type JobsServiceFetchMutationResult = Awaited<ReturnType<typeof JobsService.fetch>>;
|
29
|
+
export type LogsServicePushLogsMutationResult = Awaited<ReturnType<typeof LogsService.pushLogs>>;
|
30
|
+
export type WorkerServiceRegisterMutationResult = Awaited<ReturnType<typeof WorkerService.register>>;
|
31
|
+
export type JobsServiceStateMutationResult = Awaited<ReturnType<typeof JobsService.state>>;
|
32
|
+
export type WorkerServiceSetStateMutationResult = Awaited<ReturnType<typeof WorkerService.setState>>;
|
33
|
+
export type WorkerServiceUpdateQueuesMutationResult = Awaited<ReturnType<typeof WorkerService.updateQueues>>;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// generated with @7nohe/openapi-react-query-codegen@1.6.2
|
2
|
+
|
3
|
+
import { type QueryClient } from "@tanstack/react-query";
|
4
|
+
import { LogsService, MonitorService, UiService } from "../requests/services.gen";
|
5
|
+
import * as Common from "./common";
|
6
|
+
export const ensureUseLogsServiceLogfilePathData = (queryClient: QueryClient, { authorization, dagId, mapIndex, runId, taskId, tryNumber }: {
|
7
|
+
authorization: string;
|
8
|
+
dagId: string;
|
9
|
+
mapIndex: number;
|
10
|
+
runId: string;
|
11
|
+
taskId: string;
|
12
|
+
tryNumber: number;
|
13
|
+
}) => queryClient.ensureQueryData({ queryKey: Common.UseLogsServiceLogfilePathKeyFn({ authorization, dagId, mapIndex, runId, taskId, tryNumber }), queryFn: () => LogsService.logfilePath({ authorization, dagId, mapIndex, runId, taskId, tryNumber }) });
|
14
|
+
export const ensureUseMonitorServiceHealthData = (queryClient: QueryClient) => queryClient.ensureQueryData({ queryKey: Common.UseMonitorServiceHealthKeyFn(), queryFn: () => MonitorService.health() });
|
15
|
+
export const ensureUseUiServiceWorkerData = (queryClient: QueryClient) => queryClient.ensureQueryData({ queryKey: Common.UseUiServiceWorkerKeyFn(), queryFn: () => UiService.worker() });
|
16
|
+
export const ensureUseUiServiceJobsData = (queryClient: QueryClient) => queryClient.ensureQueryData({ queryKey: Common.UseUiServiceJobsKeyFn(), queryFn: () => UiService.jobs() });
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// generated with @7nohe/openapi-react-query-codegen@1.6.2
|
2
|
+
|
3
|
+
import { type QueryClient } from "@tanstack/react-query";
|
4
|
+
import { LogsService, MonitorService, UiService } from "../requests/services.gen";
|
5
|
+
import * as Common from "./common";
|
6
|
+
export const prefetchUseLogsServiceLogfilePath = (queryClient: QueryClient, { authorization, dagId, mapIndex, runId, taskId, tryNumber }: {
|
7
|
+
authorization: string;
|
8
|
+
dagId: string;
|
9
|
+
mapIndex: number;
|
10
|
+
runId: string;
|
11
|
+
taskId: string;
|
12
|
+
tryNumber: number;
|
13
|
+
}) => queryClient.prefetchQuery({ queryKey: Common.UseLogsServiceLogfilePathKeyFn({ authorization, dagId, mapIndex, runId, taskId, tryNumber }), queryFn: () => LogsService.logfilePath({ authorization, dagId, mapIndex, runId, taskId, tryNumber }) });
|
14
|
+
export const prefetchUseMonitorServiceHealth = (queryClient: QueryClient) => queryClient.prefetchQuery({ queryKey: Common.UseMonitorServiceHealthKeyFn(), queryFn: () => MonitorService.health() });
|
15
|
+
export const prefetchUseUiServiceWorker = (queryClient: QueryClient) => queryClient.prefetchQuery({ queryKey: Common.UseUiServiceWorkerKeyFn(), queryFn: () => UiService.worker() });
|
16
|
+
export const prefetchUseUiServiceJobs = (queryClient: QueryClient) => queryClient.prefetchQuery({ queryKey: Common.UseUiServiceJobsKeyFn(), queryFn: () => UiService.jobs() });
|
@@ -0,0 +1,87 @@
|
|
1
|
+
// generated with @7nohe/openapi-react-query-codegen@1.6.2
|
2
|
+
|
3
|
+
import { UseMutationOptions, UseQueryOptions, useMutation, useQuery } from "@tanstack/react-query";
|
4
|
+
import { JobsService, LogsService, MonitorService, UiService, WorkerService } from "../requests/services.gen";
|
5
|
+
import { PushLogsBody, TaskInstanceState, WorkerQueueUpdateBody, WorkerQueuesBody, WorkerStateBody } from "../requests/types.gen";
|
6
|
+
import * as Common from "./common";
|
7
|
+
export const useLogsServiceLogfilePath = <TData = Common.LogsServiceLogfilePathDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>({ authorization, dagId, mapIndex, runId, taskId, tryNumber }: {
|
8
|
+
authorization: string;
|
9
|
+
dagId: string;
|
10
|
+
mapIndex: number;
|
11
|
+
runId: string;
|
12
|
+
taskId: string;
|
13
|
+
tryNumber: number;
|
14
|
+
}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useQuery<TData, TError>({ queryKey: Common.UseLogsServiceLogfilePathKeyFn({ authorization, dagId, mapIndex, runId, taskId, tryNumber }, queryKey), queryFn: () => LogsService.logfilePath({ authorization, dagId, mapIndex, runId, taskId, tryNumber }) as TData, ...options });
|
15
|
+
export const useMonitorServiceHealth = <TData = Common.MonitorServiceHealthDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>(queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useQuery<TData, TError>({ queryKey: Common.UseMonitorServiceHealthKeyFn(queryKey), queryFn: () => MonitorService.health() as TData, ...options });
|
16
|
+
export const useUiServiceWorker = <TData = Common.UiServiceWorkerDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>(queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useQuery<TData, TError>({ queryKey: Common.UseUiServiceWorkerKeyFn(queryKey), queryFn: () => UiService.worker() as TData, ...options });
|
17
|
+
export const useUiServiceJobs = <TData = Common.UiServiceJobsDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>(queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useQuery<TData, TError>({ queryKey: Common.UseUiServiceJobsKeyFn(queryKey), queryFn: () => UiService.jobs() as TData, ...options });
|
18
|
+
export const useJobsServiceFetch = <TData = Common.JobsServiceFetchMutationResult, TError = unknown, TContext = unknown>(options?: Omit<UseMutationOptions<TData, TError, {
|
19
|
+
authorization: string;
|
20
|
+
requestBody: WorkerQueuesBody;
|
21
|
+
workerName: string;
|
22
|
+
}, TContext>, "mutationFn">) => useMutation<TData, TError, {
|
23
|
+
authorization: string;
|
24
|
+
requestBody: WorkerQueuesBody;
|
25
|
+
workerName: string;
|
26
|
+
}, TContext>({ mutationFn: ({ authorization, requestBody, workerName }) => JobsService.fetch({ authorization, requestBody, workerName }) as unknown as Promise<TData>, ...options });
|
27
|
+
export const useLogsServicePushLogs = <TData = Common.LogsServicePushLogsMutationResult, TError = unknown, TContext = unknown>(options?: Omit<UseMutationOptions<TData, TError, {
|
28
|
+
authorization: string;
|
29
|
+
dagId: string;
|
30
|
+
mapIndex: number;
|
31
|
+
requestBody: PushLogsBody;
|
32
|
+
runId: string;
|
33
|
+
taskId: string;
|
34
|
+
tryNumber: number;
|
35
|
+
}, TContext>, "mutationFn">) => useMutation<TData, TError, {
|
36
|
+
authorization: string;
|
37
|
+
dagId: string;
|
38
|
+
mapIndex: number;
|
39
|
+
requestBody: PushLogsBody;
|
40
|
+
runId: string;
|
41
|
+
taskId: string;
|
42
|
+
tryNumber: number;
|
43
|
+
}, TContext>({ mutationFn: ({ authorization, dagId, mapIndex, requestBody, runId, taskId, tryNumber }) => LogsService.pushLogs({ authorization, dagId, mapIndex, requestBody, runId, taskId, tryNumber }) as unknown as Promise<TData>, ...options });
|
44
|
+
export const useWorkerServiceRegister = <TData = Common.WorkerServiceRegisterMutationResult, TError = unknown, TContext = unknown>(options?: Omit<UseMutationOptions<TData, TError, {
|
45
|
+
authorization: string;
|
46
|
+
requestBody: WorkerStateBody;
|
47
|
+
workerName: string;
|
48
|
+
}, TContext>, "mutationFn">) => useMutation<TData, TError, {
|
49
|
+
authorization: string;
|
50
|
+
requestBody: WorkerStateBody;
|
51
|
+
workerName: string;
|
52
|
+
}, TContext>({ mutationFn: ({ authorization, requestBody, workerName }) => WorkerService.register({ authorization, requestBody, workerName }) as unknown as Promise<TData>, ...options });
|
53
|
+
export const useJobsServiceState = <TData = Common.JobsServiceStateMutationResult, TError = unknown, TContext = unknown>(options?: Omit<UseMutationOptions<TData, TError, {
|
54
|
+
authorization: string;
|
55
|
+
dagId: string;
|
56
|
+
mapIndex: number;
|
57
|
+
runId: string;
|
58
|
+
state: TaskInstanceState;
|
59
|
+
taskId: string;
|
60
|
+
tryNumber: number;
|
61
|
+
}, TContext>, "mutationFn">) => useMutation<TData, TError, {
|
62
|
+
authorization: string;
|
63
|
+
dagId: string;
|
64
|
+
mapIndex: number;
|
65
|
+
runId: string;
|
66
|
+
state: TaskInstanceState;
|
67
|
+
taskId: string;
|
68
|
+
tryNumber: number;
|
69
|
+
}, TContext>({ mutationFn: ({ authorization, dagId, mapIndex, runId, state, taskId, tryNumber }) => JobsService.state({ authorization, dagId, mapIndex, runId, state, taskId, tryNumber }) as unknown as Promise<TData>, ...options });
|
70
|
+
export const useWorkerServiceSetState = <TData = Common.WorkerServiceSetStateMutationResult, TError = unknown, TContext = unknown>(options?: Omit<UseMutationOptions<TData, TError, {
|
71
|
+
authorization: string;
|
72
|
+
requestBody: WorkerStateBody;
|
73
|
+
workerName: string;
|
74
|
+
}, TContext>, "mutationFn">) => useMutation<TData, TError, {
|
75
|
+
authorization: string;
|
76
|
+
requestBody: WorkerStateBody;
|
77
|
+
workerName: string;
|
78
|
+
}, TContext>({ mutationFn: ({ authorization, requestBody, workerName }) => WorkerService.setState({ authorization, requestBody, workerName }) as unknown as Promise<TData>, ...options });
|
79
|
+
export const useWorkerServiceUpdateQueues = <TData = Common.WorkerServiceUpdateQueuesMutationResult, TError = unknown, TContext = unknown>(options?: Omit<UseMutationOptions<TData, TError, {
|
80
|
+
authorization: string;
|
81
|
+
requestBody: WorkerQueueUpdateBody;
|
82
|
+
workerName: string;
|
83
|
+
}, TContext>, "mutationFn">) => useMutation<TData, TError, {
|
84
|
+
authorization: string;
|
85
|
+
requestBody: WorkerQueueUpdateBody;
|
86
|
+
workerName: string;
|
87
|
+
}, TContext>({ mutationFn: ({ authorization, requestBody, workerName }) => WorkerService.updateQueues({ authorization, requestBody, workerName }) as unknown as Promise<TData>, ...options });
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// generated with @7nohe/openapi-react-query-codegen@1.6.2
|
2
|
+
|
3
|
+
import { UseQueryOptions, useSuspenseQuery } from "@tanstack/react-query";
|
4
|
+
import { LogsService, MonitorService, UiService } from "../requests/services.gen";
|
5
|
+
import * as Common from "./common";
|
6
|
+
export const useLogsServiceLogfilePathSuspense = <TData = Common.LogsServiceLogfilePathDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>({ authorization, dagId, mapIndex, runId, taskId, tryNumber }: {
|
7
|
+
authorization: string;
|
8
|
+
dagId: string;
|
9
|
+
mapIndex: number;
|
10
|
+
runId: string;
|
11
|
+
taskId: string;
|
12
|
+
tryNumber: number;
|
13
|
+
}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useSuspenseQuery<TData, TError>({ queryKey: Common.UseLogsServiceLogfilePathKeyFn({ authorization, dagId, mapIndex, runId, taskId, tryNumber }, queryKey), queryFn: () => LogsService.logfilePath({ authorization, dagId, mapIndex, runId, taskId, tryNumber }) as TData, ...options });
|
14
|
+
export const useMonitorServiceHealthSuspense = <TData = Common.MonitorServiceHealthDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>(queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useSuspenseQuery<TData, TError>({ queryKey: Common.UseMonitorServiceHealthKeyFn(queryKey), queryFn: () => MonitorService.health() as TData, ...options });
|
15
|
+
export const useUiServiceWorkerSuspense = <TData = Common.UiServiceWorkerDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>(queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useSuspenseQuery<TData, TError>({ queryKey: Common.UseUiServiceWorkerKeyFn(queryKey), queryFn: () => UiService.worker() as TData, ...options });
|
16
|
+
export const useUiServiceJobsSuspense = <TData = Common.UiServiceJobsDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>(queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useSuspenseQuery<TData, TError>({ queryKey: Common.UseUiServiceJobsKeyFn(queryKey), queryFn: () => UiService.jobs() as TData, ...options });
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
2
|
+
import type { ApiResult } from './ApiResult';
|
3
|
+
|
4
|
+
export class ApiError extends Error {
|
5
|
+
public readonly url: string;
|
6
|
+
public readonly status: number;
|
7
|
+
public readonly statusText: string;
|
8
|
+
public readonly body: unknown;
|
9
|
+
public readonly request: ApiRequestOptions;
|
10
|
+
|
11
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string) {
|
12
|
+
super(message);
|
13
|
+
|
14
|
+
this.name = 'ApiError';
|
15
|
+
this.url = response.url;
|
16
|
+
this.status = response.status;
|
17
|
+
this.statusText = response.statusText;
|
18
|
+
this.body = response.body;
|
19
|
+
this.request = request;
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export type ApiRequestOptions<T = unknown> = {
|
2
|
+
readonly body?: any;
|
3
|
+
readonly cookies?: Record<string, unknown>;
|
4
|
+
readonly errors?: Record<number | string, string>;
|
5
|
+
readonly formData?: Record<string, unknown> | any[] | Blob | File;
|
6
|
+
readonly headers?: Record<string, unknown>;
|
7
|
+
readonly mediaType?: string;
|
8
|
+
readonly method:
|
9
|
+
| 'DELETE'
|
10
|
+
| 'GET'
|
11
|
+
| 'HEAD'
|
12
|
+
| 'OPTIONS'
|
13
|
+
| 'PATCH'
|
14
|
+
| 'POST'
|
15
|
+
| 'PUT';
|
16
|
+
readonly path?: Record<string, unknown>;
|
17
|
+
readonly query?: Record<string, unknown>;
|
18
|
+
readonly responseHeader?: string;
|
19
|
+
readonly responseTransformer?: (data: unknown) => Promise<T>;
|
20
|
+
readonly url: string;
|
21
|
+
};
|
@@ -0,0 +1,126 @@
|
|
1
|
+
export class CancelError extends Error {
|
2
|
+
constructor(message: string) {
|
3
|
+
super(message);
|
4
|
+
this.name = 'CancelError';
|
5
|
+
}
|
6
|
+
|
7
|
+
public get isCancelled(): boolean {
|
8
|
+
return true;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface OnCancel {
|
13
|
+
readonly isResolved: boolean;
|
14
|
+
readonly isRejected: boolean;
|
15
|
+
readonly isCancelled: boolean;
|
16
|
+
|
17
|
+
(cancelHandler: () => void): void;
|
18
|
+
}
|
19
|
+
|
20
|
+
export class CancelablePromise<T> implements Promise<T> {
|
21
|
+
private _isResolved: boolean;
|
22
|
+
private _isRejected: boolean;
|
23
|
+
private _isCancelled: boolean;
|
24
|
+
readonly cancelHandlers: (() => void)[];
|
25
|
+
readonly promise: Promise<T>;
|
26
|
+
private _resolve?: (value: T | PromiseLike<T>) => void;
|
27
|
+
private _reject?: (reason?: unknown) => void;
|
28
|
+
|
29
|
+
constructor(
|
30
|
+
executor: (
|
31
|
+
resolve: (value: T | PromiseLike<T>) => void,
|
32
|
+
reject: (reason?: unknown) => void,
|
33
|
+
onCancel: OnCancel
|
34
|
+
) => void
|
35
|
+
) {
|
36
|
+
this._isResolved = false;
|
37
|
+
this._isRejected = false;
|
38
|
+
this._isCancelled = false;
|
39
|
+
this.cancelHandlers = [];
|
40
|
+
this.promise = new Promise<T>((resolve, reject) => {
|
41
|
+
this._resolve = resolve;
|
42
|
+
this._reject = reject;
|
43
|
+
|
44
|
+
const onResolve = (value: T | PromiseLike<T>): void => {
|
45
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
this._isResolved = true;
|
49
|
+
if (this._resolve) this._resolve(value);
|
50
|
+
};
|
51
|
+
|
52
|
+
const onReject = (reason?: unknown): void => {
|
53
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
54
|
+
return;
|
55
|
+
}
|
56
|
+
this._isRejected = true;
|
57
|
+
if (this._reject) this._reject(reason);
|
58
|
+
};
|
59
|
+
|
60
|
+
const onCancel = (cancelHandler: () => void): void => {
|
61
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
62
|
+
return;
|
63
|
+
}
|
64
|
+
this.cancelHandlers.push(cancelHandler);
|
65
|
+
};
|
66
|
+
|
67
|
+
Object.defineProperty(onCancel, 'isResolved', {
|
68
|
+
get: (): boolean => this._isResolved,
|
69
|
+
});
|
70
|
+
|
71
|
+
Object.defineProperty(onCancel, 'isRejected', {
|
72
|
+
get: (): boolean => this._isRejected,
|
73
|
+
});
|
74
|
+
|
75
|
+
Object.defineProperty(onCancel, 'isCancelled', {
|
76
|
+
get: (): boolean => this._isCancelled,
|
77
|
+
});
|
78
|
+
|
79
|
+
return executor(onResolve, onReject, onCancel as OnCancel);
|
80
|
+
});
|
81
|
+
}
|
82
|
+
|
83
|
+
get [Symbol.toStringTag]() {
|
84
|
+
return "Cancellable Promise";
|
85
|
+
}
|
86
|
+
|
87
|
+
public then<TResult1 = T, TResult2 = never>(
|
88
|
+
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
89
|
+
onRejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null
|
90
|
+
): Promise<TResult1 | TResult2> {
|
91
|
+
return this.promise.then(onFulfilled, onRejected);
|
92
|
+
}
|
93
|
+
|
94
|
+
public catch<TResult = never>(
|
95
|
+
onRejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null
|
96
|
+
): Promise<T | TResult> {
|
97
|
+
return this.promise.catch(onRejected);
|
98
|
+
}
|
99
|
+
|
100
|
+
public finally(onFinally?: (() => void) | null): Promise<T> {
|
101
|
+
return this.promise.finally(onFinally);
|
102
|
+
}
|
103
|
+
|
104
|
+
public cancel(): void {
|
105
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
this._isCancelled = true;
|
109
|
+
if (this.cancelHandlers.length) {
|
110
|
+
try {
|
111
|
+
for (const cancelHandler of this.cancelHandlers) {
|
112
|
+
cancelHandler();
|
113
|
+
}
|
114
|
+
} catch (error) {
|
115
|
+
console.warn('Cancellation threw an error', error);
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
this.cancelHandlers.length = 0;
|
120
|
+
if (this._reject) this._reject(new CancelError('Request aborted'));
|
121
|
+
}
|
122
|
+
|
123
|
+
public get isCancelled(): boolean {
|
124
|
+
return this._isCancelled;
|
125
|
+
}
|
126
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
|
2
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
3
|
+
|
4
|
+
type Headers = Record<string, string>;
|
5
|
+
type Middleware<T> = (value: T) => T | Promise<T>;
|
6
|
+
type Resolver<T> = (options: ApiRequestOptions<T>) => Promise<T>;
|
7
|
+
|
8
|
+
export class Interceptors<T> {
|
9
|
+
_fns: Middleware<T>[];
|
10
|
+
|
11
|
+
constructor() {
|
12
|
+
this._fns = [];
|
13
|
+
}
|
14
|
+
|
15
|
+
eject(fn: Middleware<T>): void {
|
16
|
+
const index = this._fns.indexOf(fn);
|
17
|
+
if (index !== -1) {
|
18
|
+
this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)];
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
use(fn: Middleware<T>): void {
|
23
|
+
this._fns = [...this._fns, fn];
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
export type OpenAPIConfig = {
|
28
|
+
BASE: string;
|
29
|
+
CREDENTIALS: 'include' | 'omit' | 'same-origin';
|
30
|
+
ENCODE_PATH?: ((path: string) => string) | undefined;
|
31
|
+
HEADERS?: Headers | Resolver<Headers> | undefined;
|
32
|
+
PASSWORD?: string | Resolver<string> | undefined;
|
33
|
+
TOKEN?: string | Resolver<string> | undefined;
|
34
|
+
USERNAME?: string | Resolver<string> | undefined;
|
35
|
+
VERSION: string;
|
36
|
+
WITH_CREDENTIALS: boolean;
|
37
|
+
interceptors: {
|
38
|
+
request: Interceptors<AxiosRequestConfig>;
|
39
|
+
response: Interceptors<AxiosResponse>;
|
40
|
+
};
|
41
|
+
};
|
42
|
+
|
43
|
+
export const OpenAPI: OpenAPIConfig = {
|
44
|
+
BASE: '',
|
45
|
+
CREDENTIALS: 'include',
|
46
|
+
ENCODE_PATH: undefined,
|
47
|
+
HEADERS: undefined,
|
48
|
+
PASSWORD: undefined,
|
49
|
+
TOKEN: undefined,
|
50
|
+
USERNAME: undefined,
|
51
|
+
VERSION: '0.1.0',
|
52
|
+
WITH_CREDENTIALS: false,
|
53
|
+
interceptors: {
|
54
|
+
request: new Interceptors(),
|
55
|
+
response: new Interceptors(),
|
56
|
+
},
|
57
|
+
};
|