@prefecthq/prefect-ui-library 3.5.8 → 3.5.10
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/{RunsPageWithDefaultFilter-CaD-iM3l.mjs → RunsPageWithDefaultFilter-DpBy-vtD.mjs} +2 -2
- package/dist/{RunsPageWithDefaultFilter-CaD-iM3l.mjs.map → RunsPageWithDefaultFilter-DpBy-vtD.mjs.map} +1 -1
- package/dist/{WorkQueueToWorkPoolQueueRedirect-P8NTt3Xq.mjs → WorkQueueToWorkPoolQueueRedirect-CDfcjENh.mjs} +2 -2
- package/dist/{WorkQueueToWorkPoolQueueRedirect-P8NTt3Xq.mjs.map → WorkQueueToWorkPoolQueueRedirect-CDfcjENh.mjs.map} +1 -1
- package/dist/{index-M9_iwjmx.mjs → index-D6PK6lvZ.mjs} +11 -8
- package/dist/index-D6PK6lvZ.mjs.map +1 -0
- package/dist/prefect-ui-library.mjs +1 -1
- package/dist/prefect-ui-library.umd.js +2 -2
- package/dist/prefect-ui-library.umd.js.map +1 -1
- package/dist/types/src/services/Api.d.ts +4 -2
- package/dist/types/src/services/WorkspaceFlowRunsApi.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/FlowRunLogsDownloadButton.vue +1 -1
- package/src/services/Api.ts +13 -4
- package/src/services/WorkspaceFlowRunsApi.ts +2 -2
- package/dist/index-M9_iwjmx.mjs.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig, AxiosResponse, RawAxiosRequestHeaders } from 'axios';
|
|
2
|
+
import { MaybeGetter } from '../types';
|
|
2
3
|
import { MaybeArray } from '../types/utilities';
|
|
3
4
|
export type AxiosInstanceSetupHook = (instance: AxiosInstance) => void;
|
|
4
5
|
export type PrefectConfig = {
|
|
@@ -12,12 +13,13 @@ export declare const getPrefectBaseUrl: ApiBaseUrl;
|
|
|
12
13
|
export declare const getPrefectUIHeaders: RawAxiosRequestHeaders;
|
|
13
14
|
export declare const getAuthorizationHeaders: ApiHeaders;
|
|
14
15
|
export declare class Api<T extends PrefectConfig = PrefectConfig> {
|
|
15
|
-
protected readonly apiConfig: T
|
|
16
|
+
protected readonly apiConfig: MaybeGetter<T>;
|
|
16
17
|
protected apiHeaders: MaybeArray<ApiHeaders>;
|
|
17
18
|
protected apiBaseUrl: ApiBaseUrl;
|
|
18
19
|
protected routePrefix: string | undefined;
|
|
19
20
|
protected instanceSetupHook: AxiosInstanceSetupHook | null;
|
|
20
|
-
constructor(apiConfig: T
|
|
21
|
+
constructor(apiConfig: MaybeGetter<T>, instanceSetupHook?: AxiosInstanceSetupHook | null);
|
|
22
|
+
protected getConfig(): T;
|
|
21
23
|
protected composeBaseUrl(): string;
|
|
22
24
|
protected composeHeaders(): RawAxiosRequestHeaders;
|
|
23
25
|
protected combinePath(route: string | undefined): string;
|
|
@@ -27,5 +27,5 @@ export declare class WorkspaceFlowRunsApi extends WorkspaceApi {
|
|
|
27
27
|
resumeFlowRun(id: string, values?: SchemaValues): Promise<OrchestrationResult>;
|
|
28
28
|
resumeFlowRunV2(id: string, values: SchemaValuesV2): Promise<OrchestrationResult>;
|
|
29
29
|
deleteFlowRun(flowRunId: string): Promise<void>;
|
|
30
|
-
|
|
30
|
+
downloadFlowRunLogs(flowRunId: string, flowRunName: string | null): Promise<void>;
|
|
31
31
|
}
|
package/package.json
CHANGED
package/src/services/Api.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { asArray } from '@prefecthq/prefect-design'
|
|
2
2
|
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, RawAxiosRequestHeaders } from 'axios'
|
|
3
|
+
import { MaybeGetter } from '@/types'
|
|
3
4
|
import { MaybeArray } from '@/types/utilities'
|
|
4
5
|
import { isDefined } from '@/utilities/variables'
|
|
5
6
|
|
|
@@ -29,30 +30,38 @@ export const getAuthorizationHeaders: ApiHeaders = (config) => {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export class Api<T extends PrefectConfig = PrefectConfig> {
|
|
32
|
-
protected readonly apiConfig: T
|
|
33
|
+
protected readonly apiConfig: MaybeGetter<T>
|
|
33
34
|
protected apiHeaders: MaybeArray<ApiHeaders> = [getPrefectUIHeaders, getAuthorizationHeaders]
|
|
34
35
|
protected apiBaseUrl: ApiBaseUrl = getPrefectBaseUrl
|
|
35
36
|
protected routePrefix: string | undefined
|
|
36
37
|
protected instanceSetupHook: AxiosInstanceSetupHook | null
|
|
37
38
|
|
|
38
|
-
public constructor(apiConfig: T
|
|
39
|
+
public constructor(apiConfig: MaybeGetter<T>, instanceSetupHook: AxiosInstanceSetupHook | null = null) {
|
|
39
40
|
this.apiConfig = apiConfig
|
|
40
41
|
this.instanceSetupHook = instanceSetupHook
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
protected getConfig(): T {
|
|
45
|
+
if (typeof this.apiConfig === 'function') {
|
|
46
|
+
return this.apiConfig()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return this.apiConfig
|
|
50
|
+
}
|
|
51
|
+
|
|
43
52
|
protected composeBaseUrl(): string {
|
|
44
53
|
if (typeof this.apiBaseUrl === 'string') {
|
|
45
54
|
return this.apiBaseUrl
|
|
46
55
|
}
|
|
47
56
|
|
|
48
|
-
return this.apiBaseUrl(this.
|
|
57
|
+
return this.apiBaseUrl(this.getConfig())
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
protected composeHeaders(): RawAxiosRequestHeaders {
|
|
52
61
|
const array = asArray(this.apiHeaders)
|
|
53
62
|
|
|
54
63
|
return array.reduce<RawAxiosRequestHeaders>((headers, header) => {
|
|
55
|
-
const value = typeof header === 'function' ? header(this.
|
|
64
|
+
const value = typeof header === 'function' ? header(this.getConfig()) : header
|
|
56
65
|
|
|
57
66
|
return {
|
|
58
67
|
...headers,
|
|
@@ -146,8 +146,8 @@ export class WorkspaceFlowRunsApi extends WorkspaceApi {
|
|
|
146
146
|
return this.delete(`/${flowRunId}`)
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
public async
|
|
150
|
-
const { data } = await this.get<string>(`/${flowRunId}/download
|
|
149
|
+
public async downloadFlowRunLogs(flowRunId: string, flowRunName: string | null): Promise<void> {
|
|
150
|
+
const { data } = await this.get<string>(`/${flowRunId}/logs/download`, {
|
|
151
151
|
responseType: 'stream',
|
|
152
152
|
})
|
|
153
153
|
|