@digo-org/digo-api 1.0.33 → 1.0.35
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/package.json +1 -1
- package/src/examples/artifact-example-data-1.json +80 -0
- package/src/examples/artifact-example-link-1.json +6 -0
- package/src/examples/artifact-example-multiple-1.json +90 -0
- package/src/examples/artifact-example-vizFiles-1.json +8 -0
- package/src/examples/data-examples.ts +74 -0
- package/src/index.ts +4 -0
- package/src/types-llm.ts +24 -0
- package/src/types-misc.ts +33 -1
package/package.json
CHANGED
@@ -0,0 +1,80 @@
|
|
1
|
+
{
|
2
|
+
"DATA_ASSET_DEFINITION": {
|
3
|
+
"timeArray": [],
|
4
|
+
"columns": [
|
5
|
+
{
|
6
|
+
"id": "gdp_2024",
|
7
|
+
"name": "GDP 2024 (Trillions USD)",
|
8
|
+
"type": "NUMBER",
|
9
|
+
"definition": {
|
10
|
+
"defaultValue": 0,
|
11
|
+
"min": 0,
|
12
|
+
"units": "Trillions USD",
|
13
|
+
"decimals": 2
|
14
|
+
}
|
15
|
+
}
|
16
|
+
],
|
17
|
+
"rows": [
|
18
|
+
{
|
19
|
+
"id": "usa",
|
20
|
+
"name": "United States",
|
21
|
+
"hidden": false,
|
22
|
+
"gdp_2024": 30.34
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"id": "china",
|
26
|
+
"name": "China",
|
27
|
+
"hidden": false,
|
28
|
+
"gdp_2024": 19.53
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"id": "germany",
|
32
|
+
"name": "Germany",
|
33
|
+
"hidden": false,
|
34
|
+
"gdp_2024": 4.92
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"id": "japan",
|
38
|
+
"name": "Japan",
|
39
|
+
"hidden": false,
|
40
|
+
"gdp_2024": 4.39
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"id": "india",
|
44
|
+
"name": "India",
|
45
|
+
"hidden": false,
|
46
|
+
"gdp_2024": 4.27
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"id": "united_kingdom",
|
50
|
+
"name": "United Kingdom",
|
51
|
+
"hidden": false,
|
52
|
+
"gdp_2024": 3.73
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"id": "france",
|
56
|
+
"name": "France",
|
57
|
+
"hidden": false,
|
58
|
+
"gdp_2024": 3.28
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"id": "italy",
|
62
|
+
"name": "Italy",
|
63
|
+
"hidden": false,
|
64
|
+
"gdp_2024": 2.46
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"id": "brazil",
|
68
|
+
"name": "Brazil",
|
69
|
+
"hidden": false,
|
70
|
+
"gdp_2024": 2.31
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"id": "canada",
|
74
|
+
"name": "Canada",
|
75
|
+
"hidden": false,
|
76
|
+
"gdp_2024": 2.33
|
77
|
+
}
|
78
|
+
]
|
79
|
+
}
|
80
|
+
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
{
|
2
|
+
"DATA_ASSET_DEFINITION": {
|
3
|
+
"timeArray": [],
|
4
|
+
"columns": [
|
5
|
+
{
|
6
|
+
"id": "gdp_2024",
|
7
|
+
"name": "GDP 2024 (Trillions USD)",
|
8
|
+
"type": "NUMBER",
|
9
|
+
"definition": {
|
10
|
+
"defaultValue": 0,
|
11
|
+
"min": 0,
|
12
|
+
"units": "Trillions USD",
|
13
|
+
"decimals": 2
|
14
|
+
}
|
15
|
+
}
|
16
|
+
],
|
17
|
+
"rows": [
|
18
|
+
{
|
19
|
+
"id": "usa",
|
20
|
+
"name": "United States",
|
21
|
+
"hidden": false,
|
22
|
+
"gdp_2024": 30.34
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"id": "china",
|
26
|
+
"name": "China",
|
27
|
+
"hidden": false,
|
28
|
+
"gdp_2024": 19.53
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"id": "germany",
|
32
|
+
"name": "Germany",
|
33
|
+
"hidden": false,
|
34
|
+
"gdp_2024": 4.92
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"id": "japan",
|
38
|
+
"name": "Japan",
|
39
|
+
"hidden": false,
|
40
|
+
"gdp_2024": 4.39
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"id": "india",
|
44
|
+
"name": "India",
|
45
|
+
"hidden": false,
|
46
|
+
"gdp_2024": 4.27
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"id": "united_kingdom",
|
50
|
+
"name": "United Kingdom",
|
51
|
+
"hidden": false,
|
52
|
+
"gdp_2024": 3.73
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"id": "france",
|
56
|
+
"name": "France",
|
57
|
+
"hidden": false,
|
58
|
+
"gdp_2024": 3.28
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"id": "italy",
|
62
|
+
"name": "Italy",
|
63
|
+
"hidden": false,
|
64
|
+
"gdp_2024": 2.46
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"id": "brazil",
|
68
|
+
"name": "Brazil",
|
69
|
+
"hidden": false,
|
70
|
+
"gdp_2024": 2.31
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"id": "canada",
|
74
|
+
"name": "Canada",
|
75
|
+
"hidden": false,
|
76
|
+
"gdp_2024": 2.33
|
77
|
+
}
|
78
|
+
]
|
79
|
+
},
|
80
|
+
"LINKS": {
|
81
|
+
"bar-color": "color-1",
|
82
|
+
"bar-value": "number-1"
|
83
|
+
},
|
84
|
+
"VIZ_ASSET_FILES": {
|
85
|
+
"/asset.tsx": "import { DigoAsset } from '@digo-org/digo-api';\n\nimport { ResponsiveContainer, Cell, BarChart, CartesianGrid, XAxis, YAxis, Legend, Bar, Rectangle, Tooltip } from 'recharts';\n\nexport class Asset extends DigoAsset {\n constructor() {\n super();\n }\n\n override render() {\n return (\n <ResponsiveContainer width=\"100%\" height=\"100%\" key=\"responsive-container\">\n <BarChart\n data={this.instances}\n layout=\"horizontal\"\n margin={{\n top: 120,\n right: 60,\n left: 40,\n bottom: 120,\n }}\n style={{ backgroundColor: this.globalParameters['bg-color'] as string }}\n\n >\n <CartesianGrid strokeDasharray=\"3 3\" />\n\n <XAxis dataKey=\"id\" />\n\n <YAxis />\n\n <Legend />\n\n <Tooltip />\n\n <Bar\n dataKey=\"bar-value\"\n fill=\"#ff\"\n animationEasing=\"ease-in-out\"\n animationDuration={200}\n activeBar={<Rectangle fill=\"pink\" stroke=\"blue\" />}\n >\n {this.instances?.map((instance, index) => {\n const color = instance['bar-color'];\n return <Cell key={`cell-${index}`} fill={color as string} />;\n })}\n </Bar>\n\n </BarChart>\n </ResponsiveContainer>\n );\n }\n}\n",
|
86
|
+
"/styles.css": "body {\n font-family: sans-serif;\n -webkit-font-smoothing: auto;\n -moz-font-smoothing: auto;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n font-smooth: always;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n}\n\n.root {\n height: 100vh;\n background-color: 'red';\n display: grid;\n}",
|
87
|
+
"/package.json": "{\n \"dependencies\": {\n \"react\": \"^19.0.0\",\n \"react-dom\": \"^19.0.0\",\n \"react-scripts\": \"^5.0.0\",\n \"@digo-org/digo-api\": \"1.0.28\",\n \"@react-three/drei\": \"^10.0.6\",\n \"@react-three/fiber\": \"^9.1.2\",\n \"recharts\": \"^2.15.1\"\n },\n \"main\": \"/index.tsx\",\n \"devDependencies\": {}\n}",
|
88
|
+
"/definition.json": "[\n {\n \"id\": \"bg-color\",\n \"group\": \"\",\n \"isGlobal\": true,\n \"properties\": {\n \"name\": \"Background Color\",\n \"type\": 2,\n \"definition\": {\n \"defaultValue\": \"#000\"\n }\n }\n },\n {\n \"id\": \"bar-value\",\n \"group\": \"\",\n \"isGlobal\": false,\n \"properties\": {\n \"name\": \"Value\",\n \"type\": 0,\n \"definition\": {\n \"defaultValue\": 50,\n \"min\": 0,\n \"max\": 100,\n \"icon\": \"icon-[material-symbols--percent-rounded]\",\n \"decimals\": 0,\n \"step\": 1,\n \"units\": \"\"\n }\n }\n },\n {\n \"id\": \"bar-color\",\n \"group\": \"\",\n \"isGlobal\": false,\n \"properties\": {\n \"name\": \"Bar Color\",\n \"type\": 2,\n \"definition\": {\n \"defaultValue\": \"#ffffff\"\n }\n }\n }\n]"
|
89
|
+
}
|
90
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
{
|
2
|
+
"VIZ_FILES": {
|
3
|
+
"/asset.tsx": "import { DigoAsset } from '@digo-org/digo-api';\n\nimport { ResponsiveContainer, Cell, BarChart, CartesianGrid, XAxis, YAxis, Legend, Bar, Rectangle, Tooltip } from 'recharts';\n\nexport class Asset extends DigoAsset {\n constructor() {\n super();\n }\n\n override render() {\n return (\n <ResponsiveContainer width=\"100%\" height=\"100%\" key=\"responsive-container\">\n <BarChart\n data={this.instances}\n layout=\"horizontal\"\n margin={{\n top: 120,\n right: 60,\n left: 40,\n bottom: 120,\n }}\n style={{ backgroundColor: this.globalParameters['bg-color'] as string }}\n\n >\n <CartesianGrid strokeDasharray=\"3 3\" />\n\n <XAxis dataKey=\"id\" />\n\n <YAxis />\n\n <Legend />\n\n <Tooltip />\n\n <Bar\n dataKey=\"bar-value\"\n fill=\"#ff\"\n animationEasing=\"ease-in-out\"\n animationDuration={200}\n activeBar={<Rectangle fill=\"pink\" stroke=\"blue\" />}\n >\n {this.instances?.map((instance, index) => {\n const color = instance['bar-color'];\n return <Cell key={`cell-${index}`} fill={color as string} />;\n })}\n </Bar>\n\n </BarChart>\n </ResponsiveContainer>\n );\n }\n}\n",
|
4
|
+
"/styles.css": "body {\n font-family: sans-serif;\n -webkit-font-smoothing: auto;\n -moz-font-smoothing: auto;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n font-smooth: always;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n}\n\n.root {\n height: 100vh;\n background-color: 'red';\n display: grid;\n}",
|
5
|
+
"/package.json": "{\n \"dependencies\": {\n \"react\": \"^19.0.0\",\n \"react-dom\": \"^19.0.0\",\n \"react-scripts\": \"^5.0.0\",\n \"@digo-org/digo-api\": \"1.0.28\",\n \"@react-three/drei\": \"^10.0.6\",\n \"@react-three/fiber\": \"^9.1.2\",\n \"recharts\": \"^2.15.1\"\n },\n \"main\": \"/index.tsx\",\n \"devDependencies\": {}\n}",
|
6
|
+
"/definition.json": "[\n {\n \"id\": \"bg-color\",\n \"group\": \"\",\n \"isGlobal\": true,\n \"properties\": {\n \"name\": \"Background Color\",\n \"type\": 2,\n \"definition\": {\n \"defaultValue\": \"#000\"\n }\n }\n },\n {\n \"id\": \"bar-value\",\n \"group\": \"\",\n \"isGlobal\": false,\n \"properties\": {\n \"name\": \"Value\",\n \"type\": 0,\n \"definition\": {\n \"defaultValue\": 50,\n \"min\": 0,\n \"max\": 100,\n \"icon\": \"icon-[material-symbols--percent-rounded]\",\n \"decimals\": 0,\n \"step\": 1,\n \"units\": \"\"\n }\n }\n },\n {\n \"id\": \"bar-color\",\n \"group\": \"\",\n \"isGlobal\": false,\n \"properties\": {\n \"name\": \"Bar Color\",\n \"type\": 2,\n \"definition\": {\n \"defaultValue\": \"#ffffff\"\n }\n }\n }\n]"
|
7
|
+
}
|
8
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import { DataAssetDefinition, ParameterType } from '@digo-org/digo-api';
|
2
|
+
|
3
|
+
export const DATA_ASSET_DEFINITION_EXAMPLES: DataAssetDefinition[] = [
|
4
|
+
{
|
5
|
+
rows: [
|
6
|
+
{
|
7
|
+
'id': 'row-1',
|
8
|
+
'name': 'Iphone',
|
9
|
+
'hidden': false,
|
10
|
+
'color-1': '#41c968',
|
11
|
+
'number-1': 10,
|
12
|
+
'number-2': 2000,
|
13
|
+
},
|
14
|
+
{
|
15
|
+
'id': 'row-2',
|
16
|
+
'name': 'Mac',
|
17
|
+
'hidden': false,
|
18
|
+
'color-1': '#536fa6',
|
19
|
+
'number-1': 20,
|
20
|
+
'number-2': 2010,
|
21
|
+
},
|
22
|
+
{
|
23
|
+
'id': 'row-3',
|
24
|
+
'name': 'Watch',
|
25
|
+
'hidden': false,
|
26
|
+
'color-1': '#a6ba62',
|
27
|
+
'number-1': 40,
|
28
|
+
'number-2': 2020,
|
29
|
+
},
|
30
|
+
{
|
31
|
+
'id': 'row-4',
|
32
|
+
'name': 'Vision Pro',
|
33
|
+
'hidden': false,
|
34
|
+
'color-1': '#e75a5a',
|
35
|
+
'number-1': 30,
|
36
|
+
'number-2': 2025,
|
37
|
+
},
|
38
|
+
],
|
39
|
+
columns: [
|
40
|
+
{
|
41
|
+
id: 'number-1',
|
42
|
+
name: 'Market Share (%)',
|
43
|
+
type: ParameterType.NUMBER,
|
44
|
+
isArray: false,
|
45
|
+
definition: {
|
46
|
+
max: 100,
|
47
|
+
min: 0,
|
48
|
+
defaultValue: 0,
|
49
|
+
},
|
50
|
+
},
|
51
|
+
{
|
52
|
+
id: 'color-1',
|
53
|
+
name: 'Color',
|
54
|
+
type: ParameterType.COLOR,
|
55
|
+
isArray: false,
|
56
|
+
definition: {
|
57
|
+
defaultValue: '#FFFFFF',
|
58
|
+
},
|
59
|
+
},
|
60
|
+
{
|
61
|
+
id: 'number-2',
|
62
|
+
name: 'Year',
|
63
|
+
type: ParameterType.NUMBER,
|
64
|
+
isArray: false,
|
65
|
+
definition: {
|
66
|
+
max: 2025,
|
67
|
+
min: 2000,
|
68
|
+
defaultValue: 0,
|
69
|
+
},
|
70
|
+
},
|
71
|
+
],
|
72
|
+
timeArray: [],
|
73
|
+
},
|
74
|
+
];
|
package/src/index.ts
CHANGED
@@ -8,6 +8,10 @@ export * from '@digo-org/digo-api/src/types-data';
|
|
8
8
|
|
9
9
|
export * from '@digo-org/digo-api/src/types-misc';
|
10
10
|
|
11
|
+
export * from '@digo-org/digo-api/src/types-llm';
|
12
|
+
|
11
13
|
export * from '@digo-org/digo-api/src/types-viz-files';
|
12
14
|
|
13
15
|
export * from '@digo-org/digo-api/src/types-viz';
|
16
|
+
|
17
|
+
export * from '@digo-org/digo-api/src/examples/data-examples';
|
package/src/types-llm.ts
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
import { CommonMetadata, DataAssetDefinition, Links, VizAssetDefinition, VizAssetFiles } from '@digo-org/digo-api';
|
2
|
+
|
3
|
+
export interface Artifact extends CommonMetadata {
|
4
|
+
type: ArtifactType;
|
5
|
+
value: DataAssetDefinition | VizAssetFiles | VizAssetDefinition | Links;
|
6
|
+
}
|
7
|
+
|
8
|
+
export enum ArtifactType {
|
9
|
+
DATA_ASSET_DEFINITION = 'DATA_ASSET_DEFINITION',
|
10
|
+
VIZ_ASSET_FILES = 'VIZ_ASSET_FILES',
|
11
|
+
VIZ_ASSET_DEFINITION = 'VIZ_ASSET_DEFINITION',
|
12
|
+
LINKS = 'LINKS',
|
13
|
+
}
|
14
|
+
|
15
|
+
export interface MessagePart {
|
16
|
+
type: MessageType;
|
17
|
+
value: string | Artifact;
|
18
|
+
}
|
19
|
+
|
20
|
+
export enum MessageType {
|
21
|
+
TEXT = 'TEXT',
|
22
|
+
ARCTIFACT = 'ARCTIFACT',
|
23
|
+
RESOURCE = 'RESOURCE',
|
24
|
+
}
|
package/src/types-misc.ts
CHANGED
@@ -1,9 +1,19 @@
|
|
1
|
-
import { ParameterDefinition, ParameterValueArray } from '@digo-org/digo-api';
|
1
|
+
import { ArtifactType, DataAssetDefinition, MessagePart, ParameterDefinition, ParameterValueArray, VizAssetDefinition, VizAssetFiles } from '@digo-org/digo-api';
|
2
|
+
|
3
|
+
export type Links = Record<string, string>; /* parameter-id -> column-id */
|
2
4
|
|
3
5
|
export interface CommonMetadata {
|
4
6
|
name: string;
|
5
7
|
description?: string;
|
6
8
|
tags?: string[];
|
9
|
+
icon?: string;
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface ProjectDefinition {
|
13
|
+
dataAssetDefinition: DataAssetDefinition;
|
14
|
+
vizAssetDefinition: VizAssetDefinition;
|
15
|
+
vizAssetFiles: VizAssetFiles;
|
16
|
+
links: Links;
|
7
17
|
}
|
8
18
|
|
9
19
|
export interface ParameterTypeDefinition {
|
@@ -18,3 +28,25 @@ export interface ParameterArray {
|
|
18
28
|
definition: ParameterDefinition;
|
19
29
|
labels: string[];
|
20
30
|
};
|
31
|
+
|
32
|
+
export enum MessageRole {
|
33
|
+
USER = 'USER',
|
34
|
+
ASSISTANT = 'ASSISTANT',
|
35
|
+
}
|
36
|
+
|
37
|
+
export interface MessageDefinition {
|
38
|
+
role: MessageRole;
|
39
|
+
content: MessagePart[];
|
40
|
+
}
|
41
|
+
|
42
|
+
export interface ArtifactStep {
|
43
|
+
type: ArtifactType;
|
44
|
+
name: string;
|
45
|
+
code?: string;
|
46
|
+
action: ArctifactStepAction;
|
47
|
+
}
|
48
|
+
|
49
|
+
export enum ArctifactStepAction {
|
50
|
+
GENERATED = 'GENERATED',
|
51
|
+
EDITED = 'EDITED',
|
52
|
+
}
|