@tinywork/glass 0.0.45 → 0.0.46
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 +27 -26
- package/dist/index.js +8 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import fs from
|
|
3
|
-
import path from
|
|
4
|
-
import http from
|
|
5
|
-
import https from
|
|
6
|
-
import crypto from
|
|
7
|
-
import axios from
|
|
8
|
-
import qs from
|
|
9
|
-
import { BrowserWindow, type MenuItemConstructorOptions, type Session } from
|
|
10
|
-
type ResourceType =
|
|
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
|
+
type ResourceType = "Fetch/XHR" | "JS" | "CSS" | "Img" | "Media" | "Font" | "Doc" | "WS" | "Wasm" | "Other";
|
|
11
11
|
export type JSONPropertySchema = {
|
|
12
12
|
type: string;
|
|
13
13
|
description?: string;
|
|
@@ -28,7 +28,7 @@ export type DocSchema = {
|
|
|
28
28
|
name: string;
|
|
29
29
|
desc?: string;
|
|
30
30
|
pathname?: string;
|
|
31
|
-
method?:
|
|
31
|
+
method?: "GET" | "POST" | "PUT" | "DELETE";
|
|
32
32
|
code?: string;
|
|
33
33
|
modifier?: string;
|
|
34
34
|
modifyTime?: string;
|
|
@@ -78,33 +78,33 @@ export type Plan = {
|
|
|
78
78
|
/** 校验结果的ts类型声明 */
|
|
79
79
|
assert?: string;
|
|
80
80
|
};
|
|
81
|
-
export type MockMode =
|
|
82
|
-
export type ActionMode =
|
|
83
|
-
export type ActionTarget =
|
|
84
|
-
export type ContextMenuType =
|
|
81
|
+
export type MockMode = "None" | "Local" | "Advance";
|
|
82
|
+
export type ActionMode = "Modify" | "Add" | "Remove";
|
|
83
|
+
export type ActionTarget = "Origin";
|
|
84
|
+
export type ContextMenuType = "log" | "group" | "doc" | "rule" | "project" | "version" | "plan" | "case";
|
|
85
85
|
export type ContextMenuParams = {
|
|
86
|
-
type:
|
|
86
|
+
type: "log";
|
|
87
87
|
data: NetLog;
|
|
88
88
|
} | {
|
|
89
|
-
type:
|
|
89
|
+
type: "group";
|
|
90
90
|
data: GroupSchema;
|
|
91
91
|
} | {
|
|
92
|
-
type:
|
|
92
|
+
type: "doc";
|
|
93
93
|
data: DocSchema;
|
|
94
94
|
} | {
|
|
95
|
-
type:
|
|
95
|
+
type: "rule";
|
|
96
96
|
data: RuleSchema;
|
|
97
97
|
} | {
|
|
98
|
-
type:
|
|
98
|
+
type: "project";
|
|
99
99
|
data: Project;
|
|
100
100
|
} | {
|
|
101
|
-
type:
|
|
101
|
+
type: "version";
|
|
102
102
|
data: Version;
|
|
103
103
|
} | {
|
|
104
|
-
type:
|
|
104
|
+
type: "plan";
|
|
105
105
|
data: Plan;
|
|
106
106
|
} | {
|
|
107
|
-
type:
|
|
107
|
+
type: "case";
|
|
108
108
|
data: Case;
|
|
109
109
|
};
|
|
110
110
|
export type MockModelSchema = {
|
|
@@ -164,7 +164,7 @@ export type Case = {
|
|
|
164
164
|
desc?: string;
|
|
165
165
|
origin: string;
|
|
166
166
|
pathname: string;
|
|
167
|
-
method:
|
|
167
|
+
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
168
168
|
params?: Record<string, any>;
|
|
169
169
|
headers?: Record<string, any>;
|
|
170
170
|
body?: any;
|
|
@@ -238,7 +238,7 @@ export interface IGlassContext {
|
|
|
238
238
|
showMessage: (options: {
|
|
239
239
|
message: string;
|
|
240
240
|
title?: string;
|
|
241
|
-
type?:
|
|
241
|
+
type?: "success" | "info" | "error";
|
|
242
242
|
}) => Promise<void>;
|
|
243
243
|
showProgress: () => IProgress;
|
|
244
244
|
transformDocToJsonSchema: (doc: DocFullSchema) => JSONSchema;
|
|
@@ -252,7 +252,8 @@ export interface IGlassExtension {
|
|
|
252
252
|
onItemChange?(context: IGlassContext): Promise<void>;
|
|
253
253
|
/** 要修改url时,直接在params.url = new URL方式修改 */
|
|
254
254
|
onRequest?(context: IGlassContext, params: {
|
|
255
|
-
url
|
|
255
|
+
/** url为null时表示break了请求 */
|
|
256
|
+
url: URL | null;
|
|
256
257
|
req: http.IncomingMessage;
|
|
257
258
|
res: http.ServerResponse;
|
|
258
259
|
isLocal?: boolean;
|
|
@@ -296,7 +297,7 @@ export interface IGlassExtension {
|
|
|
296
297
|
onContextMenu?(context: IGlassContext, params: ContextMenuParams, menus?: MenuItemConstructorOptions[]): Promise<void>;
|
|
297
298
|
getDefaultRule?(context: IGlassContext, docs: DocSchema[], log: NetLog, rule?: {
|
|
298
299
|
id: string;
|
|
299
|
-
mode:
|
|
300
|
+
mode: "None";
|
|
300
301
|
} & Partial<{
|
|
301
302
|
name: string;
|
|
302
303
|
origin: string;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import path from
|
|
3
|
-
import http from
|
|
4
|
-
import https from
|
|
5
|
-
import crypto from
|
|
6
|
-
import axios from
|
|
7
|
-
import qs from
|
|
8
|
-
import { BrowserWindow, shell, clipboard, } from
|
|
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
9
|
const writeText = clipboard.writeText;
|
|
10
10
|
const openExternal = shell.openExternal;
|
|
11
11
|
export { fs, qs, path, http, https, axios, crypto, BrowserWindow, openExternal, writeText, };
|