@tinywork/glass 0.0.44 → 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 CHANGED
@@ -1,13 +1,13 @@
1
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
- type ResourceType = 'Fetch/XHR' | 'JS' | 'CSS' | 'Img' | 'Media' | 'Font' | 'Doc' | 'WS' | 'Wasm' | 'Other';
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?: 'GET' | 'POST' | 'PUT' | 'DELETE';
31
+ method?: "GET" | "POST" | "PUT" | "DELETE";
32
32
  code?: string;
33
33
  modifier?: string;
34
34
  modifyTime?: string;
@@ -65,31 +65,47 @@ export type Version = {
65
65
  status: boolean;
66
66
  actived?: boolean;
67
67
  };
68
- export type MockMode = 'None' | 'Local' | 'Advance';
69
- export type ActionMode = 'Modify' | 'Add' | 'Remove';
70
- export type ActionTarget = 'Origin';
71
- export type ContextMenuType = 'log' | 'case' | 'group' | 'doc' | 'rule' | 'project' | 'version';
68
+ export type Plan = {
69
+ id: string;
70
+ versionId: string;
71
+ name: string;
72
+ desc?: string;
73
+ origin: string;
74
+ prefix: string;
75
+ params?: string;
76
+ headers?: string;
77
+ body?: string;
78
+ /** 校验结果的ts类型声明 */
79
+ assert?: string;
80
+ };
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";
72
85
  export type ContextMenuParams = {
73
- type: 'log';
86
+ type: "log";
74
87
  data: NetLog;
75
88
  } | {
76
- type: 'case';
77
- data: Case;
78
- } | {
79
- type: 'group';
89
+ type: "group";
80
90
  data: GroupSchema;
81
91
  } | {
82
- type: 'doc';
92
+ type: "doc";
83
93
  data: DocSchema;
84
94
  } | {
85
- type: 'rule';
95
+ type: "rule";
86
96
  data: RuleSchema;
87
97
  } | {
88
- type: 'project';
98
+ type: "project";
89
99
  data: Project;
90
100
  } | {
91
- type: 'version';
101
+ type: "version";
92
102
  data: Version;
103
+ } | {
104
+ type: "plan";
105
+ data: Plan;
106
+ } | {
107
+ type: "case";
108
+ data: Case;
93
109
  };
94
110
  export type MockModelSchema = {
95
111
  id: string;
@@ -148,7 +164,7 @@ export type Case = {
148
164
  desc?: string;
149
165
  origin: string;
150
166
  pathname: string;
151
- method: 'GET' | 'POST' | 'PUT' | 'DELETE';
167
+ method: "GET" | "POST" | "PUT" | "DELETE";
152
168
  params?: Record<string, any>;
153
169
  headers?: Record<string, any>;
154
170
  body?: any;
@@ -222,7 +238,7 @@ export interface IGlassContext {
222
238
  showMessage: (options: {
223
239
  message: string;
224
240
  title?: string;
225
- type?: 'success' | 'info' | 'error';
241
+ type?: "success" | "info" | "error";
226
242
  }) => Promise<void>;
227
243
  showProgress: () => IProgress;
228
244
  transformDocToJsonSchema: (doc: DocFullSchema) => JSONSchema;
@@ -236,7 +252,8 @@ export interface IGlassExtension {
236
252
  onItemChange?(context: IGlassContext): Promise<void>;
237
253
  /** 要修改url时,直接在params.url = new URL方式修改 */
238
254
  onRequest?(context: IGlassContext, params: {
239
- url: URL;
255
+ /** url为null时表示break了请求 */
256
+ url: URL | null;
240
257
  req: http.IncomingMessage;
241
258
  res: http.ServerResponse;
242
259
  isLocal?: boolean;
@@ -280,7 +297,7 @@ export interface IGlassExtension {
280
297
  onContextMenu?(context: IGlassContext, params: ContextMenuParams, menus?: MenuItemConstructorOptions[]): Promise<void>;
281
298
  getDefaultRule?(context: IGlassContext, docs: DocSchema[], log: NetLog, rule?: {
282
299
  id: string;
283
- mode: 'None';
300
+ mode: "None";
284
301
  } & Partial<{
285
302
  name: string;
286
303
  origin: string;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
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';
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, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinywork/glass",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [