11/**
2- * @file This file is Ellyse's exploration into the interactions between
3- * charms, cells, and documents, and how they relate to common memory.
2+ * @file This file is Ellyse's exploration into the interactions between
3+ * charms, cells, and documents, and how they relate to common memory.
44 *
55 * I'm starting from the bottom (common memory) up and purposely calling
66 * APIs that would normally call into common memory.
7- *
87 */
9- import { CharmManager , Charm } from "../common-charm/src/charm.ts" ;
8+ import { Charm , CharmManager } from "../common-charm/src/charm.ts" ;
109import { Cell } from "../common-runner/src/cell.ts" ;
1110import { DocImpl , getDoc } from "../common-runner/src/doc.ts" ;
12- import { EntityId } from "../common-runner/src/cell -map.ts" ;
11+ import { EntityId } from "../common-runner/src/doc -map.ts" ;
1312import { storage } from "../common-charm/src/storage.ts" ;
1413import { getSpace , Space } from "../common-runner/src/space.ts" ;
1514
1615const replica = "ellyse7" ;
1716const TOOLSHED_API_URL = "https://toolshed.saga-castor.ts.net/" ;
1817
1918// simple log function
20- const log : < T > ( s : T , prefix ?: string ) => void = ( s , prefix ?) =>
21- console . log ( "-------------\n" + ( prefix ? prefix : "" ) + ":\n" + JSON . stringify ( s , null , 2 ) ) ;
19+ const log : < T > ( s : T , prefix ?: string ) => void = ( s , prefix ?) =>
20+ console . log (
21+ "-------------\n" + ( prefix ? prefix : "" ) + ":\n" +
22+ JSON . stringify ( s , null , 2 ) ,
23+ ) ;
2224
23- function createCell ( space : Space ) : Cell < Charm > {
25+ function createCell ( space : Space ) : Cell < Charm > {
2426 const myCharm : Charm = {
2527 NAME : "mycharm" ,
2628 UI : "someui" ,
2729 "somekey" : "some value" ,
2830 } ;
2931
30- // make this a DocImpl<Charm> because we need to return a Cell<Charm> since
32+ // make this a DocImpl<Charm> because we need to return a Cell<Charm> since
3133 // that's what CharmManger.add() needs later on
32- const myDoc : DocImpl < Charm > = getDoc < Charm > ( myCharm , crypto . randomUUID ( ) , space ) ;
34+ const myDoc : DocImpl < Charm > = getDoc < Charm > (
35+ myCharm ,
36+ crypto . randomUUID ( ) ,
37+ space ,
38+ ) ;
3339 return myDoc . asCell ( ) ;
3440}
3541
@@ -38,15 +44,15 @@ async function main() {
3844 const charmManager = new CharmManager ( replica ) ;
3945 log ( charmManager , "charmManager" ) ;
4046
41- // let's try to create a cell
47+ // let's try to create a cell
4248 const space : Space = getSpace ( replica ) ;
4349 const cell : Cell < Charm > = createCell ( space ) ;
4450 log ( cell . get ( ) , "cell value from Cell.get()" ) ;
45-
46- // this feels like magic and wrong,
47- // but we crash in the next CharmManager.add() if this isn't set
51+
52+ // this feels like magic and wrong,
53+ // but we crash in the next CharmManager.add() if this isn't set
4854 storage . setRemoteStorage (
49- new URL ( TOOLSHED_API_URL )
55+ new URL ( TOOLSHED_API_URL ) ,
5056 ) ;
5157
5258 // let's add the cell to the charmManager
0 commit comments