@djvlc/openapi-user-client 1.3.0 → 1.4.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/index.d.mts +96 -19
- package/dist/index.d.ts +96 -19
- package/dist/index.js +44 -67
- package/dist/index.mjs +49 -66
- package/package.json +5 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { BaseClientOptions, Configuration as Configuration$1 } from '@djvlc/openapi-client-core';
|
|
2
|
+
export { AbortError, Configuration, DjvApiError, Interceptors, Logger, Middleware, NetworkError, RequestOptions, RetryOptions, TimeoutError, createConsoleLogger, createSilentLogger, isRetryableError } from '@djvlc/openapi-client-core';
|
|
3
|
+
|
|
1
4
|
interface ConfigurationParameters {
|
|
2
5
|
basePath?: string;
|
|
3
6
|
fetchApi?: FetchAPI;
|
|
@@ -2534,33 +2537,107 @@ declare namespace apis {
|
|
|
2534
2537
|
export { apis_ActionApi as ActionApi, type apis_ActionApiExecuteActionBatchOperationRequest as ActionApiExecuteActionBatchOperationRequest, type apis_ActionApiExecuteActionRequest as ActionApiExecuteActionRequest, type apis_ActionApiInterface as ActionApiInterface, apis_ActivityApi as ActivityApi, type apis_ActivityApiGetActivityStateBatchOperationRequest as ActivityApiGetActivityStateBatchOperationRequest, type apis_ActivityApiGetActivityStateRequest as ActivityApiGetActivityStateRequest, type apis_ActivityApiInterface as ActivityApiInterface, apis_DataApi as DataApi, type apis_DataApiInterface as DataApiInterface, type apis_DataApiQueryDataBatchOperationRequest as DataApiQueryDataBatchOperationRequest, type apis_DataApiQueryDataRequest as DataApiQueryDataRequest, apis_HealthApi as HealthApi, type apis_HealthApiInterface as HealthApiInterface, apis_PageApi as PageApi, type apis_PageApiInterface as PageApiInterface, type apis_PageApiResolvePageBatchOperationRequest as PageApiResolvePageBatchOperationRequest, type apis_PageApiResolvePageRequest as PageApiResolvePageRequest, type apis_ResolvePageChannelEnum as ResolvePageChannelEnum, apis_TrackApi as TrackApi, type apis_TrackApiInterface as TrackApiInterface, type apis_TrackApiTrackOperationRequest as TrackApiTrackOperationRequest };
|
|
2535
2538
|
}
|
|
2536
2539
|
|
|
2537
|
-
|
|
2540
|
+
/**
|
|
2541
|
+
* @djvlc/openapi-user-client - User API 客户端
|
|
2542
|
+
*
|
|
2543
|
+
* 用于 Runtime 访问 User API(数据面)。
|
|
2544
|
+
*
|
|
2545
|
+
* @example
|
|
2546
|
+
* ```typescript
|
|
2547
|
+
* import { createUserClient, DjvApiError, TimeoutError } from '@djvlc/openapi-user-client';
|
|
2548
|
+
*
|
|
2549
|
+
* const client = createUserClient({
|
|
2550
|
+
* baseUrl: 'https://api.example.com',
|
|
2551
|
+
* getAuthToken: () => localStorage.getItem('token') ?? '',
|
|
2552
|
+
* getTraceHeaders: () => ({ traceparent: '00-...' }),
|
|
2553
|
+
* retry: { maxRetries: 2 },
|
|
2554
|
+
* });
|
|
2555
|
+
*
|
|
2556
|
+
* try {
|
|
2557
|
+
* const page = await client.PageApi.resolvePage({ pageUid: 'xxx' });
|
|
2558
|
+
* } catch (e) {
|
|
2559
|
+
* if (DjvApiError.is(e)) {
|
|
2560
|
+
* console.log('业务错误:', e.code, e.traceId);
|
|
2561
|
+
* } else if (TimeoutError.is(e)) {
|
|
2562
|
+
* console.log('请求超时');
|
|
2563
|
+
* }
|
|
2564
|
+
* }
|
|
2565
|
+
* ```
|
|
2566
|
+
*/
|
|
2567
|
+
|
|
2568
|
+
interface UserClientOptions extends Omit<BaseClientOptions, 'baseUrl'> {
|
|
2569
|
+
/** API 基础 URL */
|
|
2538
2570
|
baseUrl: string;
|
|
2539
|
-
/**
|
|
2571
|
+
/**
|
|
2572
|
+
* 获取认证 Token
|
|
2573
|
+
*
|
|
2574
|
+
* User API 可能需要登录态(也可能不需要)
|
|
2575
|
+
*/
|
|
2540
2576
|
getAuthToken?: () => string | Promise<string>;
|
|
2541
|
-
/**
|
|
2577
|
+
/**
|
|
2578
|
+
* 获取追踪头
|
|
2579
|
+
*
|
|
2580
|
+
* OpenTelemetry: traceparent, baggage 等
|
|
2581
|
+
*/
|
|
2542
2582
|
getTraceHeaders?: () => Record<string, string>;
|
|
2543
|
-
/**
|
|
2583
|
+
/**
|
|
2584
|
+
* 默认请求头
|
|
2585
|
+
*
|
|
2586
|
+
* 如 x-device-id, x-channel, x-app-key 等
|
|
2587
|
+
*/
|
|
2544
2588
|
defaultHeaders?: Record<string, string>;
|
|
2545
|
-
/**
|
|
2589
|
+
/**
|
|
2590
|
+
* 超时时间(毫秒)
|
|
2591
|
+
*
|
|
2592
|
+
* @default 15000 (User API 追求快失败)
|
|
2593
|
+
*/
|
|
2546
2594
|
timeoutMs?: number;
|
|
2547
|
-
|
|
2548
|
-
|
|
2595
|
+
/**
|
|
2596
|
+
* Cookie 策略
|
|
2597
|
+
*
|
|
2598
|
+
* @default 'omit' (User API 通常不走 Cookie)
|
|
2599
|
+
*/
|
|
2549
2600
|
credentials?: RequestCredentials;
|
|
2550
2601
|
}
|
|
2551
|
-
type
|
|
2552
|
-
|
|
2602
|
+
type ApiClasses = typeof apis;
|
|
2603
|
+
type ApiInstanceMap = {
|
|
2604
|
+
[K in keyof ApiClasses as K extends `${string}Api` ? ApiClasses[K] extends new (...args: unknown[]) => unknown ? K : never : never]: ApiClasses[K] extends new (...args: unknown[]) => infer T ? T : never;
|
|
2553
2605
|
};
|
|
2606
|
+
/**
|
|
2607
|
+
* 创建 User API 客户端
|
|
2608
|
+
*
|
|
2609
|
+
* @param opts - 客户端配置
|
|
2610
|
+
* @returns 包含所有 API 实例的客户端对象
|
|
2611
|
+
*
|
|
2612
|
+
* @example
|
|
2613
|
+
* ```typescript
|
|
2614
|
+
* const client = createUserClient({
|
|
2615
|
+
* baseUrl: 'https://api.example.com',
|
|
2616
|
+
* getAuthToken: () => getToken(),
|
|
2617
|
+
* defaultHeaders: {
|
|
2618
|
+
* 'x-device-id': deviceId,
|
|
2619
|
+
* 'x-channel': 'h5',
|
|
2620
|
+
* },
|
|
2621
|
+
* retry: { maxRetries: 2 },
|
|
2622
|
+
* });
|
|
2623
|
+
*
|
|
2624
|
+
* // 解析页面
|
|
2625
|
+
* const page = await client.PageApi.resolvePage({ pageUid: 'xxx' });
|
|
2626
|
+
*
|
|
2627
|
+
* // 执行动作
|
|
2628
|
+
* const result = await client.ActionsApi.executeAction({
|
|
2629
|
+
* actionExecuteRequest: {
|
|
2630
|
+
* actionType: 'claim',
|
|
2631
|
+
* params: { activityId: 'xxx' },
|
|
2632
|
+
* context: {},
|
|
2633
|
+
* },
|
|
2634
|
+
* });
|
|
2635
|
+
* ```
|
|
2636
|
+
*/
|
|
2554
2637
|
declare function createUserClient(opts: UserClientOptions): {
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
HealthApi: HealthApi;
|
|
2559
|
-
PageApi: PageApi;
|
|
2560
|
-
TrackApi: TrackApi;
|
|
2561
|
-
config: Configuration;
|
|
2562
|
-
apis: ApiInstances;
|
|
2563
|
-
};
|
|
2638
|
+
config: Configuration$1;
|
|
2639
|
+
apis: ApiInstanceMap;
|
|
2640
|
+
} & ApiInstanceMap;
|
|
2564
2641
|
type UserClient = ReturnType<typeof createUserClient>;
|
|
2565
2642
|
|
|
2566
|
-
export { ActionApi, type ActionApiExecuteActionBatchOperationRequest, type ActionApiExecuteActionRequest, type ActionApiInterface, type ActionContext, ActionContextFromJSON, ActionContextFromJSONTyped, ActionContextToJSON, ActionContextToJSONTyped, type ActionExecuteRequest, ActionExecuteRequestFromJSON, ActionExecuteRequestFromJSONTyped, ActionExecuteRequestToJSON, ActionExecuteRequestToJSONTyped, type ActionExecuteResponse, ActionExecuteResponseFromJSON, ActionExecuteResponseFromJSONTyped, ActionExecuteResponseToJSON, ActionExecuteResponseToJSONTyped, ActivityApi, type ActivityApiGetActivityStateBatchOperationRequest, type ActivityApiGetActivityStateRequest, type ActivityApiInterface, type ActivityState, type ActivityStateActivityInfo, ActivityStateActivityInfoFromJSON, ActivityStateActivityInfoFromJSONTyped, ActivityStateActivityInfoToJSON, ActivityStateActivityInfoToJSONTyped, ActivityStateFromJSON, ActivityStateFromJSONTyped, type ActivityStateResponse, ActivityStateResponseFromJSON, ActivityStateResponseFromJSONTyped, ActivityStateResponseToJSON, ActivityStateResponseToJSONTyped, ActivityStateStatusEnum, ActivityStateToJSON, ActivityStateToJSONTyped, type BaseResponseVo, BaseResponseVoFromJSON, BaseResponseVoFromJSONTyped, BaseResponseVoToJSON, BaseResponseVoToJSONTyped, type BlockedComponent, BlockedComponentFromJSON, BlockedComponentFromJSONTyped, BlockedComponentToJSON, BlockedComponentToJSONTyped,
|
|
2643
|
+
export { ActionApi, type ActionApiExecuteActionBatchOperationRequest, type ActionApiExecuteActionRequest, type ActionApiInterface, type ActionContext, ActionContextFromJSON, ActionContextFromJSONTyped, ActionContextToJSON, ActionContextToJSONTyped, type ActionExecuteRequest, ActionExecuteRequestFromJSON, ActionExecuteRequestFromJSONTyped, ActionExecuteRequestToJSON, ActionExecuteRequestToJSONTyped, type ActionExecuteResponse, ActionExecuteResponseFromJSON, ActionExecuteResponseFromJSONTyped, ActionExecuteResponseToJSON, ActionExecuteResponseToJSONTyped, ActivityApi, type ActivityApiGetActivityStateBatchOperationRequest, type ActivityApiGetActivityStateRequest, type ActivityApiInterface, type ActivityState, type ActivityStateActivityInfo, ActivityStateActivityInfoFromJSON, ActivityStateActivityInfoFromJSONTyped, ActivityStateActivityInfoToJSON, ActivityStateActivityInfoToJSONTyped, ActivityStateFromJSON, ActivityStateFromJSONTyped, type ActivityStateResponse, ActivityStateResponseFromJSON, ActivityStateResponseFromJSONTyped, ActivityStateResponseToJSON, ActivityStateResponseToJSONTyped, ActivityStateStatusEnum, ActivityStateToJSON, ActivityStateToJSONTyped, type BaseResponseVo, BaseResponseVoFromJSON, BaseResponseVoFromJSONTyped, BaseResponseVoToJSON, BaseResponseVoToJSONTyped, type BlockedComponent, BlockedComponentFromJSON, BlockedComponentFromJSONTyped, BlockedComponentToJSON, BlockedComponentToJSONTyped, DataApi, type DataApiInterface, type DataApiQueryDataBatchOperationRequest, type DataApiQueryDataRequest, type DataQueryContext, DataQueryContextFromJSON, DataQueryContextFromJSONTyped, DataQueryContextToJSON, DataQueryContextToJSONTyped, type DataQueryRequest, DataQueryRequestFromJSON, DataQueryRequestFromJSONTyped, DataQueryRequestToJSON, DataQueryRequestToJSONTyped, type DataQueryResponse, DataQueryResponseFromJSON, DataQueryResponseFromJSONTyped, DataQueryResponseToJSON, DataQueryResponseToJSONTyped, type ErrorDetail, ErrorDetailFromJSON, ErrorDetailFromJSONTyped, ErrorDetailToJSON, ErrorDetailToJSONTyped, type ErrorResponseVo, ErrorResponseVoFromJSON, ErrorResponseVoFromJSONTyped, ErrorResponseVoToJSON, ErrorResponseVoToJSONTyped, type ExecuteActionBatch200Response, ExecuteActionBatch200ResponseFromJSON, ExecuteActionBatch200ResponseFromJSONTyped, ExecuteActionBatch200ResponseToJSON, ExecuteActionBatch200ResponseToJSONTyped, type ExecuteActionBatchRequest, ExecuteActionBatchRequestFromJSON, ExecuteActionBatchRequestFromJSONTyped, ExecuteActionBatchRequestToJSON, ExecuteActionBatchRequestToJSONTyped, type GetActivityStateBatch200Response, GetActivityStateBatch200ResponseFromJSON, GetActivityStateBatch200ResponseFromJSONTyped, GetActivityStateBatch200ResponseToJSON, GetActivityStateBatch200ResponseToJSONTyped, type GetActivityStateBatchRequest, GetActivityStateBatchRequestFromJSON, GetActivityStateBatchRequestFromJSONTyped, GetActivityStateBatchRequestToJSON, GetActivityStateBatchRequestToJSONTyped, HealthApi, type HealthApiInterface, type HealthResponse, type HealthResponseChecksValue, HealthResponseChecksValueFromJSON, HealthResponseChecksValueFromJSONTyped, HealthResponseChecksValueToJSON, HealthResponseChecksValueToJSONTyped, HealthResponseFromJSON, HealthResponseFromJSONTyped, HealthResponseStatusEnum, HealthResponseToJSON, HealthResponseToJSONTyped, type ManifestItem, ManifestItemFromJSON, ManifestItemFromJSONTyped, ManifestItemToJSON, ManifestItemToJSONTyped, PageApi, type PageApiInterface, type PageApiResolvePageBatchOperationRequest, type PageApiResolvePageRequest, type PageManifest, PageManifestFromJSON, PageManifestFromJSONTyped, PageManifestToJSON, PageManifestToJSONTyped, type PageResolveResponse, PageResolveResponseFromJSON, PageResolveResponseFromJSONTyped, PageResolveResponseToJSON, PageResolveResponseToJSONTyped, type PageResolveResult, PageResolveResultFromJSON, PageResolveResultFromJSONTyped, PageResolveResultToJSON, PageResolveResultToJSONTyped, type QueryDataBatch200Response, QueryDataBatch200ResponseFromJSON, QueryDataBatch200ResponseFromJSONTyped, QueryDataBatch200ResponseToJSON, QueryDataBatch200ResponseToJSONTyped, type QueryDataBatchRequest, QueryDataBatchRequestFromJSON, QueryDataBatchRequestFromJSONTyped, QueryDataBatchRequestToJSON, QueryDataBatchRequestToJSONTyped, type ResolvePageBatch200Response, ResolvePageBatch200ResponseFromJSON, ResolvePageBatch200ResponseFromJSONTyped, ResolvePageBatch200ResponseToJSON, ResolvePageBatch200ResponseToJSONTyped, type ResolvePageBatchRequest, ResolvePageBatchRequestChannelEnum, ResolvePageBatchRequestFromJSON, ResolvePageBatchRequestFromJSONTyped, ResolvePageBatchRequestToJSON, ResolvePageBatchRequestToJSONTyped, ResolvePageChannelEnum, type RuntimeConfig, RuntimeConfigFromJSON, RuntimeConfigFromJSONTyped, type RuntimeConfigReportConfig, RuntimeConfigReportConfigFromJSON, RuntimeConfigReportConfigFromJSONTyped, RuntimeConfigReportConfigToJSON, RuntimeConfigReportConfigToJSONTyped, RuntimeConfigToJSON, RuntimeConfigToJSONTyped, type TraceContext, TraceContextFromJSON, TraceContextFromJSONTyped, TraceContextToJSON, TraceContextToJSONTyped, TrackApi, type TrackApiInterface, type TrackApiTrackOperationRequest, type TrackContext, TrackContextFromJSON, TrackContextFromJSONTyped, TrackContextToJSON, TrackContextToJSONTyped, type TrackEvent, TrackEventEventTypeEnum, TrackEventFromJSON, TrackEventFromJSONTyped, TrackEventToJSON, TrackEventToJSONTyped, type TrackRequest, TrackRequestFromJSON, TrackRequestFromJSONTyped, TrackRequestToJSON, TrackRequestToJSONTyped, type UserActivityState, UserActivityStateFromJSON, UserActivityStateFromJSONTyped, type UserActivityStateProgress, UserActivityStateProgressFromJSON, UserActivityStateProgressFromJSONTyped, UserActivityStateProgressToJSON, UserActivityStateProgressToJSONTyped, UserActivityStateToJSON, UserActivityStateToJSONTyped, type UserClient, type UserClientOptions, createUserClient, instanceOfActionContext, instanceOfActionExecuteRequest, instanceOfActionExecuteResponse, instanceOfActivityState, instanceOfActivityStateActivityInfo, instanceOfActivityStateResponse, instanceOfBaseResponseVo, instanceOfBlockedComponent, instanceOfDataQueryContext, instanceOfDataQueryRequest, instanceOfDataQueryResponse, instanceOfErrorDetail, instanceOfErrorResponseVo, instanceOfExecuteActionBatch200Response, instanceOfExecuteActionBatchRequest, instanceOfGetActivityStateBatch200Response, instanceOfGetActivityStateBatchRequest, instanceOfHealthResponse, instanceOfHealthResponseChecksValue, instanceOfManifestItem, instanceOfPageManifest, instanceOfPageResolveResponse, instanceOfPageResolveResult, instanceOfQueryDataBatch200Response, instanceOfQueryDataBatchRequest, instanceOfResolvePageBatch200Response, instanceOfResolvePageBatchRequest, instanceOfRuntimeConfig, instanceOfRuntimeConfigReportConfig, instanceOfTraceContext, instanceOfTrackContext, instanceOfTrackEvent, instanceOfTrackRequest, instanceOfUserActivityState, instanceOfUserActivityStateProgress };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { BaseClientOptions, Configuration as Configuration$1 } from '@djvlc/openapi-client-core';
|
|
2
|
+
export { AbortError, Configuration, DjvApiError, Interceptors, Logger, Middleware, NetworkError, RequestOptions, RetryOptions, TimeoutError, createConsoleLogger, createSilentLogger, isRetryableError } from '@djvlc/openapi-client-core';
|
|
3
|
+
|
|
1
4
|
interface ConfigurationParameters {
|
|
2
5
|
basePath?: string;
|
|
3
6
|
fetchApi?: FetchAPI;
|
|
@@ -2534,33 +2537,107 @@ declare namespace apis {
|
|
|
2534
2537
|
export { apis_ActionApi as ActionApi, type apis_ActionApiExecuteActionBatchOperationRequest as ActionApiExecuteActionBatchOperationRequest, type apis_ActionApiExecuteActionRequest as ActionApiExecuteActionRequest, type apis_ActionApiInterface as ActionApiInterface, apis_ActivityApi as ActivityApi, type apis_ActivityApiGetActivityStateBatchOperationRequest as ActivityApiGetActivityStateBatchOperationRequest, type apis_ActivityApiGetActivityStateRequest as ActivityApiGetActivityStateRequest, type apis_ActivityApiInterface as ActivityApiInterface, apis_DataApi as DataApi, type apis_DataApiInterface as DataApiInterface, type apis_DataApiQueryDataBatchOperationRequest as DataApiQueryDataBatchOperationRequest, type apis_DataApiQueryDataRequest as DataApiQueryDataRequest, apis_HealthApi as HealthApi, type apis_HealthApiInterface as HealthApiInterface, apis_PageApi as PageApi, type apis_PageApiInterface as PageApiInterface, type apis_PageApiResolvePageBatchOperationRequest as PageApiResolvePageBatchOperationRequest, type apis_PageApiResolvePageRequest as PageApiResolvePageRequest, type apis_ResolvePageChannelEnum as ResolvePageChannelEnum, apis_TrackApi as TrackApi, type apis_TrackApiInterface as TrackApiInterface, type apis_TrackApiTrackOperationRequest as TrackApiTrackOperationRequest };
|
|
2535
2538
|
}
|
|
2536
2539
|
|
|
2537
|
-
|
|
2540
|
+
/**
|
|
2541
|
+
* @djvlc/openapi-user-client - User API 客户端
|
|
2542
|
+
*
|
|
2543
|
+
* 用于 Runtime 访问 User API(数据面)。
|
|
2544
|
+
*
|
|
2545
|
+
* @example
|
|
2546
|
+
* ```typescript
|
|
2547
|
+
* import { createUserClient, DjvApiError, TimeoutError } from '@djvlc/openapi-user-client';
|
|
2548
|
+
*
|
|
2549
|
+
* const client = createUserClient({
|
|
2550
|
+
* baseUrl: 'https://api.example.com',
|
|
2551
|
+
* getAuthToken: () => localStorage.getItem('token') ?? '',
|
|
2552
|
+
* getTraceHeaders: () => ({ traceparent: '00-...' }),
|
|
2553
|
+
* retry: { maxRetries: 2 },
|
|
2554
|
+
* });
|
|
2555
|
+
*
|
|
2556
|
+
* try {
|
|
2557
|
+
* const page = await client.PageApi.resolvePage({ pageUid: 'xxx' });
|
|
2558
|
+
* } catch (e) {
|
|
2559
|
+
* if (DjvApiError.is(e)) {
|
|
2560
|
+
* console.log('业务错误:', e.code, e.traceId);
|
|
2561
|
+
* } else if (TimeoutError.is(e)) {
|
|
2562
|
+
* console.log('请求超时');
|
|
2563
|
+
* }
|
|
2564
|
+
* }
|
|
2565
|
+
* ```
|
|
2566
|
+
*/
|
|
2567
|
+
|
|
2568
|
+
interface UserClientOptions extends Omit<BaseClientOptions, 'baseUrl'> {
|
|
2569
|
+
/** API 基础 URL */
|
|
2538
2570
|
baseUrl: string;
|
|
2539
|
-
/**
|
|
2571
|
+
/**
|
|
2572
|
+
* 获取认证 Token
|
|
2573
|
+
*
|
|
2574
|
+
* User API 可能需要登录态(也可能不需要)
|
|
2575
|
+
*/
|
|
2540
2576
|
getAuthToken?: () => string | Promise<string>;
|
|
2541
|
-
/**
|
|
2577
|
+
/**
|
|
2578
|
+
* 获取追踪头
|
|
2579
|
+
*
|
|
2580
|
+
* OpenTelemetry: traceparent, baggage 等
|
|
2581
|
+
*/
|
|
2542
2582
|
getTraceHeaders?: () => Record<string, string>;
|
|
2543
|
-
/**
|
|
2583
|
+
/**
|
|
2584
|
+
* 默认请求头
|
|
2585
|
+
*
|
|
2586
|
+
* 如 x-device-id, x-channel, x-app-key 等
|
|
2587
|
+
*/
|
|
2544
2588
|
defaultHeaders?: Record<string, string>;
|
|
2545
|
-
/**
|
|
2589
|
+
/**
|
|
2590
|
+
* 超时时间(毫秒)
|
|
2591
|
+
*
|
|
2592
|
+
* @default 15000 (User API 追求快失败)
|
|
2593
|
+
*/
|
|
2546
2594
|
timeoutMs?: number;
|
|
2547
|
-
|
|
2548
|
-
|
|
2595
|
+
/**
|
|
2596
|
+
* Cookie 策略
|
|
2597
|
+
*
|
|
2598
|
+
* @default 'omit' (User API 通常不走 Cookie)
|
|
2599
|
+
*/
|
|
2549
2600
|
credentials?: RequestCredentials;
|
|
2550
2601
|
}
|
|
2551
|
-
type
|
|
2552
|
-
|
|
2602
|
+
type ApiClasses = typeof apis;
|
|
2603
|
+
type ApiInstanceMap = {
|
|
2604
|
+
[K in keyof ApiClasses as K extends `${string}Api` ? ApiClasses[K] extends new (...args: unknown[]) => unknown ? K : never : never]: ApiClasses[K] extends new (...args: unknown[]) => infer T ? T : never;
|
|
2553
2605
|
};
|
|
2606
|
+
/**
|
|
2607
|
+
* 创建 User API 客户端
|
|
2608
|
+
*
|
|
2609
|
+
* @param opts - 客户端配置
|
|
2610
|
+
* @returns 包含所有 API 实例的客户端对象
|
|
2611
|
+
*
|
|
2612
|
+
* @example
|
|
2613
|
+
* ```typescript
|
|
2614
|
+
* const client = createUserClient({
|
|
2615
|
+
* baseUrl: 'https://api.example.com',
|
|
2616
|
+
* getAuthToken: () => getToken(),
|
|
2617
|
+
* defaultHeaders: {
|
|
2618
|
+
* 'x-device-id': deviceId,
|
|
2619
|
+
* 'x-channel': 'h5',
|
|
2620
|
+
* },
|
|
2621
|
+
* retry: { maxRetries: 2 },
|
|
2622
|
+
* });
|
|
2623
|
+
*
|
|
2624
|
+
* // 解析页面
|
|
2625
|
+
* const page = await client.PageApi.resolvePage({ pageUid: 'xxx' });
|
|
2626
|
+
*
|
|
2627
|
+
* // 执行动作
|
|
2628
|
+
* const result = await client.ActionsApi.executeAction({
|
|
2629
|
+
* actionExecuteRequest: {
|
|
2630
|
+
* actionType: 'claim',
|
|
2631
|
+
* params: { activityId: 'xxx' },
|
|
2632
|
+
* context: {},
|
|
2633
|
+
* },
|
|
2634
|
+
* });
|
|
2635
|
+
* ```
|
|
2636
|
+
*/
|
|
2554
2637
|
declare function createUserClient(opts: UserClientOptions): {
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
HealthApi: HealthApi;
|
|
2559
|
-
PageApi: PageApi;
|
|
2560
|
-
TrackApi: TrackApi;
|
|
2561
|
-
config: Configuration;
|
|
2562
|
-
apis: ApiInstances;
|
|
2563
|
-
};
|
|
2638
|
+
config: Configuration$1;
|
|
2639
|
+
apis: ApiInstanceMap;
|
|
2640
|
+
} & ApiInstanceMap;
|
|
2564
2641
|
type UserClient = ReturnType<typeof createUserClient>;
|
|
2565
2642
|
|
|
2566
|
-
export { ActionApi, type ActionApiExecuteActionBatchOperationRequest, type ActionApiExecuteActionRequest, type ActionApiInterface, type ActionContext, ActionContextFromJSON, ActionContextFromJSONTyped, ActionContextToJSON, ActionContextToJSONTyped, type ActionExecuteRequest, ActionExecuteRequestFromJSON, ActionExecuteRequestFromJSONTyped, ActionExecuteRequestToJSON, ActionExecuteRequestToJSONTyped, type ActionExecuteResponse, ActionExecuteResponseFromJSON, ActionExecuteResponseFromJSONTyped, ActionExecuteResponseToJSON, ActionExecuteResponseToJSONTyped, ActivityApi, type ActivityApiGetActivityStateBatchOperationRequest, type ActivityApiGetActivityStateRequest, type ActivityApiInterface, type ActivityState, type ActivityStateActivityInfo, ActivityStateActivityInfoFromJSON, ActivityStateActivityInfoFromJSONTyped, ActivityStateActivityInfoToJSON, ActivityStateActivityInfoToJSONTyped, ActivityStateFromJSON, ActivityStateFromJSONTyped, type ActivityStateResponse, ActivityStateResponseFromJSON, ActivityStateResponseFromJSONTyped, ActivityStateResponseToJSON, ActivityStateResponseToJSONTyped, ActivityStateStatusEnum, ActivityStateToJSON, ActivityStateToJSONTyped, type BaseResponseVo, BaseResponseVoFromJSON, BaseResponseVoFromJSONTyped, BaseResponseVoToJSON, BaseResponseVoToJSONTyped, type BlockedComponent, BlockedComponentFromJSON, BlockedComponentFromJSONTyped, BlockedComponentToJSON, BlockedComponentToJSONTyped,
|
|
2643
|
+
export { ActionApi, type ActionApiExecuteActionBatchOperationRequest, type ActionApiExecuteActionRequest, type ActionApiInterface, type ActionContext, ActionContextFromJSON, ActionContextFromJSONTyped, ActionContextToJSON, ActionContextToJSONTyped, type ActionExecuteRequest, ActionExecuteRequestFromJSON, ActionExecuteRequestFromJSONTyped, ActionExecuteRequestToJSON, ActionExecuteRequestToJSONTyped, type ActionExecuteResponse, ActionExecuteResponseFromJSON, ActionExecuteResponseFromJSONTyped, ActionExecuteResponseToJSON, ActionExecuteResponseToJSONTyped, ActivityApi, type ActivityApiGetActivityStateBatchOperationRequest, type ActivityApiGetActivityStateRequest, type ActivityApiInterface, type ActivityState, type ActivityStateActivityInfo, ActivityStateActivityInfoFromJSON, ActivityStateActivityInfoFromJSONTyped, ActivityStateActivityInfoToJSON, ActivityStateActivityInfoToJSONTyped, ActivityStateFromJSON, ActivityStateFromJSONTyped, type ActivityStateResponse, ActivityStateResponseFromJSON, ActivityStateResponseFromJSONTyped, ActivityStateResponseToJSON, ActivityStateResponseToJSONTyped, ActivityStateStatusEnum, ActivityStateToJSON, ActivityStateToJSONTyped, type BaseResponseVo, BaseResponseVoFromJSON, BaseResponseVoFromJSONTyped, BaseResponseVoToJSON, BaseResponseVoToJSONTyped, type BlockedComponent, BlockedComponentFromJSON, BlockedComponentFromJSONTyped, BlockedComponentToJSON, BlockedComponentToJSONTyped, DataApi, type DataApiInterface, type DataApiQueryDataBatchOperationRequest, type DataApiQueryDataRequest, type DataQueryContext, DataQueryContextFromJSON, DataQueryContextFromJSONTyped, DataQueryContextToJSON, DataQueryContextToJSONTyped, type DataQueryRequest, DataQueryRequestFromJSON, DataQueryRequestFromJSONTyped, DataQueryRequestToJSON, DataQueryRequestToJSONTyped, type DataQueryResponse, DataQueryResponseFromJSON, DataQueryResponseFromJSONTyped, DataQueryResponseToJSON, DataQueryResponseToJSONTyped, type ErrorDetail, ErrorDetailFromJSON, ErrorDetailFromJSONTyped, ErrorDetailToJSON, ErrorDetailToJSONTyped, type ErrorResponseVo, ErrorResponseVoFromJSON, ErrorResponseVoFromJSONTyped, ErrorResponseVoToJSON, ErrorResponseVoToJSONTyped, type ExecuteActionBatch200Response, ExecuteActionBatch200ResponseFromJSON, ExecuteActionBatch200ResponseFromJSONTyped, ExecuteActionBatch200ResponseToJSON, ExecuteActionBatch200ResponseToJSONTyped, type ExecuteActionBatchRequest, ExecuteActionBatchRequestFromJSON, ExecuteActionBatchRequestFromJSONTyped, ExecuteActionBatchRequestToJSON, ExecuteActionBatchRequestToJSONTyped, type GetActivityStateBatch200Response, GetActivityStateBatch200ResponseFromJSON, GetActivityStateBatch200ResponseFromJSONTyped, GetActivityStateBatch200ResponseToJSON, GetActivityStateBatch200ResponseToJSONTyped, type GetActivityStateBatchRequest, GetActivityStateBatchRequestFromJSON, GetActivityStateBatchRequestFromJSONTyped, GetActivityStateBatchRequestToJSON, GetActivityStateBatchRequestToJSONTyped, HealthApi, type HealthApiInterface, type HealthResponse, type HealthResponseChecksValue, HealthResponseChecksValueFromJSON, HealthResponseChecksValueFromJSONTyped, HealthResponseChecksValueToJSON, HealthResponseChecksValueToJSONTyped, HealthResponseFromJSON, HealthResponseFromJSONTyped, HealthResponseStatusEnum, HealthResponseToJSON, HealthResponseToJSONTyped, type ManifestItem, ManifestItemFromJSON, ManifestItemFromJSONTyped, ManifestItemToJSON, ManifestItemToJSONTyped, PageApi, type PageApiInterface, type PageApiResolvePageBatchOperationRequest, type PageApiResolvePageRequest, type PageManifest, PageManifestFromJSON, PageManifestFromJSONTyped, PageManifestToJSON, PageManifestToJSONTyped, type PageResolveResponse, PageResolveResponseFromJSON, PageResolveResponseFromJSONTyped, PageResolveResponseToJSON, PageResolveResponseToJSONTyped, type PageResolveResult, PageResolveResultFromJSON, PageResolveResultFromJSONTyped, PageResolveResultToJSON, PageResolveResultToJSONTyped, type QueryDataBatch200Response, QueryDataBatch200ResponseFromJSON, QueryDataBatch200ResponseFromJSONTyped, QueryDataBatch200ResponseToJSON, QueryDataBatch200ResponseToJSONTyped, type QueryDataBatchRequest, QueryDataBatchRequestFromJSON, QueryDataBatchRequestFromJSONTyped, QueryDataBatchRequestToJSON, QueryDataBatchRequestToJSONTyped, type ResolvePageBatch200Response, ResolvePageBatch200ResponseFromJSON, ResolvePageBatch200ResponseFromJSONTyped, ResolvePageBatch200ResponseToJSON, ResolvePageBatch200ResponseToJSONTyped, type ResolvePageBatchRequest, ResolvePageBatchRequestChannelEnum, ResolvePageBatchRequestFromJSON, ResolvePageBatchRequestFromJSONTyped, ResolvePageBatchRequestToJSON, ResolvePageBatchRequestToJSONTyped, ResolvePageChannelEnum, type RuntimeConfig, RuntimeConfigFromJSON, RuntimeConfigFromJSONTyped, type RuntimeConfigReportConfig, RuntimeConfigReportConfigFromJSON, RuntimeConfigReportConfigFromJSONTyped, RuntimeConfigReportConfigToJSON, RuntimeConfigReportConfigToJSONTyped, RuntimeConfigToJSON, RuntimeConfigToJSONTyped, type TraceContext, TraceContextFromJSON, TraceContextFromJSONTyped, TraceContextToJSON, TraceContextToJSONTyped, TrackApi, type TrackApiInterface, type TrackApiTrackOperationRequest, type TrackContext, TrackContextFromJSON, TrackContextFromJSONTyped, TrackContextToJSON, TrackContextToJSONTyped, type TrackEvent, TrackEventEventTypeEnum, TrackEventFromJSON, TrackEventFromJSONTyped, TrackEventToJSON, TrackEventToJSONTyped, type TrackRequest, TrackRequestFromJSON, TrackRequestFromJSONTyped, TrackRequestToJSON, TrackRequestToJSONTyped, type UserActivityState, UserActivityStateFromJSON, UserActivityStateFromJSONTyped, type UserActivityStateProgress, UserActivityStateProgressFromJSON, UserActivityStateProgressFromJSONTyped, UserActivityStateProgressToJSON, UserActivityStateProgressToJSONTyped, UserActivityStateToJSON, UserActivityStateToJSONTyped, type UserClient, type UserClientOptions, createUserClient, instanceOfActionContext, instanceOfActionExecuteRequest, instanceOfActionExecuteResponse, instanceOfActivityState, instanceOfActivityStateActivityInfo, instanceOfActivityStateResponse, instanceOfBaseResponseVo, instanceOfBlockedComponent, instanceOfDataQueryContext, instanceOfDataQueryRequest, instanceOfDataQueryResponse, instanceOfErrorDetail, instanceOfErrorResponseVo, instanceOfExecuteActionBatch200Response, instanceOfExecuteActionBatchRequest, instanceOfGetActivityStateBatch200Response, instanceOfGetActivityStateBatchRequest, instanceOfHealthResponse, instanceOfHealthResponseChecksValue, instanceOfManifestItem, instanceOfPageManifest, instanceOfPageResolveResponse, instanceOfPageResolveResult, instanceOfQueryDataBatch200Response, instanceOfQueryDataBatchRequest, instanceOfResolvePageBatch200Response, instanceOfResolvePageBatchRequest, instanceOfRuntimeConfig, instanceOfRuntimeConfigReportConfig, instanceOfTraceContext, instanceOfTrackContext, instanceOfTrackEvent, instanceOfTrackRequest, instanceOfUserActivityState, instanceOfUserActivityStateProgress };
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
AbortError: () => import_openapi_client_core2.AbortError,
|
|
23
24
|
ActionApi: () => ActionApi,
|
|
24
25
|
ActionContextFromJSON: () => ActionContextFromJSON,
|
|
25
26
|
ActionContextFromJSONTyped: () => ActionContextFromJSONTyped,
|
|
@@ -55,7 +56,7 @@ __export(index_exports, {
|
|
|
55
56
|
BlockedComponentFromJSONTyped: () => BlockedComponentFromJSONTyped,
|
|
56
57
|
BlockedComponentToJSON: () => BlockedComponentToJSON,
|
|
57
58
|
BlockedComponentToJSONTyped: () => BlockedComponentToJSONTyped,
|
|
58
|
-
Configuration: () => Configuration,
|
|
59
|
+
Configuration: () => import_openapi_client_core2.Configuration,
|
|
59
60
|
DataApi: () => DataApi,
|
|
60
61
|
DataQueryContextFromJSON: () => DataQueryContextFromJSON,
|
|
61
62
|
DataQueryContextFromJSONTyped: () => DataQueryContextFromJSONTyped,
|
|
@@ -69,6 +70,7 @@ __export(index_exports, {
|
|
|
69
70
|
DataQueryResponseFromJSONTyped: () => DataQueryResponseFromJSONTyped,
|
|
70
71
|
DataQueryResponseToJSON: () => DataQueryResponseToJSON,
|
|
71
72
|
DataQueryResponseToJSONTyped: () => DataQueryResponseToJSONTyped,
|
|
73
|
+
DjvApiError: () => import_openapi_client_core2.DjvApiError,
|
|
72
74
|
ErrorDetailFromJSON: () => ErrorDetailFromJSON,
|
|
73
75
|
ErrorDetailFromJSONTyped: () => ErrorDetailFromJSONTyped,
|
|
74
76
|
ErrorDetailToJSON: () => ErrorDetailToJSON,
|
|
@@ -107,6 +109,7 @@ __export(index_exports, {
|
|
|
107
109
|
ManifestItemFromJSONTyped: () => ManifestItemFromJSONTyped,
|
|
108
110
|
ManifestItemToJSON: () => ManifestItemToJSON,
|
|
109
111
|
ManifestItemToJSONTyped: () => ManifestItemToJSONTyped,
|
|
112
|
+
NetworkError: () => import_openapi_client_core2.NetworkError,
|
|
110
113
|
PageApi: () => PageApi,
|
|
111
114
|
PageManifestFromJSON: () => PageManifestFromJSON,
|
|
112
115
|
PageManifestFromJSONTyped: () => PageManifestFromJSONTyped,
|
|
@@ -146,6 +149,7 @@ __export(index_exports, {
|
|
|
146
149
|
RuntimeConfigReportConfigToJSONTyped: () => RuntimeConfigReportConfigToJSONTyped,
|
|
147
150
|
RuntimeConfigToJSON: () => RuntimeConfigToJSON,
|
|
148
151
|
RuntimeConfigToJSONTyped: () => RuntimeConfigToJSONTyped,
|
|
152
|
+
TimeoutError: () => import_openapi_client_core2.TimeoutError,
|
|
149
153
|
TraceContextFromJSON: () => TraceContextFromJSON,
|
|
150
154
|
TraceContextFromJSONTyped: () => TraceContextFromJSONTyped,
|
|
151
155
|
TraceContextToJSON: () => TraceContextToJSON,
|
|
@@ -172,6 +176,8 @@ __export(index_exports, {
|
|
|
172
176
|
UserActivityStateProgressToJSONTyped: () => UserActivityStateProgressToJSONTyped,
|
|
173
177
|
UserActivityStateToJSON: () => UserActivityStateToJSON,
|
|
174
178
|
UserActivityStateToJSONTyped: () => UserActivityStateToJSONTyped,
|
|
179
|
+
createConsoleLogger: () => import_openapi_client_core2.createConsoleLogger,
|
|
180
|
+
createSilentLogger: () => import_openapi_client_core2.createSilentLogger,
|
|
175
181
|
createUserClient: () => createUserClient,
|
|
176
182
|
instanceOfActionContext: () => instanceOfActionContext,
|
|
177
183
|
instanceOfActionExecuteRequest: () => instanceOfActionExecuteRequest,
|
|
@@ -207,9 +213,23 @@ __export(index_exports, {
|
|
|
207
213
|
instanceOfTrackEvent: () => instanceOfTrackEvent,
|
|
208
214
|
instanceOfTrackRequest: () => instanceOfTrackRequest,
|
|
209
215
|
instanceOfUserActivityState: () => instanceOfUserActivityState,
|
|
210
|
-
instanceOfUserActivityStateProgress: () => instanceOfUserActivityStateProgress
|
|
216
|
+
instanceOfUserActivityStateProgress: () => instanceOfUserActivityStateProgress,
|
|
217
|
+
isRetryableError: () => import_openapi_client_core2.isRetryableError
|
|
211
218
|
});
|
|
212
219
|
module.exports = __toCommonJS(index_exports);
|
|
220
|
+
var import_openapi_client_core = require("@djvlc/openapi-client-core");
|
|
221
|
+
|
|
222
|
+
// src/gen/apis/index.ts
|
|
223
|
+
var apis_exports = {};
|
|
224
|
+
__export(apis_exports, {
|
|
225
|
+
ActionApi: () => ActionApi,
|
|
226
|
+
ActivityApi: () => ActivityApi,
|
|
227
|
+
DataApi: () => DataApi,
|
|
228
|
+
HealthApi: () => HealthApi,
|
|
229
|
+
PageApi: () => PageApi,
|
|
230
|
+
ResolvePageChannelEnum: () => ResolvePageChannelEnum,
|
|
231
|
+
TrackApi: () => TrackApi
|
|
232
|
+
});
|
|
213
233
|
|
|
214
234
|
// src/gen/runtime.ts
|
|
215
235
|
var BASE_PATH = "https://api.djvlc.com".replace(/\/+$/, "");
|
|
@@ -468,18 +488,6 @@ var VoidApiResponse = class {
|
|
|
468
488
|
}
|
|
469
489
|
};
|
|
470
490
|
|
|
471
|
-
// src/gen/apis/index.ts
|
|
472
|
-
var apis_exports = {};
|
|
473
|
-
__export(apis_exports, {
|
|
474
|
-
ActionApi: () => ActionApi,
|
|
475
|
-
ActivityApi: () => ActivityApi,
|
|
476
|
-
DataApi: () => DataApi,
|
|
477
|
-
HealthApi: () => HealthApi,
|
|
478
|
-
PageApi: () => PageApi,
|
|
479
|
-
ResolvePageChannelEnum: () => ResolvePageChannelEnum,
|
|
480
|
-
TrackApi: () => TrackApi
|
|
481
|
-
});
|
|
482
|
-
|
|
483
491
|
// src/gen/models/ActionContext.ts
|
|
484
492
|
function instanceOfActionContext(value) {
|
|
485
493
|
return true;
|
|
@@ -2132,64 +2140,27 @@ var TrackApi = class extends BaseAPI {
|
|
|
2132
2140
|
};
|
|
2133
2141
|
|
|
2134
2142
|
// src/index.ts
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
const controller = new AbortController();
|
|
2141
|
-
const id = setTimeout(() => controller.abort(), timeoutMs);
|
|
2142
|
-
try {
|
|
2143
|
-
return await fetchImpl(input, { ...init, signal: controller.signal });
|
|
2144
|
-
} finally {
|
|
2145
|
-
clearTimeout(id);
|
|
2146
|
-
}
|
|
2147
|
-
});
|
|
2148
|
-
}
|
|
2149
|
-
function normalizeHeaders(initHeaders) {
|
|
2150
|
-
return new Headers(initHeaders ?? {});
|
|
2151
|
-
}
|
|
2143
|
+
var import_openapi_client_core2 = require("@djvlc/openapi-client-core");
|
|
2144
|
+
var SDK_INFO = {
|
|
2145
|
+
name: true ? "@djvlc/openapi-user-client" : "@djvlc/openapi-user-client",
|
|
2146
|
+
version: true ? "1.0.0" : "0.0.0-dev"
|
|
2147
|
+
};
|
|
2152
2148
|
function createUserClient(opts) {
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
const headers = normalizeHeaders(context.init.headers);
|
|
2159
|
-
if (opts.defaultHeaders) {
|
|
2160
|
-
for (const [k, v] of Object.entries(opts.defaultHeaders)) headers.set(k, v);
|
|
2161
|
-
}
|
|
2162
|
-
if (opts.getAuthToken) {
|
|
2163
|
-
const token = await opts.getAuthToken();
|
|
2164
|
-
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
2165
|
-
}
|
|
2166
|
-
if (opts.getTraceHeaders) {
|
|
2167
|
-
const traceHeaders = opts.getTraceHeaders();
|
|
2168
|
-
for (const [k, v] of Object.entries(traceHeaders)) headers.set(k, v);
|
|
2169
|
-
}
|
|
2170
|
-
return { url: context.url, init: { ...context.init, headers } };
|
|
2171
|
-
}
|
|
2149
|
+
const defaultOpts = {
|
|
2150
|
+
timeoutMs: 15e3,
|
|
2151
|
+
// User API 追求快失败
|
|
2152
|
+
credentials: "omit"
|
|
2153
|
+
// 通常不走 Cookie
|
|
2172
2154
|
};
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
middleware: [headersMiddleware],
|
|
2177
|
-
credentials: opts.credentials ?? "omit"
|
|
2178
|
-
});
|
|
2179
|
-
const apiInstances = {};
|
|
2180
|
-
for (const [name, ApiClass] of Object.entries(apis_exports)) {
|
|
2181
|
-
if (typeof ApiClass === "function" && name.endsWith("Api")) {
|
|
2182
|
-
apiInstances[name] = new ApiClass(config);
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
return {
|
|
2186
|
-
config,
|
|
2187
|
-
apis: apiInstances,
|
|
2188
|
-
...apiInstances
|
|
2155
|
+
const mergedOpts = {
|
|
2156
|
+
...defaultOpts,
|
|
2157
|
+
...opts
|
|
2189
2158
|
};
|
|
2159
|
+
return (0, import_openapi_client_core.createClient)(apis_exports, mergedOpts, SDK_INFO);
|
|
2190
2160
|
}
|
|
2191
2161
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2192
2162
|
0 && (module.exports = {
|
|
2163
|
+
AbortError,
|
|
2193
2164
|
ActionApi,
|
|
2194
2165
|
ActionContextFromJSON,
|
|
2195
2166
|
ActionContextFromJSONTyped,
|
|
@@ -2239,6 +2210,7 @@ function createUserClient(opts) {
|
|
|
2239
2210
|
DataQueryResponseFromJSONTyped,
|
|
2240
2211
|
DataQueryResponseToJSON,
|
|
2241
2212
|
DataQueryResponseToJSONTyped,
|
|
2213
|
+
DjvApiError,
|
|
2242
2214
|
ErrorDetailFromJSON,
|
|
2243
2215
|
ErrorDetailFromJSONTyped,
|
|
2244
2216
|
ErrorDetailToJSON,
|
|
@@ -2277,6 +2249,7 @@ function createUserClient(opts) {
|
|
|
2277
2249
|
ManifestItemFromJSONTyped,
|
|
2278
2250
|
ManifestItemToJSON,
|
|
2279
2251
|
ManifestItemToJSONTyped,
|
|
2252
|
+
NetworkError,
|
|
2280
2253
|
PageApi,
|
|
2281
2254
|
PageManifestFromJSON,
|
|
2282
2255
|
PageManifestFromJSONTyped,
|
|
@@ -2316,6 +2289,7 @@ function createUserClient(opts) {
|
|
|
2316
2289
|
RuntimeConfigReportConfigToJSONTyped,
|
|
2317
2290
|
RuntimeConfigToJSON,
|
|
2318
2291
|
RuntimeConfigToJSONTyped,
|
|
2292
|
+
TimeoutError,
|
|
2319
2293
|
TraceContextFromJSON,
|
|
2320
2294
|
TraceContextFromJSONTyped,
|
|
2321
2295
|
TraceContextToJSON,
|
|
@@ -2342,6 +2316,8 @@ function createUserClient(opts) {
|
|
|
2342
2316
|
UserActivityStateProgressToJSONTyped,
|
|
2343
2317
|
UserActivityStateToJSON,
|
|
2344
2318
|
UserActivityStateToJSONTyped,
|
|
2319
|
+
createConsoleLogger,
|
|
2320
|
+
createSilentLogger,
|
|
2345
2321
|
createUserClient,
|
|
2346
2322
|
instanceOfActionContext,
|
|
2347
2323
|
instanceOfActionExecuteRequest,
|
|
@@ -2377,5 +2353,6 @@ function createUserClient(opts) {
|
|
|
2377
2353
|
instanceOfTrackEvent,
|
|
2378
2354
|
instanceOfTrackRequest,
|
|
2379
2355
|
instanceOfUserActivityState,
|
|
2380
|
-
instanceOfUserActivityStateProgress
|
|
2356
|
+
instanceOfUserActivityStateProgress,
|
|
2357
|
+
isRetryableError
|
|
2381
2358
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,23 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
// src/index.ts
|
|
8
|
+
import {
|
|
9
|
+
createClient
|
|
10
|
+
} from "@djvlc/openapi-client-core";
|
|
11
|
+
|
|
12
|
+
// src/gen/apis/index.ts
|
|
13
|
+
var apis_exports = {};
|
|
14
|
+
__export(apis_exports, {
|
|
15
|
+
ActionApi: () => ActionApi,
|
|
16
|
+
ActivityApi: () => ActivityApi,
|
|
17
|
+
DataApi: () => DataApi,
|
|
18
|
+
HealthApi: () => HealthApi,
|
|
19
|
+
PageApi: () => PageApi,
|
|
20
|
+
ResolvePageChannelEnum: () => ResolvePageChannelEnum,
|
|
21
|
+
TrackApi: () => TrackApi
|
|
22
|
+
});
|
|
23
|
+
|
|
7
24
|
// src/gen/runtime.ts
|
|
8
25
|
var BASE_PATH = "https://api.djvlc.com".replace(/\/+$/, "");
|
|
9
26
|
var Configuration = class {
|
|
@@ -261,18 +278,6 @@ var VoidApiResponse = class {
|
|
|
261
278
|
}
|
|
262
279
|
};
|
|
263
280
|
|
|
264
|
-
// src/gen/apis/index.ts
|
|
265
|
-
var apis_exports = {};
|
|
266
|
-
__export(apis_exports, {
|
|
267
|
-
ActionApi: () => ActionApi,
|
|
268
|
-
ActivityApi: () => ActivityApi,
|
|
269
|
-
DataApi: () => DataApi,
|
|
270
|
-
HealthApi: () => HealthApi,
|
|
271
|
-
PageApi: () => PageApi,
|
|
272
|
-
ResolvePageChannelEnum: () => ResolvePageChannelEnum,
|
|
273
|
-
TrackApi: () => TrackApi
|
|
274
|
-
});
|
|
275
|
-
|
|
276
281
|
// src/gen/models/ActionContext.ts
|
|
277
282
|
function instanceOfActionContext(value) {
|
|
278
283
|
return true;
|
|
@@ -1925,63 +1930,35 @@ var TrackApi = class extends BaseAPI {
|
|
|
1925
1930
|
};
|
|
1926
1931
|
|
|
1927
1932
|
// src/index.ts
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
}
|
|
1942
|
-
function normalizeHeaders(initHeaders) {
|
|
1943
|
-
return new Headers(initHeaders ?? {});
|
|
1944
|
-
}
|
|
1933
|
+
import {
|
|
1934
|
+
DjvApiError,
|
|
1935
|
+
NetworkError,
|
|
1936
|
+
TimeoutError,
|
|
1937
|
+
AbortError,
|
|
1938
|
+
isRetryableError,
|
|
1939
|
+
Configuration as Configuration3,
|
|
1940
|
+
createConsoleLogger,
|
|
1941
|
+
createSilentLogger
|
|
1942
|
+
} from "@djvlc/openapi-client-core";
|
|
1943
|
+
var SDK_INFO = {
|
|
1944
|
+
name: true ? "@djvlc/openapi-user-client" : "@djvlc/openapi-user-client",
|
|
1945
|
+
version: true ? "1.0.0" : "0.0.0-dev"
|
|
1946
|
+
};
|
|
1945
1947
|
function createUserClient(opts) {
|
|
1946
|
-
const
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
const headers = normalizeHeaders(context.init.headers);
|
|
1952
|
-
if (opts.defaultHeaders) {
|
|
1953
|
-
for (const [k, v] of Object.entries(opts.defaultHeaders)) headers.set(k, v);
|
|
1954
|
-
}
|
|
1955
|
-
if (opts.getAuthToken) {
|
|
1956
|
-
const token = await opts.getAuthToken();
|
|
1957
|
-
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
1958
|
-
}
|
|
1959
|
-
if (opts.getTraceHeaders) {
|
|
1960
|
-
const traceHeaders = opts.getTraceHeaders();
|
|
1961
|
-
for (const [k, v] of Object.entries(traceHeaders)) headers.set(k, v);
|
|
1962
|
-
}
|
|
1963
|
-
return { url: context.url, init: { ...context.init, headers } };
|
|
1964
|
-
}
|
|
1948
|
+
const defaultOpts = {
|
|
1949
|
+
timeoutMs: 15e3,
|
|
1950
|
+
// User API 追求快失败
|
|
1951
|
+
credentials: "omit"
|
|
1952
|
+
// 通常不走 Cookie
|
|
1965
1953
|
};
|
|
1966
|
-
const
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
middleware: [headersMiddleware],
|
|
1970
|
-
credentials: opts.credentials ?? "omit"
|
|
1971
|
-
});
|
|
1972
|
-
const apiInstances = {};
|
|
1973
|
-
for (const [name, ApiClass] of Object.entries(apis_exports)) {
|
|
1974
|
-
if (typeof ApiClass === "function" && name.endsWith("Api")) {
|
|
1975
|
-
apiInstances[name] = new ApiClass(config);
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
return {
|
|
1979
|
-
config,
|
|
1980
|
-
apis: apiInstances,
|
|
1981
|
-
...apiInstances
|
|
1954
|
+
const mergedOpts = {
|
|
1955
|
+
...defaultOpts,
|
|
1956
|
+
...opts
|
|
1982
1957
|
};
|
|
1958
|
+
return createClient(apis_exports, mergedOpts, SDK_INFO);
|
|
1983
1959
|
}
|
|
1984
1960
|
export {
|
|
1961
|
+
AbortError,
|
|
1985
1962
|
ActionApi,
|
|
1986
1963
|
ActionContextFromJSON,
|
|
1987
1964
|
ActionContextFromJSONTyped,
|
|
@@ -2017,7 +1994,7 @@ export {
|
|
|
2017
1994
|
BlockedComponentFromJSONTyped,
|
|
2018
1995
|
BlockedComponentToJSON,
|
|
2019
1996
|
BlockedComponentToJSONTyped,
|
|
2020
|
-
Configuration,
|
|
1997
|
+
Configuration3 as Configuration,
|
|
2021
1998
|
DataApi,
|
|
2022
1999
|
DataQueryContextFromJSON,
|
|
2023
2000
|
DataQueryContextFromJSONTyped,
|
|
@@ -2031,6 +2008,7 @@ export {
|
|
|
2031
2008
|
DataQueryResponseFromJSONTyped,
|
|
2032
2009
|
DataQueryResponseToJSON,
|
|
2033
2010
|
DataQueryResponseToJSONTyped,
|
|
2011
|
+
DjvApiError,
|
|
2034
2012
|
ErrorDetailFromJSON,
|
|
2035
2013
|
ErrorDetailFromJSONTyped,
|
|
2036
2014
|
ErrorDetailToJSON,
|
|
@@ -2069,6 +2047,7 @@ export {
|
|
|
2069
2047
|
ManifestItemFromJSONTyped,
|
|
2070
2048
|
ManifestItemToJSON,
|
|
2071
2049
|
ManifestItemToJSONTyped,
|
|
2050
|
+
NetworkError,
|
|
2072
2051
|
PageApi,
|
|
2073
2052
|
PageManifestFromJSON,
|
|
2074
2053
|
PageManifestFromJSONTyped,
|
|
@@ -2108,6 +2087,7 @@ export {
|
|
|
2108
2087
|
RuntimeConfigReportConfigToJSONTyped,
|
|
2109
2088
|
RuntimeConfigToJSON,
|
|
2110
2089
|
RuntimeConfigToJSONTyped,
|
|
2090
|
+
TimeoutError,
|
|
2111
2091
|
TraceContextFromJSON,
|
|
2112
2092
|
TraceContextFromJSONTyped,
|
|
2113
2093
|
TraceContextToJSON,
|
|
@@ -2134,6 +2114,8 @@ export {
|
|
|
2134
2114
|
UserActivityStateProgressToJSONTyped,
|
|
2135
2115
|
UserActivityStateToJSON,
|
|
2136
2116
|
UserActivityStateToJSONTyped,
|
|
2117
|
+
createConsoleLogger,
|
|
2118
|
+
createSilentLogger,
|
|
2137
2119
|
createUserClient,
|
|
2138
2120
|
instanceOfActionContext,
|
|
2139
2121
|
instanceOfActionExecuteRequest,
|
|
@@ -2169,5 +2151,6 @@ export {
|
|
|
2169
2151
|
instanceOfTrackEvent,
|
|
2170
2152
|
instanceOfTrackRequest,
|
|
2171
2153
|
instanceOfUserActivityState,
|
|
2172
|
-
instanceOfUserActivityStateProgress
|
|
2154
|
+
instanceOfUserActivityStateProgress,
|
|
2155
|
+
isRetryableError
|
|
2173
2156
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djvlc/openapi-user-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "DJV Low-code Platform - User API 客户端(自动生成)",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -19,12 +19,14 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"clean": "rimraf src/gen dist",
|
|
21
21
|
"gen": "node ../../tools/openapi/generate-clients.js user",
|
|
22
|
-
"build": "tsup
|
|
22
|
+
"build": "tsup --config tsup.config.ts",
|
|
23
23
|
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
24
24
|
"lint": "eslint src/ --ext .ts --ignore-pattern src/gen/",
|
|
25
25
|
"typecheck": "tsc --noEmit"
|
|
26
26
|
},
|
|
27
|
-
"dependencies": {
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@djvlc/openapi-client-core": "1.0.0"
|
|
29
|
+
},
|
|
28
30
|
"devDependencies": {
|
|
29
31
|
"@types/node": "^20.0.0",
|
|
30
32
|
"@typescript-eslint/eslint-plugin": "^7.0.0",
|