@dforge-core/dforge-mcp 0.1.0-rc.1 → 0.1.0-rc.11

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,221 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://dforge.dev/schemas/reports.schema.json",
4
+ "title": "dForge Module Reports",
5
+ "description": "Report definitions for a dForge module: a map of report code → report definition. Reports are not listed in manifest.json; the install pipeline picks up ui/reports.json automatically.",
6
+ "type": "object",
7
+ "additionalProperties": {
8
+ "$ref": "#/$defs/report"
9
+ },
10
+ "$defs": {
11
+ "report": {
12
+ "type": "object",
13
+ "required": ["description", "layout", "datasets"],
14
+ "properties": {
15
+ "description": {
16
+ "type": "string",
17
+ "description": "Human-readable report title"
18
+ },
19
+ "layout": {
20
+ "$ref": "#/$defs/layout"
21
+ },
22
+ "datasets": {
23
+ "type": "object",
24
+ "description": "Map of dataset code → dataset definition. Panels reference datasets by code via `datasetCd`.",
25
+ "additionalProperties": { "$ref": "#/$defs/dataset" }
26
+ },
27
+ "parameters": {
28
+ "type": "object",
29
+ "description": "Report-level parameters (alternative to per-dataset `params`). Map of param code → param definition.",
30
+ "additionalProperties": { "$ref": "#/$defs/paramDef" }
31
+ }
32
+ },
33
+ "additionalProperties": false
34
+ },
35
+
36
+ "layout": {
37
+ "type": "object",
38
+ "required": ["panels"],
39
+ "properties": {
40
+ "panels": {
41
+ "type": "array",
42
+ "items": { "$ref": "#/$defs/panel" }
43
+ }
44
+ },
45
+ "additionalProperties": false
46
+ },
47
+
48
+ "panel": {
49
+ "type": "object",
50
+ "required": ["vizType", "datasetCd"],
51
+ "properties": {
52
+ "vizType": {
53
+ "type": "string",
54
+ "enum": ["table", "chart", "metric", "pivot"],
55
+ "description": "Visualization type"
56
+ },
57
+ "datasetCd": {
58
+ "type": "string",
59
+ "description": "Dataset code (key in the parent `datasets` map)"
60
+ },
61
+ "title": { "type": "string" },
62
+ "config": {
63
+ "type": "object",
64
+ "description": "Viz-type-specific configuration. For chart: { chartType, categoryCol, valueCol, agg, chartSize }. For table: { groupRules, aggregations }."
65
+ }
66
+ },
67
+ "additionalProperties": false
68
+ },
69
+
70
+ "dataset": {
71
+ "type": "object",
72
+ "required": ["datasetType"],
73
+ "properties": {
74
+ "caption": {
75
+ "type": "string",
76
+ "description": "Display label for the dataset (used in panel headings if no `title`)"
77
+ },
78
+ "datasetType": {
79
+ "type": "string",
80
+ "enum": ["Q", "S"],
81
+ "description": "Q = SQL/entity query, S = stored procedure"
82
+ },
83
+ "query": {
84
+ "$ref": "#/$defs/query",
85
+ "description": "Used when datasetType is 'Q'"
86
+ },
87
+ "procedureName": {
88
+ "type": "string",
89
+ "description": "Used when datasetType is 'S'"
90
+ },
91
+ "columnsDef": {
92
+ "type": "object",
93
+ "description": "Optional column metadata overrides: field code → { label, visible, ... }",
94
+ "additionalProperties": { "$ref": "#/$defs/columnDef" }
95
+ },
96
+ "params": {
97
+ "type": "object",
98
+ "description": "Dataset-level parameters (alternative to top-level `parameters`)",
99
+ "additionalProperties": { "$ref": "#/$defs/paramDef" }
100
+ }
101
+ },
102
+ "additionalProperties": false
103
+ },
104
+
105
+ "query": {
106
+ "type": "object",
107
+ "required": ["entityCd"],
108
+ "properties": {
109
+ "entityCd": {
110
+ "type": "string",
111
+ "description": "Source entity code"
112
+ },
113
+ "columns": {
114
+ "type": "array",
115
+ "items": { "type": "string" },
116
+ "description": "Column codes to select (supports dot navigation: 'customer.name')"
117
+ },
118
+ "filter": {
119
+ "$ref": "#/$defs/filter"
120
+ },
121
+ "sort": {
122
+ "type": "array",
123
+ "items": { "$ref": "#/$defs/sortClause" }
124
+ }
125
+ },
126
+ "additionalProperties": false
127
+ },
128
+
129
+ "sortClause": {
130
+ "type": "object",
131
+ "required": ["c"],
132
+ "properties": {
133
+ "c": { "type": "string", "description": "Column code" },
134
+ "d": {
135
+ "type": "string",
136
+ "enum": ["asc", "desc"],
137
+ "description": "Sort direction (default: asc)"
138
+ }
139
+ },
140
+ "additionalProperties": false
141
+ },
142
+
143
+ "columnDef": {
144
+ "type": "object",
145
+ "properties": {
146
+ "label": { "type": "string" },
147
+ "visible": { "type": "boolean" },
148
+ "width": { "type": "integer", "minimum": 1 }
149
+ },
150
+ "additionalProperties": false
151
+ },
152
+
153
+ "paramDef": {
154
+ "type": "object",
155
+ "required": ["fieldTypeCd"],
156
+ "properties": {
157
+ "fieldTypeCd": {
158
+ "type": "string",
159
+ "description": "Field type code (see settings.schema.json for the common list)"
160
+ },
161
+ "label": { "type": "string" },
162
+ "required": {
163
+ "type": "boolean",
164
+ "default": false,
165
+ "description": "Whether the user must provide a value (older modules also use `isRequired`)"
166
+ },
167
+ "isRequired": {
168
+ "type": "boolean",
169
+ "description": "Alternate spelling of `required` used by some modules. Prefer `required` for new code."
170
+ },
171
+ "default": {
172
+ "description": "Default value applied if the user doesn't provide one"
173
+ },
174
+ "link": {
175
+ "type": "object",
176
+ "description": "Entity link for lookup-type params (alternative to nesting under `params.link`). Shape: { entity: '<code>', otherKey?: '<column>' }.",
177
+ "properties": {
178
+ "entity": { "type": "string" },
179
+ "otherKey": { "type": "string" }
180
+ },
181
+ "additionalProperties": false
182
+ },
183
+ "params": {
184
+ "type": "object",
185
+ "description": "Field-type-specific params (e.g. lookup → { link: { entity, otherKey } })"
186
+ }
187
+ },
188
+ "additionalProperties": false
189
+ },
190
+
191
+ "filter": {
192
+ "description": "Canonical dForge filter expression — same shape as data_views.json filter. Either `{c, o, v}` or `{g, i: [...]}`.",
193
+ "oneOf": [
194
+ { "$ref": "#/$defs/filterCondition" },
195
+ { "$ref": "#/$defs/filterGroup" }
196
+ ]
197
+ },
198
+ "filterCondition": {
199
+ "type": "object",
200
+ "required": ["c", "o"],
201
+ "properties": {
202
+ "c": { "type": "string" },
203
+ "o": { "type": "string" },
204
+ "v": {}
205
+ },
206
+ "additionalProperties": false
207
+ },
208
+ "filterGroup": {
209
+ "type": "object",
210
+ "required": ["g", "i"],
211
+ "properties": {
212
+ "g": { "type": "string", "enum": ["and", "or"] },
213
+ "i": {
214
+ "type": "array",
215
+ "items": { "$ref": "#/$defs/filter" }
216
+ }
217
+ },
218
+ "additionalProperties": false
219
+ }
220
+ }
221
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://dforge.dev/schemas/roles.schema.json",
4
+ "title": "dForge Roles",
5
+ "description": "Role definitions with entity rights for a dForge module",
6
+ "type": "object",
7
+ "additionalProperties": {
8
+ "$ref": "#/$defs/role"
9
+ },
10
+ "$defs": {
11
+ "role": {
12
+ "type": "object",
13
+ "required": ["description", "rights"],
14
+ "properties": {
15
+ "description": {
16
+ "type": "string",
17
+ "description": "Role display name"
18
+ },
19
+ "rights": {
20
+ "type": "object",
21
+ "description": "Entity rights: entity code → rights string",
22
+ "additionalProperties": {
23
+ "type": "string",
24
+ "pattern": "^[SIUDCE]*$",
25
+ "description": "Rights: S=Select, I=Insert, U=Update, D=Delete, C=Clone, E=Execute"
26
+ }
27
+ }
28
+ },
29
+ "additionalProperties": false
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://dforge.dev/schemas/seed_data.schema.json",
4
+ "title": "dForge Seed Data",
5
+ "description": "Seed data records for a dForge entity",
6
+ "type": "object",
7
+ "required": ["entityCode", "records"],
8
+ "properties": {
9
+ "entityCode": {
10
+ "type": "string",
11
+ "description": "Target entity code to insert records into"
12
+ },
13
+ "records": {
14
+ "type": "array",
15
+ "description": "Array of records, each record is an object with column_code → value",
16
+ "items": {
17
+ "type": "object",
18
+ "additionalProperties": true
19
+ }
20
+ }
21
+ },
22
+ "additionalProperties": false
23
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://dforge.dev/schemas/settings.schema.json",
4
+ "title": "dForge Module Settings",
5
+ "description": "Module-level settings definitions: a flat map of setting code → setting definition. Settings are folder-scoped at runtime (values inherit through the folder tree) and surface in the Module Settings UI.",
6
+ "type": "object",
7
+ "additionalProperties": {
8
+ "$ref": "#/$defs/setting"
9
+ },
10
+ "$defs": {
11
+ "setting": {
12
+ "type": "object",
13
+ "required": ["fieldTypeCd"],
14
+ "properties": {
15
+ "fieldTypeCd": {
16
+ "type": "string",
17
+ "description": "Field type code (must match one in dforge.field_type). Common values: text, number, integer, decimal, boolean, checkbox, dropdown, multiSelect, date, dateTime, time, image, file, fileList, lookup, color, currency, percent, html, markdown, password, email, phone, url, textarea, json."
18
+ },
19
+ "baseDatatypeCd": {
20
+ "type": "string",
21
+ "enum": ["string", "number", "bool", "date", "dateTime", "time", "json"],
22
+ "description": "Underlying primitive datatype. Older settings declare this explicitly; newer settings (using `formula`) often omit it."
23
+ },
24
+ "label": {
25
+ "type": "string",
26
+ "description": "Display label (newer style). Prefer this over `description`/`desc` for new settings."
27
+ },
28
+ "description": {
29
+ "type": "string",
30
+ "description": "Display label (older style). Use `label` for new settings."
31
+ },
32
+ "desc": {
33
+ "type": "string",
34
+ "description": "Alternative label key used by some older modules. Prefer `label`."
35
+ },
36
+ "defaultValue": {
37
+ "description": "Default value before the user sets one. Type matches `baseDatatypeCd`."
38
+ },
39
+ "formula": {
40
+ "type": "string",
41
+ "description": "Formula expression to evaluate the default (e.g. \"'USD'\"). Alternative to `defaultValue`."
42
+ },
43
+ "required": {
44
+ "type": "boolean",
45
+ "description": "If true, the setting must be set somewhere in the folder chain for installation to proceed."
46
+ },
47
+ "params": {
48
+ "type": "object",
49
+ "description": "Field-type-specific parameters. Examples: dropdown → { options: [...] }; number → { min, max }; lookup → { link: { entity, otherKey } }."
50
+ }
51
+ },
52
+ "additionalProperties": false
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,99 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://dforge.dev/schemas/traits.schema.json",
4
+ "title": "dForge Trait Definitions",
5
+ "description": "Defines entity traits that expand into fields, references, and constraints during module install. Shipped as traits.json at module root.",
6
+ "type": "object",
7
+ "additionalProperties": {
8
+ "$ref": "#/$defs/traitDefinition"
9
+ },
10
+ "$defs": {
11
+ "traitDefinition": {
12
+ "type": "object",
13
+ "description": "A single trait definition",
14
+ "properties": {
15
+ "description": {
16
+ "type": "string",
17
+ "description": "Human-readable description of the trait"
18
+ },
19
+ "includes": {
20
+ "type": "array",
21
+ "items": { "type": "string" },
22
+ "description": "Other trait names to include (inherit fields from). Expanded recursively with circular reference protection."
23
+ },
24
+ "fields": {
25
+ "type": "object",
26
+ "description": "Field definitions to add to entities using this trait. Keys support {entity}/{Entity} placeholders for parametric names.",
27
+ "additionalProperties": {
28
+ "$ref": "#/$defs/traitField"
29
+ }
30
+ },
31
+ "references": {
32
+ "type": "object",
33
+ "description": "FK reference definitions to add. Keys support {Entity} placeholder.",
34
+ "additionalProperties": {
35
+ "$ref": "#/$defs/traitReference"
36
+ }
37
+ },
38
+ "constraints": {
39
+ "type": "object",
40
+ "description": "Constraint definitions to add. Keys support {Entity} placeholder (e.g. 'UQ_{Entity}_period_key')."
41
+ }
42
+ },
43
+ "additionalProperties": false
44
+ },
45
+ "traitField": {
46
+ "type": "object",
47
+ "description": "Field definition within a trait. Same shape as entity field definitions.",
48
+ "properties": {
49
+ "dbDatatype": { "type": "string" },
50
+ "columnType": { "type": "string" },
51
+ "fieldTypeCd": { "type": "string" },
52
+ "flags": { "type": "string" },
53
+ "isPk": { "type": "boolean" },
54
+ "isIdentity": { "type": "boolean" },
55
+ "isNullable": { "type": "boolean" },
56
+ "formula": { "type": "string" },
57
+ "orderNum": { "type": "integer" },
58
+ "description": { "type": "string", "description": "Supports {entity}/{Entity} placeholders" },
59
+ "maxLen": { "type": "integer" },
60
+ "link": {
61
+ "type": "object",
62
+ "properties": {
63
+ "entity": { "type": "string" },
64
+ "thisKey": { "type": "string" },
65
+ "otherKey": { "type": "string" }
66
+ },
67
+ "required": ["entity", "thisKey", "otherKey"],
68
+ "additionalProperties": false
69
+ }
70
+ },
71
+ "additionalProperties": false
72
+ },
73
+ "traitReference": {
74
+ "type": "object",
75
+ "description": "FK reference definition within a trait",
76
+ "required": ["from", "to"],
77
+ "properties": {
78
+ "from": {
79
+ "type": "object",
80
+ "required": ["field"],
81
+ "properties": {
82
+ "field": { "type": "string" }
83
+ },
84
+ "additionalProperties": false
85
+ },
86
+ "to": {
87
+ "type": "object",
88
+ "required": ["entity", "field"],
89
+ "properties": {
90
+ "entity": { "type": "string" },
91
+ "field": { "type": "string" }
92
+ },
93
+ "additionalProperties": false
94
+ }
95
+ },
96
+ "additionalProperties": false
97
+ }
98
+ }
99
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://dforge.dev/schemas/triggers.schema.json",
4
+ "title": "dForge Module Triggers",
5
+ "description": "Trigger definitions for a dForge module (logic/triggers.json). A trigger watches an entity for an event (insert/update/delete/status_change/any), evaluates an optional formula condition using `[field]` syntax, and fires an action if true. Different from scheduled jobs (cron-driven) and webhooks (outbound HTTP) — triggers are intra-tenant DB-event-driven action invocations.",
6
+ "type": "object",
7
+ "required": ["triggers"],
8
+ "properties": {
9
+ "triggers": {
10
+ "type": "array",
11
+ "items": { "$ref": "#/$defs/trigger" }
12
+ }
13
+ },
14
+ "additionalProperties": false,
15
+ "$defs": {
16
+ "trigger": {
17
+ "type": "object",
18
+ "required": ["code", "entity", "event", "action"],
19
+ "properties": {
20
+ "code": {
21
+ "type": "string",
22
+ "pattern": "^[a-z][a-z0-9_]*$",
23
+ "description": "Trigger code, unique within the module."
24
+ },
25
+ "description": {
26
+ "type": "string",
27
+ "description": "Human-readable description of what the trigger does and when."
28
+ },
29
+ "entity": {
30
+ "type": "string",
31
+ "description": "Entity whose events this trigger watches. May be cross-module via dot notation (e.g. 'fin.invoice')."
32
+ },
33
+ "event": {
34
+ "type": "string",
35
+ "enum": ["insert", "update", "delete", "status_change", "any"],
36
+ "description": "DB event that fires this trigger. 'status_change' only fires when the entity's status field actually changes value. 'any' fires for all insert/update/delete."
37
+ },
38
+ "condition": {
39
+ "type": "string",
40
+ "description": "Optional formula expression — same shape as canExecute in action DSL. Uses `[field]` syntax to reference the affected record. Single-line, evaluates to boolean. If omitted, trigger fires for every matching event."
41
+ },
42
+ "action": {
43
+ "type": "string",
44
+ "description": "Action code to invoke. The action must NOT use record-context (`[field]`) syntax in a way that requires the original triggering record — the trigger passes the record id via params. Cross-module form 'module.action' is supported."
45
+ },
46
+ "params": {
47
+ "type": "object",
48
+ "description": "Optional static parameters passed to the action at invocation time. Merged with the runtime-injected `record_id` / `record_old` (if event uses old-record diff)."
49
+ },
50
+ "async": {
51
+ "type": "boolean",
52
+ "default": false,
53
+ "description": "When true, the action runs in the background — the triggering transaction commits before the action starts. Recommended for slow actions (emails, external API calls). When false, the action runs in the same transaction; failures roll back the original DB change."
54
+ }
55
+ },
56
+ "additionalProperties": false
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "dForge Module Webhooks",
4
+ "description": "Webhook subscription definitions for a dForge module package (webhooks.json)",
5
+ "type": "object",
6
+ "required": ["subscriptions"],
7
+ "properties": {
8
+ "subscriptions": {
9
+ "type": "array",
10
+ "items": {
11
+ "type": "object",
12
+ "required": ["code", "description", "entity", "event"],
13
+ "properties": {
14
+ "code": {
15
+ "type": "string",
16
+ "maxLength": 100,
17
+ "pattern": "^[a-z][a-z0-9_]*$",
18
+ "description": "Unique identifier within the module"
19
+ },
20
+ "description": {
21
+ "type": "string",
22
+ "description": "Human-readable description"
23
+ },
24
+ "entity": {
25
+ "type": "string",
26
+ "description": "Entity code that triggers this webhook"
27
+ },
28
+ "event": {
29
+ "type": "string",
30
+ "enum": ["insert", "update", "delete", "status_change", "any"],
31
+ "description": "Event type that fires this webhook"
32
+ },
33
+ "condition": {
34
+ "type": "string",
35
+ "description": "Formula evaluated against the record. Webhook fires only if true."
36
+ },
37
+ "endpointUrl": {
38
+ "type": "string",
39
+ "format": "uri",
40
+ "description": "Default endpoint URL. Integration modules ship with this pre-configured; admin can override."
41
+ },
42
+ "secretCd": {
43
+ "type": "string",
44
+ "description": "Secret code for API key (from dforge.secret table, admin-configured)"
45
+ },
46
+ "payload": {
47
+ "type": "object",
48
+ "properties": {
49
+ "include": {
50
+ "type": "array",
51
+ "items": { "type": "string" },
52
+ "description": "Field codes to include. If omitted, include all visible fields."
53
+ },
54
+ "includeOld": {
55
+ "type": "boolean",
56
+ "default": false,
57
+ "description": "Include previous field values on update/status_change events"
58
+ }
59
+ },
60
+ "additionalProperties": false
61
+ },
62
+ "enabled": {
63
+ "type": "boolean",
64
+ "default": true,
65
+ "description": "Can be set to false to disable without removing"
66
+ }
67
+ },
68
+ "additionalProperties": false
69
+ }
70
+ }
71
+ },
72
+ "additionalProperties": false
73
+ }