1
- import { z } from 'zod'
2
1
import { OutcomeComment } from './outcomeComment'
3
2
import { OutcomeVote } from './outcomeVote'
4
3
import { Profile } from './profile'
5
- import { AgentPubKeyB64 , Option , WithActionHash } from './shared'
4
+ import { WithActionHash } from './shared'
5
+ import {
6
+ SmallTask as _SmallTask ,
7
+ SmallScope as _SmallScope ,
8
+ TimeFrame as _TimeFrame ,
9
+ SmallsEstimate as _SmallsEstimate ,
10
+ UncertainScope as _UncertainScope ,
11
+ Scope as _Scope ,
12
+ Outcome as _Outcome ,
13
+ } from 'zod-models'
6
14
7
15
export type AchievementStatus = 'Achieved' | 'NotAchieved'
8
16
9
- export const SmallTaskSchema = z . object ( {
10
- complete : z . boolean ( ) ,
11
- task : z . string ( ) ,
12
- } )
13
- export type SmallTask = {
14
- complete : boolean
15
- task : string
16
- }
17
-
18
- export const SmallScopeSchema = z . object ( {
19
- achievementStatus : z . enum ( [ 'Achieved' , 'NotAchieved' ] ) ,
20
- targetDate : z . number ( ) . optional ( ) ,
21
- taskList : z . array ( SmallTaskSchema ) ,
22
- } )
23
- export interface SmallScope {
24
- achievementStatus : AchievementStatus
25
- targetDate : Option < number >
26
- taskList : Array < SmallTask >
27
- }
28
-
29
- export const TimeFrameSchema = z . object ( {
30
- fromDate : z . number ( ) ,
31
- toDate : z . number ( ) ,
32
- } )
33
- export interface TimeFrame {
34
- fromDate : number //f64,
35
- toDate : number //f64,
36
- }
37
- export const SmallsEstimateSchema = z . number ( )
38
- export type SmallsEstimate = number
39
-
40
- export const UncertainScopeSchema = z . object ( {
41
- smallsEstimate : SmallsEstimateSchema . optional ( ) ,
42
- timeFrame : TimeFrameSchema ,
43
- inBreakdown : z . boolean ( ) ,
44
- } )
45
- export interface UncertainScope {
46
- smallsEstimate : Option < SmallsEstimate >
47
- timeFrame : Option < TimeFrame >
48
- inBreakdown : boolean
49
- }
17
+ export type SmallTask = _SmallTask
18
+ export type SmallScope = _SmallScope
19
+ export type SmallsEstimate = _SmallsEstimate
20
+ export type ScopeSmallVariant = SmallScope
50
21
51
- export type ScopeSmallVariant = { Small : SmallScope }
52
- export type ScopeUncertainVariant = { Uncertain : UncertainScope }
22
+ export type TimeFrame = _TimeFrame
23
+ export type UncertainScope = _UncertainScope
24
+ export type ScopeUncertainVariant = UncertainScope
53
25
54
- export const ScopeSchema = z . union ( [ SmallScopeSchema , UncertainScopeSchema ] )
55
- export type Scope = ScopeSmallVariant | ScopeUncertainVariant
26
+ export type Scope = _Scope
56
27
28
+ // TODO: convert to zod schema
57
29
export type ComputedAchievementStatus = {
58
30
uncertains : number
59
31
smallsAchieved : number
@@ -63,30 +35,7 @@ export type ComputedAchievementStatus = {
63
35
simple : ComputedSimpleAchievementStatus
64
36
}
65
37
66
- export const OutcomeSchema = z . object ( {
67
- content : z . string ( ) ,
68
- creatorAgentPubKey : z . string ( ) ,
69
- editorAgentPubKey : z . string ( ) . optional ( ) ,
70
- timestampCreated : z . number ( ) . gt ( 0 ) ,
71
- timestampUpdated : z . number ( ) . gt ( 0 ) . optional ( ) ,
72
- scope : ScopeSchema ,
73
- tags : z . array ( z . string ( ) ) . optional ( ) ,
74
- description : z . string ( ) ,
75
- isImported : z . boolean ( ) ,
76
- githubLink : z . string ( ) . url ( ) ,
77
- } )
78
- export interface Outcome {
79
- content : string
80
- creatorAgentPubKey : AgentPubKeyB64
81
- editorAgentPubKey : Option < AgentPubKeyB64 >
82
- timestampCreated : number //f64,
83
- timestampUpdated : Option < number > //f64
84
- scope : Scope
85
- tags : Option < Array < string > >
86
- description : string
87
- isImported : boolean
88
- githubLink : string
89
- }
38
+ export type Outcome = _Outcome
90
39
/*
91
40
Uncertain
92
41
{
0 commit comments