@weaveui/web 0.0.1
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/LICENSE +35 -0
- package/README.md +119 -0
- package/THIRD_PARTY_NOTICES +29 -0
- package/dist/apm-log.es.js +996 -0
- package/dist/apm-log.umd.cjs +1 -0
- package/dist/business/apm-log/behavior-directive.d.ts +9 -0
- package/dist/business/apm-log/behavior-log.d.ts +6 -0
- package/dist/business/apm-log/behavior-types.d.ts +121 -0
- package/dist/business/apm-log/browser.d.ts +3 -0
- package/dist/business/apm-log/directive.d.ts +13 -0
- package/dist/business/apm-log/index.d.ts +8 -0
- package/dist/business/apm-log/legacy-apm-log.d.ts +6 -0
- package/dist/business/apm-log/types.d.ts +147 -0
- package/dist/business/apm-log/vue.d.ts +5 -0
- package/dist/business/monitor/index.d.ts +81 -0
- package/dist/business/monitor/monitor-plugin.d.ts +9 -0
- package/dist/business/monitor/runtime-types.d.ts +166 -0
- package/dist/business/monitor/runtime.d.ts +6 -0
- package/dist/business/monitor/types.d.ts +221 -0
- package/dist/business/permission/Permission.d.ts +18 -0
- package/dist/business/permission/PermissionPluginClass.d.ts +40 -0
- package/dist/business/permission/directive.d.ts +7 -0
- package/dist/business/permission/index.d.ts +35 -0
- package/dist/business/permission/permission-plugin.d.ts +16 -0
- package/dist/business/permission/storage.d.ts +30 -0
- package/dist/business/permission/tree.d.ts +19 -0
- package/dist/business/permission/types.d.ts +115 -0
- package/dist/business/upload-cos/index.d.ts +117 -0
- package/dist/business/upload-cos/src/UploadCos.vue.d.ts +70 -0
- package/dist/business/upload-cos/src/types.d.ts +72 -0
- package/dist/business/upload-cos/src/utils.d.ts +9 -0
- package/dist/index.d.ts +1894 -0
- package/dist/index.es.js +4315 -0
- package/dist/index.umd.cjs +6 -0
- package/dist/monitor.es.js +1217 -0
- package/dist/monitor.umd.cjs +1 -0
- package/dist/permission.es.js +631 -0
- package/dist/permission.umd.cjs +1 -0
- package/dist/style.css +1 -0
- package/dist/upload-cos.es.js +426 -0
- package/dist/upload-cos.style.css +1 -0
- package/dist/upload-cos.umd.cjs +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/is.d.ts +2 -0
- package/dist/utils/withInstall.d.ts +7 -0
- package/package.json +105 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
export type MonitorLevel = 'debug' | 'info' | 'warning' | 'error' | 'fatal';
|
|
3
|
+
export type MonitorContext = Record<string, unknown>;
|
|
4
|
+
export type MonitorTags = Record<string, string | number | boolean>;
|
|
5
|
+
export interface MonitorExceptionData {
|
|
6
|
+
name: string;
|
|
7
|
+
message: string;
|
|
8
|
+
stack?: string;
|
|
9
|
+
source?: 'manual' | 'window.error' | 'vue' | 'unhandledrejection';
|
|
10
|
+
filename?: string;
|
|
11
|
+
line?: number;
|
|
12
|
+
column?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface MonitorMessageData {
|
|
15
|
+
message: string;
|
|
16
|
+
}
|
|
17
|
+
export interface MonitorResourceData {
|
|
18
|
+
element: string;
|
|
19
|
+
url: string;
|
|
20
|
+
}
|
|
21
|
+
export interface MonitorNavigationData {
|
|
22
|
+
source: 'history' | 'hashchange' | 'popstate';
|
|
23
|
+
method?: 'pushState' | 'replaceState';
|
|
24
|
+
from: string;
|
|
25
|
+
to: string;
|
|
26
|
+
duration: number;
|
|
27
|
+
}
|
|
28
|
+
export interface MonitorPerformanceData {
|
|
29
|
+
navigationType?: string;
|
|
30
|
+
duration: number;
|
|
31
|
+
redirect: number;
|
|
32
|
+
dns: number;
|
|
33
|
+
connection: number;
|
|
34
|
+
request: number;
|
|
35
|
+
response: number;
|
|
36
|
+
domInteractive: number;
|
|
37
|
+
domContentLoaded: number;
|
|
38
|
+
load: number;
|
|
39
|
+
}
|
|
40
|
+
export interface MonitorRequestData {
|
|
41
|
+
kind: 'fetch' | 'xhr';
|
|
42
|
+
method: string;
|
|
43
|
+
url: string;
|
|
44
|
+
status?: number;
|
|
45
|
+
duration: number;
|
|
46
|
+
ok: boolean;
|
|
47
|
+
error?: string;
|
|
48
|
+
}
|
|
49
|
+
interface MonitorEventBase<TType extends string, TData> {
|
|
50
|
+
type: TType;
|
|
51
|
+
level: MonitorLevel;
|
|
52
|
+
timestamp: number;
|
|
53
|
+
url: string;
|
|
54
|
+
context: MonitorContext;
|
|
55
|
+
tags: MonitorTags;
|
|
56
|
+
data: TData;
|
|
57
|
+
}
|
|
58
|
+
export type MonitorEvent = MonitorEventBase<'exception', MonitorExceptionData> | MonitorEventBase<'message', MonitorMessageData> | MonitorEventBase<'resource', MonitorResourceData> | MonitorEventBase<'unhandledrejection', MonitorExceptionData> | MonitorEventBase<'navigation', MonitorNavigationData> | MonitorEventBase<'performance', MonitorPerformanceData> | MonitorEventBase<'request', MonitorRequestData>;
|
|
59
|
+
export interface MonitorTransportContext {
|
|
60
|
+
fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
61
|
+
createXMLHttpRequest: () => XMLHttpRequest;
|
|
62
|
+
}
|
|
63
|
+
export interface MonitorRedactionOptions {
|
|
64
|
+
keys?: readonly (string | RegExp)[];
|
|
65
|
+
queryParams?: readonly (string | RegExp)[];
|
|
66
|
+
replacement?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface MonitorVuePluginOptions {
|
|
69
|
+
startOnInstall?: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface MonitorVuePlugin {
|
|
72
|
+
install: (app: App) => void;
|
|
73
|
+
}
|
|
74
|
+
export interface MonitorClient {
|
|
75
|
+
readonly started: boolean;
|
|
76
|
+
start: () => boolean;
|
|
77
|
+
stop: () => void;
|
|
78
|
+
destroy: () => void;
|
|
79
|
+
captureException: (exception: unknown, context?: MonitorContext) => void;
|
|
80
|
+
captureMessage: (message: string, level?: MonitorLevel, context?: MonitorContext) => void;
|
|
81
|
+
createVuePlugin: (options?: MonitorVuePluginOptions) => MonitorVuePlugin;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The report shape exposed by the historical `monitor-jiniu` package.
|
|
85
|
+
*
|
|
86
|
+
* The adapter intentionally keeps this extensible because old applications
|
|
87
|
+
* commonly passed business fields directly to `log()`.
|
|
88
|
+
*/
|
|
89
|
+
export interface LegacyMonitorReport {
|
|
90
|
+
moduleId?: string;
|
|
91
|
+
type: string;
|
|
92
|
+
status?: string;
|
|
93
|
+
time: number;
|
|
94
|
+
pageUrl?: string;
|
|
95
|
+
appChannelId?: string;
|
|
96
|
+
dataChannelId?: string;
|
|
97
|
+
version?: string;
|
|
98
|
+
userId?: string | number;
|
|
99
|
+
message?: unknown;
|
|
100
|
+
data?: Record<string, unknown>;
|
|
101
|
+
[key: string]: unknown;
|
|
102
|
+
}
|
|
103
|
+
export type LegacyMonitorLogPayload = string | Record<string, unknown>;
|
|
104
|
+
export type LegacyBeforeDataReport = (report: LegacyMonitorReport) => LegacyMonitorReport | false | void | Promise<LegacyMonitorReport | false | void>;
|
|
105
|
+
/**
|
|
106
|
+
* Receives a legacy-shaped report before the built-in `dsn` transport runs.
|
|
107
|
+
* Use the supplied context for network reporting so the request bypasses all
|
|
108
|
+
* CustomUI monitor request instrumentation on the page.
|
|
109
|
+
*/
|
|
110
|
+
export type LegacyMonitorTransport = (report: LegacyMonitorReport, event: MonitorEvent, context: MonitorTransportContext) => void | Promise<void>;
|
|
111
|
+
export type LegacyUnsupportedOption = 'silentWhiteScreen' | 'whiteBoxElements' | 'skeletonProject' | 'silentRecordScreen' | 'recordScreentime' | 'recordScreenTypeList' | 'useImgUpload' | 'silentClick' | 'throttleDelayTime' | 'maxBreadcrumbs' | 'beforePushBreadcrumb' | 'overTime' | 'handleHttpStatus' | 'defHttp' | 'router' | 'recordScreenPlugin';
|
|
112
|
+
export interface LegacyUnsupportedOptionNotice {
|
|
113
|
+
option: LegacyUnsupportedOption;
|
|
114
|
+
value: unknown;
|
|
115
|
+
message: string;
|
|
116
|
+
}
|
|
117
|
+
export type LegacyUnsupportedOptionHandler = (notice: LegacyUnsupportedOptionNotice) => void;
|
|
118
|
+
/**
|
|
119
|
+
* Options accepted by the old `monitor-jiniu` entrypoint, mapped onto the
|
|
120
|
+
* internal CustomUI monitor runtime.
|
|
121
|
+
*
|
|
122
|
+
* Historical `silent*` names are preserved as implemented by the old package:
|
|
123
|
+
* passing `true` enables the corresponding collector.
|
|
124
|
+
*/
|
|
125
|
+
export interface LegacyMonitorOptions {
|
|
126
|
+
/** Historical report endpoint. Required unless `transport` is supplied. */
|
|
127
|
+
dsn?: string;
|
|
128
|
+
version?: string;
|
|
129
|
+
appChannelId?: string;
|
|
130
|
+
dataChannelId?: string;
|
|
131
|
+
userId?: string | number;
|
|
132
|
+
getUserId?: () => string | number | null | undefined;
|
|
133
|
+
disabled?: boolean;
|
|
134
|
+
silentXhr?: boolean;
|
|
135
|
+
silentFetch?: boolean;
|
|
136
|
+
silentClick?: boolean;
|
|
137
|
+
silentError?: boolean;
|
|
138
|
+
silentUnhandledrejection?: boolean;
|
|
139
|
+
silentHashchange?: boolean;
|
|
140
|
+
silentHistory?: boolean;
|
|
141
|
+
silentPerformance?: boolean;
|
|
142
|
+
filterXhrUrlRegExp?: RegExp;
|
|
143
|
+
beforeDataReport?: LegacyBeforeDataReport;
|
|
144
|
+
repeatCodeError?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Optional custom report sender. It replaces the built-in `dsn` request.
|
|
147
|
+
* Always use `context.fetch()` or `context.createXMLHttpRequest()` inside it.
|
|
148
|
+
*/
|
|
149
|
+
transport?: LegacyMonitorTransport;
|
|
150
|
+
onUnsupportedOption?: LegacyUnsupportedOptionHandler;
|
|
151
|
+
/** Browser/test customization forwarded to the underlying monitor. */
|
|
152
|
+
window?: Window;
|
|
153
|
+
sampleRate?: number;
|
|
154
|
+
redact?: MonitorRedactionOptions;
|
|
155
|
+
tags?: MonitorTags;
|
|
156
|
+
context?: MonitorContext;
|
|
157
|
+
environment?: string;
|
|
158
|
+
random?: () => number;
|
|
159
|
+
now?: () => number;
|
|
160
|
+
silentWhiteScreen?: boolean;
|
|
161
|
+
skeletonProject?: boolean;
|
|
162
|
+
whiteBoxElements?: string | readonly string[];
|
|
163
|
+
silentRecordScreen?: boolean;
|
|
164
|
+
recordScreentime?: number;
|
|
165
|
+
recordScreenTypeList?: readonly string[];
|
|
166
|
+
useImgUpload?: boolean;
|
|
167
|
+
throttleDelayTime?: number;
|
|
168
|
+
overTime?: number;
|
|
169
|
+
maxBreadcrumbs?: number;
|
|
170
|
+
beforePushBreadcrumb?: (data: unknown) => unknown;
|
|
171
|
+
handleHttpStatus?: (data: unknown) => boolean;
|
|
172
|
+
defHttp?: unknown;
|
|
173
|
+
router?: unknown;
|
|
174
|
+
}
|
|
175
|
+
/** A small subset of the old plugin contract that can run safely in the adapter. */
|
|
176
|
+
export interface LegacyMonitorPlugin {
|
|
177
|
+
type?: string;
|
|
178
|
+
transform?: (report: LegacyMonitorReport) => void;
|
|
179
|
+
core?: (context: LegacyMonitorPluginContext) => void;
|
|
180
|
+
}
|
|
181
|
+
export interface LegacyMonitorPluginConstructor<TOptions = unknown> {
|
|
182
|
+
new (options: TOptions): LegacyMonitorPlugin;
|
|
183
|
+
}
|
|
184
|
+
export interface LegacyMonitorPluginContext {
|
|
185
|
+
readonly options: Readonly<LegacyMonitorOptions>;
|
|
186
|
+
readonly transportData: {
|
|
187
|
+
send: (payload: LegacyMonitorLogPayload) => boolean;
|
|
188
|
+
};
|
|
189
|
+
readonly breadcrumb: {
|
|
190
|
+
push: (payload: LegacyMonitorLogPayload) => boolean;
|
|
191
|
+
};
|
|
192
|
+
readonly notify: (type: string, payload?: LegacyMonitorLogPayload) => boolean;
|
|
193
|
+
}
|
|
194
|
+
export interface LegacyMonitorClient {
|
|
195
|
+
readonly monitor: MonitorClient | undefined;
|
|
196
|
+
readonly started: boolean;
|
|
197
|
+
readonly options: Readonly<LegacyMonitorOptions> | undefined;
|
|
198
|
+
init: (options?: LegacyMonitorOptions) => LegacyMonitorClient;
|
|
199
|
+
install: (app: App, options?: LegacyMonitorOptions) => void;
|
|
200
|
+
log: (payload: LegacyMonitorLogPayload) => boolean;
|
|
201
|
+
errorBoundary: (error: unknown) => boolean;
|
|
202
|
+
use: <TOptions>(plugin: LegacyMonitorPluginConstructor<TOptions>, options?: TOptions) => LegacyMonitorPlugin | undefined;
|
|
203
|
+
stop: () => void;
|
|
204
|
+
destroy: () => void;
|
|
205
|
+
}
|
|
206
|
+
export interface LegacyMonitorMapping {
|
|
207
|
+
captureRequests: {
|
|
208
|
+
xhr: boolean;
|
|
209
|
+
fetch: boolean;
|
|
210
|
+
};
|
|
211
|
+
captureGlobalErrors: boolean;
|
|
212
|
+
captureUnhandledRejections: boolean;
|
|
213
|
+
captureNavigation: boolean;
|
|
214
|
+
capturePerformance: boolean;
|
|
215
|
+
ignoredUrls: readonly (string | RegExp)[];
|
|
216
|
+
}
|
|
217
|
+
export interface LegacyMonitorRuntime {
|
|
218
|
+
readonly monitor: MonitorClient | undefined;
|
|
219
|
+
readonly mapping: LegacyMonitorMapping | undefined;
|
|
220
|
+
}
|
|
221
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { LegacyPermissionSign } from './types';
|
|
3
|
+
/** Vue 3 replacement for the legacy `<Permission :sign="...">` component. */
|
|
4
|
+
export declare const Permission: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
5
|
+
sign: {
|
|
6
|
+
type: PropType<LegacyPermissionSign>;
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
12
|
+
sign: {
|
|
13
|
+
type: PropType<LegacyPermissionSign>;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
}>> & Readonly<{}>, {
|
|
17
|
+
sign: LegacyPermissionSign;
|
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LegacyPermissionApiConfig, LegacyPermissionId, LegacyPermissionPageEvent, LegacyPermissionPluginClass as LegacyPermissionPluginClassContract, LegacyPermissionPluginConfig, LegacyPermissionPluginOptions, LegacyPermissionRoute, LegacyPermissionSign } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Vue 3-compatible implementation of the legacy permissionPluginClass API.
|
|
4
|
+
* It owns only page-event persistence and data projection; route registration
|
|
5
|
+
* and application authentication remain the responsibility of the host app.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PermissionPluginClass implements LegacyPermissionPluginClassContract {
|
|
8
|
+
readonly ifSupportIndexDb: boolean;
|
|
9
|
+
readonly pluginCfg: LegacyPermissionPluginConfig;
|
|
10
|
+
readonly revision: import('vue').Ref<number, number>;
|
|
11
|
+
private readonly fetcher;
|
|
12
|
+
private readonly storage;
|
|
13
|
+
private readonly initialization;
|
|
14
|
+
constructor(options?: LegacyPermissionPluginOptions);
|
|
15
|
+
whenReady(): Promise<void>;
|
|
16
|
+
/** Legacy spelling retained for callers that invoked the old IndexedDB setup method. */
|
|
17
|
+
excuteDbLogic(): Promise<void>;
|
|
18
|
+
/** Legacy spelling retained for callers that invoked the old storage setup method. */
|
|
19
|
+
excuteLocalStorageLogic(): Promise<void>;
|
|
20
|
+
loopApiCfgListForGetData(): Promise<void>;
|
|
21
|
+
getDataFromApi(apiCfgItem: LegacyPermissionApiConfig): Promise<LegacyPermissionPageEvent[]>;
|
|
22
|
+
parseStorage(jsonString: string): unknown;
|
|
23
|
+
generateSaveToStorageDataAndSave(appChannelId: string, pageEventData: readonly LegacyPermissionPageEvent[]): Promise<void>;
|
|
24
|
+
getPageEventDataFromApiNew(): Promise<void>;
|
|
25
|
+
getPageEventDataFromApiSync(apiCfg: LegacyPermissionApiConfig): Promise<LegacyPermissionPageEvent[]>;
|
|
26
|
+
getData<T = unknown>(appChannelId: string | undefined, tableName: string, property?: string): Promise<T | []>;
|
|
27
|
+
setData(appChannelId: string | undefined, tableName: string, newData: unknown, property?: string): Promise<void>;
|
|
28
|
+
getPageEventDataFromDbOrLocal(appChannelId?: string): Promise<LegacyPermissionPageEvent[]>;
|
|
29
|
+
getHorizontalPageEventData(appChannelId?: string): Promise<LegacyPermissionPageEvent[]>;
|
|
30
|
+
setEventIdSync(appChannelId: string, newData: unknown): Promise<void>;
|
|
31
|
+
getNeedCacheRouter(appChannelId?: string): Promise<LegacyPermissionPageEvent[]>;
|
|
32
|
+
generateRouterNew(appChannelId?: string): Promise<LegacyPermissionRoute[]>;
|
|
33
|
+
generatePermissionMgTree(appChannelId?: string): Promise<LegacyPermissionPageEvent[]>;
|
|
34
|
+
generatePermissionMgTreeForShop(appChannelId?: string, _pageEventIdList?: readonly LegacyPermissionId[]): Promise<LegacyPermissionPageEvent[]>;
|
|
35
|
+
getApiEventList(appChannelId?: string, pageEventIdList?: readonly LegacyPermissionId[] | readonly LegacyPermissionPageEvent[]): Promise<string[]>;
|
|
36
|
+
getNoPmPageTree(appChannelId?: string): Promise<LegacyPermissionPageEvent[]>;
|
|
37
|
+
checkPermission(sign: LegacyPermissionSign): Promise<boolean>;
|
|
38
|
+
private initialize;
|
|
39
|
+
private bumpRevision;
|
|
40
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ObjectDirective } from 'vue';
|
|
2
|
+
import { LegacyPermissionPluginClass, LegacyPermissionSign } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The old directive physically removed a denied element. Retaining that
|
|
5
|
+
* behavior avoids changing legacy templates that expect the node to disappear.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createLegacyPermissionDirective(permissionPluginClass: LegacyPermissionPluginClass): ObjectDirective<HTMLElement, LegacyPermissionSign>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { LegacyPermissionApiConfig, LegacyPermissionExtraContent, LegacyPermissionId, LegacyPermissionPageEvent, LegacyPermissionPluginClass, LegacyPermissionPluginConfig, LegacyPermissionRoute, LegacyPermissionSign } from './types';
|
|
3
|
+
export type PermissionId = LegacyPermissionId;
|
|
4
|
+
export type PermissionSign = LegacyPermissionSign;
|
|
5
|
+
export interface PermissionApiConfig extends LegacyPermissionApiConfig {
|
|
6
|
+
}
|
|
7
|
+
export interface PermissionExtraContent extends LegacyPermissionExtraContent {
|
|
8
|
+
}
|
|
9
|
+
export interface PermissionPageEvent extends LegacyPermissionPageEvent {
|
|
10
|
+
}
|
|
11
|
+
export interface PermissionRoute extends LegacyPermissionRoute {
|
|
12
|
+
}
|
|
13
|
+
export interface PermissionPluginConfig extends LegacyPermissionPluginConfig {
|
|
14
|
+
}
|
|
15
|
+
export interface PermissionPluginClass extends LegacyPermissionPluginClass {
|
|
16
|
+
}
|
|
17
|
+
export interface PermissionPluginOptions {
|
|
18
|
+
apiCfg?: PermissionApiConfig | readonly PermissionApiConfig[];
|
|
19
|
+
dbName?: string;
|
|
20
|
+
projectAppChannelId?: string;
|
|
21
|
+
updateStrategy?: {
|
|
22
|
+
development?: {
|
|
23
|
+
updateTime?: number | string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface PermissionPluginClassConstructor {
|
|
28
|
+
new (options?: PermissionPluginOptions): PermissionPluginClass;
|
|
29
|
+
}
|
|
30
|
+
export interface PermissionPlugin {
|
|
31
|
+
install: (app: App, options?: PermissionPluginOptions) => void;
|
|
32
|
+
PermissionPluginClass: PermissionPluginClassConstructor;
|
|
33
|
+
}
|
|
34
|
+
declare const _default: PermissionPlugin;
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { Permission } from './Permission';
|
|
3
|
+
import { PermissionPluginClass } from './PermissionPluginClass';
|
|
4
|
+
import { LEGACY_PERMISSION_INJECTION_KEY, LegacyPermissionPlugin, LegacyPermissionPluginClass, LegacyPermissionPluginInstallOptions } from './types';
|
|
5
|
+
type LegacyPermissionPluginWithClass = LegacyPermissionPlugin & {
|
|
6
|
+
PermissionPluginClass: typeof PermissionPluginClass;
|
|
7
|
+
};
|
|
8
|
+
type LegacyPermissionPluginFactoryResult = LegacyPermissionPluginWithClass & {
|
|
9
|
+
permissionPluginClass: LegacyPermissionPluginClass;
|
|
10
|
+
};
|
|
11
|
+
export declare function installLegacyPermission(app: App, options?: LegacyPermissionPluginInstallOptions): LegacyPermissionPluginClass;
|
|
12
|
+
export declare function createLegacyPermissionPlugin(options?: LegacyPermissionPluginInstallOptions): LegacyPermissionPluginFactoryResult;
|
|
13
|
+
declare const LegacyPermissionPlugin: LegacyPermissionPluginWithClass;
|
|
14
|
+
export default LegacyPermissionPlugin;
|
|
15
|
+
export { Permission, PermissionPluginClass, LEGACY_PERMISSION_INJECTION_KEY };
|
|
16
|
+
export type { LegacyPermissionApiConfig, LegacyPermissionExtraContent, LegacyPermissionId, LegacyPermissionPageEvent, LegacyPermissionPlugin, LegacyPermissionPluginClass, LegacyPermissionPluginConfig, LegacyPermissionPluginInstallOptions, LegacyPermissionPluginOptions, LegacyPermissionRoute, LegacyPermissionSign } from './types';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LegacyPermissionStorageLike } from './types';
|
|
2
|
+
export type LegacyPermissionStoreName = 'cfg' | 'data';
|
|
3
|
+
export interface LegacyStoredRecord {
|
|
4
|
+
appChannelId: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Keeps the legacy cfg/data stores when IndexedDB works and falls back to the
|
|
9
|
+
* original permissionPluginData localStorage shape, then to in-memory storage
|
|
10
|
+
* for SSR or privacy-restricted browser contexts.
|
|
11
|
+
*/
|
|
12
|
+
export declare class LegacyPermissionStorage {
|
|
13
|
+
private readonly dbName;
|
|
14
|
+
private readonly memoryPayload;
|
|
15
|
+
private readonly storage;
|
|
16
|
+
private readonly indexedDb;
|
|
17
|
+
private readonly dbPromise;
|
|
18
|
+
constructor(dbName: string, options?: {
|
|
19
|
+
storage?: LegacyPermissionStorageLike | null;
|
|
20
|
+
indexedDB?: IDBFactory | null;
|
|
21
|
+
});
|
|
22
|
+
get supportsIndexedDb(): boolean;
|
|
23
|
+
ready(): Promise<void>;
|
|
24
|
+
read(storeName: LegacyPermissionStoreName, appChannelId: string): Promise<LegacyStoredRecord | null>;
|
|
25
|
+
write(storeName: LegacyPermissionStoreName, record: LegacyStoredRecord): Promise<void>;
|
|
26
|
+
private openDatabase;
|
|
27
|
+
private readFallback;
|
|
28
|
+
private writeFallback;
|
|
29
|
+
private getFallbackPayload;
|
|
30
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LegacyPermissionId, LegacyPermissionPageEvent, LegacyPermissionRoute } from './types';
|
|
2
|
+
export declare function normalizePermissionId(value: LegacyPermissionId | undefined): string;
|
|
3
|
+
export declare function normalizePermissionIds(value: unknown): string[];
|
|
4
|
+
export declare function isEnabled(value: unknown): boolean;
|
|
5
|
+
export declare function isPermissionManaged(node: LegacyPermissionPageEvent): boolean;
|
|
6
|
+
export declare function cloneLegacyPageEvent(node: LegacyPermissionPageEvent): LegacyPermissionPageEvent;
|
|
7
|
+
export declare function sortLegacyNodes<T extends {
|
|
8
|
+
sort?: number | string;
|
|
9
|
+
createTime?: string;
|
|
10
|
+
}>(nodes: T[]): T[];
|
|
11
|
+
/** Matches the old flattening behavior without mutating its persisted source tree. */
|
|
12
|
+
export declare function flattenLegacyPageEventData(tree: readonly LegacyPermissionPageEvent[]): LegacyPermissionPageEvent[];
|
|
13
|
+
/** Derives the legacy route records but deliberately leaves router registration to the host. */
|
|
14
|
+
export declare function generateLegacyRoutes(tree: readonly LegacyPermissionPageEvent[], eventIds: readonly string[]): LegacyPermissionRoute[];
|
|
15
|
+
export declare function generatePermissionManagementTree(tree: readonly LegacyPermissionPageEvent[]): LegacyPermissionPageEvent[];
|
|
16
|
+
export declare function generateShopPermissionManagementTree(tree: readonly LegacyPermissionPageEvent[]): LegacyPermissionPageEvent[];
|
|
17
|
+
export declare function getUnmanagedPageTree(tree: readonly LegacyPermissionPageEvent[]): LegacyPermissionPageEvent[];
|
|
18
|
+
export declare function getCacheableLegacyRoutes(tree: readonly LegacyPermissionPageEvent[]): LegacyPermissionPageEvent[];
|
|
19
|
+
export declare function getApiEventIds(tree: readonly LegacyPermissionPageEvent[], pageEventIds: ReadonlySet<string>): string[];
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
export declare const LEGACY_PERMISSION_INJECTION_KEY = "permissionPluginClass";
|
|
3
|
+
export type LegacyPermissionId = string | number;
|
|
4
|
+
export type LegacyPermissionSign = LegacyPermissionId | readonly LegacyPermissionId[] | boolean | (() => boolean) | null | undefined;
|
|
5
|
+
export interface LegacyPermissionApiConfig {
|
|
6
|
+
appChannelId: string;
|
|
7
|
+
dataChannelId: string;
|
|
8
|
+
prefixUrl: string;
|
|
9
|
+
}
|
|
10
|
+
export interface LegacyPermissionExtraContent {
|
|
11
|
+
assemblyAddress?: string;
|
|
12
|
+
assemblyName?: string;
|
|
13
|
+
eventNameList?: readonly string[];
|
|
14
|
+
isBigScreen?: boolean | number | string;
|
|
15
|
+
isCache?: boolean | number | string;
|
|
16
|
+
isPsMg?: boolean | number | string;
|
|
17
|
+
isRelateParent?: boolean | number | string;
|
|
18
|
+
isSingle?: boolean | number | string;
|
|
19
|
+
menuStatus?: boolean | number | string;
|
|
20
|
+
onlyShowPageContent?: boolean | number | string;
|
|
21
|
+
openNewTab?: boolean | number | string;
|
|
22
|
+
productId?: string;
|
|
23
|
+
productName?: string;
|
|
24
|
+
showSubmenu?: boolean | number | string;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
/** Legacy page-event records are intentionally open because deployed projects add fields. */
|
|
28
|
+
export interface LegacyPermissionPageEvent {
|
|
29
|
+
appChannelId?: string;
|
|
30
|
+
children?: readonly LegacyPermissionPageEvent[];
|
|
31
|
+
createTime?: string;
|
|
32
|
+
eventIdList?: readonly LegacyPermissionId[];
|
|
33
|
+
extraContent?: LegacyPermissionExtraContent;
|
|
34
|
+
icon?: string;
|
|
35
|
+
isShow?: boolean | number | string;
|
|
36
|
+
pageId?: LegacyPermissionId;
|
|
37
|
+
pageName?: string;
|
|
38
|
+
parentId?: LegacyPermissionId;
|
|
39
|
+
routingAddress?: string;
|
|
40
|
+
sort?: number | string;
|
|
41
|
+
type?: number | string;
|
|
42
|
+
updateTime?: string;
|
|
43
|
+
parentIds?: readonly string[];
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
export interface LegacyPermissionRoute {
|
|
47
|
+
path: string;
|
|
48
|
+
name: string;
|
|
49
|
+
component: string;
|
|
50
|
+
meta: {
|
|
51
|
+
title: string;
|
|
52
|
+
icon: string;
|
|
53
|
+
};
|
|
54
|
+
id: string;
|
|
55
|
+
createTime?: string;
|
|
56
|
+
eventIdList: readonly LegacyPermissionId[];
|
|
57
|
+
isShow?: boolean | number | string;
|
|
58
|
+
sort?: number | string;
|
|
59
|
+
type?: number | string;
|
|
60
|
+
updateTime?: string;
|
|
61
|
+
children: LegacyPermissionRoute[];
|
|
62
|
+
[key: string]: unknown;
|
|
63
|
+
}
|
|
64
|
+
export interface LegacyPermissionStorageLike {
|
|
65
|
+
getItem: (key: string) => string | null;
|
|
66
|
+
setItem: (key: string, value: string) => void;
|
|
67
|
+
removeItem?: (key: string) => void;
|
|
68
|
+
}
|
|
69
|
+
export type LegacyPermissionFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
70
|
+
export interface LegacyPermissionPluginConfig {
|
|
71
|
+
apiCfg: readonly LegacyPermissionApiConfig[];
|
|
72
|
+
dbName: string;
|
|
73
|
+
projectAppChannelId: string;
|
|
74
|
+
}
|
|
75
|
+
export interface LegacyPermissionPluginOptions {
|
|
76
|
+
apiCfg?: LegacyPermissionApiConfig | readonly LegacyPermissionApiConfig[];
|
|
77
|
+
dbName?: string;
|
|
78
|
+
projectAppChannelId?: string;
|
|
79
|
+
/** Optional request implementation; defaults to browser fetch when available. */
|
|
80
|
+
fetcher?: LegacyPermissionFetch;
|
|
81
|
+
/** Optional localStorage replacement for tests, SSR adapters, or private storage. */
|
|
82
|
+
storage?: LegacyPermissionStorageLike | null;
|
|
83
|
+
/** Optional IndexedDB factory replacement. Pass null to force the storage fallback. */
|
|
84
|
+
indexedDB?: IDBFactory | null;
|
|
85
|
+
/** Defaults to true to match the old plugin's constructor-time synchronization. */
|
|
86
|
+
autoSync?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface LegacyPermissionPluginInstallOptions extends LegacyPermissionPluginOptions {
|
|
89
|
+
permissionPluginClass?: LegacyPermissionPluginClass;
|
|
90
|
+
}
|
|
91
|
+
export interface LegacyPermissionPluginClass {
|
|
92
|
+
readonly ifSupportIndexDb: boolean;
|
|
93
|
+
readonly pluginCfg: LegacyPermissionPluginConfig;
|
|
94
|
+
readonly revision: Readonly<{
|
|
95
|
+
value: number;
|
|
96
|
+
}>;
|
|
97
|
+
getPageEventDataFromDbOrLocal: (appChannelId?: string) => Promise<LegacyPermissionPageEvent[]>;
|
|
98
|
+
getHorizontalPageEventData: (appChannelId?: string) => Promise<LegacyPermissionPageEvent[]>;
|
|
99
|
+
setEventIdSync: (appChannelId: string, newData: unknown) => Promise<void>;
|
|
100
|
+
getNeedCacheRouter: (appChannelId?: string) => Promise<LegacyPermissionPageEvent[]>;
|
|
101
|
+
generateRouterNew: (appChannelId: string) => Promise<LegacyPermissionRoute[]>;
|
|
102
|
+
generatePermissionMgTree: (appChannelId: string) => Promise<LegacyPermissionPageEvent[]>;
|
|
103
|
+
generatePermissionMgTreeForShop: (appChannelId: string, pageEventIdList?: readonly LegacyPermissionId[]) => Promise<LegacyPermissionPageEvent[]>;
|
|
104
|
+
getApiEventList: (appChannelId: string, pageEventIdList?: readonly LegacyPermissionId[] | readonly LegacyPermissionPageEvent[]) => Promise<string[]>;
|
|
105
|
+
getNoPmPageTree: (appChannelId?: string) => Promise<LegacyPermissionPageEvent[]>;
|
|
106
|
+
checkPermission: (sign: LegacyPermissionSign) => Promise<boolean>;
|
|
107
|
+
}
|
|
108
|
+
export interface LegacyPermissionPlugin {
|
|
109
|
+
install: (app: App, options?: LegacyPermissionPluginInstallOptions) => void;
|
|
110
|
+
}
|
|
111
|
+
declare module 'vue' {
|
|
112
|
+
interface ComponentCustomProperties {
|
|
113
|
+
permissionPluginClass: LegacyPermissionPluginClass;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export declare const UploadCos: import('../../utils').SFCWithInstall<{
|
|
2
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('.').UploadCosProps> & Readonly<{
|
|
3
|
+
onUploadfiles?: ((file: import('.').UploadCosFile) => any) | undefined;
|
|
4
|
+
onErrorUpLoad?: ((error: unknown, response?: unknown) => any) | undefined;
|
|
5
|
+
onOverLimitTips?: (() => any) | undefined;
|
|
6
|
+
"onUpdate:overLoaderList"?: ((files: import('.').UploadCosFile[]) => any) | undefined;
|
|
7
|
+
"onUpload-progress"?: ((file: File, percent: number) => any) | undefined;
|
|
8
|
+
}>, {
|
|
9
|
+
triggerUpload: () => void;
|
|
10
|
+
handleSingleFileUpload: (file: File, credential?: import('.').UploadCosCredential) => Promise<import('.').UploadCosFile>;
|
|
11
|
+
uploadDefault: (file: File) => Promise<import('.').UploadCosFile>;
|
|
12
|
+
formatFileSize: (sizeInBytes: number) => string;
|
|
13
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
+
uploadfiles: (file: import('.').UploadCosFile) => any;
|
|
15
|
+
errorUpLoad: (error: unknown, response?: unknown) => any;
|
|
16
|
+
overLimitTips: () => any;
|
|
17
|
+
"update:overLoaderList": (files: import('.').UploadCosFile[]) => any;
|
|
18
|
+
"upload-progress": (file: File, percent: number) => any;
|
|
19
|
+
}, import('vue').PublicProps, {
|
|
20
|
+
appChanneId: string;
|
|
21
|
+
multiple: boolean;
|
|
22
|
+
accept: string;
|
|
23
|
+
baseUrl: string;
|
|
24
|
+
limit: number;
|
|
25
|
+
overLoaderList: readonly import('.').UploadCosFile[];
|
|
26
|
+
fileType: string;
|
|
27
|
+
appName: string;
|
|
28
|
+
isUseCos: boolean;
|
|
29
|
+
defaultUploadConfig: import('.').UploadCosDefaultUploadConfig;
|
|
30
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
31
|
+
fileInput: HTMLInputElement;
|
|
32
|
+
}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
33
|
+
P: {};
|
|
34
|
+
B: {};
|
|
35
|
+
D: {};
|
|
36
|
+
C: {};
|
|
37
|
+
M: {};
|
|
38
|
+
Defaults: {};
|
|
39
|
+
}, Readonly<import('.').UploadCosProps> & Readonly<{
|
|
40
|
+
onUploadfiles?: ((file: import('.').UploadCosFile) => any) | undefined;
|
|
41
|
+
onErrorUpLoad?: ((error: unknown, response?: unknown) => any) | undefined;
|
|
42
|
+
onOverLimitTips?: (() => any) | undefined;
|
|
43
|
+
"onUpdate:overLoaderList"?: ((files: import('.').UploadCosFile[]) => any) | undefined;
|
|
44
|
+
"onUpload-progress"?: ((file: File, percent: number) => any) | undefined;
|
|
45
|
+
}>, {
|
|
46
|
+
triggerUpload: () => void;
|
|
47
|
+
handleSingleFileUpload: (file: File, credential?: import('.').UploadCosCredential) => Promise<import('.').UploadCosFile>;
|
|
48
|
+
uploadDefault: (file: File) => Promise<import('.').UploadCosFile>;
|
|
49
|
+
formatFileSize: (sizeInBytes: number) => string;
|
|
50
|
+
}, {}, {}, {}, {
|
|
51
|
+
appChanneId: string;
|
|
52
|
+
multiple: boolean;
|
|
53
|
+
accept: string;
|
|
54
|
+
baseUrl: string;
|
|
55
|
+
limit: number;
|
|
56
|
+
overLoaderList: readonly import('.').UploadCosFile[];
|
|
57
|
+
fileType: string;
|
|
58
|
+
appName: string;
|
|
59
|
+
isUseCos: boolean;
|
|
60
|
+
defaultUploadConfig: import('.').UploadCosDefaultUploadConfig;
|
|
61
|
+
}>;
|
|
62
|
+
__isFragment?: never;
|
|
63
|
+
__isTeleport?: never;
|
|
64
|
+
__isSuspense?: never;
|
|
65
|
+
} & import('vue').ComponentOptionsBase<Readonly<import('.').UploadCosProps> & Readonly<{
|
|
66
|
+
onUploadfiles?: ((file: import('.').UploadCosFile) => any) | undefined;
|
|
67
|
+
onErrorUpLoad?: ((error: unknown, response?: unknown) => any) | undefined;
|
|
68
|
+
onOverLimitTips?: (() => any) | undefined;
|
|
69
|
+
"onUpdate:overLoaderList"?: ((files: import('.').UploadCosFile[]) => any) | undefined;
|
|
70
|
+
"onUpload-progress"?: ((file: File, percent: number) => any) | undefined;
|
|
71
|
+
}>, {
|
|
72
|
+
triggerUpload: () => void;
|
|
73
|
+
handleSingleFileUpload: (file: File, credential?: import('.').UploadCosCredential) => Promise<import('.').UploadCosFile>;
|
|
74
|
+
uploadDefault: (file: File) => Promise<import('.').UploadCosFile>;
|
|
75
|
+
formatFileSize: (sizeInBytes: number) => string;
|
|
76
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
77
|
+
uploadfiles: (file: import('.').UploadCosFile) => any;
|
|
78
|
+
errorUpLoad: (error: unknown, response?: unknown) => any;
|
|
79
|
+
overLimitTips: () => any;
|
|
80
|
+
"update:overLoaderList": (files: import('.').UploadCosFile[]) => any;
|
|
81
|
+
"upload-progress": (file: File, percent: number) => any;
|
|
82
|
+
}, string, {
|
|
83
|
+
appChanneId: string;
|
|
84
|
+
multiple: boolean;
|
|
85
|
+
accept: string;
|
|
86
|
+
baseUrl: string;
|
|
87
|
+
limit: number;
|
|
88
|
+
overLoaderList: readonly import('.').UploadCosFile[];
|
|
89
|
+
fileType: string;
|
|
90
|
+
appName: string;
|
|
91
|
+
isUseCos: boolean;
|
|
92
|
+
defaultUploadConfig: import('.').UploadCosDefaultUploadConfig;
|
|
93
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
94
|
+
$slots: {
|
|
95
|
+
'upload-button'?(_: {
|
|
96
|
+
triggerUpload: () => void;
|
|
97
|
+
isUploading: boolean;
|
|
98
|
+
}): any;
|
|
99
|
+
'file-list'?(_: {
|
|
100
|
+
uploadedFiles: {
|
|
101
|
+
[x: string]: unknown;
|
|
102
|
+
name?: string | undefined;
|
|
103
|
+
origin_name?: string | undefined;
|
|
104
|
+
url?: string | undefined;
|
|
105
|
+
size?: number | undefined;
|
|
106
|
+
width?: number | undefined;
|
|
107
|
+
height?: number | undefined;
|
|
108
|
+
ext?: string | undefined;
|
|
109
|
+
path?: string | undefined;
|
|
110
|
+
}[];
|
|
111
|
+
openFile: (file: import('.').UploadCosFile) => void;
|
|
112
|
+
progressMap: Record<string, number>;
|
|
113
|
+
}): any;
|
|
114
|
+
};
|
|
115
|
+
})>;
|
|
116
|
+
export default UploadCos;
|
|
117
|
+
export type { UploadCosCredential, UploadCosDefaultUploadConfig, UploadCosEmits, UploadCosExposed, UploadCosFile, UploadCosFileListSlotProps, UploadCosImageDimensions, UploadCosProgressReporter, UploadCosProps, UploadCosUploadButtonSlotProps } from './src/types';
|