@tinywork/glass 0.0.52 → 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 +34 -1
  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,6 +58,8 @@ export type DocSchema = {
43
58
  hash?: string;
44
59
  /** 无hash时,用updatedAt */
45
60
  updatedAt?: string;
61
+ /** 是否支持app编辑 */
62
+ readonly?: boolean;
46
63
  prefix?: string;
47
64
  };
48
65
  export type DocFullSchema = DocSchema & {
@@ -66,6 +83,8 @@ export type GroupSchema = {
66
83
  hash?: string;
67
84
  /** 无hash时,用updatedAt */
68
85
  updatedAt?: string;
86
+ /** 是否支持app编辑 */
87
+ readonly?: boolean;
69
88
  };
70
89
  export type Project = {
71
90
  id: string;
@@ -281,7 +300,19 @@ export interface IGlassContext {
281
300
  ruleId?: string;
282
301
  };
283
302
  }>;
284
- 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<{
285
316
  success: boolean;
286
317
  message?: string;
287
318
  }>;
@@ -367,6 +398,8 @@ export interface IGlassExtension {
367
398
  onGroupChange?(context: IGlassContext, group: GroupSchema | null, originGroup: GroupSchema | null, orgId?: string | null): Promise<boolean>;
368
399
  /** glass cli拉取接口文档 */
369
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>;
370
403
  /** 右键请求日志 */
371
404
  onContextMenu?(context: IGlassContext, params: ContextMenuParams, menus?: MenuItemConstructorOptions[]): Promise<void>;
372
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.52",
3
+ "version": "0.0.54",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [