@tinywork/glass 0.0.39 → 0.0.40

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +42 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -50,6 +50,45 @@ export type GroupSchema = {
50
50
  code?: string;
51
51
  status: boolean;
52
52
  };
53
+ export type MockMode = 'None' | 'Local' | 'Advance';
54
+ export type ActionMode = 'Modify' | 'Add' | 'Remove';
55
+ export type ActionTarget = 'Origin';
56
+ export type MockModelSchema = {
57
+ id: string;
58
+ ruleId?: string;
59
+ contentType?: string;
60
+ example?: string;
61
+ name?: string;
62
+ statusCode?: number;
63
+ status?: boolean;
64
+ };
65
+ export type RewriteActionSchema = {
66
+ id: string;
67
+ ruleId?: string;
68
+ action?: ActionMode;
69
+ target?: ActionTarget;
70
+ oldValue?: string;
71
+ newValue?: string;
72
+ status?: boolean;
73
+ };
74
+ export type FilterSchema = {
75
+ origin?: string;
76
+ pathname?: string;
77
+ params?: {
78
+ key: string;
79
+ value?: string;
80
+ }[];
81
+ };
82
+ type RuleSchema = FilterSchema & {
83
+ id: string;
84
+ mode?: MockMode;
85
+ name?: string;
86
+ apiId?: string;
87
+ throttle?: number;
88
+ localOptions?: MockModelSchema[];
89
+ actions?: RewriteActionSchema[];
90
+ updatedAt?: Date;
91
+ };
53
92
  export type NetLog = {
54
93
  uid: string;
55
94
  url: string;
@@ -62,6 +101,7 @@ export type NetLog = {
62
101
  responseHeaders?: string[][];
63
102
  resourceType?: ResourceType;
64
103
  response?: any;
104
+ rule?: RuleSchema;
65
105
  };
66
106
  export type Case = {
67
107
  id: string;
@@ -198,6 +238,8 @@ export interface IGlassExtension {
198
238
  /** glass cli拉取接口文档 */
199
239
  onDocCliUpdate?(context: IGlassContext, id: string): Promise<void>;
200
240
  onGroupChange?(context: IGlassContext, group: GroupSchema | null, originGroup: GroupSchema | null): Promise<boolean>;
241
+ /** 右键请求日志 */
242
+ onNetLogContextMenu?(context: IGlassContext, log: NetLog, menus?: MenuItemConstructorOptions): Promise<void>;
201
243
  getDefaultRule?(context: IGlassContext, docs: DocSchema[], log: NetLog, rule?: {
202
244
  id: string;
203
245
  mode: 'None';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinywork/glass",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [