@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 CHANGED
@@ -1,11 +1,6 @@
1
1
  # Digo API
2
2
 
3
- This package provides the API interfaces for DIGO Assets, making them available to other workspaces in the monorepo or external projects via npm.
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
- ## Usage
11
+ ## Quick Start
17
12
 
18
- ```typescript
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
- ## Updating the Package
25
-
26
- When you need to update the Digo API package, follow these steps:
27
-
28
- 1. **Make Your Changes**:
29
- - Update existing files or add new files in the `src/` directory
30
- - Ensure you export any new types, interfaces, or functions from index.ts
31
-
32
- 2. **Update Version**:
33
- - Increment the version number in package.json following [Semantic Versioning](https://semver.org/):
34
- - MAJOR version for incompatible API changes
35
- - MINOR version for backward-compatible functionality
36
- - PATCH version for backward-compatible bug fixes
37
-
38
- 3. **Build & Test**:
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
- ## Publishing
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
- Publishing is handled through npm:
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
- # Login to npm if not already logged in
93
- npm login
71
+ # Build the package
72
+ npm run build
94
73
 
95
- # Publish package
96
- npm publish
74
+ # Lint code
75
+ npm run lint
76
+ npm run lint:fix
97
77
  ```
98
78
 
99
- The `prepublish` script will automatically:
100
- 1. Remove the old `dist` directory
101
- 2. Run the build process to create a new `dist` directory with the latest code
79
+ ## Publishing
80
+
81
+ Update version in `package.json` and run:
82
+
83
+ ```bash
84
+ npm publish
85
+ ```
102
86
 
103
- #### Publishing Issues
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@digo-org/digo-api",
3
3
  "private": false,
4
- "version": "1.0.35",
4
+ "version": "1.0.36",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
7
7
  "types": "src/index.ts",
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 interface Artifact extends CommonMetadata {
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 | Artifact;
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
+ }