Skip to content
This repository was archived by the owner on Dec 9, 2023. It is now read-only.

Commit 4da710e

Browse files
committed
update field to resource_types and cultural_context
1 parent 9647318 commit 4da710e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/sensemaker_dna/sensemaker/applet_config.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { DnaSource, Record, ActionHash, EntryHash, AppEntryType } from "@holochain/client";
22
import { cleanAllConductors, pause, runScenario } from "@holochain/tryorama";
33
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"
55
import pkg from "tape-promise/tape";
66

77
import { setUpAliceandBob } from "./neighbourhood";
@@ -44,7 +44,7 @@ export default () =>
4444
await scenario.shareAllAgents();
4545
await pause(500);
4646

47-
const integerRange = {
47+
const integerRange: Range = {
4848
"name": "1-scale",
4949
"kind": {
5050
"Integer": { "min": 0, "max": 1 }
@@ -66,14 +66,14 @@ export default () =>
6666
t.ok(dimensionHash);
6767
console.log('dimension hash', dimensionHash)
6868

69-
const integerRange2 = {
69+
const integerRange2: Range = {
7070
name: "1-scale-total",
7171
kind: {
7272
Integer: { min: 0, max: 1000000 },
7373
},
7474
};
7575

76-
const objectiveDimension = {
76+
const objectiveDimension: Dimension = {
7777
name: "total_importance",
7878
range: integerRange2,
7979
computed: true,
@@ -93,7 +93,7 @@ export default () =>
9393
dimension_ehs: [dimensionHash]
9494
}
9595

96-
const configResourceType = {
96+
const configResourceType: ConfigResourceType = {
9797
name: resourceType.name,
9898
base_types: resourceType.base_types,
9999
dimensions: [dimension]
@@ -108,7 +108,7 @@ export default () =>
108108
t.ok(resourceTypeEh);
109109

110110
const methodName = "total_importance_method"
111-
const totalImportanceMethod = {
111+
const totalImportanceMethod: Method = {
112112
name: methodName,
113113
target_resource_type_eh: resourceTypeEh,
114114
input_dimension_ehs: [dimensionHash],
@@ -117,7 +117,7 @@ export default () =>
117117
can_compute_live: false,
118118
must_publish_dataset: false,
119119
};
120-
const configMethod = {
120+
const configMethod: ConfigMethod = {
121121
name: totalImportanceMethod.name,
122122
target_resource_type: configResourceType,
123123
input_dimensions: [dimension], // check if it's subjective (for now)
@@ -139,7 +139,7 @@ export default () =>
139139
kind: { GreaterThan: null },
140140
value: { Integer: 0 },
141141
};
142-
const configThreshold = {
142+
const configThreshold: ConfigThreshold = {
143143
dimension: objectiveDimension,
144144
kind: { GreaterThan: null },
145145
value: { Integer: 0 },
@@ -151,7 +151,7 @@ export default () =>
151151
thresholds: [threshold],
152152
order_by: [[objectiveDimensionHash, { Biggest: null }]], // DimensionEh
153153
};
154-
const configCulturalContext = {
154+
const configCulturalContext: ConfigCulturalContext = {
155155
name: culturalContext.name,
156156
resource_type: configResourceType,
157157
thresholds: [configThreshold],
@@ -167,22 +167,22 @@ export default () =>
167167
t.ok(contextEh);
168168

169169
// create a config type
170-
const appletConfig = {
170+
const appletConfig: AppletConfig = {
171171
name: "todo",
172172
dimensions: {
173173
importance: dimensionHash,
174174
total_importance: objectiveDimensionHash
175175
},
176-
resources: { task_item: resourceTypeEh },
176+
resource_types: { task_item: resourceTypeEh },
177177
methods: { total_importance_method: methodEh },
178-
contexts: { most_important_tasks: contextEh },
178+
cultural_contexts: { most_important_tasks: contextEh },
179179
}
180-
const appletConfigInput = {
180+
const appletConfigInput: AppletConfigInput = {
181181
name: appletConfig.name,
182182
dimensions: [dimension, objectiveDimension],
183-
resources: [configResourceType],
183+
resource_types: [configResourceType],
184184
methods: [configMethod],
185-
contexts: [configCulturalContext],
185+
cultural_contexts: [configCulturalContext],
186186
}
187187

188188
let maybeAppletConfig: any = await callZomeAlice(

0 commit comments

Comments
 (0)