11import { SanitizePolicies } from '@openfn/logger' ;
22import type { RawSourceMap } from 'source-map' ;
33
4+ /** UUID v4 */
5+ export type UUID = string ;
6+
47export type SourceMap = RawSourceMap ;
58
69export type SourceMapWithOperations = RawSourceMap & {
@@ -10,10 +13,17 @@ export type SourceMapWithOperations = RawSourceMap & {
1013// The serialised shape of of a project, as JSON
1114// this is what is saved to project.yaml
1215export type Project = {
13- name : string ; // human readable name
16+ /** Single-word identifier */
17+ id : string ;
18+
19+ /** human readable name */
20+ name ?: string ;
21+
22+ /** Shorthand identifier used by CLI commands */
23+ alias ?: string ;
24+
1425 description ?: string ;
1526
16- // object or array?
1727 workflows : Workflow [ ] ;
1828
1929 options : { } ;
@@ -24,8 +34,11 @@ export type Project = {
2434 openfn ?: ProjectConfig ;
2535} ;
2636
27- export type ProjectConfig = {
28- uuid : string ;
37+ export type OpenFnMetadata = {
38+ uuid ?: UUID ;
39+ } ;
40+
41+ export type ProjectConfig = OpenFnMetadata & {
2942 endpoint : string ;
3043 name : string ;
3144 env : string ;
@@ -42,7 +55,7 @@ export type ProjectConfig = {
4255 * (ie, the CLI or Worker)
4356 */
4457export type ExecutionPlan = {
45- id ?: UUID ; // this would be the run (nee attempt) id
58+ id ?: UUID ; // TODO make required
4659 workflow : Workflow ;
4760 options ?: WorkflowOptions ;
4861} ;
@@ -51,11 +64,15 @@ export type ExecutionPlan = {
5164 * A workflow is just a series of steps, executed start to finish
5265 */
5366export type Workflow = {
54- id ?: UUID ; // unique id used to track this workflow. Could be autogenerated
67+ /** The ID is the primary internal identifier for a Workflow */
68+ id ?: string ;
5569
56- // TODO: make required (worker and cli may have to generate a name)
70+ /** Human readable name, like display. Can be used to generate an internal id */
5771 name ?: string ;
5872
73+ /** Local shorthand name for use in CLI commands. Not used by Lightning */
74+ alias ?: string ;
75+
5976 steps : Array < Job | Trigger > ;
6077
6178 // global credentials
@@ -64,6 +81,8 @@ export type Workflow = {
6481
6582 // a path to a file where functions are defined
6683 globals ?: string ;
84+
85+ openfn ?: OpenFnMetadata ;
6786} ;
6887
6988export type StepId = string ;
@@ -73,6 +92,7 @@ export type StepId = string;
7392 * (usually a job)
7493 */
7594export interface Step {
95+ // TODO a Step must ALWAYS have an id (util functions can default it)
7696 id ?: StepId ;
7797 name ?: string ; // user-friendly name used in logging
7898
@@ -88,7 +108,7 @@ export type StepEdge = boolean | string | ConditionalStepEdge;
88108
89109export type ConditionalStepEdge = {
90110 condition ?: string ; // Javascript expression (function body, not function)
91- label ?: string ;
111+ label ?: string ; // TODO this is probably the name
92112 disabled ?: boolean ;
93113} ;
94114
@@ -208,6 +228,4 @@ export type ErrorReport = {
208228
209229// TODO standard shape of error object in our stack
210230
211- type UUID = string ;
212-
213231export type Lazy < T > = T | string ;
0 commit comments