@cxtms/cx-schema 1.0.0
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/README.md +384 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1523 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +111 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/schemaLoader.d.ts +17 -0
- package/dist/utils/schemaLoader.d.ts.map +1 -0
- package/dist/utils/schemaLoader.js +134 -0
- package/dist/utils/schemaLoader.js.map +1 -0
- package/dist/validator.d.ts +64 -0
- package/dist/validator.d.ts.map +1 -0
- package/dist/validator.js +380 -0
- package/dist/validator.js.map +1 -0
- package/dist/workflowValidator.d.ts +64 -0
- package/dist/workflowValidator.d.ts.map +1 -0
- package/dist/workflowValidator.js +410 -0
- package/dist/workflowValidator.js.map +1 -0
- package/package.json +50 -0
- package/schemas/actions/all.json +26 -0
- package/schemas/actions/confirm.json +21 -0
- package/schemas/actions/consoleLog.json +16 -0
- package/schemas/actions/dialog.json +25 -0
- package/schemas/actions/fileDownload.json +16 -0
- package/schemas/actions/forEach.json +31 -0
- package/schemas/actions/if.json +12 -0
- package/schemas/actions/mutation.json +25 -0
- package/schemas/actions/navigate.json +18 -0
- package/schemas/actions/navigateBack.json +22 -0
- package/schemas/actions/navigateBackOrClose.json +21 -0
- package/schemas/actions/notification.json +19 -0
- package/schemas/actions/openBarcodeScanner.json +104 -0
- package/schemas/actions/query.json +32 -0
- package/schemas/actions/refresh.json +13 -0
- package/schemas/actions/resetDirtyState.json +22 -0
- package/schemas/actions/setFields.json +21 -0
- package/schemas/actions/setStore.json +13 -0
- package/schemas/actions/validateForm.json +15 -0
- package/schemas/actions/workflow.json +24 -0
- package/schemas/components/README.md +147 -0
- package/schemas/components/appComponent.json +50 -0
- package/schemas/components/barcodeScanner.json +69 -0
- package/schemas/components/button.json +123 -0
- package/schemas/components/calendar.json +489 -0
- package/schemas/components/card.json +176 -0
- package/schemas/components/collection.json +54 -0
- package/schemas/components/dataGrid.json +119 -0
- package/schemas/components/datasource.json +151 -0
- package/schemas/components/dropdown.json +57 -0
- package/schemas/components/field-collection.json +618 -0
- package/schemas/components/field.json +265 -0
- package/schemas/components/form.json +234 -0
- package/schemas/components/index.json +68 -0
- package/schemas/components/layout.json +69 -0
- package/schemas/components/module.json +138 -0
- package/schemas/components/navDropdown.json +36 -0
- package/schemas/components/navbar.json +78 -0
- package/schemas/components/navbarItem.json +28 -0
- package/schemas/components/navbarLink.json +36 -0
- package/schemas/components/row.json +31 -0
- package/schemas/components/tab.json +34 -0
- package/schemas/components/tabs.json +35 -0
- package/schemas/components/timeline.json +172 -0
- package/schemas/components/timelineGrid.json +324 -0
- package/schemas/fields/README.md +66 -0
- package/schemas/fields/attachment.json +156 -0
- package/schemas/fields/autocomplete-googleplaces.json +130 -0
- package/schemas/fields/checkbox.json +82 -0
- package/schemas/fields/date.json +88 -0
- package/schemas/fields/datetime.json +75 -0
- package/schemas/fields/email.json +75 -0
- package/schemas/fields/index.json +53 -0
- package/schemas/fields/number.json +91 -0
- package/schemas/fields/password.json +70 -0
- package/schemas/fields/radio.json +94 -0
- package/schemas/fields/rangedatetime.json +56 -0
- package/schemas/fields/select-async.json +334 -0
- package/schemas/fields/select.json +115 -0
- package/schemas/fields/tel.json +79 -0
- package/schemas/fields/text.json +86 -0
- package/schemas/fields/textarea.json +95 -0
- package/schemas/fields/time.json +91 -0
- package/schemas/fields/url.json +74 -0
- package/schemas/schema.graphql +10492 -0
- package/schemas/schemas.json +598 -0
- package/schemas/workflows/activity.json +111 -0
- package/schemas/workflows/common/condition.json +48 -0
- package/schemas/workflows/common/expression.json +76 -0
- package/schemas/workflows/common/mapping.json +134 -0
- package/schemas/workflows/input.json +76 -0
- package/schemas/workflows/output.json +41 -0
- package/schemas/workflows/schedule.json +26 -0
- package/schemas/workflows/tasks/accounting-transaction.json +95 -0
- package/schemas/workflows/tasks/all.json +34 -0
- package/schemas/workflows/tasks/attachment.json +94 -0
- package/schemas/workflows/tasks/charge.json +90 -0
- package/schemas/workflows/tasks/commodity.json +89 -0
- package/schemas/workflows/tasks/contact.json +82 -0
- package/schemas/workflows/tasks/csv.json +79 -0
- package/schemas/workflows/tasks/document-render.json +105 -0
- package/schemas/workflows/tasks/document-send.json +84 -0
- package/schemas/workflows/tasks/email-send.json +110 -0
- package/schemas/workflows/tasks/error.json +72 -0
- package/schemas/workflows/tasks/export.json +90 -0
- package/schemas/workflows/tasks/foreach.json +69 -0
- package/schemas/workflows/tasks/generic.json +47 -0
- package/schemas/workflows/tasks/graphql.json +78 -0
- package/schemas/workflows/tasks/httpRequest.json +119 -0
- package/schemas/workflows/tasks/job.json +88 -0
- package/schemas/workflows/tasks/log.json +73 -0
- package/schemas/workflows/tasks/map.json +58 -0
- package/schemas/workflows/tasks/order.json +87 -0
- package/schemas/workflows/tasks/payment.json +85 -0
- package/schemas/workflows/tasks/setVariable.json +76 -0
- package/schemas/workflows/tasks/switch.json +75 -0
- package/schemas/workflows/tasks/template.json +73 -0
- package/schemas/workflows/tasks/validation.json +90 -0
- package/schemas/workflows/tasks/while.json +53 -0
- package/schemas/workflows/tasks/workflow-execute.json +82 -0
- package/schemas/workflows/trigger.json +86 -0
- package/schemas/workflows/variable.json +46 -0
- package/schemas/workflows/workflow.json +172 -0
- package/scripts/postinstall.js +161 -0
- package/scripts/setup-vscode.js +80 -0
- package/templates/module.yaml +83 -0
- package/templates/workflow.yaml +100 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "navigate Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"navigate": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "Navigation path",
|
|
9
|
+
"x-examples": [
|
|
10
|
+
"~/team-calendars/view/{{ calendarId }}",
|
|
11
|
+
"warehouseReceipts/{{ orderId }}",
|
|
12
|
+
"receiving/{{ encodedTrackingNumber }}",
|
|
13
|
+
"vessels/{{ vesselId }}"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"additionalProperties": false
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "navigateBack Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"navigateBack": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"fallback": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Fallback path if no previous page",
|
|
12
|
+
"x-examples": ["~/delivery-schedules"]
|
|
13
|
+
},
|
|
14
|
+
"result": {
|
|
15
|
+
"description": "Result to return when navigating back"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"x-examples": [{ "fallback": "~/delivery-schedules" }]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"additionalProperties": false
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "navigateBackOrClose Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"navigateBackOrClose": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"fallback": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Fallback path if no previous page; used when navigation history is empty"
|
|
12
|
+
},
|
|
13
|
+
"result": {
|
|
14
|
+
"description": "Result payload to supply when navigating back or closing"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"x-examples": [{ "fallback": "~/delivery-schedules" }, { "fallback": "users" }, { "result": { "saved": true } }]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"additionalProperties": false
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "notification Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"notification": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"message": { "oneOf": [{ "type": "string" }, { "$ref": "../schemas.json#/definitions/localized" }] },
|
|
10
|
+
"type": { "type": "string", "enum": ["success", "error", "warning", "info"] }
|
|
11
|
+
},
|
|
12
|
+
"x-examples": [
|
|
13
|
+
{ "message": { "en-US": "Selected Route Legs were added to the Route successfully" }, "type": "success" },
|
|
14
|
+
{ "message": "Scanner closed" }
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"additionalProperties": false
|
|
19
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "openBarcodeScanner Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"openBarcodeScanner": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"title": {
|
|
10
|
+
"oneOf": [{ "type": "string" }, { "$ref": "../schemas.json#/definitions/localized" }],
|
|
11
|
+
"description": "Optional title text for the scanner UI"
|
|
12
|
+
},
|
|
13
|
+
"minBarcodeLength": {
|
|
14
|
+
"type": "integer",
|
|
15
|
+
"description": "Minimum length for recognized barcodes",
|
|
16
|
+
"default": 1
|
|
17
|
+
},
|
|
18
|
+
"allowMultiple": {
|
|
19
|
+
"type": "boolean",
|
|
20
|
+
"description": "Allow scanning multiple barcodes before closing",
|
|
21
|
+
"default": false
|
|
22
|
+
},
|
|
23
|
+
"maxBarcodes": {
|
|
24
|
+
"type": "integer",
|
|
25
|
+
"minimum": 1,
|
|
26
|
+
"description": "Maximum number of barcodes to collect in multi-scan mode"
|
|
27
|
+
},
|
|
28
|
+
"onScan": {
|
|
29
|
+
"$ref": "../schemas.json#/definitions/actionsList",
|
|
30
|
+
"description": "Actions to execute after each successful scan"
|
|
31
|
+
},
|
|
32
|
+
"onComplete": {
|
|
33
|
+
"$ref": "../schemas.json#/definitions/actionsList",
|
|
34
|
+
"description": "Actions to execute when the scanner UI finishes multi-scan and closes"
|
|
35
|
+
},
|
|
36
|
+
"onClose": {
|
|
37
|
+
"$ref": "../schemas.json#/definitions/actionsList",
|
|
38
|
+
"description": "Actions to execute when the scanner UI is closed without completing"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"allOf": [
|
|
42
|
+
{
|
|
43
|
+
"if": { "properties": { "allowMultiple": { "const": false } }, "required": ["allowMultiple"] },
|
|
44
|
+
"then": { "not": { "required": ["maxBarcodes"] } }
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"x-examples": [
|
|
48
|
+
{
|
|
49
|
+
"title": "Scan Item",
|
|
50
|
+
"minBarcodeLength": 8,
|
|
51
|
+
"onScan": [
|
|
52
|
+
{ "setStore": { "scannedBarcode": "{{ result.data }}" } },
|
|
53
|
+
{ "notification": { "message": "Scanned: {{ result.data }}" } }
|
|
54
|
+
],
|
|
55
|
+
"onClose": [{ "notification": { "message": "Scanner closed" } }]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"title": "Scan multiple items",
|
|
59
|
+
"allowMultiple": true,
|
|
60
|
+
"minBarcodeLength": 8,
|
|
61
|
+
"onScan": [{ "notification": { "message": "Captured: {{ result.data }}" } }],
|
|
62
|
+
"onComplete": [
|
|
63
|
+
{ "setStore": { "scannedBarcodes": "{{ result.barcodes }}" } },
|
|
64
|
+
{ "notification": { "message": "Collected {{ result.barcodes.length }} barcodes" } }
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"title": "Scan up to 5 items",
|
|
69
|
+
"allowMultiple": true,
|
|
70
|
+
"maxBarcodes": 5,
|
|
71
|
+
"minBarcodeLength": 8,
|
|
72
|
+
"onScan": [{ "notification": { "message": "Added: {{ result.data }}" } }],
|
|
73
|
+
"onComplete": [
|
|
74
|
+
{ "setStore": { "scannedBarcodes": "{{ result.barcodes }}" } },
|
|
75
|
+
{ "notification": { "message": "Scanning completed ({{ result.barcodes.length }} items)" } }
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"title": "Scan or log",
|
|
80
|
+
"minBarcodeLength": 10,
|
|
81
|
+
"allowMultiple": true,
|
|
82
|
+
"maxBarcodes": 3,
|
|
83
|
+
"onScan": [
|
|
84
|
+
{
|
|
85
|
+
"if": "{{ eval result.format === 'QR_CODE' }}",
|
|
86
|
+
"then": [{ "navigate": "~/qr-details" }],
|
|
87
|
+
"else": [
|
|
88
|
+
{
|
|
89
|
+
"mutation": {
|
|
90
|
+
"command": "logBarcodeScan",
|
|
91
|
+
"variables": { "barcodeData": "{{ result.data }}", "format": "{{ result.format }}" }
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{ "notification": { "message": "Barcode logged" } }
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"onComplete": [{ "notification": { "message": "Finished scanning" } }]
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"additionalProperties": false
|
|
104
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "query Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"query": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"command": { "type": "string", "description": "GraphQL query string" },
|
|
10
|
+
"variables": { "type": "object", "description": "Query variables" },
|
|
11
|
+
"onSuccess": { "$ref": "../schemas.json#/definitions/actionsList" },
|
|
12
|
+
"onError": { "$ref": "../schemas.json#/definitions/actionsList" }
|
|
13
|
+
},
|
|
14
|
+
"x-example": {
|
|
15
|
+
"command": "query ($organizationId: Int!, $filter: String!) { attachments(organizationId: $organizationId, filter: $filter) { items { attachmentId } } }",
|
|
16
|
+
"variables": {
|
|
17
|
+
"organizationId": "{{ number organizationId }}",
|
|
18
|
+
"filter": "parentId:{{ orderId }}"
|
|
19
|
+
},
|
|
20
|
+
"onSuccess": [
|
|
21
|
+
{
|
|
22
|
+
"setFields": {
|
|
23
|
+
"attachmentIds": "{{ eval attachments.items.map(x => x.attachmentId) }}"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"onError": [{ "notification": { "message": "Failed to load attachments", "type": "error" } }]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"additionalProperties": false
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "refresh Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"refresh": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "Component or data source to refresh",
|
|
9
|
+
"x-examples": ["calendars", "calendarAvailability", "chargesGrid", "users", "routeLegsGrid"]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"additionalProperties": false
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "resetDirtyState Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"resetDirtyState": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"description": "Resets the dirty state of a form to false, indicating the form no longer has unsaved changes",
|
|
9
|
+
"properties": {
|
|
10
|
+
"formName": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "The name of the form to reset (optional, defaults to the current form context)"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"x-examples": [
|
|
16
|
+
{ "formName": "myForm" },
|
|
17
|
+
{}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"additionalProperties": false
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "setFields Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"setFields": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"description": "Fields to set in form or store",
|
|
9
|
+
"x-examples": [
|
|
10
|
+
{
|
|
11
|
+
"orderSummary.totalWeight": "{{ format order.orderSummary.totalWeight 0.00}}",
|
|
12
|
+
"orderSummary.weightUnit": "{{ order.orderSummary.weightUnit }}",
|
|
13
|
+
"orderSummary.totalVolume": "{{ format order.orderSummary.totalVolume 0.00}}",
|
|
14
|
+
"orderSummary.volumeUnit": "{{ order.orderSummary.volumeUnit }}",
|
|
15
|
+
"orderSummary.totalQuantity": "{{ order.orderSummary.totalQuantity }}"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"additionalProperties": false
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "setStore Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"setStore": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"description": "Store values to set",
|
|
9
|
+
"x-examples": [{ "scannedBarcode": "{{ result.data }}" }, { "scannedBarcodes": "{{ result.barcodes }}" }]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"additionalProperties": false
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "validateForm Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"validateForm": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"validationSchema": { "type": "object", "description": "Form validation schema" }
|
|
10
|
+
},
|
|
11
|
+
"x-examples": [{ "validationSchema": { "fieldName": { "type": "string", "required": true } } }]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"additionalProperties": false
|
|
15
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "workflow Action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"workflow": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"workflowId": { "type": "string", "description": "Workflow identifier" },
|
|
10
|
+
"inputs": { "type": "object", "description": "Workflow inputs" },
|
|
11
|
+
"onSuccess": { "$ref": "../schemas.json#/definitions/actionsList" },
|
|
12
|
+
"onError": { "$ref": "../schemas.json#/definitions/actionsList" }
|
|
13
|
+
},
|
|
14
|
+
"x-examples": [
|
|
15
|
+
{
|
|
16
|
+
"workflowId": "b7c4ffa9-bf7e-4e2c-8e57-8f24f4a2b8a8",
|
|
17
|
+
"inputs": { "request": { "message": "Hello, World!" } },
|
|
18
|
+
"onSuccess": [{ "notification": { "message": "Echo executed successfully. {{ response.echo.message }}" } }]
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"additionalProperties": false
|
|
24
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Component Schemas
|
|
2
|
+
|
|
3
|
+
This directory contains individual JSON schema files for each CargoXplorer component type. Breaking down component schemas into separate files improves maintainability, organization, and reusability.
|
|
4
|
+
|
|
5
|
+
## Directory Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
schema/
|
|
9
|
+
├── components/
|
|
10
|
+
│ ├── appComponent.json # Base app component schema
|
|
11
|
+
│ ├── navbar.json # Navigation bar component
|
|
12
|
+
│ ├── navbarItem.json # Navigation item component
|
|
13
|
+
│ ├── navDropdown.json # Navigation dropdown component
|
|
14
|
+
│ ├── navbarLink.json # Navigation link component
|
|
15
|
+
│ ├── collection.json # Collection/iteration component
|
|
16
|
+
│ ├── row.json # Row layout component
|
|
17
|
+
│ ├── dataGrid.json # Data grid component
|
|
18
|
+
│ ├── button.json # Button component
|
|
19
|
+
│ ├── form.json # Form component
|
|
20
|
+
│ ├── layout.json # Layout container component
|
|
21
|
+
│ ├── tabs.json # Tabs container component
|
|
22
|
+
│ ├── tab.json # Individual tab component
|
|
23
|
+
│ ├── field.json # Form field component
|
|
24
|
+
│ ├── dropdown.json # Dropdown menu component
|
|
25
|
+
│ ├── datasource.json # Data source component
|
|
26
|
+
│ ├── calendar.json # Calendar component
|
|
27
|
+
│ ├── module.json # Module component
|
|
28
|
+
│ ├── index.json # Component schema index
|
|
29
|
+
│ └── README.md # This documentation file
|
|
30
|
+
├── fields/ # Field type schemas
|
|
31
|
+
│ ├── text.json
|
|
32
|
+
│ ├── select-async.json
|
|
33
|
+
│ └── ...
|
|
34
|
+
└── schemas.json # Main schema file with references
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Benefits of Separate Component Schemas
|
|
38
|
+
|
|
39
|
+
### 1. **Maintainability**
|
|
40
|
+
|
|
41
|
+
- Each component schema is in its own file
|
|
42
|
+
- Easier to find and update specific component definitions
|
|
43
|
+
- Reduces the size of the main schemas.json file
|
|
44
|
+
|
|
45
|
+
### 2. **Reusability**
|
|
46
|
+
|
|
47
|
+
- Component schemas can be referenced from multiple locations
|
|
48
|
+
- Enables better modular schema design
|
|
49
|
+
- Facilitates schema composition and inheritance
|
|
50
|
+
|
|
51
|
+
### 3. **Organization**
|
|
52
|
+
|
|
53
|
+
- Clear separation between different component types
|
|
54
|
+
- Logical file structure mirrors component hierarchy
|
|
55
|
+
- Better developer experience when working with schemas
|
|
56
|
+
|
|
57
|
+
### 4. **Collaboration**
|
|
58
|
+
|
|
59
|
+
- Multiple developers can work on different component schemas simultaneously
|
|
60
|
+
- Reduces merge conflicts in the main schema file
|
|
61
|
+
- Easier code reviews for component-specific changes
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
The main `schemas.json` file now references these separate component files:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"components": {
|
|
70
|
+
"schemas": {
|
|
71
|
+
"button": {
|
|
72
|
+
"$ref": "components/button.json"
|
|
73
|
+
},
|
|
74
|
+
"dataGrid": {
|
|
75
|
+
"$ref": "components/dataGrid.json"
|
|
76
|
+
},
|
|
77
|
+
"form": {
|
|
78
|
+
"$ref": "components/form.json"
|
|
79
|
+
}
|
|
80
|
+
// ... other components
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Schema References
|
|
87
|
+
|
|
88
|
+
Each component schema file uses relative references to the main schemas.json file for shared definitions:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"properties": {
|
|
93
|
+
"onClick": {
|
|
94
|
+
"$ref": "../schemas.json#/definitions/actionsList"
|
|
95
|
+
},
|
|
96
|
+
"isHidden": {
|
|
97
|
+
"$ref": "../schemas.json#/definitions/templateExpression"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Adding New Components
|
|
104
|
+
|
|
105
|
+
To add a new component schema:
|
|
106
|
+
|
|
107
|
+
1. Create a new JSON file in this directory (e.g., `myComponent.json`)
|
|
108
|
+
2. Define the component schema following the existing patterns
|
|
109
|
+
3. Add a reference to the component in the main `schemas.json` file
|
|
110
|
+
4. Update the `index.json` file if needed
|
|
111
|
+
5. Update this README.md file
|
|
112
|
+
|
|
113
|
+
## Component Schema Structure
|
|
114
|
+
|
|
115
|
+
Each component schema should follow this general structure:
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
120
|
+
"title": "Component Name",
|
|
121
|
+
"type": "object",
|
|
122
|
+
"properties": {
|
|
123
|
+
"component": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"const": "componentName"
|
|
126
|
+
},
|
|
127
|
+
"name": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"description": "Component name identifier"
|
|
130
|
+
},
|
|
131
|
+
"props": {
|
|
132
|
+
"type": "object",
|
|
133
|
+
"properties": {
|
|
134
|
+
// Component-specific properties
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"children": {
|
|
138
|
+
"$ref": "../schemas.json#/definitions/componentChildren"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"required": ["component"]
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Validation
|
|
146
|
+
|
|
147
|
+
All component schemas are validated against JSON Schema Draft 07 specification. Ensure your schemas are valid JSON and follow the established patterns for consistency.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Generic CargoXplorer App Component",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "Base schema for any CargoXplorer component that can be used within the application",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Component name in format 'ModuleName/ComponentName'",
|
|
10
|
+
"pattern": "^[A-Za-z0-9]+/[A-Za-z0-9]+$"
|
|
11
|
+
},
|
|
12
|
+
"permissions": {
|
|
13
|
+
"$ref": "../schemas.json#/definitions/permissions"
|
|
14
|
+
},
|
|
15
|
+
"priority": {
|
|
16
|
+
"type": "integer",
|
|
17
|
+
"default": 0,
|
|
18
|
+
"description": "Component priority (higher number = higher priority)"
|
|
19
|
+
},
|
|
20
|
+
"displayName": {
|
|
21
|
+
"$ref": "../schemas.json#/definitions/localized"
|
|
22
|
+
},
|
|
23
|
+
"props": {
|
|
24
|
+
"oneOf": [
|
|
25
|
+
{
|
|
26
|
+
"type": "object",
|
|
27
|
+
"description": "Properties passed to the component when targeting a slot",
|
|
28
|
+
"properties": {
|
|
29
|
+
"targetSlot": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Name of the slot this component targets"
|
|
32
|
+
},
|
|
33
|
+
"order": {
|
|
34
|
+
"type": "integer",
|
|
35
|
+
"description": "Order of the component in the target slot"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"additionalProperties": true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"type": "null"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"layout": {
|
|
46
|
+
"$ref": "../schemas.json#/definitions/component"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": ["name", "layout"]
|
|
50
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Barcode Scanner Component",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"component": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"const": "barcodeScanner"
|
|
9
|
+
},
|
|
10
|
+
"name": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Component name identifier"
|
|
13
|
+
},
|
|
14
|
+
"props": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {
|
|
17
|
+
"minBarcodeLength": {
|
|
18
|
+
"type": "integer",
|
|
19
|
+
"description": "Minimum length for recognized barcodes"
|
|
20
|
+
},
|
|
21
|
+
"onScan": {
|
|
22
|
+
"$ref": "../schemas.json#/definitions/actionsList",
|
|
23
|
+
"description": "Actions to execute when a barcode is successfully scanned"
|
|
24
|
+
},
|
|
25
|
+
"isHidden": {
|
|
26
|
+
"$ref": "../schemas.json#/definitions/templateExpression",
|
|
27
|
+
"description": "Boolean expression for conditional rendering"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": ["component"],
|
|
33
|
+
"x-examples": [
|
|
34
|
+
{
|
|
35
|
+
"component": "barcodeScanner",
|
|
36
|
+
"props": {
|
|
37
|
+
"minBarcodeLength": 8,
|
|
38
|
+
"onScan": [
|
|
39
|
+
{ "setStore": { "scannedBarcode": "{{ result.data }}" } },
|
|
40
|
+
{ "notification": { "message": "Barcode scanned: {{ result.data }}" } }
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"component": "barcodeScanner",
|
|
46
|
+
"props": {
|
|
47
|
+
"minBarcodeLength": 10,
|
|
48
|
+
"onScan": [
|
|
49
|
+
{
|
|
50
|
+
"if": "{{ eval result.format === 'QR_CODE' }}",
|
|
51
|
+
"then": [{ "setStore": { "qrCodeData": "{{ result.data }}" } }, { "navigate": "/qr-details" }],
|
|
52
|
+
"else": [
|
|
53
|
+
{
|
|
54
|
+
"mutation": {
|
|
55
|
+
"command": "logBarcodeScan",
|
|
56
|
+
"variables": {
|
|
57
|
+
"barcodeData": "{{ result.data }}",
|
|
58
|
+
"format": "{{ result.format }}"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{ "notification": { "message": "Barcode logged: {{ result.data }}" } }
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|