@tinywork/glass 0.0.53 → 0.0.54

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 +30 -3
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -13,6 +13,21 @@ export declare enum Operation {
13
13
  MODIFY = 2,
14
14
  DELETE = 3
15
15
  }
16
+ export type GlassAction = "file" | "bind" | "unbind" | "check";
17
+ export type GlassActionParams = {
18
+ type: "file";
19
+ data: DocSchema;
20
+ declare?: boolean;
21
+ output: {
22
+ code: string;
23
+ filename?: string;
24
+ };
25
+ } | {
26
+ type: "bind" | "unbind";
27
+ data: DocSchema;
28
+ } | {
29
+ type: "check";
30
+ };
16
31
  export type ResourceType = "Fetch/XHR" | "JS" | "CSS" | "Img" | "Media" | "Font" | "Doc" | "WS" | "Wasm" | "Other";
17
32
  export type JSONPropertySchema = {
18
33
  type: string;
@@ -43,8 +58,6 @@ export type DocSchema = {
43
58
  hash?: string;
44
59
  /** 无hash时,用updatedAt */
45
60
  updatedAt?: string;
46
- /** 用来glass生成时的文件名,同pathname下时区分不同接口用 */
47
- filename?: string;
48
61
  /** 是否支持app编辑 */
49
62
  readonly?: boolean;
50
63
  prefix?: string;
@@ -287,7 +300,19 @@ export interface IGlassContext {
287
300
  ruleId?: string;
288
301
  };
289
302
  }>;
290
- saveDocs: (docs: DocSchema[]) => Promise<{
303
+ saveDocs: (docs: DocSchema[], options?: {
304
+ /** 是否根据文档自动生成rule规则 */
305
+ defaultRules?: {
306
+ name: string;
307
+ origin: string;
308
+ pathname: string;
309
+ apiId: string;
310
+ params?: {
311
+ key: string;
312
+ value?: string;
313
+ }[] | null;
314
+ }[];
315
+ }) => Promise<{
291
316
  success: boolean;
292
317
  message?: string;
293
318
  }>;
@@ -373,6 +398,8 @@ export interface IGlassExtension {
373
398
  onGroupChange?(context: IGlassContext, group: GroupSchema | null, originGroup: GroupSchema | null, orgId?: string | null): Promise<boolean>;
374
399
  /** glass cli拉取接口文档 */
375
400
  onDocCliUpdate?(context: IGlassContext, id: string, orgId?: string | null): Promise<void>;
401
+ /** glass cli执行 */
402
+ onGlassAction?(context: IGlassContext, params: GlassActionParams, orgId?: string | null): Promise<void>;
376
403
  /** 右键请求日志 */
377
404
  onContextMenu?(context: IGlassContext, params: ContextMenuParams, menus?: MenuItemConstructorOptions[]): Promise<void>;
378
405
  getDefaultRule?(context: IGlassContext, docs: DocSchema[], log: NetLog, rule?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinywork/glass",
3
- "version": "0.0.53",
3
+ "version": "0.0.54",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [