@tinywork/glass 0.0.54 → 1.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/package.json +6 -14
- package/src/index.ts +557 -0
- package/dist/index.d.ts +0 -423
- package/dist/index.js +0 -18
package/package.json
CHANGED
|
@@ -1,34 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinywork/glass",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"types": "src/index.ts",
|
|
6
7
|
"files": [
|
|
7
|
-
"
|
|
8
|
+
"src"
|
|
8
9
|
],
|
|
9
10
|
"scripts": {
|
|
10
|
-
"build": "rm -rf ./dist && tsc",
|
|
11
11
|
"release": "standard-version"
|
|
12
12
|
},
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "ISC",
|
|
15
|
-
"peerDependencies": {
|
|
16
|
-
"electron": "^21.0.0"
|
|
17
|
-
},
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"axios": "^1.2.2",
|
|
20
|
-
"qs": "^6.11.2"
|
|
21
|
-
},
|
|
22
15
|
"devDependencies": {
|
|
23
16
|
"@commitlint/cli": "^17.5.1",
|
|
24
17
|
"@commitlint/config-conventional": "^17.4.4",
|
|
25
|
-
"@types/qs": "^6.9.8",
|
|
26
18
|
"standard-version": "^9.5.0",
|
|
27
19
|
"typescript": "^4.9.4"
|
|
28
20
|
},
|
|
29
21
|
"engines": {
|
|
30
|
-
"npm": ">=8.0
|
|
31
|
-
"node": ">=
|
|
22
|
+
"npm": ">=10.8.0",
|
|
23
|
+
"node": ">=20.18.0"
|
|
32
24
|
},
|
|
33
25
|
"standard-version": {
|
|
34
26
|
"scripts": {
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
|
|
3
|
+
/** electron类型 */
|
|
4
|
+
export type MenuItemConstructorOptions = {
|
|
5
|
+
label: string;
|
|
6
|
+
click: () => void;
|
|
7
|
+
};
|
|
8
|
+
export type Cookie = {
|
|
9
|
+
value?: string;
|
|
10
|
+
};
|
|
11
|
+
export abstract class Cookies {
|
|
12
|
+
abstract get(options: { name: string }): Promise<Cookie[]>;
|
|
13
|
+
abstract addListener(
|
|
14
|
+
event: "changed",
|
|
15
|
+
listener: (
|
|
16
|
+
event: Event,
|
|
17
|
+
/**
|
|
18
|
+
* The cookie that was changed.
|
|
19
|
+
*/
|
|
20
|
+
cookie: Cookie,
|
|
21
|
+
/**
|
|
22
|
+
* The cause of the change with one of the following values:
|
|
23
|
+
*/
|
|
24
|
+
cause:
|
|
25
|
+
| "explicit"
|
|
26
|
+
| "overwrite"
|
|
27
|
+
| "expired"
|
|
28
|
+
| "evicted"
|
|
29
|
+
| "expired-overwrite",
|
|
30
|
+
/**
|
|
31
|
+
* `true` if the cookie was removed, `false` otherwise.
|
|
32
|
+
*/
|
|
33
|
+
removed: boolean
|
|
34
|
+
) => void
|
|
35
|
+
): this;
|
|
36
|
+
abstract removeListener(
|
|
37
|
+
event: "changed",
|
|
38
|
+
listener: (
|
|
39
|
+
event: Event,
|
|
40
|
+
/**
|
|
41
|
+
* The cookie that was changed.
|
|
42
|
+
*/
|
|
43
|
+
cookie: Cookie,
|
|
44
|
+
/**
|
|
45
|
+
* The cause of the change with one of the following values:
|
|
46
|
+
*/
|
|
47
|
+
cause:
|
|
48
|
+
| "explicit"
|
|
49
|
+
| "overwrite"
|
|
50
|
+
| "expired"
|
|
51
|
+
| "evicted"
|
|
52
|
+
| "expired-overwrite",
|
|
53
|
+
/**
|
|
54
|
+
* `true` if the cookie was removed, `false` otherwise.
|
|
55
|
+
*/
|
|
56
|
+
removed: boolean
|
|
57
|
+
) => void
|
|
58
|
+
): this;
|
|
59
|
+
}
|
|
60
|
+
export type Session = {
|
|
61
|
+
setProxy: (options: { mode: "direct" }) => Promise<void>;
|
|
62
|
+
cookies: Cookies;
|
|
63
|
+
};
|
|
64
|
+
export abstract class BrowserWindow {
|
|
65
|
+
webContents: {
|
|
66
|
+
session: Session;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** 1-新增,2-修改,3-删除 */
|
|
71
|
+
export type Operation = 1 | 2 | 3;
|
|
72
|
+
|
|
73
|
+
export type GlassAction = "file" | "remove" | "bind" | "unbind" | "check";
|
|
74
|
+
export type GlassActionParams =
|
|
75
|
+
| {
|
|
76
|
+
type: "file";
|
|
77
|
+
data: DocSchema;
|
|
78
|
+
declare?: boolean;
|
|
79
|
+
output: { code: string; filename?: string };
|
|
80
|
+
}
|
|
81
|
+
| {
|
|
82
|
+
type: "bind" | "unbind";
|
|
83
|
+
data: DocSchema;
|
|
84
|
+
}
|
|
85
|
+
| {
|
|
86
|
+
type: "check";
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export type ResourceType =
|
|
90
|
+
| "Fetch/XHR"
|
|
91
|
+
| "JS"
|
|
92
|
+
| "CSS"
|
|
93
|
+
| "Img"
|
|
94
|
+
| "Media"
|
|
95
|
+
| "Font"
|
|
96
|
+
| "Doc"
|
|
97
|
+
| "WS"
|
|
98
|
+
| "Wasm"
|
|
99
|
+
| "Other";
|
|
100
|
+
|
|
101
|
+
export type JSONPropertySchema = {
|
|
102
|
+
type: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
items?: JSONPropertySchema;
|
|
105
|
+
properties?: {
|
|
106
|
+
[key: string]: JSONPropertySchema;
|
|
107
|
+
};
|
|
108
|
+
required?: string[];
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export type JSONSchema = JSONPropertySchema & {
|
|
112
|
+
$schema?: string;
|
|
113
|
+
$id?: string;
|
|
114
|
+
title?: string;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type DocSchema = {
|
|
118
|
+
apiId: string;
|
|
119
|
+
groupId: string;
|
|
120
|
+
name: string;
|
|
121
|
+
desc?: string;
|
|
122
|
+
pathname?: string;
|
|
123
|
+
method?: "GET" | "POST" | "PUT" | "DELETE";
|
|
124
|
+
code?: string; // ts声明
|
|
125
|
+
modifier?: string; // 最后操作人
|
|
126
|
+
modifyTime?: string; // 最后操作时间
|
|
127
|
+
tags?: string[] | null;
|
|
128
|
+
status: boolean;
|
|
129
|
+
hash?: string;
|
|
130
|
+
/** 无hash时,用updatedAt */
|
|
131
|
+
updatedAt?: string;
|
|
132
|
+
/** 是否支持app编辑 */
|
|
133
|
+
readonly?: boolean;
|
|
134
|
+
|
|
135
|
+
prefix?: string;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export type DocFullSchema = DocSchema & {
|
|
139
|
+
external: {
|
|
140
|
+
group: string;
|
|
141
|
+
orgId?: string;
|
|
142
|
+
teamId?: string;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export type GroupSchema = {
|
|
147
|
+
id: string;
|
|
148
|
+
orgId?: string | null;
|
|
149
|
+
teamId?: string | null;
|
|
150
|
+
parentId: string | null;
|
|
151
|
+
name: string;
|
|
152
|
+
desc?: string;
|
|
153
|
+
origin?: string;
|
|
154
|
+
prefix?: string;
|
|
155
|
+
code?: string;
|
|
156
|
+
status: boolean;
|
|
157
|
+
hash?: string;
|
|
158
|
+
/** 无hash时,用updatedAt */
|
|
159
|
+
updatedAt?: string;
|
|
160
|
+
/** 是否支持app编辑 */
|
|
161
|
+
readonly?: boolean;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export type Project = {
|
|
165
|
+
id: string;
|
|
166
|
+
orgId?: string | null;
|
|
167
|
+
teamId?: string | null;
|
|
168
|
+
name: string;
|
|
169
|
+
desc?: string;
|
|
170
|
+
status: boolean;
|
|
171
|
+
actived?: boolean;
|
|
172
|
+
hash?: string;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export type Version = {
|
|
176
|
+
id: string;
|
|
177
|
+
projectId: string;
|
|
178
|
+
name: string;
|
|
179
|
+
desc?: string;
|
|
180
|
+
status: boolean;
|
|
181
|
+
actived?: boolean;
|
|
182
|
+
hash?: string;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export type Plan = {
|
|
186
|
+
id: string;
|
|
187
|
+
versionId: string;
|
|
188
|
+
name: string;
|
|
189
|
+
desc?: string;
|
|
190
|
+
origin: string;
|
|
191
|
+
prefix: string;
|
|
192
|
+
params?: string;
|
|
193
|
+
headers?: string;
|
|
194
|
+
body?: string;
|
|
195
|
+
/** 校验结果的ts类型声明 */
|
|
196
|
+
assert?: string;
|
|
197
|
+
hash?: string;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export type Case = {
|
|
201
|
+
id: string;
|
|
202
|
+
versionId: string;
|
|
203
|
+
planId?: string;
|
|
204
|
+
name: string;
|
|
205
|
+
desc?: string;
|
|
206
|
+
origin: string;
|
|
207
|
+
pathname: string;
|
|
208
|
+
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
209
|
+
params?: Record<string, any>;
|
|
210
|
+
headers?: Record<string, any>;
|
|
211
|
+
body?: any;
|
|
212
|
+
apiId?: string;
|
|
213
|
+
/** 校验结果的ts类型声明 */
|
|
214
|
+
assert?: string;
|
|
215
|
+
hash?: string;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export type CaseData = Omit<Case, "params" | "headers" | "body"> & {
|
|
219
|
+
params?: string;
|
|
220
|
+
headers?: string;
|
|
221
|
+
body?: string;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export type Association = {
|
|
225
|
+
versionId: string;
|
|
226
|
+
apiId: string;
|
|
227
|
+
tags?: string[];
|
|
228
|
+
hash?: string;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export type MockMode = "None" | "Local" | "Advance";
|
|
232
|
+
export type ActionMode = "Modify" | "Add" | "Remove";
|
|
233
|
+
export type ActionTarget = "Origin";
|
|
234
|
+
export type ContextMenuType =
|
|
235
|
+
| "log"
|
|
236
|
+
| "group"
|
|
237
|
+
| "doc"
|
|
238
|
+
| "rule"
|
|
239
|
+
| "project"
|
|
240
|
+
| "version"
|
|
241
|
+
| "plan"
|
|
242
|
+
| "case"
|
|
243
|
+
| "association";
|
|
244
|
+
|
|
245
|
+
export type ContextMenuParams =
|
|
246
|
+
| { type: "log"; data: NetLog }
|
|
247
|
+
| { type: "group"; data: GroupSchema }
|
|
248
|
+
| { type: "doc"; data: DocSchema }
|
|
249
|
+
| { type: "rule"; data: RuleSchema }
|
|
250
|
+
| { type: "project"; data: Project }
|
|
251
|
+
| { type: "version"; data: Version }
|
|
252
|
+
| { type: "plan"; data: Plan }
|
|
253
|
+
| { type: "case"; data: Case }
|
|
254
|
+
| { type: "association"; data: Association };
|
|
255
|
+
|
|
256
|
+
export type SyncDataType =
|
|
257
|
+
| "group"
|
|
258
|
+
| "doc"
|
|
259
|
+
| "rule"
|
|
260
|
+
| "project"
|
|
261
|
+
| "version"
|
|
262
|
+
| "plan"
|
|
263
|
+
| "case";
|
|
264
|
+
|
|
265
|
+
export type SyncDataParams =
|
|
266
|
+
| { type: "group"; data: GroupSchema }
|
|
267
|
+
| { type: "doc"; data: DocSchema }
|
|
268
|
+
| { type: "rule"; data: RuleSchema }
|
|
269
|
+
| { type: "project"; data: Project }
|
|
270
|
+
| { type: "version"; data: Version }
|
|
271
|
+
| { type: "plan"; data: Plan }
|
|
272
|
+
| { type: "case"; data: CaseData };
|
|
273
|
+
|
|
274
|
+
export type MockModelSchema = {
|
|
275
|
+
id: string;
|
|
276
|
+
ruleId?: string;
|
|
277
|
+
contentType?: string;
|
|
278
|
+
example?: string;
|
|
279
|
+
name?: string;
|
|
280
|
+
statusCode?: number;
|
|
281
|
+
status?: boolean;
|
|
282
|
+
updatedAt?: string;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export type RewriteActionSchema = {
|
|
286
|
+
id: string;
|
|
287
|
+
ruleId?: string;
|
|
288
|
+
name?: string;
|
|
289
|
+
action?: ActionMode;
|
|
290
|
+
target?: ActionTarget;
|
|
291
|
+
oldValue?: string;
|
|
292
|
+
newValue?: string;
|
|
293
|
+
status?: boolean;
|
|
294
|
+
updatedAt?: string;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
export type FilterSchema = {
|
|
298
|
+
origin?: string;
|
|
299
|
+
pathname?: string;
|
|
300
|
+
params?: { key: string; value?: string }[];
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export type RuleSchema = FilterSchema & {
|
|
304
|
+
id: string;
|
|
305
|
+
orgId?: string | null;
|
|
306
|
+
teamId?: string | null;
|
|
307
|
+
mode?: MockMode; // 是否走mock
|
|
308
|
+
name?: string;
|
|
309
|
+
apiId?: string;
|
|
310
|
+
throttle?: number;
|
|
311
|
+
/** 本地匹配规则是排序用 */
|
|
312
|
+
sort?: number;
|
|
313
|
+
tags?: string[];
|
|
314
|
+
localOptions?: MockModelSchema[];
|
|
315
|
+
actions?: RewriteActionSchema[];
|
|
316
|
+
hash?: string;
|
|
317
|
+
updatedAt?: string;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export type NetLog = {
|
|
321
|
+
uid: string;
|
|
322
|
+
url: string;
|
|
323
|
+
realUrl: string;
|
|
324
|
+
method: string;
|
|
325
|
+
requestHeaders: string[][];
|
|
326
|
+
query?: string;
|
|
327
|
+
body?: any;
|
|
328
|
+
statusCode?: number;
|
|
329
|
+
responseHeaders?: string[][];
|
|
330
|
+
resourceType?: ResourceType;
|
|
331
|
+
response?: any;
|
|
332
|
+
rule?: RuleSchema;
|
|
333
|
+
};
|
|
334
|
+
export interface IProgress {
|
|
335
|
+
update: (option: { percent: number; text?: string }) => Promise<void>;
|
|
336
|
+
destroy: () => Promise<void>;
|
|
337
|
+
}
|
|
338
|
+
export interface IGlassContext {
|
|
339
|
+
getItem: <T>(key: string) => Promise<T>;
|
|
340
|
+
setItem: <T>(key: string, value: T) => Promise<void>;
|
|
341
|
+
|
|
342
|
+
saveGroup: (
|
|
343
|
+
group: GroupSchema
|
|
344
|
+
) => Promise<{ success: boolean; message?: string }>;
|
|
345
|
+
saveGroups: (
|
|
346
|
+
groups: GroupSchema[]
|
|
347
|
+
) => Promise<{ success: boolean; message?: string }>;
|
|
348
|
+
saveDoc: (
|
|
349
|
+
doc: DocSchema,
|
|
350
|
+
options?: {
|
|
351
|
+
/** 是否触发缓存更新 */
|
|
352
|
+
hooks?: boolean;
|
|
353
|
+
/** 是否根据文档自动生成rule规则 */
|
|
354
|
+
defaultRule?: Partial<{
|
|
355
|
+
name: string;
|
|
356
|
+
origin: string;
|
|
357
|
+
pathname: string;
|
|
358
|
+
params: { key: string; value?: string }[];
|
|
359
|
+
}>;
|
|
360
|
+
}
|
|
361
|
+
) => Promise<{
|
|
362
|
+
success: boolean;
|
|
363
|
+
message?: string;
|
|
364
|
+
data?: {
|
|
365
|
+
apiId: string;
|
|
366
|
+
ruleId?: string;
|
|
367
|
+
};
|
|
368
|
+
}>;
|
|
369
|
+
saveDocs: (
|
|
370
|
+
docs: DocSchema[],
|
|
371
|
+
options?: {
|
|
372
|
+
/** 是否根据文档自动生成rule规则 */
|
|
373
|
+
defaultRules?: {
|
|
374
|
+
name: string;
|
|
375
|
+
origin: string;
|
|
376
|
+
pathname: string;
|
|
377
|
+
apiId: string;
|
|
378
|
+
params?: { key: string; value?: string }[] | null;
|
|
379
|
+
}[];
|
|
380
|
+
}
|
|
381
|
+
) => Promise<{ success: boolean; message?: string }>;
|
|
382
|
+
/** 批量更新rule的本地数据 */
|
|
383
|
+
saveExamples: (
|
|
384
|
+
ruleId: string,
|
|
385
|
+
examples: {
|
|
386
|
+
id: string;
|
|
387
|
+
contentType?: string;
|
|
388
|
+
example?: string;
|
|
389
|
+
name?: string;
|
|
390
|
+
statusCode?: number;
|
|
391
|
+
status?: boolean;
|
|
392
|
+
}[]
|
|
393
|
+
) => Promise<{ success: boolean; message?: string }>;
|
|
394
|
+
|
|
395
|
+
registerMenu: (id: string, options: MenuItemConstructorOptions) => void;
|
|
396
|
+
unregisterMenu: (id: string) => void;
|
|
397
|
+
|
|
398
|
+
getSession: (id: string, isPersist?: boolean) => Session;
|
|
399
|
+
showInputBox: (option: {
|
|
400
|
+
title?: string;
|
|
401
|
+
placeholder?: string;
|
|
402
|
+
value?: string;
|
|
403
|
+
}) => Promise<string>;
|
|
404
|
+
showMessage: (options: {
|
|
405
|
+
message: string;
|
|
406
|
+
title?: string;
|
|
407
|
+
type?: "success" | "info" | "error";
|
|
408
|
+
}) => Promise<void>;
|
|
409
|
+
showProgress: () => IProgress;
|
|
410
|
+
|
|
411
|
+
transformDocToJsonSchema: (doc: DocFullSchema) => JSONSchema;
|
|
412
|
+
genDataFromDocSchema: (doc: DocFullSchema) => Record<string, any>;
|
|
413
|
+
|
|
414
|
+
postMessage: (message: Partial<NetLog>) => Promise<void>;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export interface IGlassExtension {
|
|
418
|
+
install?(context: IGlassContext): Promise<void>;
|
|
419
|
+
activate?(context: IGlassContext): Promise<void>;
|
|
420
|
+
/** 通过设置页面修改数据 */
|
|
421
|
+
onItemChange?(context: IGlassContext): Promise<void>;
|
|
422
|
+
/** 要修改url时,直接在params.url = new URL方式修改 */
|
|
423
|
+
onRequest?(
|
|
424
|
+
context: IGlassContext,
|
|
425
|
+
params: {
|
|
426
|
+
/** url为null时表示break了请求 */
|
|
427
|
+
url: URL | null;
|
|
428
|
+
req: IncomingMessage;
|
|
429
|
+
res: ServerResponse;
|
|
430
|
+
isLocal?: boolean;
|
|
431
|
+
}
|
|
432
|
+
): Promise<void>;
|
|
433
|
+
/** 在执行请求用例时触发,用于修改config */
|
|
434
|
+
onRequestExec?(
|
|
435
|
+
context: IGlassContext,
|
|
436
|
+
config: {
|
|
437
|
+
url: string;
|
|
438
|
+
method: string;
|
|
439
|
+
headers?: Record<string, any>;
|
|
440
|
+
params?: Record<string, any>;
|
|
441
|
+
data?: any;
|
|
442
|
+
}
|
|
443
|
+
): Promise<void>;
|
|
444
|
+
|
|
445
|
+
/** 在用例批量执行前触发 */
|
|
446
|
+
beforeCasesExec?(
|
|
447
|
+
context: IGlassContext,
|
|
448
|
+
data: { list: Case[] }
|
|
449
|
+
): Promise<void>;
|
|
450
|
+
/** 在单条用例执行时触发 */
|
|
451
|
+
onCaseExec?(context: IGlassContext, data: Case): Promise<void>;
|
|
452
|
+
/** 在用例批量执行后触发 */
|
|
453
|
+
afterCasesExec?(
|
|
454
|
+
context: IGlassContext,
|
|
455
|
+
data: { list: Case[]; failCases: { id: string; message?: string }[] }
|
|
456
|
+
): Promise<void>;
|
|
457
|
+
|
|
458
|
+
/** 远程服务同步数据至本机 */
|
|
459
|
+
onSyncDownload?(
|
|
460
|
+
context: IGlassContext,
|
|
461
|
+
operation: Operation,
|
|
462
|
+
params: SyncDataParams,
|
|
463
|
+
orgId?: string | null
|
|
464
|
+
): Promise<void>;
|
|
465
|
+
/** 本机变更同步数据至远程服务 */
|
|
466
|
+
onSyncUpload?(
|
|
467
|
+
context: IGlassContext,
|
|
468
|
+
operation: Operation,
|
|
469
|
+
params: SyncDataParams,
|
|
470
|
+
orgId?: string | null
|
|
471
|
+
): Promise<void>;
|
|
472
|
+
|
|
473
|
+
/** 在postMessage到页面之前 */
|
|
474
|
+
onMessagePost?(
|
|
475
|
+
context: IGlassContext,
|
|
476
|
+
message: Partial<NetLog>
|
|
477
|
+
): Promise<void>;
|
|
478
|
+
onResponse?(
|
|
479
|
+
context: IGlassContext,
|
|
480
|
+
params: {
|
|
481
|
+
url: URL;
|
|
482
|
+
req: IncomingMessage;
|
|
483
|
+
res: ServerResponse;
|
|
484
|
+
}
|
|
485
|
+
): Promise<void>;
|
|
486
|
+
deactivate?(context: IGlassContext): Promise<void>;
|
|
487
|
+
uninstall?(context: IGlassContext): Promise<void>;
|
|
488
|
+
|
|
489
|
+
onDocChange?(
|
|
490
|
+
context: IGlassContext,
|
|
491
|
+
doc: DocFullSchema | null,
|
|
492
|
+
originDoc: DocFullSchema | null,
|
|
493
|
+
orgId?: string | null
|
|
494
|
+
): Promise<boolean>;
|
|
495
|
+
onGroupChange?(
|
|
496
|
+
context: IGlassContext,
|
|
497
|
+
group: GroupSchema | null,
|
|
498
|
+
originGroup: GroupSchema | null,
|
|
499
|
+
orgId?: string | null
|
|
500
|
+
): Promise<boolean>;
|
|
501
|
+
/** glass cli拉取接口文档 */
|
|
502
|
+
onDocCliUpdate?(
|
|
503
|
+
context: IGlassContext,
|
|
504
|
+
id: string,
|
|
505
|
+
orgId?: string | null
|
|
506
|
+
): Promise<void>;
|
|
507
|
+
/** glass cli执行 */
|
|
508
|
+
onGlassAction?(
|
|
509
|
+
context: IGlassContext,
|
|
510
|
+
params: GlassActionParams,
|
|
511
|
+
orgId?: string | null
|
|
512
|
+
): Promise<void>;
|
|
513
|
+
/** 右键请求日志 */
|
|
514
|
+
onContextMenu?(
|
|
515
|
+
context: IGlassContext,
|
|
516
|
+
params: ContextMenuParams,
|
|
517
|
+
menus?: MenuItemConstructorOptions[]
|
|
518
|
+
): Promise<void>;
|
|
519
|
+
|
|
520
|
+
getDefaultRule?(
|
|
521
|
+
context: IGlassContext,
|
|
522
|
+
docs: DocSchema[],
|
|
523
|
+
log: NetLog,
|
|
524
|
+
rule?: {
|
|
525
|
+
id: string;
|
|
526
|
+
mode: "None";
|
|
527
|
+
} & Partial<{
|
|
528
|
+
name: string;
|
|
529
|
+
origin: string;
|
|
530
|
+
pathname: string;
|
|
531
|
+
params: { key: string; value?: string }[];
|
|
532
|
+
apiId: string;
|
|
533
|
+
}>
|
|
534
|
+
): Promise<void>;
|
|
535
|
+
/** 根据doc或者log来初始化case */
|
|
536
|
+
getDefaultCase?(
|
|
537
|
+
context: IGlassContext,
|
|
538
|
+
docs: DocSchema[],
|
|
539
|
+
log?: NetLog,
|
|
540
|
+
defaultCase?: Partial<Case>
|
|
541
|
+
): Promise<void>;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export type writeText = (text: string) => void;
|
|
545
|
+
export type openExternal = (url: string) => void;
|
|
546
|
+
export type openBrowserWindow = (browserWindowOptions: {
|
|
547
|
+
width?: number;
|
|
548
|
+
height?: number;
|
|
549
|
+
minHeight?: number;
|
|
550
|
+
minWidth?: number;
|
|
551
|
+
show?: boolean;
|
|
552
|
+
alwaysOnTop?: boolean;
|
|
553
|
+
url: string;
|
|
554
|
+
webPreferences?: {
|
|
555
|
+
session?: Session;
|
|
556
|
+
};
|
|
557
|
+
}) => Promise<BrowserWindow>;
|
package/dist/index.d.ts
DELETED
|
@@ -1,423 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import http from "node:http";
|
|
5
|
-
import https from "node:https";
|
|
6
|
-
import crypto from "node:crypto";
|
|
7
|
-
import axios from "axios";
|
|
8
|
-
import qs from "qs";
|
|
9
|
-
import { BrowserWindow, type MenuItemConstructorOptions, type Session } from "electron";
|
|
10
|
-
/** 1-新增,2-修改,3-删除 */
|
|
11
|
-
export declare enum Operation {
|
|
12
|
-
ADD = 1,
|
|
13
|
-
MODIFY = 2,
|
|
14
|
-
DELETE = 3
|
|
15
|
-
}
|
|
16
|
-
export type GlassAction = "file" | "bind" | "unbind" | "check";
|
|
17
|
-
export type GlassActionParams = {
|
|
18
|
-
type: "file";
|
|
19
|
-
data: DocSchema;
|
|
20
|
-
declare?: boolean;
|
|
21
|
-
output: {
|
|
22
|
-
code: string;
|
|
23
|
-
filename?: string;
|
|
24
|
-
};
|
|
25
|
-
} | {
|
|
26
|
-
type: "bind" | "unbind";
|
|
27
|
-
data: DocSchema;
|
|
28
|
-
} | {
|
|
29
|
-
type: "check";
|
|
30
|
-
};
|
|
31
|
-
export type ResourceType = "Fetch/XHR" | "JS" | "CSS" | "Img" | "Media" | "Font" | "Doc" | "WS" | "Wasm" | "Other";
|
|
32
|
-
export type JSONPropertySchema = {
|
|
33
|
-
type: string;
|
|
34
|
-
description?: string;
|
|
35
|
-
items?: JSONPropertySchema;
|
|
36
|
-
properties?: {
|
|
37
|
-
[key: string]: JSONPropertySchema;
|
|
38
|
-
};
|
|
39
|
-
required?: string[];
|
|
40
|
-
};
|
|
41
|
-
export type JSONSchema = JSONPropertySchema & {
|
|
42
|
-
$schema?: string;
|
|
43
|
-
$id?: string;
|
|
44
|
-
title?: string;
|
|
45
|
-
};
|
|
46
|
-
export type DocSchema = {
|
|
47
|
-
apiId: string;
|
|
48
|
-
groupId: string;
|
|
49
|
-
name: string;
|
|
50
|
-
desc?: string;
|
|
51
|
-
pathname?: string;
|
|
52
|
-
method?: "GET" | "POST" | "PUT" | "DELETE";
|
|
53
|
-
code?: string;
|
|
54
|
-
modifier?: string;
|
|
55
|
-
modifyTime?: string;
|
|
56
|
-
tags?: string[] | null;
|
|
57
|
-
status: boolean;
|
|
58
|
-
hash?: string;
|
|
59
|
-
/** 无hash时,用updatedAt */
|
|
60
|
-
updatedAt?: string;
|
|
61
|
-
/** 是否支持app编辑 */
|
|
62
|
-
readonly?: boolean;
|
|
63
|
-
prefix?: string;
|
|
64
|
-
};
|
|
65
|
-
export type DocFullSchema = DocSchema & {
|
|
66
|
-
external: {
|
|
67
|
-
group: string;
|
|
68
|
-
orgId?: string;
|
|
69
|
-
teamId?: string;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
export type GroupSchema = {
|
|
73
|
-
id: string;
|
|
74
|
-
orgId?: string | null;
|
|
75
|
-
teamId?: string | null;
|
|
76
|
-
parentId: string | null;
|
|
77
|
-
name: string;
|
|
78
|
-
desc?: string;
|
|
79
|
-
origin?: string;
|
|
80
|
-
prefix?: string;
|
|
81
|
-
code?: string;
|
|
82
|
-
status: boolean;
|
|
83
|
-
hash?: string;
|
|
84
|
-
/** 无hash时,用updatedAt */
|
|
85
|
-
updatedAt?: string;
|
|
86
|
-
/** 是否支持app编辑 */
|
|
87
|
-
readonly?: boolean;
|
|
88
|
-
};
|
|
89
|
-
export type Project = {
|
|
90
|
-
id: string;
|
|
91
|
-
orgId?: string | null;
|
|
92
|
-
teamId?: string | null;
|
|
93
|
-
name: string;
|
|
94
|
-
desc?: string;
|
|
95
|
-
status: boolean;
|
|
96
|
-
actived?: boolean;
|
|
97
|
-
hash?: string;
|
|
98
|
-
};
|
|
99
|
-
export type Version = {
|
|
100
|
-
id: string;
|
|
101
|
-
projectId: string;
|
|
102
|
-
name: string;
|
|
103
|
-
desc?: string;
|
|
104
|
-
status: boolean;
|
|
105
|
-
actived?: boolean;
|
|
106
|
-
hash?: string;
|
|
107
|
-
};
|
|
108
|
-
export type Plan = {
|
|
109
|
-
id: string;
|
|
110
|
-
versionId: string;
|
|
111
|
-
name: string;
|
|
112
|
-
desc?: string;
|
|
113
|
-
origin: string;
|
|
114
|
-
prefix: string;
|
|
115
|
-
params?: string;
|
|
116
|
-
headers?: string;
|
|
117
|
-
body?: string;
|
|
118
|
-
/** 校验结果的ts类型声明 */
|
|
119
|
-
assert?: string;
|
|
120
|
-
hash?: string;
|
|
121
|
-
};
|
|
122
|
-
export type Case = {
|
|
123
|
-
id: string;
|
|
124
|
-
versionId: string;
|
|
125
|
-
planId?: string;
|
|
126
|
-
name: string;
|
|
127
|
-
desc?: string;
|
|
128
|
-
origin: string;
|
|
129
|
-
pathname: string;
|
|
130
|
-
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
131
|
-
params?: Record<string, any>;
|
|
132
|
-
headers?: Record<string, any>;
|
|
133
|
-
body?: any;
|
|
134
|
-
apiId?: string;
|
|
135
|
-
/** 校验结果的ts类型声明 */
|
|
136
|
-
assert?: string;
|
|
137
|
-
hash?: string;
|
|
138
|
-
};
|
|
139
|
-
export type CaseData = Omit<Case, "params" | "headers" | "body"> & {
|
|
140
|
-
params?: string;
|
|
141
|
-
headers?: string;
|
|
142
|
-
body?: string;
|
|
143
|
-
};
|
|
144
|
-
export type Association = {
|
|
145
|
-
versionId: string;
|
|
146
|
-
apiId: string;
|
|
147
|
-
tags?: string[];
|
|
148
|
-
hash?: string;
|
|
149
|
-
};
|
|
150
|
-
export type MockMode = "None" | "Local" | "Advance";
|
|
151
|
-
export type ActionMode = "Modify" | "Add" | "Remove";
|
|
152
|
-
export type ActionTarget = "Origin";
|
|
153
|
-
export type ContextMenuType = "log" | "group" | "doc" | "rule" | "project" | "version" | "plan" | "case" | "association";
|
|
154
|
-
export type ContextMenuParams = {
|
|
155
|
-
type: "log";
|
|
156
|
-
data: NetLog;
|
|
157
|
-
} | {
|
|
158
|
-
type: "group";
|
|
159
|
-
data: GroupSchema;
|
|
160
|
-
} | {
|
|
161
|
-
type: "doc";
|
|
162
|
-
data: DocSchema;
|
|
163
|
-
} | {
|
|
164
|
-
type: "rule";
|
|
165
|
-
data: RuleSchema;
|
|
166
|
-
} | {
|
|
167
|
-
type: "project";
|
|
168
|
-
data: Project;
|
|
169
|
-
} | {
|
|
170
|
-
type: "version";
|
|
171
|
-
data: Version;
|
|
172
|
-
} | {
|
|
173
|
-
type: "plan";
|
|
174
|
-
data: Plan;
|
|
175
|
-
} | {
|
|
176
|
-
type: "case";
|
|
177
|
-
data: Case;
|
|
178
|
-
} | {
|
|
179
|
-
type: "association";
|
|
180
|
-
data: Association;
|
|
181
|
-
};
|
|
182
|
-
export type SyncDataType = "group" | "doc" | "rule" | "project" | "version" | "plan" | "case";
|
|
183
|
-
export type SyncDataParams = {
|
|
184
|
-
type: "group";
|
|
185
|
-
data: GroupSchema;
|
|
186
|
-
} | {
|
|
187
|
-
type: "doc";
|
|
188
|
-
data: DocSchema;
|
|
189
|
-
} | {
|
|
190
|
-
type: "rule";
|
|
191
|
-
data: RuleSchema;
|
|
192
|
-
} | {
|
|
193
|
-
type: "project";
|
|
194
|
-
data: Project;
|
|
195
|
-
} | {
|
|
196
|
-
type: "version";
|
|
197
|
-
data: Version;
|
|
198
|
-
} | {
|
|
199
|
-
type: "plan";
|
|
200
|
-
data: Plan;
|
|
201
|
-
} | {
|
|
202
|
-
type: "case";
|
|
203
|
-
data: CaseData;
|
|
204
|
-
};
|
|
205
|
-
export type MockModelSchema = {
|
|
206
|
-
id: string;
|
|
207
|
-
ruleId?: string;
|
|
208
|
-
contentType?: string;
|
|
209
|
-
example?: string;
|
|
210
|
-
name?: string;
|
|
211
|
-
statusCode?: number;
|
|
212
|
-
status?: boolean;
|
|
213
|
-
updatedAt?: string;
|
|
214
|
-
};
|
|
215
|
-
export type RewriteActionSchema = {
|
|
216
|
-
id: string;
|
|
217
|
-
ruleId?: string;
|
|
218
|
-
name?: string;
|
|
219
|
-
action?: ActionMode;
|
|
220
|
-
target?: ActionTarget;
|
|
221
|
-
oldValue?: string;
|
|
222
|
-
newValue?: string;
|
|
223
|
-
status?: boolean;
|
|
224
|
-
updatedAt?: string;
|
|
225
|
-
};
|
|
226
|
-
export type FilterSchema = {
|
|
227
|
-
origin?: string;
|
|
228
|
-
pathname?: string;
|
|
229
|
-
params?: {
|
|
230
|
-
key: string;
|
|
231
|
-
value?: string;
|
|
232
|
-
}[];
|
|
233
|
-
};
|
|
234
|
-
export type RuleSchema = FilterSchema & {
|
|
235
|
-
id: string;
|
|
236
|
-
orgId?: string | null;
|
|
237
|
-
teamId?: string | null;
|
|
238
|
-
mode?: MockMode;
|
|
239
|
-
name?: string;
|
|
240
|
-
apiId?: string;
|
|
241
|
-
throttle?: number;
|
|
242
|
-
/** 本地匹配规则是排序用 */
|
|
243
|
-
sort?: number;
|
|
244
|
-
tags?: string[];
|
|
245
|
-
localOptions?: MockModelSchema[];
|
|
246
|
-
actions?: RewriteActionSchema[];
|
|
247
|
-
hash?: string;
|
|
248
|
-
updatedAt?: string;
|
|
249
|
-
};
|
|
250
|
-
export type NetLog = {
|
|
251
|
-
uid: string;
|
|
252
|
-
url: string;
|
|
253
|
-
realUrl: string;
|
|
254
|
-
method: string;
|
|
255
|
-
requestHeaders: string[][];
|
|
256
|
-
query?: string;
|
|
257
|
-
body?: any;
|
|
258
|
-
statusCode?: number;
|
|
259
|
-
responseHeaders?: string[][];
|
|
260
|
-
resourceType?: ResourceType;
|
|
261
|
-
response?: any;
|
|
262
|
-
rule?: RuleSchema;
|
|
263
|
-
};
|
|
264
|
-
export interface IProgress {
|
|
265
|
-
update: (option: {
|
|
266
|
-
percent: number;
|
|
267
|
-
text?: string;
|
|
268
|
-
}) => Promise<void>;
|
|
269
|
-
destroy: () => Promise<void>;
|
|
270
|
-
}
|
|
271
|
-
export interface IGlassContext {
|
|
272
|
-
getItem: <T>(key: string) => Promise<T>;
|
|
273
|
-
setItem: <T>(key: string, value: T) => Promise<void>;
|
|
274
|
-
saveGroup: (group: GroupSchema) => Promise<{
|
|
275
|
-
success: boolean;
|
|
276
|
-
message?: string;
|
|
277
|
-
}>;
|
|
278
|
-
saveGroups: (groups: GroupSchema[]) => Promise<{
|
|
279
|
-
success: boolean;
|
|
280
|
-
message?: string;
|
|
281
|
-
}>;
|
|
282
|
-
saveDoc: (doc: DocSchema, options?: {
|
|
283
|
-
/** 是否触发缓存更新 */
|
|
284
|
-
hooks?: boolean;
|
|
285
|
-
/** 是否根据文档自动生成rule规则 */
|
|
286
|
-
defaultRule?: Partial<{
|
|
287
|
-
name: string;
|
|
288
|
-
origin: string;
|
|
289
|
-
pathname: string;
|
|
290
|
-
params: {
|
|
291
|
-
key: string;
|
|
292
|
-
value?: string;
|
|
293
|
-
}[];
|
|
294
|
-
}>;
|
|
295
|
-
}) => Promise<{
|
|
296
|
-
success: boolean;
|
|
297
|
-
message?: string;
|
|
298
|
-
data?: {
|
|
299
|
-
apiId: string;
|
|
300
|
-
ruleId?: string;
|
|
301
|
-
};
|
|
302
|
-
}>;
|
|
303
|
-
saveDocs: (docs: DocSchema[], options?: {
|
|
304
|
-
/** 是否根据文档自动生成rule规则 */
|
|
305
|
-
defaultRules?: {
|
|
306
|
-
name: string;
|
|
307
|
-
origin: string;
|
|
308
|
-
pathname: string;
|
|
309
|
-
apiId: string;
|
|
310
|
-
params?: {
|
|
311
|
-
key: string;
|
|
312
|
-
value?: string;
|
|
313
|
-
}[] | null;
|
|
314
|
-
}[];
|
|
315
|
-
}) => Promise<{
|
|
316
|
-
success: boolean;
|
|
317
|
-
message?: string;
|
|
318
|
-
}>;
|
|
319
|
-
/** 批量更新rule的本地数据 */
|
|
320
|
-
saveExamples: (ruleId: string, examples: {
|
|
321
|
-
id: string;
|
|
322
|
-
contentType?: string;
|
|
323
|
-
example?: string;
|
|
324
|
-
name?: string;
|
|
325
|
-
statusCode?: number;
|
|
326
|
-
status?: boolean;
|
|
327
|
-
}[]) => Promise<{
|
|
328
|
-
success: boolean;
|
|
329
|
-
message?: string;
|
|
330
|
-
}>;
|
|
331
|
-
registerMenu: (id: string, options: MenuItemConstructorOptions) => void;
|
|
332
|
-
unregisterMenu: (id: string) => void;
|
|
333
|
-
getSession: (id: string, isPersist?: boolean) => Session;
|
|
334
|
-
showInputBox: (option: {
|
|
335
|
-
title?: string;
|
|
336
|
-
placeholder?: string;
|
|
337
|
-
value?: string;
|
|
338
|
-
}) => Promise<string>;
|
|
339
|
-
showMessage: (options: {
|
|
340
|
-
message: string;
|
|
341
|
-
title?: string;
|
|
342
|
-
type?: "success" | "info" | "error";
|
|
343
|
-
}) => Promise<void>;
|
|
344
|
-
showProgress: () => IProgress;
|
|
345
|
-
transformDocToJsonSchema: (doc: DocFullSchema) => JSONSchema;
|
|
346
|
-
genDataFromDocSchema: (doc: DocFullSchema) => Record<string, any>;
|
|
347
|
-
postMessage: (message: Partial<NetLog>) => Promise<void>;
|
|
348
|
-
}
|
|
349
|
-
export interface IGlassExtension {
|
|
350
|
-
install?(context: IGlassContext): Promise<void>;
|
|
351
|
-
activate?(context: IGlassContext): Promise<void>;
|
|
352
|
-
/** 通过设置页面修改数据 */
|
|
353
|
-
onItemChange?(context: IGlassContext): Promise<void>;
|
|
354
|
-
/** 要修改url时,直接在params.url = new URL方式修改 */
|
|
355
|
-
onRequest?(context: IGlassContext, params: {
|
|
356
|
-
/** url为null时表示break了请求 */
|
|
357
|
-
url: URL | null;
|
|
358
|
-
req: http.IncomingMessage;
|
|
359
|
-
res: http.ServerResponse;
|
|
360
|
-
isLocal?: boolean;
|
|
361
|
-
}): Promise<void>;
|
|
362
|
-
/** 在执行请求用例时触发,用于修改config */
|
|
363
|
-
onRequestExec?(context: IGlassContext, config: {
|
|
364
|
-
url: string;
|
|
365
|
-
method: string;
|
|
366
|
-
headers?: Record<string, any>;
|
|
367
|
-
params?: Record<string, any>;
|
|
368
|
-
data?: any;
|
|
369
|
-
}): Promise<void>;
|
|
370
|
-
/** 在用例批量执行前触发 */
|
|
371
|
-
beforeCasesExec?(context: IGlassContext, data: {
|
|
372
|
-
list: Case[];
|
|
373
|
-
}): Promise<void>;
|
|
374
|
-
/** 在单条用例执行时触发 */
|
|
375
|
-
onCaseExec?(context: IGlassContext, data: Case): Promise<void>;
|
|
376
|
-
/** 在用例批量执行后触发 */
|
|
377
|
-
afterCasesExec?(context: IGlassContext, data: {
|
|
378
|
-
list: Case[];
|
|
379
|
-
failCases: {
|
|
380
|
-
id: string;
|
|
381
|
-
message?: string;
|
|
382
|
-
}[];
|
|
383
|
-
}): Promise<void>;
|
|
384
|
-
/** 远程服务同步数据至本机 */
|
|
385
|
-
onSyncDownload?(context: IGlassContext, operation: Operation, params: SyncDataParams, orgId?: string | null): Promise<void>;
|
|
386
|
-
/** 本机变更同步数据至远程服务 */
|
|
387
|
-
onSyncUpload?(context: IGlassContext, operation: Operation, params: SyncDataParams, orgId?: string | null): Promise<void>;
|
|
388
|
-
/** 在postMessage到页面之前 */
|
|
389
|
-
onMessagePost?(context: IGlassContext, message: Partial<NetLog>): Promise<void>;
|
|
390
|
-
onResponse?(context: IGlassContext, params: {
|
|
391
|
-
url: URL;
|
|
392
|
-
req: http.IncomingMessage;
|
|
393
|
-
res: http.ServerResponse;
|
|
394
|
-
}): Promise<void>;
|
|
395
|
-
deactivate?(context: IGlassContext): Promise<void>;
|
|
396
|
-
uninstall?(context: IGlassContext): Promise<void>;
|
|
397
|
-
onDocChange?(context: IGlassContext, doc: DocFullSchema | null, originDoc: DocFullSchema | null, orgId?: string | null): Promise<boolean>;
|
|
398
|
-
onGroupChange?(context: IGlassContext, group: GroupSchema | null, originGroup: GroupSchema | null, orgId?: string | null): Promise<boolean>;
|
|
399
|
-
/** glass cli拉取接口文档 */
|
|
400
|
-
onDocCliUpdate?(context: IGlassContext, id: string, orgId?: string | null): Promise<void>;
|
|
401
|
-
/** glass cli执行 */
|
|
402
|
-
onGlassAction?(context: IGlassContext, params: GlassActionParams, orgId?: string | null): Promise<void>;
|
|
403
|
-
/** 右键请求日志 */
|
|
404
|
-
onContextMenu?(context: IGlassContext, params: ContextMenuParams, menus?: MenuItemConstructorOptions[]): Promise<void>;
|
|
405
|
-
getDefaultRule?(context: IGlassContext, docs: DocSchema[], log: NetLog, rule?: {
|
|
406
|
-
id: string;
|
|
407
|
-
mode: "None";
|
|
408
|
-
} & Partial<{
|
|
409
|
-
name: string;
|
|
410
|
-
origin: string;
|
|
411
|
-
pathname: string;
|
|
412
|
-
params: {
|
|
413
|
-
key: string;
|
|
414
|
-
value?: string;
|
|
415
|
-
}[];
|
|
416
|
-
apiId: string;
|
|
417
|
-
}>): Promise<void>;
|
|
418
|
-
/** 根据doc或者log来初始化case */
|
|
419
|
-
getDefaultCase?(context: IGlassContext, docs: DocSchema[], log?: NetLog, defaultCase?: Partial<Case>): Promise<void>;
|
|
420
|
-
}
|
|
421
|
-
declare const writeText: (text: string, type?: "selection" | "clipboard") => void;
|
|
422
|
-
declare const openExternal: (url: string, options?: Electron.OpenExternalOptions) => Promise<void>;
|
|
423
|
-
export { fs, qs, path, http, https, axios, crypto, BrowserWindow, openExternal, writeText, type Session, type MenuItemConstructorOptions, };
|
package/dist/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import http from "node:http";
|
|
4
|
-
import https from "node:https";
|
|
5
|
-
import crypto from "node:crypto";
|
|
6
|
-
import axios from "axios";
|
|
7
|
-
import qs from "qs";
|
|
8
|
-
import { BrowserWindow, shell, clipboard, } from "electron";
|
|
9
|
-
/** 1-新增,2-修改,3-删除 */
|
|
10
|
-
export var Operation;
|
|
11
|
-
(function (Operation) {
|
|
12
|
-
Operation[Operation["ADD"] = 1] = "ADD";
|
|
13
|
-
Operation[Operation["MODIFY"] = 2] = "MODIFY";
|
|
14
|
-
Operation[Operation["DELETE"] = 3] = "DELETE";
|
|
15
|
-
})(Operation || (Operation = {}));
|
|
16
|
-
const writeText = clipboard.writeText;
|
|
17
|
-
const openExternal = shell.openExternal;
|
|
18
|
-
export { fs, qs, path, http, https, axios, crypto, BrowserWindow, openExternal, writeText, };
|