@tinywork/glass 0.0.31 → 0.0.33

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
@@ -4,6 +4,7 @@ import path from 'node:path';
4
4
  import http from 'node:http';
5
5
  import https from 'node:https';
6
6
  import querystring from 'node:querystring';
7
+ import crypto from 'node:crypto';
7
8
  import axios from 'axios';
8
9
  import { BrowserWindow, type MenuItemConstructorOptions, type Session } from 'electron';
9
10
  type ResourceType = 'Fetch/XHR' | 'JS' | 'CSS' | 'Img' | 'Media' | 'Font' | 'Doc' | 'WS' | 'Wasm' | 'Other';
@@ -145,6 +146,14 @@ export interface IGlassExtension {
145
146
  res: http.ServerResponse;
146
147
  isLocal?: boolean;
147
148
  }): Promise<void>;
149
+ /** 在执行请求用例时触发,用于修改config */
150
+ onRequestExec?(context: IGlassContext, config: {
151
+ url: string;
152
+ method: string;
153
+ headers?: Record<string, any>;
154
+ params?: Record<string, any>;
155
+ data?: any;
156
+ }): Promise<void>;
148
157
  /** 在postMessage到页面之前 */
149
158
  onMessagePost?(context: IGlassContext, message: Partial<NetLog>): Promise<void>;
150
159
  onResponse?(context: IGlassContext, params: {
@@ -172,4 +181,4 @@ export interface IGlassExtension {
172
181
  apiId: string;
173
182
  }>): Promise<void>;
174
183
  }
175
- export { fs, querystring, path, http, https, axios, BrowserWindow, type Session };
184
+ export { fs, querystring, path, http, https, axios, crypto, BrowserWindow, type Session };
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import path from 'node:path';
3
3
  import http from 'node:http';
4
4
  import https from 'node:https';
5
5
  import querystring from 'node:querystring';
6
+ import crypto from 'node:crypto';
6
7
  import axios from 'axios';
7
8
  import { BrowserWindow } from 'electron';
8
- export { fs, querystring, path, http, https, axios, BrowserWindow };
9
+ export { fs, querystring, path, http, https, axios, crypto, BrowserWindow };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinywork/glass",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [