1
1
import { DnaSource , Record , ActionHash , EntryHash , AppEntryType } from "@holochain/client" ;
2
2
import { cleanAllConductors , pause , runScenario } from "@holochain/tryorama" ;
3
3
import { decode } from "@msgpack/msgpack" ;
4
- import { CulturalContext , Dimension , ResourceType , Threshold } from "@neighbourhoods/nh-we-applet "
4
+ import { CulturalContext , Dimension , ResourceType , Threshold , Range , ConfigResourceType , Method , ConfigMethod , ConfigThreshold , ConfigCulturalContext , AppletConfig , AppletConfigInput } from "@neighbourhoods/sensemaker-lite-types "
5
5
import pkg from "tape-promise/tape" ;
6
6
7
7
import { setUpAliceandBob } from "./neighbourhood" ;
@@ -44,7 +44,7 @@ export default () =>
44
44
await scenario . shareAllAgents ( ) ;
45
45
await pause ( 500 ) ;
46
46
47
- const integerRange = {
47
+ const integerRange : Range = {
48
48
"name" : "1-scale" ,
49
49
"kind" : {
50
50
"Integer" : { "min" : 0 , "max" : 1 }
@@ -66,14 +66,14 @@ export default () =>
66
66
t . ok ( dimensionHash ) ;
67
67
console . log ( 'dimension hash' , dimensionHash )
68
68
69
- const integerRange2 = {
69
+ const integerRange2 : Range = {
70
70
name : "1-scale-total" ,
71
71
kind : {
72
72
Integer : { min : 0 , max : 1000000 } ,
73
73
} ,
74
74
} ;
75
75
76
- const objectiveDimension = {
76
+ const objectiveDimension : Dimension = {
77
77
name : "total_importance" ,
78
78
range : integerRange2 ,
79
79
computed : true ,
@@ -93,7 +93,7 @@ export default () =>
93
93
dimension_ehs : [ dimensionHash ]
94
94
}
95
95
96
- const configResourceType = {
96
+ const configResourceType : ConfigResourceType = {
97
97
name : resourceType . name ,
98
98
base_types : resourceType . base_types ,
99
99
dimensions : [ dimension ]
@@ -108,7 +108,7 @@ export default () =>
108
108
t . ok ( resourceTypeEh ) ;
109
109
110
110
const methodName = "total_importance_method"
111
- const totalImportanceMethod = {
111
+ const totalImportanceMethod : Method = {
112
112
name : methodName ,
113
113
target_resource_type_eh : resourceTypeEh ,
114
114
input_dimension_ehs : [ dimensionHash ] ,
@@ -117,7 +117,7 @@ export default () =>
117
117
can_compute_live : false ,
118
118
must_publish_dataset : false ,
119
119
} ;
120
- const configMethod = {
120
+ const configMethod : ConfigMethod = {
121
121
name : totalImportanceMethod . name ,
122
122
target_resource_type : configResourceType ,
123
123
input_dimensions : [ dimension ] , // check if it's subjective (for now)
@@ -139,7 +139,7 @@ export default () =>
139
139
kind : { GreaterThan : null } ,
140
140
value : { Integer : 0 } ,
141
141
} ;
142
- const configThreshold = {
142
+ const configThreshold : ConfigThreshold = {
143
143
dimension : objectiveDimension ,
144
144
kind : { GreaterThan : null } ,
145
145
value : { Integer : 0 } ,
@@ -151,7 +151,7 @@ export default () =>
151
151
thresholds : [ threshold ] ,
152
152
order_by : [ [ objectiveDimensionHash , { Biggest : null } ] ] , // DimensionEh
153
153
} ;
154
- const configCulturalContext = {
154
+ const configCulturalContext : ConfigCulturalContext = {
155
155
name : culturalContext . name ,
156
156
resource_type : configResourceType ,
157
157
thresholds : [ configThreshold ] ,
@@ -167,22 +167,22 @@ export default () =>
167
167
t . ok ( contextEh ) ;
168
168
169
169
// create a config type
170
- const appletConfig = {
170
+ const appletConfig : AppletConfig = {
171
171
name : "todo" ,
172
172
dimensions : {
173
173
importance : dimensionHash ,
174
174
total_importance : objectiveDimensionHash
175
175
} ,
176
- resources : { task_item : resourceTypeEh } ,
176
+ resource_types : { task_item : resourceTypeEh } ,
177
177
methods : { total_importance_method : methodEh } ,
178
- contexts : { most_important_tasks : contextEh } ,
178
+ cultural_contexts : { most_important_tasks : contextEh } ,
179
179
}
180
- const appletConfigInput = {
180
+ const appletConfigInput : AppletConfigInput = {
181
181
name : appletConfig . name ,
182
182
dimensions : [ dimension , objectiveDimension ] ,
183
- resources : [ configResourceType ] ,
183
+ resource_types : [ configResourceType ] ,
184
184
methods : [ configMethod ] ,
185
- contexts : [ configCulturalContext ] ,
185
+ cultural_contexts : [ configCulturalContext ] ,
186
186
}
187
187
188
188
let maybeAppletConfig : any = await callZomeAlice (
0 commit comments