@digo-org/digo-api 1.0.35 → 1.0.36
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 +65 -84
- package/package.json +1 -1
- package/src/types-llm.ts +5 -5
- package/src/types-misc.ts +6 -1
package/README.md
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
# Digo API
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
## Overview
|
7
|
-
|
8
|
-
The Digo API package contains interfaces and utility functions that define and facilitate communication with Digo Assets. These components form the foundation for building applications that work with the Digo ecosystem.
|
3
|
+
TypeScript API for building interactive data visualizations with the DIGO ecosystem.
|
9
4
|
|
10
5
|
## Installation
|
11
6
|
|
@@ -13,94 +8,80 @@ The Digo API package contains interfaces and utility functions that define and f
|
|
13
8
|
npm install @digo-org/digo-api
|
14
9
|
```
|
15
10
|
|
16
|
-
##
|
11
|
+
## Quick Start
|
17
12
|
|
18
|
-
|
19
|
-
import { DigoApi } from '@digo-org/digo-api';
|
20
|
-
// or specific components
|
21
|
-
import { YourSpecificComponent } from '@digo-org/digo-api';
|
22
|
-
```
|
13
|
+
Create a visualization asset by extending the base class:
|
23
14
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
```bash
|
40
|
-
# Lint your code
|
41
|
-
npm run lint
|
42
|
-
|
43
|
-
# Fix linting issues automatically
|
44
|
-
npm run lint:fix
|
45
|
-
|
46
|
-
# Build the package
|
47
|
-
npm run build
|
48
|
-
```
|
49
|
-
|
50
|
-
4. **Commit Changes**:
|
51
|
-
- Commit all changes to your repository
|
52
|
-
- Use descriptive commit messages that explain your changes
|
53
|
-
|
54
|
-
5. **Publish**:
|
55
|
-
```bash
|
56
|
-
# The prepublish script will automatically run build
|
57
|
-
npm publish
|
58
|
-
```
|
59
|
-
|
60
|
-
## Understanding package.json
|
61
|
-
|
62
|
-
The package.json file contains important configurations:
|
63
|
-
|
64
|
-
```json
|
65
|
-
{
|
66
|
-
"name": "@digo-org/digo-api", // Package name with org scope
|
67
|
-
"private": false, // Allows publishing to npm
|
68
|
-
"version": "1.0.2", // Current package version
|
69
|
-
"type": "module", // Use ES modules
|
70
|
-
"main": "src/index.ts", // Main entry point
|
71
|
-
"types": "src/index.ts", // TypeScript types entry point
|
72
|
-
"publishConfig": { // Publishing configuration
|
73
|
-
"access": "public" // Makes the scoped package publicly available
|
74
|
-
},
|
75
|
-
"scripts": { // NPM scripts
|
76
|
-
"build": "tsc --build", // Compile TypeScript
|
77
|
-
"lint": "eslint ./src", // Check code quality
|
78
|
-
"lint:fix": "eslint ./src --fix", // Fix code quality issues
|
79
|
-
"prepublish": "rm -rf ./dist && npm run build" // Pre-publish hook
|
80
|
-
},
|
81
|
-
"devDependencies": { // Development dependencies
|
82
|
-
"@digo/dev-dependencies": "*" // Shared dev dependencies
|
15
|
+
```typescript
|
16
|
+
import { DigoAsset } from '@digo-org/digo-api';
|
17
|
+
import { ReactNode } from 'react';
|
18
|
+
|
19
|
+
export class MyVisualization extends DigoAsset {
|
20
|
+
render(): ReactNode {
|
21
|
+
return (
|
22
|
+
<div>
|
23
|
+
{this.instances.map(instance => (
|
24
|
+
<div key={instance.id}>
|
25
|
+
{/* Your visualization here */}
|
26
|
+
</div>
|
27
|
+
))}
|
28
|
+
</div>
|
29
|
+
);
|
83
30
|
}
|
84
31
|
}
|
85
32
|
```
|
86
33
|
|
87
|
-
##
|
34
|
+
## Core Concepts
|
35
|
+
|
36
|
+
- **DigoAsset**: Base class for creating visualization components
|
37
|
+
- **Data Types**: Define data structure with columns, rows, and parameters
|
38
|
+
- **Visualization Types**: Configure interactive parameters and instances
|
39
|
+
- **Parameter System**: Type-safe parameter definitions (NUMBER, COLOR, TEXT, etc.)
|
40
|
+
|
41
|
+
## Key Exports
|
42
|
+
|
43
|
+
### Main Classes
|
44
|
+
- [`DigoAsset`](src/digo-asset.ts) - Base class for visualization assets
|
45
|
+
|
46
|
+
### Data Definition
|
47
|
+
- [`DataAssetDefinition`](src/types-data.ts) - Structure for tabular data
|
48
|
+
- [`Row`](src/types-data.ts), [`Column`](src/types-data.ts) - Data components
|
49
|
+
|
50
|
+
### Visualization Definition
|
51
|
+
- [`VizAssetDefinition`](src/types-viz.ts) - Visualization configuration
|
52
|
+
- [`Instance`](src/types-viz.ts) - Individual visualization instances
|
53
|
+
- [`VizAssetFiles`](src/types-viz-files.ts) - File structure for viz assets
|
88
54
|
|
89
|
-
|
55
|
+
### Parameters
|
56
|
+
- [`ParameterType`](src/types-common.ts) - Available parameter types
|
57
|
+
- [`Parameter`](src/types-common.ts) - Parameter definitions
|
58
|
+
- [`ParameterValue`](src/types-common.ts) - Parameter values
|
59
|
+
|
60
|
+
### Constants
|
61
|
+
- [`API_MESSAGES`](src/constants.ts) - Message types for asset communication
|
62
|
+
|
63
|
+
### Examples
|
64
|
+
- [`DATA_ASSET_DEFINITION_EXAMPLES`](src/examples/data-examples.ts) - Sample data structures
|
65
|
+
|
66
|
+
> **Note**: Types in [`types-misc.ts`](src/types-misc.ts) and [`types-llm.ts`](src/types-llm.ts) are internal implementation details and not intended for public use.
|
67
|
+
|
68
|
+
## Development
|
90
69
|
|
91
70
|
```bash
|
92
|
-
#
|
93
|
-
npm
|
71
|
+
# Build the package
|
72
|
+
npm run build
|
94
73
|
|
95
|
-
#
|
96
|
-
npm
|
74
|
+
# Lint code
|
75
|
+
npm run lint
|
76
|
+
npm run lint:fix
|
97
77
|
```
|
98
78
|
|
99
|
-
|
100
|
-
|
101
|
-
|
79
|
+
## Publishing
|
80
|
+
|
81
|
+
Update version in `package.json` and run:
|
82
|
+
|
83
|
+
```bash
|
84
|
+
npm publish
|
85
|
+
```
|
102
86
|
|
103
|
-
|
104
|
-
- Verify you're logged into npm with the correct account
|
105
|
-
- Ensure the version has been incremented
|
106
|
-
- Check that you have the necessary permissions in the @digo-org organization
|
87
|
+
The prepublish script automatically builds the package before publishing.
|
package/package.json
CHANGED
package/src/types-llm.ts
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
import { CommonMetadata, DataAssetDefinition, Links, VizAssetDefinition, VizAssetFiles } from '@digo-org/digo-api';
|
2
2
|
|
3
|
-
export
|
4
|
-
type: ArtifactType;
|
5
|
-
value: DataAssetDefinition | VizAssetFiles | VizAssetDefinition | Links;
|
6
|
-
}
|
3
|
+
export type Artifacts = Partial<Record<ArtifactType, ArtifactValue>> & CommonMetadata;
|
7
4
|
|
8
5
|
export enum ArtifactType {
|
9
6
|
DATA_ASSET_DEFINITION = 'DATA_ASSET_DEFINITION',
|
10
7
|
VIZ_ASSET_FILES = 'VIZ_ASSET_FILES',
|
11
8
|
VIZ_ASSET_DEFINITION = 'VIZ_ASSET_DEFINITION',
|
12
9
|
LINKS = 'LINKS',
|
10
|
+
PROJECT_DEFINITION = 'PROJECT_DEFINITION',
|
13
11
|
}
|
14
12
|
|
13
|
+
export type ArtifactValue = DataAssetDefinition | VizAssetFiles | VizAssetDefinition | Links;
|
14
|
+
|
15
15
|
export interface MessagePart {
|
16
16
|
type: MessageType;
|
17
|
-
value: string |
|
17
|
+
value: string | Artifacts;
|
18
18
|
}
|
19
19
|
|
20
20
|
export enum MessageType {
|
package/src/types-misc.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ArtifactType, DataAssetDefinition, MessagePart, ParameterDefinition, ParameterValueArray, VizAssetDefinition, VizAssetFiles } from '@digo-org/digo-api';
|
1
|
+
import { ArtifactType, ArtifactValue, DataAssetDefinition, MessagePart, ParameterDefinition, ParameterValueArray, VizAssetDefinition, VizAssetFiles } from '@digo-org/digo-api';
|
2
2
|
|
3
3
|
export type Links = Record<string, string>; /* parameter-id -> column-id */
|
4
4
|
|
@@ -50,3 +50,8 @@ export enum ArctifactStepAction {
|
|
50
50
|
GENERATED = 'GENERATED',
|
51
51
|
EDITED = 'EDITED',
|
52
52
|
}
|
53
|
+
|
54
|
+
export interface Artifact extends CommonMetadata {
|
55
|
+
type: ArtifactType;
|
56
|
+
value: ArtifactValue | ProjectDefinition;
|
57
|
+
}
|