From 2c62dbac8cffafee43e578447550f64e0be88cbf Mon Sep 17 00:00:00 2001 From: Pierre Jeambrun Date: Tue, 12 Nov 2024 19:47:24 +0800 Subject: [PATCH] Fix main pre-commit (#43923) --- airflow/ui/openapi-gen/queries/common.ts | 34 +++++++ airflow/ui/openapi-gen/queries/prefetch.ts | 56 +++++++++++ airflow/ui/openapi-gen/queries/queries.ts | 57 ++++++++++++ airflow/ui/openapi-gen/queries/suspense.ts | 57 ++++++++++++ .../ui/openapi-gen/requests/schemas.gen.ts | 92 +++++++++++++++++++ .../ui/openapi-gen/requests/services.gen.ts | 45 +++++++++ airflow/ui/openapi-gen/requests/types.gen.ts | 69 ++++++++++++++ 7 files changed, 410 insertions(+) diff --git a/airflow/ui/openapi-gen/queries/common.ts b/airflow/ui/openapi-gen/queries/common.ts index cfbb945b4e57f..5e9d12a78d9b6 100644 --- a/airflow/ui/openapi-gen/queries/common.ts +++ b/airflow/ui/openapi-gen/queries/common.ts @@ -21,6 +21,7 @@ import { TaskInstanceService, VariableService, VersionService, + XcomService, } from "../requests/services.gen"; import { DagRunState, DagWarningType } from "../requests/types.gen"; @@ -905,6 +906,39 @@ export const UseDagStatsServiceGetDagStatsKeyFn = ( } = {}, queryKey?: Array, ) => [useDagStatsServiceGetDagStatsKey, ...(queryKey ?? [{ dagIds }])]; +export type XcomServiceGetXcomEntryDefaultResponse = Awaited< + ReturnType +>; +export type XcomServiceGetXcomEntryQueryResult< + TData = XcomServiceGetXcomEntryDefaultResponse, + TError = unknown, +> = UseQueryResult; +export const useXcomServiceGetXcomEntryKey = "XcomServiceGetXcomEntry"; +export const UseXcomServiceGetXcomEntryKeyFn = ( + { + dagId, + dagRunId, + deserialize, + mapIndex, + stringify, + taskId, + xcomKey, + }: { + dagId: string; + dagRunId: string; + deserialize?: boolean; + mapIndex?: number; + stringify?: boolean; + taskId: string; + xcomKey: string; + }, + queryKey?: Array, +) => [ + useXcomServiceGetXcomEntryKey, + ...(queryKey ?? [ + { dagId, dagRunId, deserialize, mapIndex, stringify, taskId, xcomKey }, + ]), +]; export type BackfillServiceCreateBackfillMutationResult = Awaited< ReturnType >; diff --git a/airflow/ui/openapi-gen/queries/prefetch.ts b/airflow/ui/openapi-gen/queries/prefetch.ts index b8dc71dd821cd..ad690171afc06 100644 --- a/airflow/ui/openapi-gen/queries/prefetch.ts +++ b/airflow/ui/openapi-gen/queries/prefetch.ts @@ -21,6 +21,7 @@ import { TaskInstanceService, VariableService, VersionService, + XcomService, } from "../requests/services.gen"; import { DagRunState, DagWarningType } from "../requests/types.gen"; import * as Common from "./common"; @@ -1214,3 +1215,58 @@ export const prefetchUseDagStatsServiceGetDagStats = ( queryKey: Common.UseDagStatsServiceGetDagStatsKeyFn({ dagIds }), queryFn: () => DagStatsService.getDagStats({ dagIds }), }); +/** + * Get Xcom Entry + * Get an XCom entry. + * @param data The data for the request. + * @param data.dagId + * @param data.taskId + * @param data.dagRunId + * @param data.xcomKey + * @param data.mapIndex + * @param data.deserialize + * @param data.stringify + * @returns unknown Successful Response + * @throws ApiError + */ +export const prefetchUseXcomServiceGetXcomEntry = ( + queryClient: QueryClient, + { + dagId, + dagRunId, + deserialize, + mapIndex, + stringify, + taskId, + xcomKey, + }: { + dagId: string; + dagRunId: string; + deserialize?: boolean; + mapIndex?: number; + stringify?: boolean; + taskId: string; + xcomKey: string; + }, +) => + queryClient.prefetchQuery({ + queryKey: Common.UseXcomServiceGetXcomEntryKeyFn({ + dagId, + dagRunId, + deserialize, + mapIndex, + stringify, + taskId, + xcomKey, + }), + queryFn: () => + XcomService.getXcomEntry({ + dagId, + dagRunId, + deserialize, + mapIndex, + stringify, + taskId, + xcomKey, + }), + }); diff --git a/airflow/ui/openapi-gen/queries/queries.ts b/airflow/ui/openapi-gen/queries/queries.ts index 3a8d508a8c426..e20730af0d6f7 100644 --- a/airflow/ui/openapi-gen/queries/queries.ts +++ b/airflow/ui/openapi-gen/queries/queries.ts @@ -26,6 +26,7 @@ import { TaskInstanceService, VariableService, VersionService, + XcomService, } from "../requests/services.gen"; import { BackfillPostBody, @@ -1464,6 +1465,62 @@ export const useDagStatsServiceGetDagStats = < queryFn: () => DagStatsService.getDagStats({ dagIds }) as TData, ...options, }); +/** + * Get Xcom Entry + * Get an XCom entry. + * @param data The data for the request. + * @param data.dagId + * @param data.taskId + * @param data.dagRunId + * @param data.xcomKey + * @param data.mapIndex + * @param data.deserialize + * @param data.stringify + * @returns unknown Successful Response + * @throws ApiError + */ +export const useXcomServiceGetXcomEntry = < + TData = Common.XcomServiceGetXcomEntryDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagId, + dagRunId, + deserialize, + mapIndex, + stringify, + taskId, + xcomKey, + }: { + dagId: string; + dagRunId: string; + deserialize?: boolean; + mapIndex?: number; + stringify?: boolean; + taskId: string; + xcomKey: string; + }, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useQuery({ + queryKey: Common.UseXcomServiceGetXcomEntryKeyFn( + { dagId, dagRunId, deserialize, mapIndex, stringify, taskId, xcomKey }, + queryKey, + ), + queryFn: () => + XcomService.getXcomEntry({ + dagId, + dagRunId, + deserialize, + mapIndex, + stringify, + taskId, + xcomKey, + }) as TData, + ...options, + }); /** * Create Backfill * @param data The data for the request. diff --git a/airflow/ui/openapi-gen/queries/suspense.ts b/airflow/ui/openapi-gen/queries/suspense.ts index 3672219a23f2f..ca4fca9c15c2f 100644 --- a/airflow/ui/openapi-gen/queries/suspense.ts +++ b/airflow/ui/openapi-gen/queries/suspense.ts @@ -21,6 +21,7 @@ import { TaskInstanceService, VariableService, VersionService, + XcomService, } from "../requests/services.gen"; import { DagRunState, DagWarningType } from "../requests/types.gen"; import * as Common from "./common"; @@ -1449,3 +1450,59 @@ export const useDagStatsServiceGetDagStatsSuspense = < queryFn: () => DagStatsService.getDagStats({ dagIds }) as TData, ...options, }); +/** + * Get Xcom Entry + * Get an XCom entry. + * @param data The data for the request. + * @param data.dagId + * @param data.taskId + * @param data.dagRunId + * @param data.xcomKey + * @param data.mapIndex + * @param data.deserialize + * @param data.stringify + * @returns unknown Successful Response + * @throws ApiError + */ +export const useXcomServiceGetXcomEntrySuspense = < + TData = Common.XcomServiceGetXcomEntryDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagId, + dagRunId, + deserialize, + mapIndex, + stringify, + taskId, + xcomKey, + }: { + dagId: string; + dagRunId: string; + deserialize?: boolean; + mapIndex?: number; + stringify?: boolean; + taskId: string; + xcomKey: string; + }, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useSuspenseQuery({ + queryKey: Common.UseXcomServiceGetXcomEntryKeyFn( + { dagId, dagRunId, deserialize, mapIndex, stringify, taskId, xcomKey }, + queryKey, + ), + queryFn: () => + XcomService.getXcomEntry({ + dagId, + dagRunId, + deserialize, + mapIndex, + stringify, + taskId, + xcomKey, + }) as TData, + ...options, + }); diff --git a/airflow/ui/openapi-gen/requests/schemas.gen.ts b/airflow/ui/openapi-gen/requests/schemas.gen.ts index 5199a04962f28..dc630be5dd1ed 100644 --- a/airflow/ui/openapi-gen/requests/schemas.gen.ts +++ b/airflow/ui/openapi-gen/requests/schemas.gen.ts @@ -3096,3 +3096,95 @@ export const $VersionInfo = { title: "VersionInfo", description: "Version information serializer for responses.", } as const; + +export const $XComResponseNative = { + properties: { + key: { + type: "string", + title: "Key", + }, + timestamp: { + type: "string", + format: "date-time", + title: "Timestamp", + }, + execution_date: { + type: "string", + format: "date-time", + title: "Execution Date", + }, + map_index: { + type: "integer", + title: "Map Index", + }, + task_id: { + type: "string", + title: "Task Id", + }, + dag_id: { + type: "string", + title: "Dag Id", + }, + value: { + title: "Value", + }, + }, + type: "object", + required: [ + "key", + "timestamp", + "execution_date", + "map_index", + "task_id", + "dag_id", + "value", + ], + title: "XComResponseNative", + description: "XCom response serializer with native return type.", +} as const; + +export const $XComResponseString = { + properties: { + key: { + type: "string", + title: "Key", + }, + timestamp: { + type: "string", + format: "date-time", + title: "Timestamp", + }, + execution_date: { + type: "string", + format: "date-time", + title: "Execution Date", + }, + map_index: { + type: "integer", + title: "Map Index", + }, + task_id: { + type: "string", + title: "Task Id", + }, + dag_id: { + type: "string", + title: "Dag Id", + }, + value: { + title: "Value", + }, + }, + type: "object", + required: [ + "key", + "timestamp", + "execution_date", + "map_index", + "task_id", + "dag_id", + "value", + ], + title: "XComResponseString", + description: "XCom response serializer with string return type.", +} as const; diff --git a/airflow/ui/openapi-gen/requests/services.gen.ts b/airflow/ui/openapi-gen/requests/services.gen.ts index 8a6cd3e4f702a..39c3e8d7bc1c3 100644 --- a/airflow/ui/openapi-gen/requests/services.gen.ts +++ b/airflow/ui/openapi-gen/requests/services.gen.ts @@ -103,6 +103,8 @@ import type { GetVersionResponse, GetDagStatsData, GetDagStatsResponse, + GetXcomEntryData, + GetXcomEntryResponse, } from "./types.gen"; export class AssetService { @@ -1689,3 +1691,46 @@ export class DagStatsService { }); } } + +export class XcomService { + /** + * Get Xcom Entry + * Get an XCom entry. + * @param data The data for the request. + * @param data.dagId + * @param data.taskId + * @param data.dagRunId + * @param data.xcomKey + * @param data.mapIndex + * @param data.deserialize + * @param data.stringify + * @returns unknown Successful Response + * @throws ApiError + */ + public static getXcomEntry( + data: GetXcomEntryData, + ): CancelablePromise { + return __request(OpenAPI, { + method: "GET", + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntries/{xcom_key}", + path: { + dag_id: data.dagId, + task_id: data.taskId, + dag_run_id: data.dagRunId, + xcom_key: data.xcomKey, + }, + query: { + map_index: data.mapIndex, + deserialize: data.deserialize, + stringify: data.stringify, + }, + errors: { + 400: "Bad Request", + 401: "Unauthorized", + 403: "Forbidden", + 404: "Not Found", + 422: "Validation Error", + }, + }); + } +} diff --git a/airflow/ui/openapi-gen/requests/types.gen.ts b/airflow/ui/openapi-gen/requests/types.gen.ts index 8817a45abd48a..d38dda245bcbd 100644 --- a/airflow/ui/openapi-gen/requests/types.gen.ts +++ b/airflow/ui/openapi-gen/requests/types.gen.ts @@ -750,6 +750,32 @@ export type VersionInfo = { git_version: string | null; }; +/** + * XCom response serializer with native return type. + */ +export type XComResponseNative = { + key: string; + timestamp: string; + execution_date: string; + map_index: number; + task_id: string; + dag_id: string; + value: unknown; +}; + +/** + * XCom response serializer with string return type. + */ +export type XComResponseString = { + key: string; + timestamp: string; + execution_date: string; + map_index: number; + task_id: string; + dag_id: string; + value: unknown; +}; + export type NextRunAssetsData = { dagId: string; }; @@ -1175,6 +1201,18 @@ export type GetDagStatsData = { export type GetDagStatsResponse = DagStatsCollectionResponse; +export type GetXcomEntryData = { + dagId: string; + dagRunId: string; + deserialize?: boolean; + mapIndex?: number; + stringify?: boolean; + taskId: string; + xcomKey: string; +}; + +export type GetXcomEntryResponse = XComResponseNative | XComResponseString; + export type $OpenApiTs = { "/ui/next_run_assets/{dag_id}": { get: { @@ -2463,4 +2501,35 @@ export type $OpenApiTs = { }; }; }; + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntries/{xcom_key}": { + get: { + req: GetXcomEntryData; + res: { + /** + * Successful Response + */ + 200: XComResponseNative | XComResponseString; + /** + * Bad Request + */ + 400: HTTPExceptionResponse; + /** + * Unauthorized + */ + 401: HTTPExceptionResponse; + /** + * Forbidden + */ + 403: HTTPExceptionResponse; + /** + * Not Found + */ + 404: HTTPExceptionResponse; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; };