@ximatai/muyun-web-app 0.26.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EmployeeDetailWorkspaceView-mtdcsqgF.js +14 -0
- package/dist/EmployeeManagementView-CKKvQZaC.js +1706 -0
- package/dist/MetadataOrchestrationView-CprWBocy.js +655 -0
- package/dist/ModuleActionManagementView-DNuAQUPE.js +597 -0
- package/dist/RoleAuthorizationView-CQtSAJoJ.js +592 -0
- package/dist/RoleDetailWorkspaceView-Dh8DXpyS.js +26 -0
- package/dist/RoleManagementView-BrqaFV7y.js +1927 -0
- package/dist/SystemUserDetailWorkspaceView-N-kvycAu.js +17 -0
- package/dist/SystemUserManagementView-BVS5moV5.js +761 -0
- package/dist/UserDetailWorkspaceView-Iek6xwix.js +17 -0
- package/dist/UserManagementView-BR_Jz8O-.js +965 -0
- package/dist/currentUserContext-B1lj1WgF.js +11 -0
- package/dist/index.css +2 -0
- package/dist/index.js +7127 -0
- package/dist/pageRealtime-sRtDYlQP.js +140 -0
- package/dist/platform-components-bC1gwhic.js +8412 -0
- package/dist/types/App.vue.d.ts +3 -0
- package/dist/types/app/ChangeOwnPasswordDialog.vue.d.ts +27 -0
- package/dist/types/app/LoginView.vue.d.ts +14 -0
- package/dist/types/app/appWorkbenchStartup.d.ts +3 -0
- package/dist/types/app/devWorkbenchStartup.d.ts +1 -0
- package/dist/types/app/loginTenant.d.ts +6 -0
- package/dist/types/app/platformMessage.d.ts +6 -0
- package/dist/types/app/query.d.ts +3 -0
- package/dist/types/app/router.d.ts +1 -0
- package/dist/types/app/workbenchStartup.d.ts +24 -0
- package/dist/types/consumer/PlatformAdminOutlet.vue.d.ts +7 -0
- package/dist/types/consumer/index.d.ts +15 -0
- package/dist/types/dynamic-page-runtime/DynamicModuleHost.vue.d.ts +7 -0
- package/dist/types/dynamic-page-runtime/DynamicModulePage.vue.d.ts +7 -0
- package/dist/types/dynamic-page-runtime/actionReactions.d.ts +16 -0
- package/dist/types/dynamic-page-runtime/index.d.ts +3 -0
- package/dist/types/dynamic-page-runtime/mockDescriptor.d.ts +2 -0
- package/dist/types/main.d.ts +2 -0
- package/dist/types/platform-admin-runtime/PlatformAdminOutlet.vue.d.ts +7 -0
- package/dist/types/platform-admin-runtime/WorkspaceViewDrawer.vue.d.ts +32 -0
- package/dist/types/platform-admin-runtime/WorkspaceViewOutlet.vue.d.ts +7 -0
- package/dist/types/platform-admin-runtime/authSession.d.ts +8 -0
- package/dist/types/platform-admin-runtime/backendHttp.d.ts +3 -0
- package/dist/types/platform-admin-runtime/currentUserContext.d.ts +4 -0
- package/dist/types/platform-admin-runtime/index.d.ts +12 -0
- package/dist/types/platform-admin-runtime/moduleOpenApi.d.ts +36 -0
- package/dist/types/platform-admin-runtime/pageRealtime.d.ts +61 -0
- package/dist/types/platform-admin-runtime/platformAdminRoutes.d.ts +21 -0
- package/dist/types/platform-admin-runtime/realtime.d.ts +20 -0
- package/dist/types/platform-admin-runtime/sessionRecovery.d.ts +3 -0
- package/dist/types/platform-admin-runtime/useWorkspaceViewPromotion.d.ts +24 -0
- package/dist/types/platform-admin-runtime/workspaceViewContract.d.ts +36 -0
- package/dist/types/platform-admin-runtime/workspaceViewContributions.d.ts +3 -0
- package/dist/types/platform-admin-runtime/workspaceViewHost.d.ts +10 -0
- package/dist/types/platform-admin-runtime/workspaceViewSessions.d.ts +18 -0
- package/dist/types/platform-admin-runtime/workspaceViews.d.ts +18 -0
- package/dist/types/platform-components/ApplicationScopeSwitcher.vue.d.ts +18 -0
- package/dist/types/platform-components/CrudRecordListExplorer.vue.d.ts +52 -0
- package/dist/types/platform-components/DateTimeText.vue.d.ts +15 -0
- package/dist/types/platform-components/DrawerOperationBar.vue.d.ts +18 -0
- package/dist/types/platform-components/EnabledSelect.vue.d.ts +14 -0
- package/dist/types/platform-components/ManagementExplorerColumn.vue.d.ts +13 -0
- package/dist/types/platform-components/ManagementWorkspace.vue.d.ts +19 -0
- package/dist/types/platform-components/ModuleActionButton.vue.d.ts +40 -0
- package/dist/types/platform-components/RecordActionBar.vue.d.ts +20 -0
- package/dist/types/platform-components/RecordDetailDrawer.vue.d.ts +37 -0
- package/dist/types/platform-components/RecordDetailFields.vue.d.ts +23 -0
- package/dist/types/platform-components/RecordDetailLayout.vue.d.ts +37 -0
- package/dist/types/platform-components/RecordDetailPanel.vue.d.ts +25 -0
- package/dist/types/platform-components/RecordExpandedSubtable.vue.d.ts +29 -0
- package/dist/types/platform-components/RecordExplorerPanel.vue.d.ts +39 -0
- package/dist/types/platform-components/RecordExternalChangeNotice.vue.d.ts +20 -0
- package/dist/types/platform-components/RecordFormFields.vue.d.ts +31 -0
- package/dist/types/platform-components/RecordListExplorer.vue.d.ts +42 -0
- package/dist/types/platform-components/RecordMetaSection.vue.d.ts +8 -0
- package/dist/types/platform-components/RecordModeDrawer.vue.d.ts +74 -0
- package/dist/types/platform-components/RecordPicker.vue.d.ts +35 -0
- package/dist/types/platform-components/RecordQueryListPanel.vue.d.ts +103 -0
- package/dist/types/platform-components/RecordStatusSwitch.vue.d.ts +18 -0
- package/dist/types/platform-components/RecordStatusTag.vue.d.ts +6 -0
- package/dist/types/platform-components/RecordTreeSelector.vue.d.ts +22 -0
- package/dist/types/platform-components/RecycleBinModeButton.vue.d.ts +16 -0
- package/dist/types/platform-components/StaticManagementLayout.vue.d.ts +44 -0
- package/dist/types/platform-components/TreeRecordExplorer.vue.d.ts +57 -0
- package/dist/types/platform-components/UserSessionExpandedSubtable.vue.d.ts +26 -0
- package/dist/types/platform-components/actionConfirmation.d.ts +3 -0
- package/dist/types/platform-components/crudRecordListModel.d.ts +10 -0
- package/dist/types/platform-components/drawerPromotion.d.ts +4 -0
- package/dist/types/platform-components/index.d.ts +76 -0
- package/dist/types/platform-components/optionFieldOptions.d.ts +10 -0
- package/dist/types/platform-components/pageLayoutContext.d.ts +6 -0
- package/dist/types/platform-components/platformActionResultFeedback.d.ts +12 -0
- package/dist/types/platform-components/platformActionResultReactions.d.ts +53 -0
- package/dist/types/platform-components/platformDateTime.d.ts +16 -0
- package/dist/types/platform-components/platformErrorFeedback.d.ts +15 -0
- package/dist/types/platform-components/platformTimeZoneContext.d.ts +3 -0
- package/dist/types/platform-components/recordActionBarModel.d.ts +27 -0
- package/dist/types/platform-components/recordDetailFieldModel.d.ts +7 -0
- package/dist/types/platform-components/recordDraftNormalizer.d.ts +1 -0
- package/dist/types/platform-components/recordEditorSessionState.d.ts +38 -0
- package/dist/types/platform-components/recordExplorerItemModel.d.ts +8 -0
- package/dist/types/platform-components/recordFormFieldModel.d.ts +57 -0
- package/dist/types/platform-components/recordPickerConstraints.d.ts +20 -0
- package/dist/types/platform-components/recordPickerModel.d.ts +2 -0
- package/dist/types/platform-components/recycleBinState.d.ts +39 -0
- package/dist/types/platform-components/scopedResourceTreeModuleContext.d.ts +6 -0
- package/dist/types/platform-components/scopedTreeModuleContext.d.ts +10 -0
- package/dist/types/platform-components/softDeletedConflictHandler.d.ts +75 -0
- package/dist/types/platform-components/staticCrudManagementState.d.ts +66 -0
- package/dist/types/platform-components/staticFormActionFlow.d.ts +39 -0
- package/dist/types/platform-components/staticTreeResourceModuleContext.d.ts +7 -0
- package/dist/types/platform-components/treeRecordModel.d.ts +17 -0
- package/dist/types/platform-components/useRecycleBinExplorerMode.d.ts +26 -0
- package/dist/types/platform-components/userSessionPresentation.d.ts +12 -0
- package/dist/types/platform-workbench/Workbench.vue.d.ts +46 -0
- package/dist/types/platform-workbench/WorkbenchMenu.vue.d.ts +23 -0
- package/dist/types/platform-workbench/WorkbenchMenuTree.vue.d.ts +13 -0
- package/dist/types/platform-workbench/WorkbenchOutlet.vue.d.ts +7 -0
- package/dist/types/platform-workbench/hosts/BusinessRouteHost.vue.d.ts +7 -0
- package/dist/types/platform-workbench/hosts/ExternalPageHost.vue.d.ts +7 -0
- package/dist/types/platform-workbench/hosts/PlatformRouteHost.vue.d.ts +7 -0
- package/dist/types/platform-workbench/index.d.ts +11 -0
- package/dist/types/platform-workbench/menuNavigation.d.ts +28 -0
- package/dist/types/platform-workbench/menuTreeModel.d.ts +20 -0
- package/dist/types/platform-workbench/pageHostRegistry.d.ts +3 -0
- package/dist/types/platform-workbench/realtimeStatus.d.ts +7 -0
- package/dist/types/platform-workbench/workbenchNavigation.d.ts +12 -0
- package/dist/types/views/ApplicationManagementView.vue.d.ts +3 -0
- package/dist/types/views/DepartmentManagementView.vue.d.ts +3 -0
- package/dist/types/views/DictionaryManagementView.vue.d.ts +3 -0
- package/dist/types/views/EmployeeDetailContent.vue.d.ts +64 -0
- package/dist/types/views/EmployeeDetailWorkspaceView.vue.d.ts +6 -0
- package/dist/types/views/EmployeeEmploymentDrawer.vue.d.ts +14 -0
- package/dist/types/views/EmployeeEmploymentTable.vue.d.ts +18 -0
- package/dist/types/views/EmployeeManagementView.vue.d.ts +7 -0
- package/dist/types/views/FieldSpecManagementView.vue.d.ts +3 -0
- package/dist/types/views/FieldUiControlManagementView.vue.d.ts +3 -0
- package/dist/types/views/HomeView.vue.d.ts +3 -0
- package/dist/types/views/MenuManagementView.vue.d.ts +3 -0
- package/dist/types/views/MetadataOrchestrationView.vue.d.ts +8 -0
- package/dist/types/views/ModuleActionManagementView.vue.d.ts +9 -0
- package/dist/types/views/ModuleManagementView.vue.d.ts +3 -0
- package/dist/types/views/ModuleOpenApiView.vue.d.ts +10 -0
- package/dist/types/views/OpenApiCatalogView.vue.d.ts +9 -0
- package/dist/types/views/OrganizationManagementView.vue.d.ts +3 -0
- package/dist/types/views/PasswordManagementView.vue.d.ts +3 -0
- package/dist/types/views/PositionManagementView.vue.d.ts +3 -0
- package/dist/types/views/RoleAccountGrantDrawer.vue.d.ts +16 -0
- package/dist/types/views/RoleAuthorizationView.vue.d.ts +12 -0
- package/dist/types/views/RoleDetailWorkspaceView.vue.d.ts +9 -0
- package/dist/types/views/RoleEmploymentGrantDrawer.vue.d.ts +16 -0
- package/dist/types/views/RoleGroupMemberSelector.vue.d.ts +18 -0
- package/dist/types/views/RoleManagementView.vue.d.ts +9 -0
- package/dist/types/views/SystemUserDetailWorkspaceView.vue.d.ts +7 -0
- package/dist/types/views/SystemUserManagementView.vue.d.ts +7 -0
- package/dist/types/views/TenantManagementView.vue.d.ts +3 -0
- package/dist/types/views/UserDetailContent.vue.d.ts +32 -0
- package/dist/types/views/UserDetailWorkspaceView.vue.d.ts +7 -0
- package/dist/types/views/UserManagementView.vue.d.ts +8 -0
- package/dist/types/views/applicationManagementState.d.ts +64 -0
- package/dist/types/views/departmentManagementState.d.ts +137 -0
- package/dist/types/views/dictionaryManagementState.d.ts +215 -0
- package/dist/types/views/employeeDetailStateModel.d.ts +39 -0
- package/dist/types/views/employeeDetailWorkspaceSession.d.ts +16 -0
- package/dist/types/views/employeeDetailWorkspaceView.d.ts +4 -0
- package/dist/types/views/fieldSpecManagementState.d.ts +80 -0
- package/dist/types/views/fieldUiControlManagementState.d.ts +76 -0
- package/dist/types/views/menuManagementState.d.ts +178 -0
- package/dist/types/views/metadataOrchestrationState.d.ts +278 -0
- package/dist/types/views/metadataOrchestrationWorkspaceView.d.ts +6 -0
- package/dist/types/views/moduleActionManagementWorkspaceView.d.ts +7 -0
- package/dist/types/views/moduleManagementState.d.ts +76 -0
- package/dist/types/views/organizationManagementState.d.ts +64 -0
- package/dist/types/views/positionManagementState.d.ts +218 -0
- package/dist/types/views/roleAuthorizationWorkspaceSession.d.ts +17 -0
- package/dist/types/views/roleAuthorizationWorkspaceView.d.ts +5 -0
- package/dist/types/views/roleDetailWorkspaceSession.d.ts +19 -0
- package/dist/types/views/roleDetailWorkspaceView.d.ts +8 -0
- package/dist/types/views/roleGrantClient.d.ts +59 -0
- package/dist/types/views/systemUserDetailWorkspaceSession.d.ts +12 -0
- package/dist/types/views/systemUserDetailWorkspaceView.d.ts +5 -0
- package/dist/types/views/tenantManagementState.d.ts +64 -0
- package/dist/types/views/useEmployeeEmploymentRows.d.ts +20 -0
- package/dist/types/views/useUserSessionRows.d.ts +28 -0
- package/dist/types/views/userDetailStateModel.d.ts +11 -0
- package/dist/types/views/userDetailWorkspaceSession.d.ts +14 -0
- package/dist/types/views/userDetailWorkspaceView.d.ts +4 -0
- package/dist/types/vue-ui-antdv/components/ActionBar.vue.d.ts +11 -0
- package/dist/types/vue-ui-antdv/components/DictionarySelect.vue.d.ts +14 -0
- package/dist/types/vue-ui-antdv/components/ReferenceSelect.vue.d.ts +16 -0
- package/dist/types/vue-ui-antdv/components/UiActionButton.vue.d.ts +37 -0
- package/dist/types/vue-ui-antdv/components/UiBadge.vue.d.ts +20 -0
- package/dist/types/vue-ui-antdv/components/UiButton.vue.d.ts +41 -0
- package/dist/types/vue-ui-antdv/components/UiCheckbox.vue.d.ts +30 -0
- package/dist/types/vue-ui-antdv/components/UiDataTable.vue.d.ts +71 -0
- package/dist/types/vue-ui-antdv/components/UiDropdown.vue.d.ts +29 -0
- package/dist/types/vue-ui-antdv/components/UiEmpty.vue.d.ts +6 -0
- package/dist/types/vue-ui-antdv/components/UiError.vue.d.ts +7 -0
- package/dist/types/vue-ui-antdv/components/UiForm.vue.d.ts +15 -0
- package/dist/types/vue-ui-antdv/components/UiIcon.vue.d.ts +7 -0
- package/dist/types/vue-ui-antdv/components/UiInput.vue.d.ts +25 -0
- package/dist/types/vue-ui-antdv/components/UiMenu.vue.d.ts +19 -0
- package/dist/types/vue-ui-antdv/components/UiModal.vue.d.ts +36 -0
- package/dist/types/vue-ui-antdv/components/UiRecordExplorerItem.vue.d.ts +26 -0
- package/dist/types/vue-ui-antdv/components/UiSearchInput.vue.d.ts +22 -0
- package/dist/types/vue-ui-antdv/components/UiSelect.vue.d.ts +30 -0
- package/dist/types/vue-ui-antdv/components/UiSidePanel.vue.d.ts +28 -0
- package/dist/types/vue-ui-antdv/components/UiSidePanelHost.vue.d.ts +13 -0
- package/dist/types/vue-ui-antdv/components/UiSpin.vue.d.ts +22 -0
- package/dist/types/vue-ui-antdv/components/UiSwitch.vue.d.ts +22 -0
- package/dist/types/vue-ui-antdv/components/UiTable.vue.d.ts +13 -0
- package/dist/types/vue-ui-antdv/components/UiTabs.vue.d.ts +14 -0
- package/dist/types/vue-ui-antdv/components/UiTextArea.vue.d.ts +20 -0
- package/dist/types/vue-ui-antdv/components/UiTooltip.vue.d.ts +19 -0
- package/dist/types/vue-ui-antdv/components/UiTree.vue.d.ts +17 -0
- package/dist/types/vue-ui-antdv/components/UiTreeSelect.vue.d.ts +30 -0
- package/dist/types/vue-ui-antdv/components/sidePanelHost.d.ts +3 -0
- package/dist/types/vue-ui-antdv/confirm.d.ts +5 -0
- package/dist/types/vue-ui-antdv/dataTableModel.d.ts +10 -0
- package/dist/types/vue-ui-antdv/dictionaries.d.ts +2 -0
- package/dist/types/vue-ui-antdv/feedback.d.ts +10 -0
- package/dist/types/vue-ui-antdv/index.d.ts +36 -0
- package/dist/types/vue-ui-antdv/references.d.ts +8 -0
- package/dist/types/vue-ui-antdv/registry.d.ts +3 -0
- package/dist/types/vue-ui-antdv/types.d.ts +65 -0
- package/dist/types/web-contracts/index.d.ts +862 -0
- package/dist/types/web-core/actionResult.d.ts +28 -0
- package/dist/types/web-core/clients.d.ts +23 -0
- package/dist/types/web-core/dataChanges.d.ts +15 -0
- package/dist/types/web-core/errors.d.ts +65 -0
- package/dist/types/web-core/http.d.ts +21 -0
- package/dist/types/web-core/index.d.ts +8 -0
- package/dist/types/web-core/mock.d.ts +6 -0
- package/dist/types/web-core/module/abilities.d.ts +21 -0
- package/dist/types/web-core/module/abilityCodes.d.ts +18 -0
- package/dist/types/web-core/module/index.d.ts +6 -0
- package/dist/types/web-core/module/moduleContext.d.ts +49 -0
- package/dist/types/web-core/module/recycleBin.d.ts +6 -0
- package/dist/types/web-core/module/runtimeContext.d.ts +65 -0
- package/dist/types/web-core/module/staticModuleClient.d.ts +45 -0
- package/dist/types/web-core/query.d.ts +16 -0
- package/dist/types/web-core/realtime.d.ts +104 -0
- package/dist/useUserSessionRows-CLM0ZvAF.js +128 -0
- package/dist/workspaceViewSessions-WsJU3OS7.js +1578 -0
- package/package.json +27 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { webDataChangeTypes, type WebActionResultEnvelope, type WebDataChange, type WebDataChangeType } from '@muyun/web-contracts';
|
|
2
|
+
export interface ResolvedWebActionResult {
|
|
3
|
+
message: string;
|
|
4
|
+
messageCode?: string;
|
|
5
|
+
messageType?: string;
|
|
6
|
+
resultType?: string;
|
|
7
|
+
changeSetId?: string;
|
|
8
|
+
changes: WebDataChange[];
|
|
9
|
+
raw: unknown;
|
|
10
|
+
}
|
|
11
|
+
export { webDataChangeTypes };
|
|
12
|
+
export type { WebDataChange, WebDataChangeType };
|
|
13
|
+
export declare const webDataChanges: {
|
|
14
|
+
recordCreated(moduleAlias: string, recordId: string, facts?: WebDataChangeFacts): WebDataChange;
|
|
15
|
+
recordUpdated(moduleAlias: string, recordId: string, facts?: WebDataChangeFacts): WebDataChange;
|
|
16
|
+
recordDeleted(moduleAlias: string, recordId: string, facts?: WebDataChangeFacts): WebDataChange;
|
|
17
|
+
collectionChanged(moduleAlias: string, facts?: WebDataChangeFacts): WebDataChange;
|
|
18
|
+
};
|
|
19
|
+
export type WebDataChangeFacts = Omit<WebDataChange, 'type' | 'moduleAlias'>;
|
|
20
|
+
export declare function withWebActionResultChanges<T>(result: T, changes: WebDataChange[]): T & {
|
|
21
|
+
changes: WebDataChange[];
|
|
22
|
+
};
|
|
23
|
+
export declare function resolveWebActionResultMessage(result: unknown, fallbackMessage?: string): string;
|
|
24
|
+
export declare function resolveWebActionResult(result: unknown, options?: {
|
|
25
|
+
fallbackMessage?: string;
|
|
26
|
+
}): ResolvedWebActionResult;
|
|
27
|
+
export declare function actionResultData<TData>(result: TData | WebActionResultEnvelope<TData>): TData;
|
|
28
|
+
export declare function webDataChangeKey(change: WebDataChange): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ChangeOwnPasswordRequest, CurrentUser, LoginRequest, LoginResult, MenuMineResponse } from '@muyun/web-contracts';
|
|
2
|
+
import type { HttpClient } from './http';
|
|
3
|
+
export interface SessionClient {
|
|
4
|
+
current(): Promise<CurrentUser>;
|
|
5
|
+
}
|
|
6
|
+
export interface MenuClient {
|
|
7
|
+
mine(): Promise<MenuMineResponse>;
|
|
8
|
+
}
|
|
9
|
+
export interface AuthClient {
|
|
10
|
+
login(request: LoginRequest): Promise<LoginResult>;
|
|
11
|
+
changeOwnPassword(request: ChangeOwnPasswordRequest, token: string): Promise<void>;
|
|
12
|
+
logout(token?: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createSessionClient(http: HttpClient): SessionClient;
|
|
15
|
+
export declare function createMenuClient(http: HttpClient): MenuClient;
|
|
16
|
+
/**
|
|
17
|
+
* The backend serializes Java enum values as upper-case identifiers while the
|
|
18
|
+
* web contract deliberately uses lower-case literals. Normalize once at the
|
|
19
|
+
* HTTP projection boundary so every workbench consumer sees the same menu
|
|
20
|
+
* contract instead of requiring application-level compatibility code.
|
|
21
|
+
*/
|
|
22
|
+
export declare function normalizeMenuMineResponse(response: unknown): MenuMineResponse;
|
|
23
|
+
export declare function createAuthClient(http: HttpClient): AuthClient;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { WebCommittedChangeSet } from '@muyun/web-contracts';
|
|
2
|
+
export type DataChangeHandler = (changeSet: WebCommittedChangeSet) => void | Promise<void>;
|
|
3
|
+
export interface DataChangeDispatcher {
|
|
4
|
+
dispatch(changeSet: WebCommittedChangeSet): Promise<boolean>;
|
|
5
|
+
subscribe(handler: DataChangeHandler): DataChangeSubscription;
|
|
6
|
+
markHandled(changeSetId: string | undefined): void;
|
|
7
|
+
}
|
|
8
|
+
export interface DataChangeDispatcherOptions {
|
|
9
|
+
maxHandledChangeSetIds?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface DataChangeSubscription {
|
|
12
|
+
unsubscribe(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare function createDataChangeDispatcher(options?: DataChangeDispatcherOptions): DataChangeDispatcher;
|
|
15
|
+
export declare function normalizeChangeSet(changeSet: WebCommittedChangeSet | undefined): WebCommittedChangeSet | undefined;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { WebActionMessage } from '@muyun/web-contracts';
|
|
2
|
+
export interface ErrorTarget {
|
|
3
|
+
kind?: string;
|
|
4
|
+
moduleAlias?: string;
|
|
5
|
+
entityAlias?: string;
|
|
6
|
+
relationAlias?: string;
|
|
7
|
+
fieldName?: string;
|
|
8
|
+
rowIndex?: number;
|
|
9
|
+
recordId?: string;
|
|
10
|
+
actionCode?: string;
|
|
11
|
+
attachmentId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ErrorUiContext {
|
|
14
|
+
phase: 'page-load' | 'action' | 'background';
|
|
15
|
+
surface: 'workbench' | 'form' | 'table' | 'dialog' | 'unknown';
|
|
16
|
+
}
|
|
17
|
+
export type GlobalErrorSlot = 'redirect-login' | 'page-error' | 'global-toast' | 'global-modal' | 'silent';
|
|
18
|
+
export interface GlobalErrorPresentation {
|
|
19
|
+
slot: GlobalErrorSlot;
|
|
20
|
+
message: string;
|
|
21
|
+
traceId?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const platformErrorCodes: {
|
|
24
|
+
readonly appError: "APP_ERROR";
|
|
25
|
+
readonly networkError: "NETWORK_ERROR";
|
|
26
|
+
readonly httpError: "HTTP_ERROR";
|
|
27
|
+
readonly authRequired: "AUTH_REQUIRED";
|
|
28
|
+
readonly authExpired: "AUTH_EXPIRED";
|
|
29
|
+
readonly passwordChangeRequired: "PASSWORD_CHANGE_REQUIRED";
|
|
30
|
+
readonly loginBadCredentials: "LOGIN_BAD_CREDENTIALS";
|
|
31
|
+
readonly accessDenied: "ACCESS_DENIED";
|
|
32
|
+
readonly validationFailed: "VALIDATION_FAILED";
|
|
33
|
+
readonly conflictVersion: "CONFLICT_VERSION";
|
|
34
|
+
readonly resourceInUse: "RESOURCE_IN_USE";
|
|
35
|
+
readonly resourceNotFound: "RESOURCE_NOT_FOUND";
|
|
36
|
+
readonly resourceSoftDeletedConflict: "RESOURCE_SOFT_DELETED_CONFLICT";
|
|
37
|
+
readonly configMissing: "CONFIG_MISSING";
|
|
38
|
+
readonly internalError: "INTERNAL_ERROR";
|
|
39
|
+
};
|
|
40
|
+
export type PlatformErrorCode = (typeof platformErrorCodes)[keyof typeof platformErrorCodes] | (string & {});
|
|
41
|
+
export declare class AppError extends Error {
|
|
42
|
+
readonly code: PlatformErrorCode;
|
|
43
|
+
readonly status?: number;
|
|
44
|
+
readonly traceId?: string;
|
|
45
|
+
readonly scope?: Record<string, unknown>;
|
|
46
|
+
readonly targets: ErrorTarget[];
|
|
47
|
+
readonly details?: Record<string, unknown>;
|
|
48
|
+
readonly messageArgs?: Record<string, unknown>;
|
|
49
|
+
readonly actionMessage?: WebActionMessage;
|
|
50
|
+
globallyHandled: boolean;
|
|
51
|
+
constructor(message: string, options?: {
|
|
52
|
+
code?: PlatformErrorCode;
|
|
53
|
+
status?: number;
|
|
54
|
+
traceId?: string;
|
|
55
|
+
scope?: Record<string, unknown>;
|
|
56
|
+
targets?: ErrorTarget[];
|
|
57
|
+
details?: Record<string, unknown>;
|
|
58
|
+
messageArgs?: Record<string, unknown>;
|
|
59
|
+
actionMessage?: WebActionMessage;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export declare function normalizeError(error: unknown): AppError;
|
|
63
|
+
export declare function resolveGlobalErrorPresentation(error: AppError, context?: ErrorUiContext): GlobalErrorPresentation;
|
|
64
|
+
export declare function userFacingErrorMessage(error: AppError): string;
|
|
65
|
+
export declare function isUnexpectedPlatformError(error: AppError): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RouteQueryValue } from '@muyun/web-contracts';
|
|
2
|
+
import { AppError } from './errors';
|
|
3
|
+
export interface RequestContext {
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
token?: string;
|
|
6
|
+
traceId?: string;
|
|
7
|
+
credentials?: RequestCredentials;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
onAuthenticationRequired?: (error: AppError, token?: string) => boolean | void;
|
|
10
|
+
}
|
|
11
|
+
export interface HttpRequestOptions {
|
|
12
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
13
|
+
path: string;
|
|
14
|
+
query?: Record<string, RouteQueryValue>;
|
|
15
|
+
body?: unknown;
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
export interface HttpClient {
|
|
19
|
+
request<T>(options: HttpRequestOptions): Promise<T>;
|
|
20
|
+
}
|
|
21
|
+
export declare function createHttpClient(context?: RequestContext): HttpClient;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CurrentUser, MenuRecord, WebTreeNode } from '@muyun/web-contracts';
|
|
2
|
+
import type { MenuClient, SessionClient } from './index';
|
|
3
|
+
export declare function createMockSessionClient(currentUser?: CurrentUser): SessionClient;
|
|
4
|
+
export declare function createMockMenuClient(records?: WebTreeNode<MenuRecord>[]): MenuClient;
|
|
5
|
+
export declare const mockCurrentUser: CurrentUser;
|
|
6
|
+
export declare const mockMenuTree: WebTreeNode<MenuRecord>[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ModuleAbilityCode } from './abilityCodes';
|
|
2
|
+
import { type ModuleRuntimeContextState } from './runtimeContext';
|
|
3
|
+
import type { ModuleEnableClient, StaticModuleCrudClient, StaticModuleTreeClient } from './staticModuleClient';
|
|
4
|
+
export interface ModuleAbilityClients<TRecord> {
|
|
5
|
+
crud: StaticModuleCrudClient<TRecord>;
|
|
6
|
+
tree: StaticModuleTreeClient<TRecord>;
|
|
7
|
+
enable: ModuleEnableClient;
|
|
8
|
+
}
|
|
9
|
+
export interface ModuleAbilities<TRecord> {
|
|
10
|
+
crud(): StaticModuleCrudClient<TRecord>;
|
|
11
|
+
tree(): StaticModuleTreeClient<TRecord>;
|
|
12
|
+
enable(): ModuleEnableClient;
|
|
13
|
+
tryCrud(): StaticModuleCrudClient<TRecord> | undefined;
|
|
14
|
+
tryTree(): StaticModuleTreeClient<TRecord> | undefined;
|
|
15
|
+
tryEnable(): ModuleEnableClient | undefined;
|
|
16
|
+
has(ability: ModuleAbilityCode | string): boolean | undefined;
|
|
17
|
+
hasCrud(): boolean | undefined;
|
|
18
|
+
hasTree(): boolean | undefined;
|
|
19
|
+
hasEnable(): boolean | undefined;
|
|
20
|
+
}
|
|
21
|
+
export declare function createModuleAbilities<TRecord>(moduleAlias: string, runtime: ModuleRuntimeContextState, clients: ModuleAbilityClients<TRecord>): ModuleAbilities<TRecord>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const moduleAbilityCodes: {
|
|
2
|
+
readonly crud: "crud";
|
|
3
|
+
readonly softDelete: "softDelete";
|
|
4
|
+
readonly lifecycle: "lifecycle";
|
|
5
|
+
readonly cache: "cache";
|
|
6
|
+
readonly tree: "tree";
|
|
7
|
+
readonly sort: "sort";
|
|
8
|
+
readonly reference: "reference";
|
|
9
|
+
readonly enable: "enable";
|
|
10
|
+
readonly dataScope: "dataScope";
|
|
11
|
+
readonly recycleBin: "recycleBin";
|
|
12
|
+
readonly workflow: "workflow";
|
|
13
|
+
readonly approval: "approval";
|
|
14
|
+
readonly childRelation: "childRelation";
|
|
15
|
+
readonly referenceDependency: "referenceDependency";
|
|
16
|
+
readonly exchange: "exchange";
|
|
17
|
+
};
|
|
18
|
+
export type ModuleAbilityCode = (typeof moduleAbilityCodes)[keyof typeof moduleAbilityCodes];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './abilityCodes';
|
|
2
|
+
export * from './recycleBin';
|
|
3
|
+
export * from './staticModuleClient';
|
|
4
|
+
export type { ModuleActionState, ModuleRuntimeAction, ModuleRuntimeContext, ModuleRuntimeContextState, } from './runtimeContext';
|
|
5
|
+
export type { ModuleAbilityClients, ModuleAbilities } from './abilities';
|
|
6
|
+
export * from './moduleContext';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { HttpClient } from '../http';
|
|
2
|
+
import { type ModuleAbilities } from './abilities';
|
|
3
|
+
import { type ModuleActionState, type ModuleRecordActionAvailability, type ModuleRuntimeAction, type ModuleRuntimeContextState } from './runtimeContext';
|
|
4
|
+
import { type StaticModuleCrudClient, type StaticModuleTreeClient } from './staticModuleClient';
|
|
5
|
+
export interface ModuleContext<TRecord> {
|
|
6
|
+
moduleAlias: string;
|
|
7
|
+
http: HttpClient;
|
|
8
|
+
crud: StaticModuleCrudClient<TRecord>;
|
|
9
|
+
runtime: ModuleRuntimeContextState;
|
|
10
|
+
abilities: ModuleAbilities<TRecord>;
|
|
11
|
+
action(actionCode: string, recordId?: string): ModuleActionState | undefined;
|
|
12
|
+
runtimeAction(actionCode: string): ModuleRuntimeAction | undefined;
|
|
13
|
+
can(actionCode: string, recordId?: string): boolean | undefined;
|
|
14
|
+
recordActions(recordId: string): Promise<ModuleRecordActionAvailability>;
|
|
15
|
+
recordActionsSnapshot(recordId: string): ModuleRecordActionAvailability | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface ModuleTreeContext<TRecord> extends ModuleContext<TRecord> {
|
|
18
|
+
tree: StaticModuleTreeClient<TRecord>;
|
|
19
|
+
}
|
|
20
|
+
export interface ModuleContextConfig {
|
|
21
|
+
http?: HttpClient;
|
|
22
|
+
httpFactory?: () => HttpClient;
|
|
23
|
+
}
|
|
24
|
+
export interface ModuleContextOptions extends ModuleContextConfig {
|
|
25
|
+
moduleAlias: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function configureModuleContext(config: ModuleContextConfig): void;
|
|
28
|
+
export declare function provideModuleContextConfig(config: ModuleContextConfig): void;
|
|
29
|
+
export declare function createModuleContext<TRecord>(options: ModuleContextOptions): ModuleContext<TRecord>;
|
|
30
|
+
export declare function createModuleTreeContext<TRecord>(options: ModuleContextOptions): ModuleTreeContext<TRecord>;
|
|
31
|
+
export declare function useModuleContext<TRecord>(options?: Partial<ModuleContextOptions>): ModuleContext<TRecord>;
|
|
32
|
+
export declare function useModuleTreeContext<TRecord>(options?: Partial<ModuleContextOptions>): ModuleTreeContext<TRecord>;
|
|
33
|
+
export declare const ModuleContextProvider: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
34
|
+
moduleAlias: {
|
|
35
|
+
type: StringConstructor;
|
|
36
|
+
required: false;
|
|
37
|
+
default: undefined;
|
|
38
|
+
};
|
|
39
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
42
|
+
moduleAlias: {
|
|
43
|
+
type: StringConstructor;
|
|
44
|
+
required: false;
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
47
|
+
}>> & Readonly<{}>, {
|
|
48
|
+
moduleAlias: string;
|
|
49
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ModuleContext } from './moduleContext';
|
|
2
|
+
/**
|
|
3
|
+
* 回收站是模块能力,查询权限只决定当前用户能否进入该能力。
|
|
4
|
+
*/
|
|
5
|
+
export declare function hasRecycleBinAbility<TRecord>(context: ModuleContext<TRecord>): boolean;
|
|
6
|
+
export declare function canQueryRecycleBin<TRecord>(context: ModuleContext<TRecord>): boolean;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ResolvedModuleUiDescriptor } from '@muyun/web-contracts';
|
|
2
|
+
import { type AppError } from '../errors';
|
|
3
|
+
import type { HttpClient } from '../http';
|
|
4
|
+
import type { ModuleAbilityCode } from './abilityCodes';
|
|
5
|
+
export interface ModuleRuntimeAction {
|
|
6
|
+
actionCode: string;
|
|
7
|
+
permissionActionCode?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
actionLevel?: 'DEFAULT' | 'LIST' | 'RECORD' | 'BATCH' | 'ANY';
|
|
10
|
+
category?: string;
|
|
11
|
+
accessMode?: 'AUTH_REQUIRED' | 'LOGIN_REQUIRED' | 'ANONYMOUS_ALLOWED';
|
|
12
|
+
actionAuth?: boolean;
|
|
13
|
+
dataAuth?: boolean;
|
|
14
|
+
defaultGrantPolicy?: string;
|
|
15
|
+
executorType?: string;
|
|
16
|
+
executorKey?: string;
|
|
17
|
+
authorized: boolean;
|
|
18
|
+
authorizationDecision?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ModuleActionState {
|
|
21
|
+
actionCode: string;
|
|
22
|
+
available: boolean;
|
|
23
|
+
reason?: string;
|
|
24
|
+
authorized?: boolean;
|
|
25
|
+
recordId?: string;
|
|
26
|
+
definition?: ModuleRuntimeAction;
|
|
27
|
+
actionLevel?: ModuleRuntimeAction['actionLevel'];
|
|
28
|
+
title?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ModuleRecordActionAvailability {
|
|
31
|
+
recordId: string;
|
|
32
|
+
actions: ModuleRecordActionDecision[];
|
|
33
|
+
}
|
|
34
|
+
export interface ModuleRecordActionDecision {
|
|
35
|
+
actionCode: string;
|
|
36
|
+
available: boolean;
|
|
37
|
+
reason?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ModuleRuntimeContext {
|
|
40
|
+
moduleAlias: string;
|
|
41
|
+
title?: string;
|
|
42
|
+
moduleKind?: 'STATIC' | 'DYNAMIC';
|
|
43
|
+
entryType?: 'module' | 'route' | 'link';
|
|
44
|
+
entryRoute?: string;
|
|
45
|
+
entryExternalUrl?: string;
|
|
46
|
+
mainEntityAlias?: string;
|
|
47
|
+
capabilities: string[];
|
|
48
|
+
abilities?: string[];
|
|
49
|
+
actions: ModuleRuntimeAction[];
|
|
50
|
+
uiDescriptor?: ResolvedModuleUiDescriptor;
|
|
51
|
+
}
|
|
52
|
+
export interface ModuleRuntimeContextState {
|
|
53
|
+
ready: Promise<ModuleRuntimeContext>;
|
|
54
|
+
load(): Promise<ModuleRuntimeContext>;
|
|
55
|
+
snapshot(): ModuleRuntimeContext | undefined;
|
|
56
|
+
error(): AppError | undefined;
|
|
57
|
+
hasAbility(ability: ModuleAbilityCode | string): boolean | undefined;
|
|
58
|
+
action(actionCode: string, recordId?: string): ModuleActionState | undefined;
|
|
59
|
+
runtimeAction(actionCode: string): ModuleRuntimeAction | undefined;
|
|
60
|
+
can(actionCode: string, recordId?: string): boolean | undefined;
|
|
61
|
+
recordActions(recordId: string): Promise<ModuleRecordActionAvailability>;
|
|
62
|
+
recordActionsSnapshot(recordId: string): ModuleRecordActionAvailability | undefined;
|
|
63
|
+
}
|
|
64
|
+
export declare function createModuleRuntimeContextState(http: HttpClient, moduleAlias: string): ModuleRuntimeContextState;
|
|
65
|
+
export declare function isRuntimeAbilityAvailable(context: ModuleRuntimeContext | undefined, ability: ModuleAbilityCode): boolean;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { TreeSortRequest, WebActionResultFacts, WebActionResultEnvelope, QuerySchema, WebListResponse, WebPageResponse, WebQueryRequest, WebTreeNode } from '@muyun/web-contracts';
|
|
2
|
+
import type { HttpClient } from '../http';
|
|
3
|
+
export interface StaticRecordMutationResult<TRecord> extends WebActionResultFacts {
|
|
4
|
+
record: TRecord;
|
|
5
|
+
}
|
|
6
|
+
export type StaticCountMutationResult = number | WebActionResultEnvelope<number>;
|
|
7
|
+
export interface RecordActionRequest {
|
|
8
|
+
version: number;
|
|
9
|
+
}
|
|
10
|
+
export interface QuerySchemaRequestOptions {
|
|
11
|
+
uiConfigId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface StaticModuleCrudClient<TRecord> {
|
|
14
|
+
querySchema(options?: QuerySchemaRequestOptions): Promise<QuerySchema>;
|
|
15
|
+
query(request?: WebQueryRequest): Promise<WebPageResponse<TRecord>>;
|
|
16
|
+
view(id: string): Promise<TRecord>;
|
|
17
|
+
insert(record: TRecord): Promise<StaticRecordMutationResult<TRecord>>;
|
|
18
|
+
update(id: string, record: TRecord): Promise<StaticRecordMutationResult<TRecord>>;
|
|
19
|
+
delete(id: string, request: RecordActionRequest): Promise<StaticCountMutationResult>;
|
|
20
|
+
enable(id: string, request: RecordActionRequest): Promise<StaticCountMutationResult>;
|
|
21
|
+
disable(id: string, request: RecordActionRequest): Promise<StaticCountMutationResult>;
|
|
22
|
+
}
|
|
23
|
+
export interface StaticModuleTreeClient<TRecord> extends StaticModuleCrudClient<TRecord> {
|
|
24
|
+
tree(): Promise<WebListResponse<WebTreeNode<TRecord>>>;
|
|
25
|
+
treeFlat(options?: {
|
|
26
|
+
rootId?: string;
|
|
27
|
+
includeSelf?: boolean;
|
|
28
|
+
}): Promise<WebListResponse<TRecord>>;
|
|
29
|
+
subtree(id: string, options?: {
|
|
30
|
+
includeSelf?: boolean;
|
|
31
|
+
}): Promise<WebListResponse<WebTreeNode<TRecord>>>;
|
|
32
|
+
sort(id: string, request: TreeSortRequest): Promise<StaticCountMutationResult>;
|
|
33
|
+
}
|
|
34
|
+
export interface ModuleEnableClient {
|
|
35
|
+
enable(id: string, request: RecordActionRequest): Promise<StaticCountMutationResult>;
|
|
36
|
+
disable(id: string, request: RecordActionRequest): Promise<StaticCountMutationResult>;
|
|
37
|
+
}
|
|
38
|
+
export declare function createStaticModuleCrudClient<TRecord>(http: HttpClient, options: {
|
|
39
|
+
moduleAlias: string;
|
|
40
|
+
}): StaticModuleCrudClient<TRecord>;
|
|
41
|
+
export declare function createStaticResourceCrudClient<TRecord>(http: HttpClient, resourcePath: string): StaticModuleCrudClient<TRecord>;
|
|
42
|
+
export declare function createStaticModuleTreeClient<TRecord>(http: HttpClient, options: {
|
|
43
|
+
moduleAlias: string;
|
|
44
|
+
}): StaticModuleTreeClient<TRecord>;
|
|
45
|
+
export declare function createStaticResourceTreeClient<TRecord>(http: HttpClient, resourcePath: string): StaticModuleTreeClient<TRecord>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query';
|
|
2
|
+
export declare function createQueryClient(): QueryClient;
|
|
3
|
+
export declare const queryKeys: {
|
|
4
|
+
session: {
|
|
5
|
+
current: readonly ["session", "current"];
|
|
6
|
+
};
|
|
7
|
+
menu: {
|
|
8
|
+
mine: readonly ["menu", "mine"];
|
|
9
|
+
};
|
|
10
|
+
staticModule: {
|
|
11
|
+
query: (moduleAlias: string, request?: unknown) => readonly ["static-module", string, "query", unknown];
|
|
12
|
+
tree: (moduleAlias: string, options?: unknown) => readonly ["static-module", string, "tree", unknown];
|
|
13
|
+
view: (moduleAlias: string, id: string) => readonly ["static-module", string, "view", string];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export { VueQueryPlugin };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type IMessage } from '@stomp/stompjs';
|
|
2
|
+
import type { WebBusinessRealtimeEvent, WebCommittedChangeSet, WebRealtimeEnvelope, WebUserNotification } from '@muyun/web-contracts';
|
|
3
|
+
import type { DataChangeDispatcher } from './dataChanges';
|
|
4
|
+
export type RealtimeConnectionState = 'idle' | 'connecting' | 'connected' | 'reconnecting' | 'disconnected' | 'unauthorized' | 'failed';
|
|
5
|
+
export interface RealtimeChannel<TPayload> {
|
|
6
|
+
destination: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
readonly __payload?: TPayload;
|
|
9
|
+
}
|
|
10
|
+
export interface RealtimeCommand<TPayload> {
|
|
11
|
+
destination: string;
|
|
12
|
+
readonly __payload?: TPayload;
|
|
13
|
+
}
|
|
14
|
+
export type RealtimeHandler<TPayload> = (payload: TPayload, envelope: WebRealtimeEnvelope<TPayload> | undefined) => void | Promise<void>;
|
|
15
|
+
export interface RealtimeSubscription {
|
|
16
|
+
unsubscribe(): void;
|
|
17
|
+
}
|
|
18
|
+
export interface RealtimeClient {
|
|
19
|
+
connect(): Promise<void>;
|
|
20
|
+
disconnect(): Promise<void>;
|
|
21
|
+
subscribe<TPayload>(channel: RealtimeChannel<TPayload>, handler: RealtimeHandler<TPayload>): RealtimeSubscription;
|
|
22
|
+
publish<TPayload>(command: RealtimeCommand<TPayload>, payload: TPayload): void;
|
|
23
|
+
state(): RealtimeConnectionState;
|
|
24
|
+
}
|
|
25
|
+
export interface RealtimeClientOptions {
|
|
26
|
+
baseUrl?: string;
|
|
27
|
+
token?: string;
|
|
28
|
+
brokerPath?: string;
|
|
29
|
+
reconnectDelay?: number;
|
|
30
|
+
heartbeatIncoming?: number;
|
|
31
|
+
heartbeatOutgoing?: number;
|
|
32
|
+
clientFactory?: StompClientFactory;
|
|
33
|
+
onStateChange?: (state: RealtimeConnectionState) => void;
|
|
34
|
+
}
|
|
35
|
+
export interface StompClientFactory {
|
|
36
|
+
(options: StompClientFactoryOptions): StompClientAdapter;
|
|
37
|
+
}
|
|
38
|
+
export interface StompClientFactoryOptions {
|
|
39
|
+
brokerURL: string;
|
|
40
|
+
connectHeaders: Record<string, string>;
|
|
41
|
+
reconnectDelay: number;
|
|
42
|
+
heartbeatIncoming: number;
|
|
43
|
+
heartbeatOutgoing: number;
|
|
44
|
+
onConnect: () => void;
|
|
45
|
+
onDisconnect: () => void;
|
|
46
|
+
onWebSocketClose: () => void;
|
|
47
|
+
onStompError: (frame?: StompErrorFrame) => void;
|
|
48
|
+
}
|
|
49
|
+
export interface StompClientAdapter {
|
|
50
|
+
connected: boolean;
|
|
51
|
+
activate(): void;
|
|
52
|
+
deactivate(): Promise<void>;
|
|
53
|
+
subscribe(destination: string, handler: (message: IMessage) => void): StompSubscriptionLike;
|
|
54
|
+
publish(options: {
|
|
55
|
+
destination: string;
|
|
56
|
+
body: string;
|
|
57
|
+
}): void;
|
|
58
|
+
}
|
|
59
|
+
export interface StompSubscriptionLike {
|
|
60
|
+
unsubscribe(): void;
|
|
61
|
+
}
|
|
62
|
+
export interface StompErrorFrame {
|
|
63
|
+
headers?: Record<string, string | undefined>;
|
|
64
|
+
body?: string;
|
|
65
|
+
}
|
|
66
|
+
export declare const realtimeMessageTypes: {
|
|
67
|
+
readonly dataChange: "platform.data-change";
|
|
68
|
+
readonly securityNotification: "platform.security-notification";
|
|
69
|
+
readonly businessEvent: "platform.business-event";
|
|
70
|
+
};
|
|
71
|
+
export declare const realtimeDestinations: {
|
|
72
|
+
readonly userDataChanges: "/user/queue/platform/data-changes";
|
|
73
|
+
readonly userNotifications: "/user/queue/platform/notifications";
|
|
74
|
+
readonly userBusinessEvents: "/user/queue/platform/business-events";
|
|
75
|
+
readonly userImMessages: "/user/queue/platform/im/messages";
|
|
76
|
+
readonly platformPing: "/app/platform/ping";
|
|
77
|
+
readonly sessionActivity: "/app/platform/session/activity";
|
|
78
|
+
readonly imMessagesSend: "/app/platform/im/messages/send";
|
|
79
|
+
};
|
|
80
|
+
export declare const dataChangeChannel: RealtimeChannel<WebCommittedChangeSet>;
|
|
81
|
+
export declare const userNotificationChannel: RealtimeChannel<WebUserNotification>;
|
|
82
|
+
export declare const userBusinessEventChannel: RealtimeChannel<WebBusinessRealtimeEvent>;
|
|
83
|
+
export declare const userImMessageChannel: RealtimeChannel<unknown>;
|
|
84
|
+
export declare const platformPingCommand: RealtimeCommand<{
|
|
85
|
+
timestamp: string;
|
|
86
|
+
}>;
|
|
87
|
+
export declare const sessionActivityCommand: RealtimeCommand<{
|
|
88
|
+
timestamp: string;
|
|
89
|
+
}>;
|
|
90
|
+
export declare const imMessageSendCommand: RealtimeCommand<unknown>;
|
|
91
|
+
export declare function tenantPublicDataChangeChannel(tenantId: string): RealtimeChannel<WebCommittedChangeSet>;
|
|
92
|
+
export declare function tenantPublicNotificationChannel(tenantId: string): RealtimeChannel<unknown>;
|
|
93
|
+
export declare function organizationPublicDataChangeChannel(organizationId: string): RealtimeChannel<WebCommittedChangeSet>;
|
|
94
|
+
export declare function organizationPublicNotificationChannel(organizationId: string): RealtimeChannel<unknown>;
|
|
95
|
+
export declare function moduleDataChangeChannel(moduleAlias: string): RealtimeChannel<WebCommittedChangeSet>;
|
|
96
|
+
export declare function recordDataChangeChannel(moduleAlias: string, recordId: string): RealtimeChannel<WebCommittedChangeSet>;
|
|
97
|
+
export declare function resourceDataChangeChannel(moduleAlias: string, resourceKey: string): RealtimeChannel<WebCommittedChangeSet>;
|
|
98
|
+
export declare function resourceRecordDataChangeChannel(moduleAlias: string, resourceKey: string, recordId: string): RealtimeChannel<WebCommittedChangeSet>;
|
|
99
|
+
export declare function contextDataChangeChannel(contextType: string, contextId: string): RealtimeChannel<WebCommittedChangeSet>;
|
|
100
|
+
export declare function imConversationMessageChannel(conversationId: string): RealtimeChannel<unknown>;
|
|
101
|
+
export declare function createRealtimeClient(options?: RealtimeClientOptions): RealtimeClient;
|
|
102
|
+
export declare function connectRealtimeDataChanges(realtime: RealtimeClient, dispatcher: DataChangeDispatcher): RealtimeSubscription;
|
|
103
|
+
export declare function connectRealtimeUserNotifications(realtime: RealtimeClient, handler: RealtimeHandler<WebUserNotification>): RealtimeSubscription;
|
|
104
|
+
export declare function connectRealtimeBusinessEvents(realtime: RealtimeClient, handler: RealtimeHandler<WebBusinessRealtimeEvent>): RealtimeSubscription;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Et as e } from "./platform-components-bC1gwhic.js";
|
|
2
|
+
import { t } from "./pageRealtime-sRtDYlQP.js";
|
|
3
|
+
import { ref as n } from "vue";
|
|
4
|
+
//#region src/views/useUserSessionRows.ts
|
|
5
|
+
function r(r) {
|
|
6
|
+
let i = n([]), a = n({}), o = n([]), s = n({}), c = t({ load: async (e) => {
|
|
7
|
+
await g(e.keys, e.isLatest);
|
|
8
|
+
} }), l = t({ load: async (e) => {
|
|
9
|
+
await Promise.all(e.keys.map((t) => d(t, e.isLatest)));
|
|
10
|
+
} });
|
|
11
|
+
function u(e) {
|
|
12
|
+
l.enqueue(e);
|
|
13
|
+
}
|
|
14
|
+
async function d(t, n = () => !0) {
|
|
15
|
+
if (!(!t || r.context.can("sessions", t) === !1)) {
|
|
16
|
+
y(t, {
|
|
17
|
+
...v(t),
|
|
18
|
+
loading: !0,
|
|
19
|
+
error: void 0
|
|
20
|
+
});
|
|
21
|
+
try {
|
|
22
|
+
await f(t);
|
|
23
|
+
let e = await r.context.http.request({
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: `/iam.user/${encodeURIComponent(t)}/sessions`
|
|
26
|
+
});
|
|
27
|
+
if (!n(t)) return;
|
|
28
|
+
y(t, {
|
|
29
|
+
records: e,
|
|
30
|
+
loading: !1,
|
|
31
|
+
error: void 0
|
|
32
|
+
});
|
|
33
|
+
} catch (i) {
|
|
34
|
+
if (!n(t)) return;
|
|
35
|
+
let a = e(i, {
|
|
36
|
+
source: `${r.source}-sessions`,
|
|
37
|
+
phase: "load"
|
|
38
|
+
});
|
|
39
|
+
y(t, {
|
|
40
|
+
...v(t),
|
|
41
|
+
loading: !1,
|
|
42
|
+
error: a.message
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function f(t) {
|
|
48
|
+
try {
|
|
49
|
+
await r.context.recordActions(t);
|
|
50
|
+
} catch (t) {
|
|
51
|
+
e(t, {
|
|
52
|
+
source: `${r.source}-sessions`,
|
|
53
|
+
phase: "load"
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function p(e, t) {
|
|
58
|
+
let n = String(e.id ?? "");
|
|
59
|
+
n && (i.value = t ? Array.from(new Set([...i.value, n])) : i.value.filter((e) => e !== n), t && v(n).records.length === 0 && l.enqueue(n));
|
|
60
|
+
}
|
|
61
|
+
function m(e) {
|
|
62
|
+
o.value = e.map((e) => String(e.id ?? "")).filter(Boolean), c.enqueue(o.value);
|
|
63
|
+
}
|
|
64
|
+
function h(e) {
|
|
65
|
+
if (e.type !== "iam.user.session.collectionChanged" || e.moduleAlias !== "iam.user") return;
|
|
66
|
+
let t = String(e.recordId ?? "");
|
|
67
|
+
t && (o.value.includes(t) && c.enqueue(t), i.value.includes(t) && l.enqueue(t));
|
|
68
|
+
}
|
|
69
|
+
async function g(t, n = () => !0) {
|
|
70
|
+
let i = Array.from(new Set(t.filter(Boolean)));
|
|
71
|
+
if (i.length !== 0) try {
|
|
72
|
+
let e = (await r.context.http.request({
|
|
73
|
+
method: "POST",
|
|
74
|
+
path: "/iam.user/sessions/status",
|
|
75
|
+
body: { userIds: i }
|
|
76
|
+
})).filter((e) => n(e.userId));
|
|
77
|
+
if (e.length === 0) return;
|
|
78
|
+
s.value = {
|
|
79
|
+
...s.value,
|
|
80
|
+
...Object.fromEntries(e.map((e) => [e.userId, e]))
|
|
81
|
+
};
|
|
82
|
+
} catch (t) {
|
|
83
|
+
e(t, {
|
|
84
|
+
source: `${r.source}-online-status`,
|
|
85
|
+
phase: "load"
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function _(e) {
|
|
90
|
+
let t = String(e.id ?? ""), n = s.value[t];
|
|
91
|
+
if (!n) return "-";
|
|
92
|
+
if (n.present) {
|
|
93
|
+
let e = n.presentSessionCount ?? 0, t = n.idleSessionCount ?? 0;
|
|
94
|
+
return e > 0 && t >= e ? `闲置 (${e}/${n.activeSessionCount})` : `使用中 (${Math.max(0, e - t)}/${n.activeSessionCount})`;
|
|
95
|
+
}
|
|
96
|
+
return n.online ? `在线 (${n.activeSessionCount})` : "离线";
|
|
97
|
+
}
|
|
98
|
+
function v(e) {
|
|
99
|
+
return e ? a.value[e] ?? {
|
|
100
|
+
records: [],
|
|
101
|
+
loading: !1
|
|
102
|
+
} : {
|
|
103
|
+
records: [],
|
|
104
|
+
loading: !1
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function y(e, t) {
|
|
108
|
+
a.value = {
|
|
109
|
+
...a.value,
|
|
110
|
+
[e]: t
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function b() {
|
|
114
|
+
c.reset(), l.reset(), i.value = [], a.value = {}, o.value = [], s.value = {};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
expandedUserKeys: i,
|
|
118
|
+
handleUserListLoaded: m,
|
|
119
|
+
handleUserRowExpand: p,
|
|
120
|
+
handleUserSessionBusinessEvent: h,
|
|
121
|
+
loadUserSessions: u,
|
|
122
|
+
resetUserSessionRows: b,
|
|
123
|
+
userOnlineStatusTitle: _,
|
|
124
|
+
userSessionState: v
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
export { r as t };
|