openxiangda 1.0.89 → 1.0.91
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 +16 -6
- package/lib/cli.js +2 -1
- package/lib/http.js +2 -2
- package/lib/utils.js +13 -0
- package/openxiangda-skills/SKILL.md +3 -3
- package/openxiangda-skills/references/architecture-design.md +2 -1
- package/openxiangda-skills/references/openxiangda-api.md +1 -1
- package/openxiangda-skills/references/pages/page-sdk.md +17 -8
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +15 -5
- package/package.json +1 -1
- package/packages/sdk/dist/runtime/index.cjs +1489 -1361
- 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 +767 -638
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +321 -12
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.d.mts +14 -1
- package/packages/sdk/dist/runtime/react.d.ts +14 -1
- package/packages/sdk/dist/runtime/react.mjs +322 -12
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
- package/templates/openxiangda-react-spa/src/app/router.tsx +4 -1
|
@@ -1301,21 +1301,33 @@ 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;
|
|
1307
1316
|
fetchImpl: typeof fetch;
|
|
1317
|
+
baseFetchImpl: typeof fetch;
|
|
1308
1318
|
reload: (options?: RuntimeReloadOptions) => Promise<void>;
|
|
1309
1319
|
setAccessToken: (accessToken?: string | null) => void;
|
|
1310
1320
|
}
|
|
1311
1321
|
declare const OpenXiangdaProvider: React__default.FC<OpenXiangdaProviderProps>;
|
|
1312
1322
|
declare const useOpenXiangda: () => OpenXiangdaRuntimeStore;
|
|
1313
1323
|
declare const useRuntimeBootstrap: () => OpenXiangdaRuntimeStore;
|
|
1324
|
+
declare const OpenXiangdaPageProvider: React__default.FC<OpenXiangdaPageProviderProps>;
|
|
1314
1325
|
declare const useAppMenus: () => {
|
|
1315
1326
|
data: RuntimeMenuItem[];
|
|
1316
1327
|
appType: string;
|
|
1317
1328
|
servicePrefix: string;
|
|
1318
1329
|
fetchImpl: typeof fetch;
|
|
1330
|
+
baseFetchImpl: typeof fetch;
|
|
1319
1331
|
reload: (options?: RuntimeReloadOptions) => Promise<void>;
|
|
1320
1332
|
setAccessToken: (accessToken?: string | null) => void;
|
|
1321
1333
|
loading: boolean;
|
|
@@ -1326,6 +1338,7 @@ declare const usePermission: () => {
|
|
|
1326
1338
|
appType: string;
|
|
1327
1339
|
servicePrefix: string;
|
|
1328
1340
|
fetchImpl: typeof fetch;
|
|
1341
|
+
baseFetchImpl: typeof fetch;
|
|
1329
1342
|
reload: (options?: RuntimeReloadOptions) => Promise<void>;
|
|
1330
1343
|
setAccessToken: (accessToken?: string | null) => void;
|
|
1331
1344
|
loading: boolean;
|
|
@@ -1397,4 +1410,4 @@ interface PublicAccessGateProps extends UsePublicAccessOptions {
|
|
|
1397
1410
|
}
|
|
1398
1411
|
declare const PublicAccessGate: React__default.FC<PublicAccessGateProps>;
|
|
1399
1412
|
|
|
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 };
|
|
1413
|
+
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 };
|
|
@@ -1301,21 +1301,33 @@ 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;
|
|
1307
1316
|
fetchImpl: typeof fetch;
|
|
1317
|
+
baseFetchImpl: typeof fetch;
|
|
1308
1318
|
reload: (options?: RuntimeReloadOptions) => Promise<void>;
|
|
1309
1319
|
setAccessToken: (accessToken?: string | null) => void;
|
|
1310
1320
|
}
|
|
1311
1321
|
declare const OpenXiangdaProvider: React__default.FC<OpenXiangdaProviderProps>;
|
|
1312
1322
|
declare const useOpenXiangda: () => OpenXiangdaRuntimeStore;
|
|
1313
1323
|
declare const useRuntimeBootstrap: () => OpenXiangdaRuntimeStore;
|
|
1324
|
+
declare const OpenXiangdaPageProvider: React__default.FC<OpenXiangdaPageProviderProps>;
|
|
1314
1325
|
declare const useAppMenus: () => {
|
|
1315
1326
|
data: RuntimeMenuItem[];
|
|
1316
1327
|
appType: string;
|
|
1317
1328
|
servicePrefix: string;
|
|
1318
1329
|
fetchImpl: typeof fetch;
|
|
1330
|
+
baseFetchImpl: typeof fetch;
|
|
1319
1331
|
reload: (options?: RuntimeReloadOptions) => Promise<void>;
|
|
1320
1332
|
setAccessToken: (accessToken?: string | null) => void;
|
|
1321
1333
|
loading: boolean;
|
|
@@ -1326,6 +1338,7 @@ declare const usePermission: () => {
|
|
|
1326
1338
|
appType: string;
|
|
1327
1339
|
servicePrefix: string;
|
|
1328
1340
|
fetchImpl: typeof fetch;
|
|
1341
|
+
baseFetchImpl: typeof fetch;
|
|
1329
1342
|
reload: (options?: RuntimeReloadOptions) => Promise<void>;
|
|
1330
1343
|
setAccessToken: (accessToken?: string | null) => void;
|
|
1331
1344
|
loading: boolean;
|
|
@@ -1397,4 +1410,4 @@ interface PublicAccessGateProps extends UsePublicAccessOptions {
|
|
|
1397
1410
|
}
|
|
1398
1411
|
declare const PublicAccessGate: React__default.FC<PublicAccessGateProps>;
|
|
1399
1412
|
|
|
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 };
|
|
1413
|
+
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 };
|
|
@@ -2480,6 +2480,7 @@ import {
|
|
|
2480
2480
|
useContext as useContext2,
|
|
2481
2481
|
useEffect as useEffect4,
|
|
2482
2482
|
useMemo as useMemo5,
|
|
2483
|
+
useRef as useRef2,
|
|
2483
2484
|
useState as useState4
|
|
2484
2485
|
} from "react";
|
|
2485
2486
|
|
|
@@ -2489,6 +2490,187 @@ var createBoundFetch = (fetchImpl) => {
|
|
|
2489
2490
|
return ((input, init) => baseFetch.call(globalThis, input, init));
|
|
2490
2491
|
};
|
|
2491
2492
|
|
|
2493
|
+
// packages/sdk/src/runtime/host/browserHost.ts
|
|
2494
|
+
var trimTrailingSlash = (value) => value.replace(/\/+$/, "");
|
|
2495
|
+
var getDefaultServicePrefix = () => typeof window !== "undefined" ? trimTrailingSlash(window.__OPENXIANGDA_SERVICE_PREFIX__ || "/service") : "/service";
|
|
2496
|
+
var joinServicePath = (servicePrefix, path) => {
|
|
2497
|
+
if (/^https?:\/\//i.test(path)) return path;
|
|
2498
|
+
const normalizedPrefix = trimTrailingSlash(servicePrefix || "/service");
|
|
2499
|
+
if (path.startsWith(normalizedPrefix)) return path;
|
|
2500
|
+
return `${normalizedPrefix}${path.startsWith("/") ? path : `/${path}`}`;
|
|
2501
|
+
};
|
|
2502
|
+
var appendQuery = (url, query) => {
|
|
2503
|
+
if (!query) return url;
|
|
2504
|
+
return `${url}${url.includes("?") ? "&" : "?"}${query}`;
|
|
2505
|
+
};
|
|
2506
|
+
var normalizeMethod2 = (method) => {
|
|
2507
|
+
const value = String(method || "get").toUpperCase();
|
|
2508
|
+
return ["GET", "POST", "PUT", "DELETE", "PATCH"].includes(value) ? value : "GET";
|
|
2509
|
+
};
|
|
2510
|
+
var normalizeEnvelopeCode2 = (value, fallback) => {
|
|
2511
|
+
if (value === void 0 || value === null || value === "") return fallback;
|
|
2512
|
+
const normalized = Number(value);
|
|
2513
|
+
return Number.isFinite(normalized) ? normalized : String(value);
|
|
2514
|
+
};
|
|
2515
|
+
var isSuccessCode2 = (value) => {
|
|
2516
|
+
if (value === void 0 || value === null || value === "") return true;
|
|
2517
|
+
const normalized = Number(value);
|
|
2518
|
+
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
2519
|
+
};
|
|
2520
|
+
var parseJsonResponse = async (response) => {
|
|
2521
|
+
const payload = await response.json().catch(() => null);
|
|
2522
|
+
if (!response.ok) {
|
|
2523
|
+
const message2 = payload && typeof payload === "object" ? payload.message || payload.error || response.statusText : response.statusText;
|
|
2524
|
+
throw new Error(message2 || "\u8BF7\u6C42\u5931\u8D25");
|
|
2525
|
+
}
|
|
2526
|
+
if (payload && typeof payload === "object" && "code" in payload) {
|
|
2527
|
+
const code = normalizeEnvelopeCode2(payload.code, response.status);
|
|
2528
|
+
return {
|
|
2529
|
+
code,
|
|
2530
|
+
success: payload.success !== false && isSuccessCode2(code),
|
|
2531
|
+
message: payload.message,
|
|
2532
|
+
result: payload.result ?? payload.data ?? null,
|
|
2533
|
+
data: payload.data,
|
|
2534
|
+
raw: payload
|
|
2535
|
+
};
|
|
2536
|
+
}
|
|
2537
|
+
return {
|
|
2538
|
+
code: response.status,
|
|
2539
|
+
success: response.ok,
|
|
2540
|
+
message: response.statusText,
|
|
2541
|
+
result: payload,
|
|
2542
|
+
data: payload,
|
|
2543
|
+
raw: payload
|
|
2544
|
+
};
|
|
2545
|
+
};
|
|
2546
|
+
var createBrowserPageBridge = (options = {}) => {
|
|
2547
|
+
const servicePrefix = options.servicePrefix || getDefaultServicePrefix();
|
|
2548
|
+
const fetchImpl = createBoundFetch(options.fetchImpl);
|
|
2549
|
+
const request = async (payload) => {
|
|
2550
|
+
if (!payload?.path) {
|
|
2551
|
+
throw new Error("transport.request \u9700\u8981 path");
|
|
2552
|
+
}
|
|
2553
|
+
const url = appendQuery(joinServicePath(servicePrefix, payload.path), payload.query);
|
|
2554
|
+
const headers = new Headers(payload.headers);
|
|
2555
|
+
let body;
|
|
2556
|
+
if (payload.body !== void 0) {
|
|
2557
|
+
if (payload.body instanceof FormData) {
|
|
2558
|
+
body = payload.body;
|
|
2559
|
+
} else {
|
|
2560
|
+
headers.set("Content-Type", headers.get("Content-Type") || "application/json");
|
|
2561
|
+
body = JSON.stringify(payload.body);
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
const response = await fetchImpl(url, {
|
|
2565
|
+
method: normalizeMethod2(payload.method),
|
|
2566
|
+
headers,
|
|
2567
|
+
body,
|
|
2568
|
+
credentials: "include"
|
|
2569
|
+
});
|
|
2570
|
+
return parseJsonResponse(response);
|
|
2571
|
+
};
|
|
2572
|
+
const download = async (payload) => {
|
|
2573
|
+
if (!payload?.path) {
|
|
2574
|
+
throw new Error("transport.download \u9700\u8981 path");
|
|
2575
|
+
}
|
|
2576
|
+
const url = appendQuery(joinServicePath(servicePrefix, payload.path), payload.query);
|
|
2577
|
+
const headers = new Headers(payload.headers);
|
|
2578
|
+
let body;
|
|
2579
|
+
if (payload.body !== void 0) {
|
|
2580
|
+
if (payload.body instanceof FormData) {
|
|
2581
|
+
body = payload.body;
|
|
2582
|
+
} else {
|
|
2583
|
+
headers.set("Content-Type", headers.get("Content-Type") || "application/json");
|
|
2584
|
+
body = JSON.stringify(payload.body);
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
const response = await fetchImpl(url, {
|
|
2588
|
+
method: normalizeMethod2(payload.method),
|
|
2589
|
+
headers,
|
|
2590
|
+
body,
|
|
2591
|
+
credentials: "include"
|
|
2592
|
+
});
|
|
2593
|
+
if (!response.ok) {
|
|
2594
|
+
throw new Error(response.statusText || "\u4E0B\u8F7D\u5931\u8D25");
|
|
2595
|
+
}
|
|
2596
|
+
return {
|
|
2597
|
+
blob: await response.blob(),
|
|
2598
|
+
contentType: response.headers.get("content-type") || void 0,
|
|
2599
|
+
fileName: response.headers.get("content-disposition") || void 0,
|
|
2600
|
+
headers: Object.fromEntries(response.headers.entries())
|
|
2601
|
+
};
|
|
2602
|
+
};
|
|
2603
|
+
return {
|
|
2604
|
+
invoke: async (method, payload) => {
|
|
2605
|
+
if (method === "transport.request") return await request(payload);
|
|
2606
|
+
if (method === "transport.download") return await download(payload);
|
|
2607
|
+
throw new Error(`\u4E0D\u652F\u6301\u7684 bridge \u65B9\u6CD5: ${method}`);
|
|
2608
|
+
}
|
|
2609
|
+
};
|
|
2610
|
+
};
|
|
2611
|
+
var createBrowserPageContext = (bootstrap, options = {}) => {
|
|
2612
|
+
const route = {
|
|
2613
|
+
pathname: options.route?.pathname || (typeof window !== "undefined" ? window.location.pathname : ""),
|
|
2614
|
+
fullPath: options.route?.fullPath || (typeof window !== "undefined" ? `${window.location.pathname}${window.location.search}${window.location.hash}` : ""),
|
|
2615
|
+
params: options.route?.params || {},
|
|
2616
|
+
query: options.route?.query || {},
|
|
2617
|
+
hash: options.route?.hash || (typeof window !== "undefined" ? window.location.hash : "")
|
|
2618
|
+
};
|
|
2619
|
+
return {
|
|
2620
|
+
protocolVersion: bootstrap.asset?.protocolVersion || "1.0",
|
|
2621
|
+
app: bootstrap.app,
|
|
2622
|
+
page: {
|
|
2623
|
+
...bootstrap.page,
|
|
2624
|
+
version: bootstrap.asset?.version || bootstrap.page.version,
|
|
2625
|
+
buildId: bootstrap.asset?.buildId || bootstrap.page.buildId
|
|
2626
|
+
},
|
|
2627
|
+
user: bootstrap.user,
|
|
2628
|
+
route,
|
|
2629
|
+
env: bootstrap.env || {},
|
|
2630
|
+
permissions: {
|
|
2631
|
+
canView: bootstrap.permissions?.canView !== false,
|
|
2632
|
+
hasFullAccess: bootstrap.permissions?.hasFullAccess === true,
|
|
2633
|
+
...bootstrap.permissions || {}
|
|
2634
|
+
},
|
|
2635
|
+
capabilities: Array.from(
|
|
2636
|
+
/* @__PURE__ */ new Set([
|
|
2637
|
+
"navigation",
|
|
2638
|
+
"ui.message",
|
|
2639
|
+
"ui.modal",
|
|
2640
|
+
"transport.request",
|
|
2641
|
+
"transport.download",
|
|
2642
|
+
...bootstrap.sdk?.supportedBridgeMethods || []
|
|
2643
|
+
])
|
|
2644
|
+
),
|
|
2645
|
+
ui: {
|
|
2646
|
+
message: {
|
|
2647
|
+
success: (text) => options.message?.success?.(text),
|
|
2648
|
+
error: (text) => options.message?.error?.(text),
|
|
2649
|
+
warning: (text) => options.message?.warning?.(text),
|
|
2650
|
+
info: (text) => options.message?.info?.(text),
|
|
2651
|
+
loading: (text) => options.message?.loading?.(text) || (() => void 0)
|
|
2652
|
+
},
|
|
2653
|
+
modal: {
|
|
2654
|
+
confirm: (input) => options.modal?.confirm?.(input) || Promise.resolve(false)
|
|
2655
|
+
}
|
|
2656
|
+
},
|
|
2657
|
+
navigation: {
|
|
2658
|
+
pushPage: (pageKey, query) => options.navigation?.pushPage?.(pageKey, query),
|
|
2659
|
+
replacePage: (pageKey, query) => options.navigation?.replacePage?.(pageKey, query),
|
|
2660
|
+
pushRoute: (routeValue, query) => options.navigation?.pushRoute?.(routeValue, query),
|
|
2661
|
+
replaceRoute: (routeValue, query) => options.navigation?.replaceRoute?.(routeValue, query),
|
|
2662
|
+
updateQuery: (query) => options.navigation?.updateQuery?.(query),
|
|
2663
|
+
setHash: (hash) => options.navigation?.setHash?.(hash),
|
|
2664
|
+
back: () => options.navigation?.back?.()
|
|
2665
|
+
},
|
|
2666
|
+
bridge: createBrowserPageBridge(options),
|
|
2667
|
+
sdk: {
|
|
2668
|
+
...bootstrap.sdk,
|
|
2669
|
+
supportedBridgeMethods: ["transport.request", "transport.download"]
|
|
2670
|
+
}
|
|
2671
|
+
};
|
|
2672
|
+
};
|
|
2673
|
+
|
|
2492
2674
|
// packages/sdk/src/runtime/react/auth.tsx
|
|
2493
2675
|
import {
|
|
2494
2676
|
useCallback as useCallback3,
|
|
@@ -2548,7 +2730,7 @@ var createAuthClient = ({
|
|
|
2548
2730
|
const payload = await readPayload(response);
|
|
2549
2731
|
const code = getRecordValue(payload, "code");
|
|
2550
2732
|
const success = getRecordValue(payload, "success");
|
|
2551
|
-
if (!response.ok || success === false || !
|
|
2733
|
+
if (!response.ok || success === false || !isSuccessCode3(code)) {
|
|
2552
2734
|
throw new AuthClientError(
|
|
2553
2735
|
String(getRecordValue(payload, "message") || `Auth request failed: ${response.status}`),
|
|
2554
2736
|
{ status: response.status, code, payload }
|
|
@@ -2601,7 +2783,7 @@ var getRecordValue = (value, key) => {
|
|
|
2601
2783
|
if (!value || typeof value !== "object") return void 0;
|
|
2602
2784
|
return value[key];
|
|
2603
2785
|
};
|
|
2604
|
-
var
|
|
2786
|
+
var isSuccessCode3 = (code) => {
|
|
2605
2787
|
if (code === void 0 || code === null || code === "") return true;
|
|
2606
2788
|
const normalized = Number(code);
|
|
2607
2789
|
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
@@ -3143,9 +3325,12 @@ var OpenXiangdaProvider = ({
|
|
|
3143
3325
|
[appType]
|
|
3144
3326
|
);
|
|
3145
3327
|
const [accessToken, setAccessTokenState] = useState4(null);
|
|
3328
|
+
const accessTokenRef = useRef2(null);
|
|
3146
3329
|
const setAccessToken = useCallback4(
|
|
3147
3330
|
(nextAccessToken) => {
|
|
3148
|
-
|
|
3331
|
+
const normalizedAccessToken = nextAccessToken || null;
|
|
3332
|
+
accessTokenRef.current = normalizedAccessToken;
|
|
3333
|
+
setAccessTokenState(normalizedAccessToken);
|
|
3149
3334
|
},
|
|
3150
3335
|
[]
|
|
3151
3336
|
);
|
|
@@ -3171,7 +3356,7 @@ var OpenXiangdaProvider = ({
|
|
|
3171
3356
|
return;
|
|
3172
3357
|
}
|
|
3173
3358
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
3174
|
-
const requestFetch = options.accessToken !== void 0 ? createAuthorizedFetch(resolvedFetch, options.accessToken || null) :
|
|
3359
|
+
const requestFetch = options.accessToken !== void 0 ? createAuthorizedFetch(resolvedFetch, options.accessToken || null) : createAuthorizedFetch(resolvedFetch, accessTokenRef.current);
|
|
3175
3360
|
try {
|
|
3176
3361
|
const response = await requestFetch(
|
|
3177
3362
|
buildServiceUrl2(
|
|
@@ -3205,7 +3390,7 @@ var OpenXiangdaProvider = ({
|
|
|
3205
3390
|
error: normalizeRuntimeError(error)
|
|
3206
3391
|
});
|
|
3207
3392
|
}
|
|
3208
|
-
}, [
|
|
3393
|
+
}, [resolvedAppType, resolvedFetch, servicePrefix]);
|
|
3209
3394
|
useEffect4(() => {
|
|
3210
3395
|
void reload();
|
|
3211
3396
|
}, [reload]);
|
|
@@ -3215,10 +3400,11 @@ var OpenXiangdaProvider = ({
|
|
|
3215
3400
|
appType: resolvedAppType,
|
|
3216
3401
|
servicePrefix,
|
|
3217
3402
|
fetchImpl: authorizedFetch,
|
|
3403
|
+
baseFetchImpl: resolvedFetch,
|
|
3218
3404
|
reload,
|
|
3219
3405
|
setAccessToken
|
|
3220
3406
|
}),
|
|
3221
|
-
[authorizedFetch, reload, resolvedAppType, servicePrefix, state]
|
|
3407
|
+
[authorizedFetch, reload, resolvedAppType, resolvedFetch, servicePrefix, state]
|
|
3222
3408
|
);
|
|
3223
3409
|
return /* @__PURE__ */ jsx4(OpenXiangdaRuntimeContext.Provider, { value, children });
|
|
3224
3410
|
};
|
|
@@ -3230,6 +3416,96 @@ var useOpenXiangda = () => {
|
|
|
3230
3416
|
return context;
|
|
3231
3417
|
};
|
|
3232
3418
|
var useRuntimeBootstrap = () => useOpenXiangda();
|
|
3419
|
+
var OpenXiangdaPageProvider = ({
|
|
3420
|
+
children,
|
|
3421
|
+
page,
|
|
3422
|
+
route,
|
|
3423
|
+
env,
|
|
3424
|
+
message: message2,
|
|
3425
|
+
modal,
|
|
3426
|
+
navigation
|
|
3427
|
+
}) => {
|
|
3428
|
+
const runtime = useOpenXiangda();
|
|
3429
|
+
const context = useMemo5(() => {
|
|
3430
|
+
const bootstrap = runtime.data;
|
|
3431
|
+
const app = toRuntimeRecord(bootstrap?.app);
|
|
3432
|
+
const user = toRuntimeRecord(bootstrap?.user);
|
|
3433
|
+
const permissions = bootstrap?.permissions;
|
|
3434
|
+
const tenantId = toStringValue(getRecordValue2(app, "tenantId")) || toStringValue(getRecordValue2(user, "tenantId")) || toStringValue(getRecordValue2(app, "tenantCode")) || "";
|
|
3435
|
+
const appType = runtime.appType || bootstrap?.appType || toStringValue(getRecordValue2(app, "appType"));
|
|
3436
|
+
const routeInfo = buildBrowserRouteInfo(route);
|
|
3437
|
+
return createBrowserPageContext(
|
|
3438
|
+
{
|
|
3439
|
+
app: {
|
|
3440
|
+
...app,
|
|
3441
|
+
appType,
|
|
3442
|
+
tenantId
|
|
3443
|
+
},
|
|
3444
|
+
page: {
|
|
3445
|
+
id: routeInfo.pathname || "react-spa",
|
|
3446
|
+
code: routeInfo.pathname || "react-spa",
|
|
3447
|
+
name: "OpenXiangda React SPA",
|
|
3448
|
+
type: "react-spa",
|
|
3449
|
+
rendererType: "react-spa",
|
|
3450
|
+
routeKey: routeInfo.pathname || "react-spa",
|
|
3451
|
+
status: "ACTIVE",
|
|
3452
|
+
props: {},
|
|
3453
|
+
route: {},
|
|
3454
|
+
dataSources: [],
|
|
3455
|
+
capabilities: {},
|
|
3456
|
+
buildId: toStringValue(
|
|
3457
|
+
getRecordValue2(bootstrap?.runtime, "activeBuildId")
|
|
3458
|
+
),
|
|
3459
|
+
...page
|
|
3460
|
+
},
|
|
3461
|
+
user: {
|
|
3462
|
+
...user,
|
|
3463
|
+
id: toStringValue(getRecordValue2(user, "id")) || (user.isGuest ? "guest" : "current"),
|
|
3464
|
+
username: toStringValue(getRecordValue2(user, "username")) || toStringValue(getRecordValue2(user, "name")) || (user.isGuest ? "guest" : "current"),
|
|
3465
|
+
tenantId,
|
|
3466
|
+
isGuest: user.isGuest === true || user.userType === "guest" || Boolean(getRecordValue2(user, "publicAccess")),
|
|
3467
|
+
userType: user.userType === "guest" || user.isGuest === true ? "guest" : "normal"
|
|
3468
|
+
},
|
|
3469
|
+
env: {
|
|
3470
|
+
appType,
|
|
3471
|
+
servicePrefix: runtime.servicePrefix,
|
|
3472
|
+
runtimeMode: bootstrap?.runtime?.mode || "react-spa",
|
|
3473
|
+
...env || {}
|
|
3474
|
+
},
|
|
3475
|
+
permissions: {
|
|
3476
|
+
canView: runtime.error?.type !== "forbidden",
|
|
3477
|
+
hasFullAccess: permissions?.hasFullAccess === true,
|
|
3478
|
+
...permissions || {}
|
|
3479
|
+
},
|
|
3480
|
+
sdk: {
|
|
3481
|
+
packageName: "openxiangda",
|
|
3482
|
+
supportedBridgeMethods: ["transport.request", "transport.download"]
|
|
3483
|
+
}
|
|
3484
|
+
},
|
|
3485
|
+
{
|
|
3486
|
+
servicePrefix: runtime.servicePrefix,
|
|
3487
|
+
fetchImpl: runtime.fetchImpl,
|
|
3488
|
+
route: routeInfo,
|
|
3489
|
+
message: message2,
|
|
3490
|
+
modal,
|
|
3491
|
+
navigation
|
|
3492
|
+
}
|
|
3493
|
+
);
|
|
3494
|
+
}, [
|
|
3495
|
+
env,
|
|
3496
|
+
message2,
|
|
3497
|
+
modal,
|
|
3498
|
+
navigation,
|
|
3499
|
+
page,
|
|
3500
|
+
route,
|
|
3501
|
+
runtime.appType,
|
|
3502
|
+
runtime.data,
|
|
3503
|
+
runtime.error?.type,
|
|
3504
|
+
runtime.fetchImpl,
|
|
3505
|
+
runtime.servicePrefix
|
|
3506
|
+
]);
|
|
3507
|
+
return /* @__PURE__ */ jsx4(PageProvider, { context, children });
|
|
3508
|
+
};
|
|
3233
3509
|
var useAppMenus = () => {
|
|
3234
3510
|
const runtime = useOpenXiangda();
|
|
3235
3511
|
return {
|
|
@@ -3607,7 +3883,40 @@ var getRecordValue2 = (value, key) => {
|
|
|
3607
3883
|
if (!value || typeof value !== "object") return void 0;
|
|
3608
3884
|
return value[key];
|
|
3609
3885
|
};
|
|
3610
|
-
var
|
|
3886
|
+
var toRuntimeRecord = (value) => {
|
|
3887
|
+
return value && typeof value === "object" ? { ...value } : {};
|
|
3888
|
+
};
|
|
3889
|
+
var toStringValue = (value) => {
|
|
3890
|
+
if (value === void 0 || value === null) return "";
|
|
3891
|
+
return String(value);
|
|
3892
|
+
};
|
|
3893
|
+
var parseBrowserQuery = () => {
|
|
3894
|
+
if (typeof window === "undefined") return {};
|
|
3895
|
+
const query = {};
|
|
3896
|
+
const params = new URLSearchParams(window.location.search);
|
|
3897
|
+
params.forEach((value, key) => {
|
|
3898
|
+
const currentValue = query[key];
|
|
3899
|
+
if (currentValue === void 0) {
|
|
3900
|
+
query[key] = value;
|
|
3901
|
+
return;
|
|
3902
|
+
}
|
|
3903
|
+
query[key] = Array.isArray(currentValue) ? [...currentValue, value] : [currentValue, value];
|
|
3904
|
+
});
|
|
3905
|
+
return query;
|
|
3906
|
+
};
|
|
3907
|
+
var buildBrowserRouteInfo = (route) => {
|
|
3908
|
+
const pathname = route?.pathname || (typeof window !== "undefined" ? window.location.pathname : "");
|
|
3909
|
+
const search = typeof window !== "undefined" ? window.location.search : "";
|
|
3910
|
+
const hash = route?.hash || (typeof window !== "undefined" ? window.location.hash : "");
|
|
3911
|
+
return {
|
|
3912
|
+
pathname,
|
|
3913
|
+
fullPath: route?.fullPath || (typeof window !== "undefined" ? `${pathname}${search}${hash}` : pathname),
|
|
3914
|
+
params: route?.params || {},
|
|
3915
|
+
query: route?.query || parseBrowserQuery(),
|
|
3916
|
+
hash
|
|
3917
|
+
};
|
|
3918
|
+
};
|
|
3919
|
+
var isSuccessCode4 = (code) => {
|
|
3611
3920
|
if (code === void 0 || code === null || code === "") return true;
|
|
3612
3921
|
const normalized = Number(code);
|
|
3613
3922
|
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
@@ -3615,7 +3924,7 @@ var isSuccessCode3 = (code) => {
|
|
|
3615
3924
|
var isRuntimeEnvelopeFailure = (response, payload) => {
|
|
3616
3925
|
const code = getRecordValue2(payload, "code");
|
|
3617
3926
|
const success = getRecordValue2(payload, "success");
|
|
3618
|
-
return !response.ok || success === false || !
|
|
3927
|
+
return !response.ok || success === false || !isSuccessCode4(code);
|
|
3619
3928
|
};
|
|
3620
3929
|
var isServerErrorCode = (code) => {
|
|
3621
3930
|
const normalized = Number(code);
|
|
@@ -3685,7 +3994,7 @@ var createPublicAccessClient = ({
|
|
|
3685
3994
|
const payload = await readPayload2(response);
|
|
3686
3995
|
const code = getRecordValue3(payload, "code");
|
|
3687
3996
|
const success = getRecordValue3(payload, "success");
|
|
3688
|
-
if (!response.ok || success === false || !
|
|
3997
|
+
if (!response.ok || success === false || !isSuccessCode5(code)) {
|
|
3689
3998
|
throw new PublicAccessClientError(
|
|
3690
3999
|
String(
|
|
3691
4000
|
getRecordValue3(payload, "message") || `Public access session failed: ${response.status}`
|
|
@@ -3723,7 +4032,7 @@ var getRecordValue3 = (value, key) => {
|
|
|
3723
4032
|
if (!value || typeof value !== "object") return void 0;
|
|
3724
4033
|
return value[key];
|
|
3725
4034
|
};
|
|
3726
|
-
var
|
|
4035
|
+
var isSuccessCode5 = (code) => {
|
|
3727
4036
|
if (code === void 0 || code === null || code === "") return true;
|
|
3728
4037
|
const normalized = Number(code);
|
|
3729
4038
|
return Number.isFinite(normalized) ? normalized === 0 || normalized >= 200 && normalized < 300 : false;
|
|
@@ -3757,14 +4066,14 @@ var usePublicAccess = (options = {}) => {
|
|
|
3757
4066
|
const {
|
|
3758
4067
|
appType: runtimeAppType,
|
|
3759
4068
|
servicePrefix: runtimeServicePrefix,
|
|
3760
|
-
|
|
4069
|
+
baseFetchImpl: runtimeBaseFetchImpl,
|
|
3761
4070
|
reload: reloadRuntime,
|
|
3762
4071
|
setAccessToken
|
|
3763
4072
|
} = runtime;
|
|
3764
4073
|
const {
|
|
3765
4074
|
appType = runtimeAppType,
|
|
3766
4075
|
servicePrefix = runtimeServicePrefix,
|
|
3767
|
-
fetchImpl =
|
|
4076
|
+
fetchImpl = runtimeBaseFetchImpl,
|
|
3768
4077
|
autoStart = true,
|
|
3769
4078
|
...sessionInput
|
|
3770
4079
|
} = options;
|
|
@@ -3842,6 +4151,7 @@ var readPathFromLocation = () => typeof window === "undefined" ? void 0 : window
|
|
|
3842
4151
|
export {
|
|
3843
4152
|
AuthClientError,
|
|
3844
4153
|
LoginPage,
|
|
4154
|
+
OpenXiangdaPageProvider,
|
|
3845
4155
|
OpenXiangdaProvider,
|
|
3846
4156
|
PageProvider,
|
|
3847
4157
|
PermissionBoundary,
|