@goodo/platform-plugin 0.1.0 → 0.1.2

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.
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),o=e.z.enum(["input","checkbox","color-picker","date","data-time-range","datetime","input-number","monaco-editor","radio","select","tree-select","time","textarea","switch","slider","select-cascader","data-node","data-node-fields","context-menu"]),r=e.z.object({type:o,group:e.z.string().optional(),label:e.z.string().min(1,"Property config label is required")}),c=e.z.object({name:e.z.string().min(1,"Property name is required"),defaultValue:e.z.any().optional().default(null),config:r.optional()}),s=e.z.enum(["SelectedObject","MultipleSelectedObject","CurrentMenu"]),i=e.z.lazy(()=>e.z.object({bindProp:e.z.string().optional(),name:e.z.string().optional(),generic:e.z.array(e.z.lazy(()=>i)).optional()})),d=e.z.object({name:s,type:i}),m=e.z.object({options:e.z.object({bindProp:e.z.string().min(1,"options.bindProp is required")})}),g=e.z.object({name:e.z.string().min(1,"Event name is required"),label:e.z.string().min(1,"Event label is required"),arguments:e.z.array(d).optional().default([]),contextmenu:m.optional()}),u=e.z.object({id:e.z.string().min(1,"'id' is required and cannot be empty"),name:e.z.string().min(1,"'name' is required and cannot be empty"),icon:e.z.string().optional(),entry:e.z.string().optional().default("dist"),props:e.z.array(c).optional().default([]),events:e.z.array(g).optional().default([])});function l(t){return t}function p(t){const n=u.safeParse(t);return n.success?{success:!0,data:n.data}:{success:!1,errors:n.error.issues.map(a=>({path:a.path.join(".")||"root",message:a.message}))}}exports.defineWidget=l;exports.validateWidgetManifest=p;exports.widgetArgumentTypeSchema=i;exports.widgetConfigTypeSchema=o;exports.widgetEventArgumentNameSchema=s;exports.widgetEventArgumentSchema=d;exports.widgetEventContextMenuSchema=m;exports.widgetEventSchema=g;exports.widgetManifestSchema=u;exports.widgetPropConfigSchema=r;exports.widgetPropSchema=c;
2
+ //# sourceMappingURL=manifest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.cjs","sources":["../src/manifest.ts"],"sourcesContent":["import { z } from 'zod';\n\n// ==========================================\n// 1. Props Configuration Schemas\n// ==========================================\n\nexport const widgetConfigTypeSchema = z.enum([\n 'input',\n 'checkbox',\n 'color-picker',\n 'date',\n 'data-time-range',\n 'datetime',\n 'input-number',\n 'monaco-editor',\n 'radio',\n 'select',\n 'tree-select',\n 'time',\n 'textarea',\n 'switch',\n 'slider',\n 'select-cascader',\n 'data-node',\n 'data-node-fields',\n 'context-menu',\n]);\n\nexport const widgetPropConfigSchema = z.object({\n type: widgetConfigTypeSchema,\n group: z.string().optional(),\n label: z.string().min(1, 'Property config label is required'),\n});\n\nexport const widgetPropSchema = z.object({\n name: z.string().min(1, 'Property name is required'),\n defaultValue: z.any().optional().default(null),\n config: widgetPropConfigSchema.optional(),\n});\n\n// ==========================================\n// 2. Events & Arguments Configuration Schemas\n// ==========================================\n\n/**\n * Supported standard event argument names (3.3)\n */\nexport const widgetEventArgumentNameSchema = z.enum([\n 'SelectedObject',\n 'MultipleSelectedObject',\n 'CurrentMenu',\n]);\n\n/**\n * Recursive schema for event argument types (3.2):\n * 1. Entity type bound to property: { bindProp: 'dataSourceNode' }\n * 2. Generic collection type: { name: 'List', generic: [{ bindProp: 'dataSourceNode' }] }\n * 3. Fixed internal platform type: { name: 'CurrentMenu' }\n */\nexport type WidgetArgumentType = {\n bindProp?: string;\n name?: string;\n generic?: WidgetArgumentType[];\n};\n\nexport const widgetArgumentTypeSchema: z.ZodType<WidgetArgumentType> = z.lazy(() =>\n z.object({\n bindProp: z.string().optional(),\n name: z.string().optional(),\n generic: z.array(z.lazy(() => widgetArgumentTypeSchema)).optional(),\n })\n);\n\n/**\n * Event Argument configuration item (3.2)\n */\nexport const widgetEventArgumentSchema = z.object({\n name: widgetEventArgumentNameSchema,\n type: widgetArgumentTypeSchema,\n});\n\n/**\n * Context menu binding configuration for event (3.4)\n */\nexport const widgetEventContextMenuSchema = z.object({\n options: z.object({\n bindProp: z.string().min(1, 'options.bindProp is required'),\n }),\n});\n\n/**\n * Event configuration item (3.1)\n */\nexport const widgetEventSchema = z.object({\n name: z.string().min(1, 'Event name is required'),\n label: z.string().min(1, 'Event label is required'),\n arguments: z.array(widgetEventArgumentSchema).optional().default([]),\n contextmenu: widgetEventContextMenuSchema.optional(),\n});\n\n// ==========================================\n// 3. Widget Manifest Root Schema\n// ==========================================\n\nexport const widgetManifestSchema = z.object({\n id: z.string().min(1, \"'id' is required and cannot be empty\"),\n name: z.string().min(1, \"'name' is required and cannot be empty\"),\n icon: z.string().optional(),\n entry: z.string().optional().default('dist'),\n props: z.array(widgetPropSchema).optional().default([]),\n events: z.array(widgetEventSchema).optional().default([]),\n});\n\n// ==========================================\n// 4. Inferred TypeScript Types\n// ==========================================\n\nexport type WidgetConfigType = z.infer<typeof widgetConfigTypeSchema>;\nexport type WidgetPropConfig = z.infer<typeof widgetPropConfigSchema>;\nexport type WidgetProp = z.infer<typeof widgetPropSchema>;\n\nexport type WidgetEventArgumentName = z.infer<typeof widgetEventArgumentNameSchema>;\nexport type WidgetEventArgument = z.infer<typeof widgetEventArgumentSchema>;\nexport type WidgetEventContextMenu = z.infer<typeof widgetEventContextMenuSchema>;\nexport type WidgetEvent = z.infer<typeof widgetEventSchema>;\n\nexport type WidgetManifest = z.input<typeof widgetManifestSchema>;\nexport type ResolvedWidgetManifest = z.output<typeof widgetManifestSchema>;\n\n// ==========================================\n// 5. Helper & Validation Functions\n// ==========================================\n\n/**\n * Type-helper for defining widget manifest in `.goodo/manifest.ts`.\n * Provides full IDE autocomplete and compile-time type validation.\n */\nexport function defineWidget(config: WidgetManifest): WidgetManifest {\n return config;\n}\n\nexport interface ManifestValidationResult {\n success: boolean;\n data?: ResolvedWidgetManifest;\n errors?: Array<{ path: string; message: string }>;\n}\n\n/**\n * Validates raw manifest data using Zod schema for Node.js environments (e.g. CLI, backend).\n */\nexport function validateWidgetManifest(raw: unknown): ManifestValidationResult {\n const result = widgetManifestSchema.safeParse(raw);\n if (result.success) {\n return {\n success: true,\n data: result.data,\n };\n }\n\n return {\n success: false,\n errors: result.error.issues.map((issue) => ({\n path: issue.path.join('.') || 'root',\n message: issue.message,\n })),\n };\n}"],"names":["widgetConfigTypeSchema","z","widgetPropConfigSchema","widgetPropSchema","widgetEventArgumentNameSchema","widgetArgumentTypeSchema","widgetEventArgumentSchema","widgetEventContextMenuSchema","widgetEventSchema","widgetManifestSchema","defineWidget","config","validateWidgetManifest","raw","result","issue"],"mappings":"uGAMaA,EAAyBC,EAAAA,EAAE,KAAK,CAC3C,QACA,WACA,eACA,OACA,kBACA,WACA,eACA,gBACA,QACA,SACA,cACA,OACA,WACA,SACA,SACA,kBACA,YACA,mBACA,cACF,CAAC,EAEYC,EAAyBD,EAAAA,EAAE,OAAO,CAC7C,KAAMD,EACN,MAAOC,EAAAA,EAAE,OAAA,EAAS,SAAA,EAClB,MAAOA,EAAAA,EAAE,OAAA,EAAS,IAAI,EAAG,mCAAmC,CAC9D,CAAC,EAEYE,EAAmBF,EAAAA,EAAE,OAAO,CACvC,KAAMA,EAAAA,EAAE,OAAA,EAAS,IAAI,EAAG,2BAA2B,EACnD,aAAcA,EAAAA,EAAE,IAAA,EAAM,SAAA,EAAW,QAAQ,IAAI,EAC7C,OAAQC,EAAuB,SAAA,CACjC,CAAC,EASYE,EAAgCH,EAAAA,EAAE,KAAK,CAClD,iBACA,yBACA,aACF,CAAC,EAcYI,EAA0DJ,EAAAA,EAAE,KAAK,IAC5EA,EAAAA,EAAE,OAAO,CACP,SAAUA,EAAAA,EAAE,OAAA,EAAS,SAAA,EACrB,KAAMA,EAAAA,EAAE,OAAA,EAAS,SAAA,EACjB,QAASA,EAAAA,EAAE,MAAMA,EAAAA,EAAE,KAAK,IAAMI,CAAwB,CAAC,EAAE,SAAA,CAAS,CACnE,CACH,EAKaC,EAA4BL,EAAAA,EAAE,OAAO,CAChD,KAAMG,EACN,KAAMC,CACR,CAAC,E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num<{
3
+ input: "input";
4
+ select: "select";
5
+ checkbox: "checkbox";
6
+ "color-picker": "color-picker";
7
+ date: "date";
8
+ "data-time-range": "data-time-range";
9
+ datetime: "datetime";
10
+ "input-number": "input-number";
11
+ "monaco-editor": "monaco-editor";
12
+ radio: "radio";
13
+ "tree-select": "tree-select";
14
+ time: "time";
15
+ textarea: "textarea";
16
+ switch: "switch";
17
+ slider: "slider";
18
+ "select-cascader": "select-cascader";
19
+ "data-node": "data-node";
20
+ "data-node-fields": "data-node-fields";
21
+ "context-menu": "context-menu";
22
+ }>;
23
+ export declare const widgetPropConfigSchema: z.ZodObject<{
24
+ type: z.ZodEnum<{
25
+ input: "input";
26
+ select: "select";
27
+ checkbox: "checkbox";
28
+ "color-picker": "color-picker";
29
+ date: "date";
30
+ "data-time-range": "data-time-range";
31
+ datetime: "datetime";
32
+ "input-number": "input-number";
33
+ "monaco-editor": "monaco-editor";
34
+ radio: "radio";
35
+ "tree-select": "tree-select";
36
+ time: "time";
37
+ textarea: "textarea";
38
+ switch: "switch";
39
+ slider: "slider";
40
+ "select-cascader": "select-cascader";
41
+ "data-node": "data-node";
42
+ "data-node-fields": "data-node-fields";
43
+ "context-menu": "context-menu";
44
+ }>;
45
+ group: z.ZodOptional<z.ZodString>;
46
+ label: z.ZodString;
47
+ }, z.core.$strip>;
48
+ export declare const widgetPropSchema: z.ZodObject<{
49
+ name: z.ZodString;
50
+ defaultValue: z.ZodDefault<z.ZodOptional<z.ZodAny>>;
51
+ config: z.ZodOptional<z.ZodObject<{
52
+ type: z.ZodEnum<{
53
+ input: "input";
54
+ select: "select";
55
+ checkbox: "checkbox";
56
+ "color-picker": "color-picker";
57
+ date: "date";
58
+ "data-time-range": "data-time-range";
59
+ datetime: "datetime";
60
+ "input-number": "input-number";
61
+ "monaco-editor": "monaco-editor";
62
+ radio: "radio";
63
+ "tree-select": "tree-select";
64
+ time: "time";
65
+ textarea: "textarea";
66
+ switch: "switch";
67
+ slider: "slider";
68
+ "select-cascader": "select-cascader";
69
+ "data-node": "data-node";
70
+ "data-node-fields": "data-node-fields";
71
+ "context-menu": "context-menu";
72
+ }>;
73
+ group: z.ZodOptional<z.ZodString>;
74
+ label: z.ZodString;
75
+ }, z.core.$strip>>;
76
+ }, z.core.$strip>;
77
+ /**
78
+ * Supported standard event argument names (3.3)
79
+ */
80
+ export declare const widgetEventArgumentNameSchema: z.ZodEnum<{
81
+ SelectedObject: "SelectedObject";
82
+ MultipleSelectedObject: "MultipleSelectedObject";
83
+ CurrentMenu: "CurrentMenu";
84
+ }>;
85
+ /**
86
+ * Recursive schema for event argument types (3.2):
87
+ * 1. Entity type bound to property: { bindProp: 'dataSourceNode' }
88
+ * 2. Generic collection type: { name: 'List', generic: [{ bindProp: 'dataSourceNode' }] }
89
+ * 3. Fixed internal platform type: { name: 'CurrentMenu' }
90
+ */
91
+ export type WidgetArgumentType = {
92
+ bindProp?: string;
93
+ name?: string;
94
+ generic?: WidgetArgumentType[];
95
+ };
96
+ export declare const widgetArgumentTypeSchema: z.ZodType<WidgetArgumentType>;
97
+ /**
98
+ * Event Argument configuration item (3.2)
99
+ */
100
+ export declare const widgetEventArgumentSchema: z.ZodObject<{
101
+ name: z.ZodEnum<{
102
+ SelectedObject: "SelectedObject";
103
+ MultipleSelectedObject: "MultipleSelectedObject";
104
+ CurrentMenu: "CurrentMenu";
105
+ }>;
106
+ type: z.ZodType<WidgetArgumentType, unknown, z.core.$ZodTypeInternals<WidgetArgumentType, unknown>>;
107
+ }, z.core.$strip>;
108
+ /**
109
+ * Context menu binding configuration for event (3.4)
110
+ */
111
+ export declare const widgetEventContextMenuSchema: z.ZodObject<{
112
+ options: z.ZodObject<{
113
+ bindProp: z.ZodString;
114
+ }, z.core.$strip>;
115
+ }, z.core.$strip>;
116
+ /**
117
+ * Event configuration item (3.1)
118
+ */
119
+ export declare const widgetEventSchema: z.ZodObject<{
120
+ name: z.ZodString;
121
+ label: z.ZodString;
122
+ arguments: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
123
+ name: z.ZodEnum<{
124
+ SelectedObject: "SelectedObject";
125
+ MultipleSelectedObject: "MultipleSelectedObject";
126
+ CurrentMenu: "CurrentMenu";
127
+ }>;
128
+ type: z.ZodType<WidgetArgumentType, unknown, z.core.$ZodTypeInternals<WidgetArgumentType, unknown>>;
129
+ }, z.core.$strip>>>>;
130
+ contextmenu: z.ZodOptional<z.ZodObject<{
131
+ options: z.ZodObject<{
132
+ bindProp: z.ZodString;
133
+ }, z.core.$strip>;
134
+ }, z.core.$strip>>;
135
+ }, z.core.$strip>;
136
+ export declare const widgetManifestSchema: z.ZodObject<{
137
+ id: z.ZodString;
138
+ name: z.ZodString;
139
+ icon: z.ZodOptional<z.ZodString>;
140
+ entry: z.ZodDefault<z.ZodOptional<z.ZodString>>;
141
+ props: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
142
+ name: z.ZodString;
143
+ defaultValue: z.ZodDefault<z.ZodOptional<z.ZodAny>>;
144
+ config: z.ZodOptional<z.ZodObject<{
145
+ type: z.ZodEnum<{
146
+ input: "input";
147
+ select: "select";
148
+ checkbox: "checkbox";
149
+ "color-picker": "color-picker";
150
+ date: "date";
151
+ "data-time-range": "data-time-range";
152
+ datetime: "datetime";
153
+ "input-number": "input-number";
154
+ "monaco-editor": "monaco-editor";
155
+ radio: "radio";
156
+ "tree-select": "tree-select";
157
+ time: "time";
158
+ textarea: "textarea";
159
+ switch: "switch";
160
+ slider: "slider";
161
+ "select-cascader": "select-cascader";
162
+ "data-node": "data-node";
163
+ "data-node-fields": "data-node-fields";
164
+ "context-menu": "context-menu";
165
+ }>;
166
+ group: z.ZodOptional<z.ZodString>;
167
+ label: z.ZodString;
168
+ }, z.core.$strip>>;
169
+ }, z.core.$strip>>>>;
170
+ events: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
171
+ name: z.ZodString;
172
+ label: z.ZodString;
173
+ arguments: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
174
+ name: z.ZodEnum<{
175
+ SelectedObject: "SelectedObject";
176
+ MultipleSelectedObject: "MultipleSelectedObject";
177
+ CurrentMenu: "CurrentMenu";
178
+ }>;
179
+ type: z.ZodType<WidgetArgumentType, unknown, z.core.$ZodTypeInternals<WidgetArgumentType, unknown>>;
180
+ }, z.core.$strip>>>>;
181
+ contextmenu: z.ZodOptional<z.ZodObject<{
182
+ options: z.ZodObject<{
183
+ bindProp: z.ZodString;
184
+ }, z.core.$strip>;
185
+ }, z.core.$strip>>;
186
+ }, z.core.$strip>>>>;
187
+ }, z.core.$strip>;
188
+ export type WidgetConfigType = z.infer<typeof widgetConfigTypeSchema>;
189
+ export type WidgetPropConfig = z.infer<typeof widgetPropConfigSchema>;
190
+ export type WidgetProp = z.infer<typeof widgetPropSchema>;
191
+ export type WidgetEventArgumentName = z.infer<typeof widgetEventArgumentNameSchema>;
192
+ export type WidgetEventArgument = z.infer<typeof widgetEventArgumentSchema>;
193
+ export type WidgetEventContextMenu = z.infer<typeof widgetEventContextMenuSchema>;
194
+ export type WidgetEvent = z.infer<typeof widgetEventSchema>;
195
+ export type WidgetManifest = z.input<typeof widgetManifestSchema>;
196
+ export type ResolvedWidgetManifest = z.output<typeof widgetManifestSchema>;
197
+ /**
198
+ * Type-helper for defining widget manifest in `.goodo/manifest.ts`.
199
+ * Provides full IDE autocomplete and compile-time type validation.
200
+ */
201
+ export declare function defineWidget(config: WidgetManifest): WidgetManifest;
202
+ export interface ManifestValidationResult {
203
+ success: boolean;
204
+ data?: ResolvedWidgetManifest;
205
+ errors?: Array<{
206
+ path: string;
207
+ message: string;
208
+ }>;
209
+ }
210
+ /**
211
+ * Validates raw manifest data using Zod schema for Node.js environments (e.g. CLI, backend).
212
+ */
213
+ export declare function validateWidgetManifest(raw: unknown): ManifestValidationResult;
214
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"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AAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAM3E;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAEnE;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,wBAAwB,CAgB7E"}
@@ -0,0 +1,89 @@
1
+ import { z as e } from "zod";
2
+ const o = e.enum([
3
+ "input",
4
+ "checkbox",
5
+ "color-picker",
6
+ "date",
7
+ "data-time-range",
8
+ "datetime",
9
+ "input-number",
10
+ "monaco-editor",
11
+ "radio",
12
+ "select",
13
+ "tree-select",
14
+ "time",
15
+ "textarea",
16
+ "switch",
17
+ "slider",
18
+ "select-cascader",
19
+ "data-node",
20
+ "data-node-fields",
21
+ "context-menu"
22
+ ]), r = e.object({
23
+ type: o,
24
+ group: e.string().optional(),
25
+ label: e.string().min(1, "Property config label is required")
26
+ }), s = e.object({
27
+ name: e.string().min(1, "Property name is required"),
28
+ defaultValue: e.any().optional().default(null),
29
+ config: r.optional()
30
+ }), c = e.enum([
31
+ "SelectedObject",
32
+ "MultipleSelectedObject",
33
+ "CurrentMenu"
34
+ ]), a = e.lazy(
35
+ () => e.object({
36
+ bindProp: e.string().optional(),
37
+ name: e.string().optional(),
38
+ generic: e.array(e.lazy(() => a)).optional()
39
+ })
40
+ ), d = e.object({
41
+ name: c,
42
+ type: a
43
+ }), m = e.object({
44
+ options: e.object({
45
+ bindProp: e.string().min(1, "options.bindProp is required")
46
+ })
47
+ }), l = e.object({
48
+ name: e.string().min(1, "Event name is required"),
49
+ label: e.string().min(1, "Event label is required"),
50
+ arguments: e.array(d).optional().default([]),
51
+ contextmenu: m.optional()
52
+ }), u = e.object({
53
+ id: e.string().min(1, "'id' is required and cannot be empty"),
54
+ name: e.string().min(1, "'name' is required and cannot be empty"),
55
+ icon: e.string().optional(),
56
+ entry: e.string().optional().default("dist"),
57
+ props: e.array(s).optional().default([]),
58
+ events: e.array(l).optional().default([])
59
+ });
60
+ function g(t) {
61
+ return t;
62
+ }
63
+ function b(t) {
64
+ const n = u.safeParse(t);
65
+ return n.success ? {
66
+ success: !0,
67
+ data: n.data
68
+ } : {
69
+ success: !1,
70
+ errors: n.error.issues.map((i) => ({
71
+ path: i.path.join(".") || "root",
72
+ message: i.message
73
+ }))
74
+ };
75
+ }
76
+ export {
77
+ g as defineWidget,
78
+ b as validateWidgetManifest,
79
+ a as widgetArgumentTypeSchema,
80
+ o as widgetConfigTypeSchema,
81
+ c as widgetEventArgumentNameSchema,
82
+ d as widgetEventArgumentSchema,
83
+ m as widgetEventContextMenuSchema,
84
+ l as widgetEventSchema,
85
+ u as widgetManifestSchema,
86
+ r as widgetPropConfigSchema,
87
+ s as widgetPropSchema
88
+ };
89
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sources":["../src/manifest.ts"],"sourcesContent":["import { z } from 'zod';\n\n// ==========================================\n// 1. Props Configuration Schemas\n// ==========================================\n\nexport const widgetConfigTypeSchema = z.enum([\n 'input',\n 'checkbox',\n 'color-picker',\n 'date',\n 'data-time-range',\n 'datetime',\n 'input-number',\n 'monaco-editor',\n 'radio',\n 'select',\n 'tree-select',\n 'time',\n 'textarea',\n 'switch',\n 'slider',\n 'select-cascader',\n 'data-node',\n 'data-node-fields',\n 'context-menu',\n]);\n\nexport const widgetPropConfigSchema = z.object({\n type: widgetConfigTypeSchema,\n group: z.string().optional(),\n label: z.string().min(1, 'Property config label is required'),\n});\n\nexport const widgetPropSchema = z.object({\n name: z.string().min(1, 'Property name is required'),\n defaultValue: z.any().optional().default(null),\n config: widgetPropConfigSchema.optional(),\n});\n\n// ==========================================\n// 2. Events & Arguments Configuration Schemas\n// ==========================================\n\n/**\n * Supported standard event argument names (3.3)\n */\nexport const widgetEventArgumentNameSchema = z.enum([\n 'SelectedObject',\n 'MultipleSelectedObject',\n 'CurrentMenu',\n]);\n\n/**\n * Recursive schema for event argument types (3.2):\n * 1. Entity type bound to property: { bindProp: 'dataSourceNode' }\n * 2. Generic collection type: { name: 'List', generic: [{ bindProp: 'dataSourceNode' }] }\n * 3. Fixed internal platform type: { name: 'CurrentMenu' }\n */\nexport type WidgetArgumentType = {\n bindProp?: string;\n name?: string;\n generic?: WidgetArgumentType[];\n};\n\nexport const widgetArgumentTypeSchema: z.ZodType<WidgetArgumentType> = z.lazy(() =>\n z.object({\n bindProp: z.string().optional(),\n name: z.string().optional(),\n generic: z.array(z.lazy(() => widgetArgumentTypeSchema)).optional(),\n })\n);\n\n/**\n * Event Argument configuration item (3.2)\n */\nexport const widgetEventArgumentSchema = z.object({\n name: widgetEventArgumentNameSchema,\n type: widgetArgumentTypeSchema,\n});\n\n/**\n * Context menu binding configuration for event (3.4)\n */\nexport const widgetEventContextMenuSchema = z.object({\n options: z.object({\n bindProp: z.string().min(1, 'options.bindProp is required'),\n }),\n});\n\n/**\n * Event configuration item (3.1)\n */\nexport const widgetEventSchema = z.object({\n name: z.string().min(1, 'Event name is required'),\n label: z.string().min(1, 'Event label is required'),\n arguments: z.array(widgetEventArgumentSchema).optional().default([]),\n contextmenu: widgetEventContextMenuSchema.optional(),\n});\n\n// ==========================================\n// 3. Widget Manifest Root Schema\n// ==========================================\n\nexport const widgetManifestSchema = z.object({\n id: z.string().min(1, \"'id' is required and cannot be empty\"),\n name: z.string().min(1, \"'name' is required and cannot be empty\"),\n icon: z.string().optional(),\n entry: z.string().optional().default('dist'),\n props: z.array(widgetPropSchema).optional().default([]),\n events: z.array(widgetEventSchema).optional().default([]),\n});\n\n// ==========================================\n// 4. Inferred TypeScript Types\n// ==========================================\n\nexport type WidgetConfigType = z.infer<typeof widgetConfigTypeSchema>;\nexport type WidgetPropConfig = z.infer<typeof widgetPropConfigSchema>;\nexport type WidgetProp = z.infer<typeof widgetPropSchema>;\n\nexport type WidgetEventArgumentName = z.infer<typeof widgetEventArgumentNameSchema>;\nexport type WidgetEventArgument = z.infer<typeof widgetEventArgumentSchema>;\nexport type WidgetEventContextMenu = z.infer<typeof widgetEventContextMenuSchema>;\nexport type WidgetEvent = z.infer<typeof widgetEventSchema>;\n\nexport type WidgetManifest = z.input<typeof widgetManifestSchema>;\nexport type ResolvedWidgetManifest = z.output<typeof widgetManifestSchema>;\n\n// ==========================================\n// 5. Helper & Validation Functions\n// ==========================================\n\n/**\n * Type-helper for defining widget manifest in `.goodo/manifest.ts`.\n * Provides full IDE autocomplete and compile-time type validation.\n */\nexport function defineWidget(config: WidgetManifest): WidgetManifest {\n return config;\n}\n\nexport interface ManifestValidationResult {\n success: boolean;\n data?: ResolvedWidgetManifest;\n errors?: Array<{ path: string; message: string }>;\n}\n\n/**\n * Validates raw manifest data using Zod schema for Node.js environments (e.g. CLI, backend).\n */\nexport function validateWidgetManifest(raw: unknown): ManifestValidationResult {\n const result = widgetManifestSchema.safeParse(raw);\n if (result.success) {\n return {\n success: true,\n data: result.data,\n };\n }\n\n return {\n success: false,\n errors: result.error.issues.map((issue) => ({\n path: issue.path.join('.') || 'root',\n message: issue.message,\n })),\n };\n}"],"names":["widgetConfigTypeSchema","z","widgetPropConfigSchema","widgetPropSchema","widgetEventArgumentNameSchema","widgetArgumentTypeSchema","widgetEventArgumentSchema","widgetEventContextMenuSchema","widgetEventSchema","widgetManifestSchema","defineWidget","config","validateWidgetManifest","raw","result","issue"],"mappings":";AAMO,MAAMA,IAAyBC,EAAE,KAAK;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC,GAEYC,IAAyBD,EAAE,OAAO;AAAA,EAC7C,MAAMD;AAAA,EACN,OAAOC,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,OAAOA,EAAE,OAAA,EAAS,IAAI,GAAG,mCAAmC;AAC9D,CAAC,GAEYE,IAAmBF,EAAE,OAAO;AAAA,EACvC,MAAMA,EAAE,OAAA,EAAS,IAAI,GAAG,2BAA2B;AAAA,EACnD,cAAcA,EAAE,IAAA,EAAM,SAAA,EAAW,QAAQ,IAAI;AAAA,EAC7C,QAAQC,EAAuB,SAAA;AACjC,CAAC,GASYE,IAAgCH,EAAE,KAAK;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AACF,CAAC,GAcYI,IAA0DJ,EAAE;AAAA,EAAK,MAC5EA,EAAE,OAAO;AAAA,IACP,UAAUA,EAAE,OAAA,EAAS,SAAA;AAAA,IACrB,MAAMA,EAAE,OAAA,EAAS,SAAA;AAAA,IACjB,SAASA,EAAE,MAAMA,EAAE,KAAK,MAAMI,CAAwB,CAAC,EAAE,SAAA;AAAA,EAAS,CACnE;AACH,GAKaC,IAA4BL,EAAE,OAAO;AAAA,EAChD,MAAMG;AAAA,EACN,MAAMC;AACR,CAAC,GAKYE,IAA+BN,EAAE,OAAO;AAAA,EACnD,SAASA,EAAE,OAAO;AAAA,IAChB,UAAUA,EAAE,OAAA,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ugin sdk",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -19,6 +19,11 @@
19
19
  "types": "./dist/host.d.ts",
20
20
  "import": "./dist/host.js",
21
21
  "require": "./dist/host.cjs"
22
+ },
23
+ "./manifest": {
24
+ "types": "./dist/manifest.d.ts",
25
+ "import": "./dist/manifest.js",
26
+ "require": "./dist/manifest.cjs"
22
27
  }
23
28
  },
24
29
  "typesVersions": {
@@ -26,6 +31,9 @@
26
31
  "host": [
27
32
  "./dist/host.d.ts"
28
33
  ],
34
+ "manifest": [
35
+ "./dist/manifest.d.ts"
36
+ ],
29
37
  "*": [
30
38
  "./dist/*"
31
39
  ]
@@ -40,6 +48,9 @@
40
48
  "vite": "^5.4.2",
41
49
  "vite-plugin-dts": "^4.0.3"
42
50
  },
51
+ "dependencies": {
52
+ "zod": "^4.4.3"
53
+ },
43
54
  "scripts": {
44
55
  "dev": "vite build --watch",
45
56
  "build": "vite build",