@tinywork/glass 0.0.46 → 0.0.47
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/index.d.ts +49 -15
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import crypto from "node:crypto";
|
|
|
7
7
|
import axios from "axios";
|
|
8
8
|
import qs from "qs";
|
|
9
9
|
import { BrowserWindow, type MenuItemConstructorOptions, type Session } from "electron";
|
|
10
|
+
/** 1-新增,2-修改,3-删除 */
|
|
11
|
+
type Operation = 1 | 2 | 3;
|
|
10
12
|
type ResourceType = "Fetch/XHR" | "JS" | "CSS" | "Img" | "Media" | "Font" | "Doc" | "WS" | "Wasm" | "Other";
|
|
11
13
|
export type JSONPropertySchema = {
|
|
12
14
|
type: string;
|
|
@@ -78,6 +80,26 @@ export type Plan = {
|
|
|
78
80
|
/** 校验结果的ts类型声明 */
|
|
79
81
|
assert?: string;
|
|
80
82
|
};
|
|
83
|
+
export type Case = {
|
|
84
|
+
id: string;
|
|
85
|
+
versionId: string;
|
|
86
|
+
name: string;
|
|
87
|
+
desc?: string;
|
|
88
|
+
origin: string;
|
|
89
|
+
pathname: string;
|
|
90
|
+
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
91
|
+
params?: Record<string, any>;
|
|
92
|
+
headers?: Record<string, any>;
|
|
93
|
+
body?: any;
|
|
94
|
+
apiId?: string;
|
|
95
|
+
/** 校验结果的ts类型声明 */
|
|
96
|
+
assert?: string;
|
|
97
|
+
};
|
|
98
|
+
export type CaseData = Omit<Case, "params" | "headers" | "body"> & {
|
|
99
|
+
params?: string;
|
|
100
|
+
headers?: string;
|
|
101
|
+
body?: string;
|
|
102
|
+
};
|
|
81
103
|
export type MockMode = "None" | "Local" | "Advance";
|
|
82
104
|
export type ActionMode = "Modify" | "Add" | "Remove";
|
|
83
105
|
export type ActionTarget = "Origin";
|
|
@@ -107,6 +129,29 @@ export type ContextMenuParams = {
|
|
|
107
129
|
type: "case";
|
|
108
130
|
data: Case;
|
|
109
131
|
};
|
|
132
|
+
export type SyncDataType = "group" | "doc" | "rule" | "project" | "version" | "plan" | "case";
|
|
133
|
+
export type SyncDataParams = {
|
|
134
|
+
type: "group";
|
|
135
|
+
data: GroupSchema;
|
|
136
|
+
} | {
|
|
137
|
+
type: "doc";
|
|
138
|
+
data: DocSchema;
|
|
139
|
+
} | {
|
|
140
|
+
type: "rule";
|
|
141
|
+
data: RuleSchema;
|
|
142
|
+
} | {
|
|
143
|
+
type: "project";
|
|
144
|
+
data: Project;
|
|
145
|
+
} | {
|
|
146
|
+
type: "version";
|
|
147
|
+
data: Version;
|
|
148
|
+
} | {
|
|
149
|
+
type: "plan";
|
|
150
|
+
data: Plan;
|
|
151
|
+
} | {
|
|
152
|
+
type: "case";
|
|
153
|
+
data: CaseData;
|
|
154
|
+
};
|
|
110
155
|
export type MockModelSchema = {
|
|
111
156
|
id: string;
|
|
112
157
|
ruleId?: string;
|
|
@@ -157,21 +202,6 @@ export type NetLog = {
|
|
|
157
202
|
response?: any;
|
|
158
203
|
rule?: RuleSchema;
|
|
159
204
|
};
|
|
160
|
-
export type Case = {
|
|
161
|
-
id: string;
|
|
162
|
-
versionId: string;
|
|
163
|
-
name: string;
|
|
164
|
-
desc?: string;
|
|
165
|
-
origin: string;
|
|
166
|
-
pathname: string;
|
|
167
|
-
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
168
|
-
params?: Record<string, any>;
|
|
169
|
-
headers?: Record<string, any>;
|
|
170
|
-
body?: any;
|
|
171
|
-
apiId?: string;
|
|
172
|
-
/** 校验结果的ts类型声明 */
|
|
173
|
-
assert?: string;
|
|
174
|
-
};
|
|
175
205
|
export interface IProgress {
|
|
176
206
|
update: (option: {
|
|
177
207
|
percent: number;
|
|
@@ -280,6 +310,10 @@ export interface IGlassExtension {
|
|
|
280
310
|
message?: string;
|
|
281
311
|
}[];
|
|
282
312
|
}): Promise<void>;
|
|
313
|
+
/** 远程服务同步数据至本机 */
|
|
314
|
+
onSyncDownload?(context: IGlassContext, operation: Operation, params: SyncDataParams): Promise<void>;
|
|
315
|
+
/** 本机变更同步数据至远程服务 */
|
|
316
|
+
onSyncUpload?(context: IGlassContext, operation: Operation, params: SyncDataParams): Promise<void>;
|
|
283
317
|
/** 在postMessage到页面之前 */
|
|
284
318
|
onMessagePost?(context: IGlassContext, message: Partial<NetLog>): Promise<void>;
|
|
285
319
|
onResponse?(context: IGlassContext, params: {
|