openxiangda 1.0.88 → 1.0.90
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/README.md +18 -6
- package/openxiangda-skills/SKILL.md +5 -3
- package/openxiangda-skills/references/architecture-design.md +3 -1
- package/openxiangda-skills/references/openxiangda-api.md +3 -1
- package/openxiangda-skills/references/pages/page-sdk.md +19 -8
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +17 -5
- package/package.json +1 -1
- package/packages/sdk/dist/components/index.cjs +13 -2
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.mjs +13 -2
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +592 -387
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.d.mts +1 -1
- package/packages/sdk/dist/runtime/index.d.ts +1 -1
- package/packages/sdk/dist/runtime/index.mjs +591 -386
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +375 -11
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.d.mts +12 -2
- package/packages/sdk/dist/runtime/react.d.ts +12 -2
- package/packages/sdk/dist/runtime/react.mjs +375 -11
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
- package/templates/openxiangda-react-spa/src/app/router.tsx +4 -1
|
@@ -200,7 +200,7 @@ interface PageSdkMeta {
|
|
|
200
200
|
supportedBridgeMethods?: string[];
|
|
201
201
|
}
|
|
202
202
|
interface PageApiResponse<TResult = unknown, TRaw = TResult> {
|
|
203
|
-
code: number;
|
|
203
|
+
code: number | string;
|
|
204
204
|
success: boolean;
|
|
205
205
|
message?: string;
|
|
206
206
|
result: TResult | null;
|
|
@@ -1301,6 +1301,15 @@ interface OpenXiangdaProviderProps {
|
|
|
1301
1301
|
fetchImpl?: typeof fetch;
|
|
1302
1302
|
children: React__default.ReactNode;
|
|
1303
1303
|
}
|
|
1304
|
+
interface OpenXiangdaPageProviderProps {
|
|
1305
|
+
children: React__default.ReactNode;
|
|
1306
|
+
page?: Partial<PageInfo>;
|
|
1307
|
+
route?: Partial<PageRouteInfo>;
|
|
1308
|
+
env?: Record<string, unknown>;
|
|
1309
|
+
message?: Partial<PageMessageApi>;
|
|
1310
|
+
modal?: Partial<PageModalApi>;
|
|
1311
|
+
navigation?: Partial<PageNavigationApi>;
|
|
1312
|
+
}
|
|
1304
1313
|
interface OpenXiangdaRuntimeStore extends RuntimeRequestState<RuntimeBootstrap> {
|
|
1305
1314
|
appType: string;
|
|
1306
1315
|
servicePrefix: string;
|
|
@@ -1311,6 +1320,7 @@ interface OpenXiangdaRuntimeStore extends RuntimeRequestState<RuntimeBootstrap>
|
|
|
1311
1320
|
declare const OpenXiangdaProvider: React__default.FC<OpenXiangdaProviderProps>;
|
|
1312
1321
|
declare const useOpenXiangda: () => OpenXiangdaRuntimeStore;
|
|
1313
1322
|
declare const useRuntimeBootstrap: () => OpenXiangdaRuntimeStore;
|
|
1323
|
+
declare const OpenXiangdaPageProvider: React__default.FC<OpenXiangdaPageProviderProps>;
|
|
1314
1324
|
declare const useAppMenus: () => {
|
|
1315
1325
|
data: RuntimeMenuItem[];
|
|
1316
1326
|
appType: string;
|
|
@@ -1397,4 +1407,4 @@ interface PublicAccessGateProps extends UsePublicAccessOptions {
|
|
|
1397
1407
|
}
|
|
1398
1408
|
declare const PublicAccessGate: React__default.FC<PublicAccessGateProps>;
|
|
1399
1409
|
|
|
1400
|
-
export { type ApiPermissionListParams, type AppAuthClient, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, AuthClientError, type AuthClientOptions, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type DataViewStatsParams, type DingTalkLoginInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type LoginMethodsResult, LoginPage, type LoginPageProps, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, OpenXiangdaProvider, type OpenXiangdaProviderProps, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewNotificationTemplateParams, type ProcessApproveAction, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResolveLoginUrlInput, type RoleListParams, type RoleUsersParams, type RouteAccessResult, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseLoginMethodsState, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createAuthClient, createPageSdk, createPublicAccessClient, createReactPage, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageProps, usePageRoute, usePageSdk, usePermission, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
|
|
1410
|
+
export { type ApiPermissionListParams, type AppAuthClient, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, AuthClientError, type AuthClientOptions, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type DataViewStatsParams, type DingTalkLoginInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type LoginMethodsResult, LoginPage, type LoginPageProps, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, OpenXiangdaPageProvider, type OpenXiangdaPageProviderProps, OpenXiangdaProvider, type OpenXiangdaProviderProps, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewNotificationTemplateParams, type ProcessApproveAction, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResolveLoginUrlInput, type RoleListParams, type RoleUsersParams, type RouteAccessResult, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseLoginMethodsState, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createAuthClient, createPageSdk, createPublicAccessClient, createReactPage, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageProps, usePageRoute, usePageSdk, usePermission, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
|
|
@@ -200,7 +200,7 @@ interface PageSdkMeta {
|
|
|
200
200
|
supportedBridgeMethods?: string[];
|
|
201
201
|
}
|
|
202
202
|
interface PageApiResponse<TResult = unknown, TRaw = TResult> {
|
|
203
|
-
code: number;
|
|
203
|
+
code: number | string;
|
|
204
204
|
success: boolean;
|
|
205
205
|
message?: string;
|
|
206
206
|
result: TResult | null;
|
|
@@ -1301,6 +1301,15 @@ interface OpenXiangdaProviderProps {
|
|
|
1301
1301
|
fetchImpl?: typeof fetch;
|
|
1302
1302
|
children: React__default.ReactNode;
|
|
1303
1303
|
}
|
|
1304
|
+
interface OpenXiangdaPageProviderProps {
|
|
1305
|
+
children: React__default.ReactNode;
|
|
1306
|
+
page?: Partial<PageInfo>;
|
|
1307
|
+
route?: Partial<PageRouteInfo>;
|
|
1308
|
+
env?: Record<string, unknown>;
|
|
1309
|
+
message?: Partial<PageMessageApi>;
|
|
1310
|
+
modal?: Partial<PageModalApi>;
|
|
1311
|
+
navigation?: Partial<PageNavigationApi>;
|
|
1312
|
+
}
|
|
1304
1313
|
interface OpenXiangdaRuntimeStore extends RuntimeRequestState<RuntimeBootstrap> {
|
|
1305
1314
|
appType: string;
|
|
1306
1315
|
servicePrefix: string;
|
|
@@ -1311,6 +1320,7 @@ interface OpenXiangdaRuntimeStore extends RuntimeRequestState<RuntimeBootstrap>
|
|
|
1311
1320
|
declare const OpenXiangdaProvider: React__default.FC<OpenXiangdaProviderProps>;
|
|
1312
1321
|
declare const useOpenXiangda: () => OpenXiangdaRuntimeStore;
|
|
1313
1322
|
declare const useRuntimeBootstrap: () => OpenXiangdaRuntimeStore;
|
|
1323
|
+
declare const OpenXiangdaPageProvider: React__default.FC<OpenXiangdaPageProviderProps>;
|
|
1314
1324
|
declare const useAppMenus: () => {
|
|
1315
1325
|
data: RuntimeMenuItem[];
|
|
1316
1326
|
appType: string;
|
|
@@ -1397,4 +1407,4 @@ interface PublicAccessGateProps extends UsePublicAccessOptions {
|
|
|
1397
1407
|
}
|
|
1398
1408
|
declare const PublicAccessGate: React__default.FC<PublicAccessGateProps>;
|
|
1399
1409
|
|
|
1400
|
-
export { type ApiPermissionListParams, type AppAuthClient, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, AuthClientError, type AuthClientOptions, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type DataViewStatsParams, type DingTalkLoginInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type LoginMethodsResult, LoginPage, type LoginPageProps, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, OpenXiangdaProvider, type OpenXiangdaProviderProps, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewNotificationTemplateParams, type ProcessApproveAction, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResolveLoginUrlInput, type RoleListParams, type RoleUsersParams, type RouteAccessResult, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseLoginMethodsState, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createAuthClient, createPageSdk, createPublicAccessClient, createReactPage, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageProps, usePageRoute, usePageSdk, usePermission, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
|
|
1410
|
+
export { type ApiPermissionListParams, type AppAuthClient, type ApproveTaskParams, type AssignPermissionsParams, type AssignRolesParams, AuthClientError, type AuthClientOptions, type AuthLogoutRedirectOptions, type AuthMethod, type AuthMethodType, type AuthTokenData, type AuthUser, type BatchAddUsersToRoleParams, type BatchSendNotificationByTypeParams, type ChangeUserRoleParams, type ConnectorCallParams, type ConnectorInvokeParams, type ConnectorInvokeResult, type ConnectorRequestBodyType, type ConnectorResponseType, type CreateApiPermissionParams, type CreateFormPermissionGroupDto, type CreatePagePermissionGroupDto, type CreateRoleParams, type CreateUiPermissionParams, type CreateUserParams, type CurrentUserDepartmentParents, type CustomPageEntryConfig, type CustomPageEntryMode, type DataManagementConfigParams, type DataManagementFilterState, type DataPermissionConditionDto, type DataPermissionDto, type DataPermissionRuleDto, type DataViewQueryParams, type DataViewQueryResult, type DataViewStatsParams, type DingTalkLoginInput, type FieldAccessLevel, type FieldAccessPolicyDto, type FieldAccessPolicyItemDto, type FieldPermissionDto, type FindNotificationConfigParams, type FormAdvancedSearchParams, type FormChangeRecordParams, type FormCreateParams, type FormExportParams, type FormGetDetailParams, type FormImportParams, type FormPermissionGroup, type FormRemoveParams, type FormSearchParams, type FormUpdateParams, type FunctionInvokeParams, type FunctionInvokeResult, type GetParentDepartmentsOptions, type GetProcessInstanceParams, type GetUserRolesParams, type GuestLoginInput, type ImportExportRecordDownloadParams, type ImportExportRecordQuery, type InstanceStatus, type LoginMethodsResult, LoginPage, type LoginPageProps, type NotificationChannel, type NotificationChannelConfig, type NotificationChannelsConfig, type NotificationConfigLevel, type NotificationMessageRecord, type NotificationTemplate, type NotificationTemplatePreview, type NotificationTypeConfig, OpenXiangdaPageProvider, type OpenXiangdaPageProviderProps, OpenXiangdaProvider, type OpenXiangdaProviderProps, type PageApiPermissionRecord, type PageApiResponse, type PageAppInfo, type PageBinaryResponse, type PageBridgeApi, type PageContext, type PageDataManagementConfig, type PageDataSourceDescriptor, type PageDepartmentInfo, type PageDepartmentRecord, type PageHttpMethod, type PageInfo, type PageListResult, type PageMessageApi, type PageModalApi, type PageNavigationApi, type PageOffsetListResult, type PagePermissionGroup, type PagePermissionInfo, PageProvider, type PageQueryValue, type PageRequestOptions, type PageRoleRecord, type PageRouteInfo, type PageScope, type PageSdk, type PageSdkError, type PageSdkMeta, type PageTransportDownloadPayload, type PageTransportRequestPayload, type PageUiPermissionRecord, type PageUiPermissionType, type PageUserInfo, type PageUserRecord, type PageUserType, type PasswordLoginInput, PermissionBoundary, type PermissionBoundaryFallback, type PermissionBoundaryFallbackState, type PermissionBoundaryProps, type PhoneCodeInput, type PhoneCodeLoginInput, type PhoneCodeRegisterInput, type PhoneCodeSendResult, type PreviewNotificationTemplateParams, type ProcessApproveAction, type PublicAccessClaim, type PublicAccessClient, PublicAccessClientError, type PublicAccessClientOptions, PublicAccessGate, type PublicAccessGateProps, type PublicAccessSessionData, type PublicAccessSessionInput, type QueryFormPermissionGroupDto, type QueryPagePermissionGroupDto, type RefreshInput, type ResolveLoginUrlInput, type RoleListParams, type RoleUsersParams, type RouteAccessResult, type RuntimeBootstrap, type RuntimeErrorSnapshot, type RuntimeErrorType, type RuntimeLogoutOptions, type RuntimeMenuItem, type RuntimePagePermissions, type RuntimeRedirectLoginOptions, type RuntimeRequestError, type RuntimeRequestState, type RuntimeResolveLoginOptions, type SaveDataManagementConfigParams, type SearchComponentName, type SearchExpression, type SearchFieldKey, type SearchGroup, type SearchLogic, type SearchOperator, type SearchRule, type SearchSortItem, type SearchSystemField, type SendNotificationByTypeParams, type SendNotificationResult, type SsoLoginUrlInput, type SsoLoginUrlResult, type SubFormRule, type SwitchAppRoleParams, type SwitchPlatformRoleParams, type TerminateProcessInstanceParams, type TriggerCallbackTaskParams, type UiPermissionListParams, type UpdateApiPermissionParams, type UpdateFormPermissionGroupDto, type UpdatePagePermissionGroupDto, type UpdateRoleParams, type UpdateUiPermissionParams, type UpdateUserParams, type UseAuthOptions, type UseCanAccessRouteInput, type UseLoginMethodsState, type UsePublicAccessOptions, type UsePublicAccessState, type UserListParams, type UserMenuPermissionsResponse, type ValidateUserParams, type ViewFieldPermissionValue, type ViewOperationPermission, type ViewPermissionSummary, createAuthClient, createPageSdk, createPublicAccessClient, createReactPage, useAppMenus, useAuth, useCanAccessRoute, useCurrentUser, useDataSource, useFormViewPermissions, useLoginMethods, useMessage, useModal, useNavigation, useOpenXiangda, usePageContext, usePageProps, usePageRoute, usePageSdk, usePermission, usePublicAccess, useRuntimeAuth, useRuntimeBootstrap };
|
|
@@ -781,18 +781,39 @@ var normalizeDynamicOrder = (value) => {
|
|
|
781
781
|
}
|
|
782
782
|
return `${value.id}:${value.isAsc === "n" ? "-" : "+"}`;
|
|
783
783
|
};
|
|
784
|
+
var hasOwn = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
785
|
+
var normalizeEnvelopeCode = (value) => {
|
|
786
|
+
if (value === void 0 || value === null || value === "") {
|
|
787
|
+
return 200;
|
|
788
|
+
}
|
|
789
|
+
const normalized = Number(value);
|
|
790
|
+
return Number.isFinite(normalized) ? normalized : String(value);
|
|
791
|
+
};
|
|
792
|
+
var isSuccessCode = (value) => {
|
|
793
|
+
if (value === void 0 || value === null || value === "") {
|
|
794
|
+
return true;
|
|
795
|
+
}
|
|
796
|
+
const normalized = Number(value);
|
|
797
|
+
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
798
|
+
};
|
|
799
|
+
var getEnvelopeCode = (rawResponse) => {
|
|
800
|
+
if (isRecord(rawResponse) && hasOwn(rawResponse, "code")) {
|
|
801
|
+
return rawResponse.code;
|
|
802
|
+
}
|
|
803
|
+
const nestedData = rawResponse?.data;
|
|
804
|
+
if (isRecord(nestedData) && hasOwn(nestedData, "code")) {
|
|
805
|
+
return nestedData.code;
|
|
806
|
+
}
|
|
807
|
+
return void 0;
|
|
808
|
+
};
|
|
784
809
|
var normalizeJsonResponse = (rawResponse) => {
|
|
785
|
-
const
|
|
786
|
-
const nestedCode = Number(
|
|
787
|
-
rawResponse?.data?.code
|
|
788
|
-
);
|
|
789
|
-
const code = Number.isFinite(topLevelCode) ? topLevelCode : Number.isFinite(nestedCode) ? nestedCode : 200;
|
|
810
|
+
const code = normalizeEnvelopeCode(getEnvelopeCode(rawResponse));
|
|
790
811
|
const topLevelResult = isRecord(rawResponse) && "result" in rawResponse ? rawResponse.result : void 0;
|
|
791
812
|
const nestedResult = isRecord(rawResponse?.data) && "result" in (rawResponse.data || {}) ? rawResponse.data?.result : void 0;
|
|
792
813
|
const topLevelData = isRecord(rawResponse) && "data" in rawResponse ? rawResponse.data : void 0;
|
|
793
814
|
const result = topLevelResult !== void 0 ? topLevelResult : nestedResult !== void 0 ? nestedResult : topLevelData !== void 0 ? topLevelData : isRecord(rawResponse) ? rawResponse : null;
|
|
794
815
|
const nestedSuccess = typeof rawResponse?.data?.success === "boolean" ? rawResponse.data?.success : void 0;
|
|
795
|
-
const success =
|
|
816
|
+
const success = rawResponse?.success === false || nestedSuccess === false ? false : isSuccessCode(code);
|
|
796
817
|
return {
|
|
797
818
|
code,
|
|
798
819
|
success,
|
|
@@ -837,6 +858,9 @@ var normalizeBinaryResponse = (rawResponse) => {
|
|
|
837
858
|
};
|
|
838
859
|
};
|
|
839
860
|
var toSdkError = (input, payload) => {
|
|
861
|
+
if (input instanceof Error && input.response) {
|
|
862
|
+
return input;
|
|
863
|
+
}
|
|
840
864
|
const normalizedResponse = isRecord(input) ? normalizeJsonResponse(input) : void 0;
|
|
841
865
|
const nextError = input instanceof Error ? input : new Error(
|
|
842
866
|
normalizedResponse?.message || `\u8BF7\u6C42\u5931\u8D25: ${String(payload.method).toUpperCase()} ${payload.path}`
|
|
@@ -2465,6 +2489,187 @@ var createBoundFetch = (fetchImpl) => {
|
|
|
2465
2489
|
return ((input, init) => baseFetch.call(globalThis, input, init));
|
|
2466
2490
|
};
|
|
2467
2491
|
|
|
2492
|
+
// packages/sdk/src/runtime/host/browserHost.ts
|
|
2493
|
+
var trimTrailingSlash = (value) => value.replace(/\/+$/, "");
|
|
2494
|
+
var getDefaultServicePrefix = () => typeof window !== "undefined" ? trimTrailingSlash(window.__OPENXIANGDA_SERVICE_PREFIX__ || "/service") : "/service";
|
|
2495
|
+
var joinServicePath = (servicePrefix, path) => {
|
|
2496
|
+
if (/^https?:\/\//i.test(path)) return path;
|
|
2497
|
+
const normalizedPrefix = trimTrailingSlash(servicePrefix || "/service");
|
|
2498
|
+
if (path.startsWith(normalizedPrefix)) return path;
|
|
2499
|
+
return `${normalizedPrefix}${path.startsWith("/") ? path : `/${path}`}`;
|
|
2500
|
+
};
|
|
2501
|
+
var appendQuery = (url, query) => {
|
|
2502
|
+
if (!query) return url;
|
|
2503
|
+
return `${url}${url.includes("?") ? "&" : "?"}${query}`;
|
|
2504
|
+
};
|
|
2505
|
+
var normalizeMethod2 = (method) => {
|
|
2506
|
+
const value = String(method || "get").toUpperCase();
|
|
2507
|
+
return ["GET", "POST", "PUT", "DELETE", "PATCH"].includes(value) ? value : "GET";
|
|
2508
|
+
};
|
|
2509
|
+
var normalizeEnvelopeCode2 = (value, fallback) => {
|
|
2510
|
+
if (value === void 0 || value === null || value === "") return fallback;
|
|
2511
|
+
const normalized = Number(value);
|
|
2512
|
+
return Number.isFinite(normalized) ? normalized : String(value);
|
|
2513
|
+
};
|
|
2514
|
+
var isSuccessCode2 = (value) => {
|
|
2515
|
+
if (value === void 0 || value === null || value === "") return true;
|
|
2516
|
+
const normalized = Number(value);
|
|
2517
|
+
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
2518
|
+
};
|
|
2519
|
+
var parseJsonResponse = async (response) => {
|
|
2520
|
+
const payload = await response.json().catch(() => null);
|
|
2521
|
+
if (!response.ok) {
|
|
2522
|
+
const message2 = payload && typeof payload === "object" ? payload.message || payload.error || response.statusText : response.statusText;
|
|
2523
|
+
throw new Error(message2 || "\u8BF7\u6C42\u5931\u8D25");
|
|
2524
|
+
}
|
|
2525
|
+
if (payload && typeof payload === "object" && "code" in payload) {
|
|
2526
|
+
const code = normalizeEnvelopeCode2(payload.code, response.status);
|
|
2527
|
+
return {
|
|
2528
|
+
code,
|
|
2529
|
+
success: payload.success !== false && isSuccessCode2(code),
|
|
2530
|
+
message: payload.message,
|
|
2531
|
+
result: payload.result ?? payload.data ?? null,
|
|
2532
|
+
data: payload.data,
|
|
2533
|
+
raw: payload
|
|
2534
|
+
};
|
|
2535
|
+
}
|
|
2536
|
+
return {
|
|
2537
|
+
code: response.status,
|
|
2538
|
+
success: response.ok,
|
|
2539
|
+
message: response.statusText,
|
|
2540
|
+
result: payload,
|
|
2541
|
+
data: payload,
|
|
2542
|
+
raw: payload
|
|
2543
|
+
};
|
|
2544
|
+
};
|
|
2545
|
+
var createBrowserPageBridge = (options = {}) => {
|
|
2546
|
+
const servicePrefix = options.servicePrefix || getDefaultServicePrefix();
|
|
2547
|
+
const fetchImpl = createBoundFetch(options.fetchImpl);
|
|
2548
|
+
const request = async (payload) => {
|
|
2549
|
+
if (!payload?.path) {
|
|
2550
|
+
throw new Error("transport.request \u9700\u8981 path");
|
|
2551
|
+
}
|
|
2552
|
+
const url = appendQuery(joinServicePath(servicePrefix, payload.path), payload.query);
|
|
2553
|
+
const headers = new Headers(payload.headers);
|
|
2554
|
+
let body;
|
|
2555
|
+
if (payload.body !== void 0) {
|
|
2556
|
+
if (payload.body instanceof FormData) {
|
|
2557
|
+
body = payload.body;
|
|
2558
|
+
} else {
|
|
2559
|
+
headers.set("Content-Type", headers.get("Content-Type") || "application/json");
|
|
2560
|
+
body = JSON.stringify(payload.body);
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
const response = await fetchImpl(url, {
|
|
2564
|
+
method: normalizeMethod2(payload.method),
|
|
2565
|
+
headers,
|
|
2566
|
+
body,
|
|
2567
|
+
credentials: "include"
|
|
2568
|
+
});
|
|
2569
|
+
return parseJsonResponse(response);
|
|
2570
|
+
};
|
|
2571
|
+
const download = async (payload) => {
|
|
2572
|
+
if (!payload?.path) {
|
|
2573
|
+
throw new Error("transport.download \u9700\u8981 path");
|
|
2574
|
+
}
|
|
2575
|
+
const url = appendQuery(joinServicePath(servicePrefix, payload.path), payload.query);
|
|
2576
|
+
const headers = new Headers(payload.headers);
|
|
2577
|
+
let body;
|
|
2578
|
+
if (payload.body !== void 0) {
|
|
2579
|
+
if (payload.body instanceof FormData) {
|
|
2580
|
+
body = payload.body;
|
|
2581
|
+
} else {
|
|
2582
|
+
headers.set("Content-Type", headers.get("Content-Type") || "application/json");
|
|
2583
|
+
body = JSON.stringify(payload.body);
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
const response = await fetchImpl(url, {
|
|
2587
|
+
method: normalizeMethod2(payload.method),
|
|
2588
|
+
headers,
|
|
2589
|
+
body,
|
|
2590
|
+
credentials: "include"
|
|
2591
|
+
});
|
|
2592
|
+
if (!response.ok) {
|
|
2593
|
+
throw new Error(response.statusText || "\u4E0B\u8F7D\u5931\u8D25");
|
|
2594
|
+
}
|
|
2595
|
+
return {
|
|
2596
|
+
blob: await response.blob(),
|
|
2597
|
+
contentType: response.headers.get("content-type") || void 0,
|
|
2598
|
+
fileName: response.headers.get("content-disposition") || void 0,
|
|
2599
|
+
headers: Object.fromEntries(response.headers.entries())
|
|
2600
|
+
};
|
|
2601
|
+
};
|
|
2602
|
+
return {
|
|
2603
|
+
invoke: async (method, payload) => {
|
|
2604
|
+
if (method === "transport.request") return await request(payload);
|
|
2605
|
+
if (method === "transport.download") return await download(payload);
|
|
2606
|
+
throw new Error(`\u4E0D\u652F\u6301\u7684 bridge \u65B9\u6CD5: ${method}`);
|
|
2607
|
+
}
|
|
2608
|
+
};
|
|
2609
|
+
};
|
|
2610
|
+
var createBrowserPageContext = (bootstrap, options = {}) => {
|
|
2611
|
+
const route = {
|
|
2612
|
+
pathname: options.route?.pathname || (typeof window !== "undefined" ? window.location.pathname : ""),
|
|
2613
|
+
fullPath: options.route?.fullPath || (typeof window !== "undefined" ? `${window.location.pathname}${window.location.search}${window.location.hash}` : ""),
|
|
2614
|
+
params: options.route?.params || {},
|
|
2615
|
+
query: options.route?.query || {},
|
|
2616
|
+
hash: options.route?.hash || (typeof window !== "undefined" ? window.location.hash : "")
|
|
2617
|
+
};
|
|
2618
|
+
return {
|
|
2619
|
+
protocolVersion: bootstrap.asset?.protocolVersion || "1.0",
|
|
2620
|
+
app: bootstrap.app,
|
|
2621
|
+
page: {
|
|
2622
|
+
...bootstrap.page,
|
|
2623
|
+
version: bootstrap.asset?.version || bootstrap.page.version,
|
|
2624
|
+
buildId: bootstrap.asset?.buildId || bootstrap.page.buildId
|
|
2625
|
+
},
|
|
2626
|
+
user: bootstrap.user,
|
|
2627
|
+
route,
|
|
2628
|
+
env: bootstrap.env || {},
|
|
2629
|
+
permissions: {
|
|
2630
|
+
canView: bootstrap.permissions?.canView !== false,
|
|
2631
|
+
hasFullAccess: bootstrap.permissions?.hasFullAccess === true,
|
|
2632
|
+
...bootstrap.permissions || {}
|
|
2633
|
+
},
|
|
2634
|
+
capabilities: Array.from(
|
|
2635
|
+
/* @__PURE__ */ new Set([
|
|
2636
|
+
"navigation",
|
|
2637
|
+
"ui.message",
|
|
2638
|
+
"ui.modal",
|
|
2639
|
+
"transport.request",
|
|
2640
|
+
"transport.download",
|
|
2641
|
+
...bootstrap.sdk?.supportedBridgeMethods || []
|
|
2642
|
+
])
|
|
2643
|
+
),
|
|
2644
|
+
ui: {
|
|
2645
|
+
message: {
|
|
2646
|
+
success: (text) => options.message?.success?.(text),
|
|
2647
|
+
error: (text) => options.message?.error?.(text),
|
|
2648
|
+
warning: (text) => options.message?.warning?.(text),
|
|
2649
|
+
info: (text) => options.message?.info?.(text),
|
|
2650
|
+
loading: (text) => options.message?.loading?.(text) || (() => void 0)
|
|
2651
|
+
},
|
|
2652
|
+
modal: {
|
|
2653
|
+
confirm: (input) => options.modal?.confirm?.(input) || Promise.resolve(false)
|
|
2654
|
+
}
|
|
2655
|
+
},
|
|
2656
|
+
navigation: {
|
|
2657
|
+
pushPage: (pageKey, query) => options.navigation?.pushPage?.(pageKey, query),
|
|
2658
|
+
replacePage: (pageKey, query) => options.navigation?.replacePage?.(pageKey, query),
|
|
2659
|
+
pushRoute: (routeValue, query) => options.navigation?.pushRoute?.(routeValue, query),
|
|
2660
|
+
replaceRoute: (routeValue, query) => options.navigation?.replaceRoute?.(routeValue, query),
|
|
2661
|
+
updateQuery: (query) => options.navigation?.updateQuery?.(query),
|
|
2662
|
+
setHash: (hash) => options.navigation?.setHash?.(hash),
|
|
2663
|
+
back: () => options.navigation?.back?.()
|
|
2664
|
+
},
|
|
2665
|
+
bridge: createBrowserPageBridge(options),
|
|
2666
|
+
sdk: {
|
|
2667
|
+
...bootstrap.sdk,
|
|
2668
|
+
supportedBridgeMethods: ["transport.request", "transport.download"]
|
|
2669
|
+
}
|
|
2670
|
+
};
|
|
2671
|
+
};
|
|
2672
|
+
|
|
2468
2673
|
// packages/sdk/src/runtime/react/auth.tsx
|
|
2469
2674
|
import {
|
|
2470
2675
|
useCallback as useCallback3,
|
|
@@ -2523,7 +2728,8 @@ var createAuthClient = ({
|
|
|
2523
2728
|
});
|
|
2524
2729
|
const payload = await readPayload(response);
|
|
2525
2730
|
const code = getRecordValue(payload, "code");
|
|
2526
|
-
|
|
2731
|
+
const success = getRecordValue(payload, "success");
|
|
2732
|
+
if (!response.ok || success === false || !isSuccessCode3(code)) {
|
|
2527
2733
|
throw new AuthClientError(
|
|
2528
2734
|
String(getRecordValue(payload, "message") || `Auth request failed: ${response.status}`),
|
|
2529
2735
|
{ status: response.status, code, payload }
|
|
@@ -2576,6 +2782,11 @@ var getRecordValue = (value, key) => {
|
|
|
2576
2782
|
if (!value || typeof value !== "object") return void 0;
|
|
2577
2783
|
return value[key];
|
|
2578
2784
|
};
|
|
2785
|
+
var isSuccessCode3 = (code) => {
|
|
2786
|
+
if (code === void 0 || code === null || code === "") return true;
|
|
2787
|
+
const normalized = Number(code);
|
|
2788
|
+
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
2789
|
+
};
|
|
2579
2790
|
var resolveLoginUrl = (appType, {
|
|
2580
2791
|
callbackUrl = getCurrentHref2(),
|
|
2581
2792
|
callbackParamName = "callback",
|
|
@@ -3156,7 +3367,7 @@ var OpenXiangdaProvider = ({
|
|
|
3156
3367
|
}
|
|
3157
3368
|
);
|
|
3158
3369
|
const payload = await readJsonPayload(response);
|
|
3159
|
-
if (
|
|
3370
|
+
if (isRuntimeEnvelopeFailure(response, payload)) {
|
|
3160
3371
|
throw createRuntimeHttpError(
|
|
3161
3372
|
response,
|
|
3162
3373
|
payload,
|
|
@@ -3200,6 +3411,96 @@ var useOpenXiangda = () => {
|
|
|
3200
3411
|
return context;
|
|
3201
3412
|
};
|
|
3202
3413
|
var useRuntimeBootstrap = () => useOpenXiangda();
|
|
3414
|
+
var OpenXiangdaPageProvider = ({
|
|
3415
|
+
children,
|
|
3416
|
+
page,
|
|
3417
|
+
route,
|
|
3418
|
+
env,
|
|
3419
|
+
message: message2,
|
|
3420
|
+
modal,
|
|
3421
|
+
navigation
|
|
3422
|
+
}) => {
|
|
3423
|
+
const runtime = useOpenXiangda();
|
|
3424
|
+
const context = useMemo5(() => {
|
|
3425
|
+
const bootstrap = runtime.data;
|
|
3426
|
+
const app = toRuntimeRecord(bootstrap?.app);
|
|
3427
|
+
const user = toRuntimeRecord(bootstrap?.user);
|
|
3428
|
+
const permissions = bootstrap?.permissions;
|
|
3429
|
+
const tenantId = toStringValue(getRecordValue2(app, "tenantId")) || toStringValue(getRecordValue2(user, "tenantId")) || toStringValue(getRecordValue2(app, "tenantCode")) || "";
|
|
3430
|
+
const appType = runtime.appType || bootstrap?.appType || toStringValue(getRecordValue2(app, "appType"));
|
|
3431
|
+
const routeInfo = buildBrowserRouteInfo(route);
|
|
3432
|
+
return createBrowserPageContext(
|
|
3433
|
+
{
|
|
3434
|
+
app: {
|
|
3435
|
+
...app,
|
|
3436
|
+
appType,
|
|
3437
|
+
tenantId
|
|
3438
|
+
},
|
|
3439
|
+
page: {
|
|
3440
|
+
id: routeInfo.pathname || "react-spa",
|
|
3441
|
+
code: routeInfo.pathname || "react-spa",
|
|
3442
|
+
name: "OpenXiangda React SPA",
|
|
3443
|
+
type: "react-spa",
|
|
3444
|
+
rendererType: "react-spa",
|
|
3445
|
+
routeKey: routeInfo.pathname || "react-spa",
|
|
3446
|
+
status: "ACTIVE",
|
|
3447
|
+
props: {},
|
|
3448
|
+
route: {},
|
|
3449
|
+
dataSources: [],
|
|
3450
|
+
capabilities: {},
|
|
3451
|
+
buildId: toStringValue(
|
|
3452
|
+
getRecordValue2(bootstrap?.runtime, "activeBuildId")
|
|
3453
|
+
),
|
|
3454
|
+
...page
|
|
3455
|
+
},
|
|
3456
|
+
user: {
|
|
3457
|
+
...user,
|
|
3458
|
+
id: toStringValue(getRecordValue2(user, "id")) || (user.isGuest ? "guest" : "current"),
|
|
3459
|
+
username: toStringValue(getRecordValue2(user, "username")) || toStringValue(getRecordValue2(user, "name")) || (user.isGuest ? "guest" : "current"),
|
|
3460
|
+
tenantId,
|
|
3461
|
+
isGuest: user.isGuest === true || user.userType === "guest" || Boolean(getRecordValue2(user, "publicAccess")),
|
|
3462
|
+
userType: user.userType === "guest" || user.isGuest === true ? "guest" : "normal"
|
|
3463
|
+
},
|
|
3464
|
+
env: {
|
|
3465
|
+
appType,
|
|
3466
|
+
servicePrefix: runtime.servicePrefix,
|
|
3467
|
+
runtimeMode: bootstrap?.runtime?.mode || "react-spa",
|
|
3468
|
+
...env || {}
|
|
3469
|
+
},
|
|
3470
|
+
permissions: {
|
|
3471
|
+
canView: runtime.error?.type !== "forbidden",
|
|
3472
|
+
hasFullAccess: permissions?.hasFullAccess === true,
|
|
3473
|
+
...permissions || {}
|
|
3474
|
+
},
|
|
3475
|
+
sdk: {
|
|
3476
|
+
packageName: "openxiangda",
|
|
3477
|
+
supportedBridgeMethods: ["transport.request", "transport.download"]
|
|
3478
|
+
}
|
|
3479
|
+
},
|
|
3480
|
+
{
|
|
3481
|
+
servicePrefix: runtime.servicePrefix,
|
|
3482
|
+
fetchImpl: runtime.fetchImpl,
|
|
3483
|
+
route: routeInfo,
|
|
3484
|
+
message: message2,
|
|
3485
|
+
modal,
|
|
3486
|
+
navigation
|
|
3487
|
+
}
|
|
3488
|
+
);
|
|
3489
|
+
}, [
|
|
3490
|
+
env,
|
|
3491
|
+
message2,
|
|
3492
|
+
modal,
|
|
3493
|
+
navigation,
|
|
3494
|
+
page,
|
|
3495
|
+
route,
|
|
3496
|
+
runtime.appType,
|
|
3497
|
+
runtime.data,
|
|
3498
|
+
runtime.error?.type,
|
|
3499
|
+
runtime.fetchImpl,
|
|
3500
|
+
runtime.servicePrefix
|
|
3501
|
+
]);
|
|
3502
|
+
return /* @__PURE__ */ jsx4(PageProvider, { context, children });
|
|
3503
|
+
};
|
|
3203
3504
|
var useAppMenus = () => {
|
|
3204
3505
|
const runtime = useOpenXiangda();
|
|
3205
3506
|
return {
|
|
@@ -3291,7 +3592,7 @@ var useCanAccessRoute = (input) => {
|
|
|
3291
3592
|
payload
|
|
3292
3593
|
};
|
|
3293
3594
|
if (!disposed) {
|
|
3294
|
-
const shouldTreatAsError = !response.ok ||
|
|
3595
|
+
const shouldTreatAsError = !response.ok || isServerErrorCode(code);
|
|
3295
3596
|
setState({
|
|
3296
3597
|
data,
|
|
3297
3598
|
loading: false,
|
|
@@ -3423,7 +3724,7 @@ var useRuntimeAuth = () => {
|
|
|
3423
3724
|
}
|
|
3424
3725
|
);
|
|
3425
3726
|
const payload = await readJsonPayload(response);
|
|
3426
|
-
if (
|
|
3727
|
+
if (isRuntimeEnvelopeFailure(response, payload)) {
|
|
3427
3728
|
throw createRuntimeHttpError(
|
|
3428
3729
|
response,
|
|
3429
3730
|
payload,
|
|
@@ -3513,6 +3814,15 @@ var classifyRuntimeError = (status, code) => {
|
|
|
3513
3814
|
const normalizedCode = typeof code === "string" ? Number(code) : code;
|
|
3514
3815
|
if (status === 401 || normalizedCode === 401) return "unauthenticated";
|
|
3515
3816
|
if (status === 403 || normalizedCode === 403) return "forbidden";
|
|
3817
|
+
if (typeof code === "string") {
|
|
3818
|
+
const normalizedText = code.toUpperCase();
|
|
3819
|
+
if (normalizedText.includes("DENIED") || normalizedText.includes("FORBIDDEN")) {
|
|
3820
|
+
return "forbidden";
|
|
3821
|
+
}
|
|
3822
|
+
if (normalizedText.includes("UNAUTH") || normalizedText.includes("LOGIN")) {
|
|
3823
|
+
return "unauthenticated";
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3516
3826
|
if (!status && !normalizedCode) return "network";
|
|
3517
3827
|
return "unknown";
|
|
3518
3828
|
};
|
|
@@ -3568,6 +3878,53 @@ var getRecordValue2 = (value, key) => {
|
|
|
3568
3878
|
if (!value || typeof value !== "object") return void 0;
|
|
3569
3879
|
return value[key];
|
|
3570
3880
|
};
|
|
3881
|
+
var toRuntimeRecord = (value) => {
|
|
3882
|
+
return value && typeof value === "object" ? { ...value } : {};
|
|
3883
|
+
};
|
|
3884
|
+
var toStringValue = (value) => {
|
|
3885
|
+
if (value === void 0 || value === null) return "";
|
|
3886
|
+
return String(value);
|
|
3887
|
+
};
|
|
3888
|
+
var parseBrowserQuery = () => {
|
|
3889
|
+
if (typeof window === "undefined") return {};
|
|
3890
|
+
const query = {};
|
|
3891
|
+
const params = new URLSearchParams(window.location.search);
|
|
3892
|
+
params.forEach((value, key) => {
|
|
3893
|
+
const currentValue = query[key];
|
|
3894
|
+
if (currentValue === void 0) {
|
|
3895
|
+
query[key] = value;
|
|
3896
|
+
return;
|
|
3897
|
+
}
|
|
3898
|
+
query[key] = Array.isArray(currentValue) ? [...currentValue, value] : [currentValue, value];
|
|
3899
|
+
});
|
|
3900
|
+
return query;
|
|
3901
|
+
};
|
|
3902
|
+
var buildBrowserRouteInfo = (route) => {
|
|
3903
|
+
const pathname = route?.pathname || (typeof window !== "undefined" ? window.location.pathname : "");
|
|
3904
|
+
const search = typeof window !== "undefined" ? window.location.search : "";
|
|
3905
|
+
const hash = route?.hash || (typeof window !== "undefined" ? window.location.hash : "");
|
|
3906
|
+
return {
|
|
3907
|
+
pathname,
|
|
3908
|
+
fullPath: route?.fullPath || (typeof window !== "undefined" ? `${pathname}${search}${hash}` : pathname),
|
|
3909
|
+
params: route?.params || {},
|
|
3910
|
+
query: route?.query || parseBrowserQuery(),
|
|
3911
|
+
hash
|
|
3912
|
+
};
|
|
3913
|
+
};
|
|
3914
|
+
var isSuccessCode4 = (code) => {
|
|
3915
|
+
if (code === void 0 || code === null || code === "") return true;
|
|
3916
|
+
const normalized = Number(code);
|
|
3917
|
+
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
3918
|
+
};
|
|
3919
|
+
var isRuntimeEnvelopeFailure = (response, payload) => {
|
|
3920
|
+
const code = getRecordValue2(payload, "code");
|
|
3921
|
+
const success = getRecordValue2(payload, "success");
|
|
3922
|
+
return !response.ok || success === false || !isSuccessCode4(code);
|
|
3923
|
+
};
|
|
3924
|
+
var isServerErrorCode = (code) => {
|
|
3925
|
+
const normalized = Number(code);
|
|
3926
|
+
return Number.isFinite(normalized) && normalized >= 500;
|
|
3927
|
+
};
|
|
3571
3928
|
var getRecordString = (value, key) => {
|
|
3572
3929
|
const result = getRecordValue2(value, key);
|
|
3573
3930
|
return typeof result === "string" ? result : void 0;
|
|
@@ -3631,7 +3988,8 @@ var createPublicAccessClient = ({
|
|
|
3631
3988
|
);
|
|
3632
3989
|
const payload = await readPayload2(response);
|
|
3633
3990
|
const code = getRecordValue3(payload, "code");
|
|
3634
|
-
|
|
3991
|
+
const success = getRecordValue3(payload, "success");
|
|
3992
|
+
if (!response.ok || success === false || !isSuccessCode5(code)) {
|
|
3635
3993
|
throw new PublicAccessClientError(
|
|
3636
3994
|
String(
|
|
3637
3995
|
getRecordValue3(payload, "message") || `Public access session failed: ${response.status}`
|
|
@@ -3669,6 +4027,11 @@ var getRecordValue3 = (value, key) => {
|
|
|
3669
4027
|
if (!value || typeof value !== "object") return void 0;
|
|
3670
4028
|
return value[key];
|
|
3671
4029
|
};
|
|
4030
|
+
var isSuccessCode5 = (code) => {
|
|
4031
|
+
if (code === void 0 || code === null || code === "") return true;
|
|
4032
|
+
const normalized = Number(code);
|
|
4033
|
+
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
4034
|
+
};
|
|
3672
4035
|
var getCurrentPathname = () => typeof window === "undefined" ? void 0 : window.location.pathname;
|
|
3673
4036
|
var getCurrentDomain = () => typeof window === "undefined" ? void 0 : window.location.host;
|
|
3674
4037
|
var getCurrentUserAgent = () => typeof navigator === "undefined" ? void 0 : navigator.userAgent;
|
|
@@ -3783,6 +4146,7 @@ var readPathFromLocation = () => typeof window === "undefined" ? void 0 : window
|
|
|
3783
4146
|
export {
|
|
3784
4147
|
AuthClientError,
|
|
3785
4148
|
LoginPage,
|
|
4149
|
+
OpenXiangdaPageProvider,
|
|
3786
4150
|
OpenXiangdaProvider,
|
|
3787
4151
|
PageProvider,
|
|
3788
4152
|
PermissionBoundary,
|