@@ -19,7 +19,7 @@ class Member extends EventEmitter {
19
19
*/
20
20
async init ( avatar ) {
21
21
this . #avatar = avatar
22
- ?? await this . factory . getAvatar ( )
22
+ ?? await this . # factory. getAvatar ( )
23
23
return this
24
24
}
25
25
// getter/setter functions
@@ -56,7 +56,7 @@ class Member extends EventEmitter {
56
56
}
57
57
set avatar ( _Avatar ) {
58
58
// oops, hack around how to get dna of avatar class; review options [could block at factory-getter level, most efficient and logical]
59
- if ( ! this . factory . isAvatar ( _Avatar ) )
59
+ if ( ! this . # factory. isAvatar ( _Avatar ) )
60
60
throw new Error ( 'avatar requires Avatar Class' )
61
61
this . #avatar = _Avatar
62
62
}
@@ -80,19 +80,19 @@ class Member extends EventEmitter {
80
80
return this . agent . chat
81
81
}
82
82
get consent ( ) {
83
- return this . factory . consent // **caution**: returns <<PROMISE>>
83
+ return this . # factory. consent // **caution**: returns <<PROMISE>>
84
84
}
85
85
set consent ( _consent ) {
86
- this . factory . consents . unshift ( _consent . id )
86
+ this . # factory. consents . unshift ( _consent . id )
87
87
}
88
88
get core ( ) {
89
- return this . factory . core
89
+ return this . # factory. core
90
90
}
91
91
get dataservice ( ) {
92
92
return this . dataservices
93
93
}
94
94
get dataservices ( ) {
95
- return this . factory . dataservices
95
+ return this . # factory. dataservices
96
96
}
97
97
get description ( ) {
98
98
return this . core . description
@@ -110,7 +110,7 @@ class Member extends EventEmitter {
110
110
return this . core . form
111
111
}
112
112
get globals ( ) {
113
- return this . factory . globals
113
+ return this . # factory. globals
114
114
}
115
115
get hobbies ( ) {
116
116
return this . core . hobbies
@@ -122,7 +122,7 @@ class Member extends EventEmitter {
122
122
return this . sysid
123
123
}
124
124
get mbr_id ( ) {
125
- return this . factory . mbr_id
125
+ return this . # factory. mbr_id
126
126
}
127
127
get member ( ) {
128
128
return this . core
@@ -139,6 +139,9 @@ class Member extends EventEmitter {
139
139
get preferences ( ) {
140
140
return this . core . preferences
141
141
}
142
+ get schemas ( ) {
143
+ return this . #factory. schemas
144
+ }
142
145
get skills ( ) {
143
146
return this . core . skills
144
147
}
@@ -155,15 +158,15 @@ class Member extends EventEmitter {
155
158
async testEmitters ( ) {
156
159
// test emitters with callbacks
157
160
this . emit ( 'testEmitter' , _response => {
158
- console . log ( 'callback emitters enabled:' , _response )
161
+
159
162
} )
160
163
}
161
164
}
162
165
class Organization extends Member { // form=organization
163
166
#Menu
164
167
#Router
165
- constructor ( _Factory ) {
166
- super ( _Factory )
168
+ constructor ( Factory ) {
169
+ super ( Factory )
167
170
}
168
171
/* public functions */
169
172
async init ( avatar ) {
@@ -190,7 +193,7 @@ class Organization extends Member { // form=organization
190
193
}
191
194
get menu ( ) {
192
195
if ( ! this . #Menu) {
193
- this . #Menu = new ( this . factory . schemas . menu ) ( this ) . menu
196
+ this . #Menu = new ( this . schemas . menu ) ( this ) . menu
194
197
}
195
198
return this . #Menu
196
199
}
@@ -211,7 +214,7 @@ class Organization extends Member { // form=organization
211
214
}
212
215
get router ( ) {
213
216
if ( ! this . #Router) {
214
- this . #Router = initRouter ( new ( this . factory . schemas . menu ) ( this ) )
217
+ this . #Router = initRouter ( new ( this . schemas . menu ) ( this ) )
215
218
}
216
219
return this . #Router
217
220
}
@@ -233,12 +236,14 @@ class Organization extends Member { // form=organization
233
236
}
234
237
class MyLife extends Organization { // form=server
235
238
#avatar // MyLife's private class avatar, _same_ object reference as Member Class's `#avatar`
239
+ #factory
236
240
#version = '0.0.0' // indicates error
237
- constructor ( factory ) { // no session presumed to exist
238
- super ( factory )
241
+ constructor ( Factory ) { // no session presumed to exist
242
+ super ( Factory )
243
+ this . #factory = Factory
239
244
}
240
245
async init ( ) {
241
- this . #avatar = await this . factory . getAvatar ( )
246
+ this . #avatar = await this . # factory. getAvatar ( )
242
247
return await super . init ( this . #avatar)
243
248
}
244
249
/* public functions */
@@ -247,7 +252,7 @@ class MyLife extends Organization { // form=server
247
252
* @returns {Object[] } - An array of the currently available public experiences.
248
253
*/
249
254
async availableExperiences ( ) {
250
- const experiences = ( await this . factory . availableExperiences ( ) )
255
+ const experiences = ( await this . # factory. availableExperiences ( ) )
251
256
. map ( experience => { // map to display versions [from `mylife-avatar.mjs`]
252
257
const { autoplay= false , description, id, name, purpose, skippable= true , } = experience
253
258
return {
@@ -277,7 +282,7 @@ class MyLife extends Organization { // form=server
277
282
async datacore ( mbr_id ) {
278
283
if ( ! mbr_id || mbr_id === this . mbr_id )
279
284
throw new Error ( 'datacore cannot be accessed' )
280
- const core = this . globals . sanitize ( await this . factory . datacore ( mbr_id ) )
285
+ const core = this . globals . sanitize ( await this . # factory. datacore ( mbr_id ) )
281
286
return core
282
287
}
283
288
/**
@@ -302,10 +307,10 @@ class MyLife extends Organization { // form=server
302
307
* @returns {void } returns nothing, performs operation
303
308
*/
304
309
getAlerts ( ) {
305
- this . factory . getAlerts ( )
310
+ this . # factory. getAlerts ( )
306
311
}
307
312
async getMyLifeSession ( ) {
308
- return await this . factory . getMyLifeSession ( )
313
+ return await this . # factory. getMyLifeSession ( )
309
314
}
310
315
async hostedMemberList ( ) {
311
316
let members = await this . hostedMembers ( )
@@ -317,7 +322,7 @@ class MyLife extends Organization { // form=server
317
322
* @returns {Promise<Array> } - Array of string ids, one for each hosted member.
318
323
*/
319
324
async hostedMembers ( validations ) {
320
- return await this . factory . hostedMembers ( validations )
325
+ return await this . # factory. hostedMembers ( validations )
321
326
}
322
327
/**
323
328
* Returns whether a specified member id is hosted on this instance.
@@ -330,7 +335,6 @@ class MyLife extends Organization { // form=server
330
335
let isValidated = false
331
336
if ( isHosted )
332
337
isValidated = await this . testPartitionKey ( memberId )
333
- console . log ( 'isMemberHosted:' , isHosted , isValidated , memberId )
334
338
return isValidated
335
339
}
336
340
/**
@@ -339,7 +343,7 @@ class MyLife extends Organization { // form=server
339
343
* @param {object } candidate { 'avatarName': string, 'email': string, 'humanName': string, }
340
344
*/
341
345
async registerCandidate ( candidate ) {
342
- return await this . factory . registerCandidate ( candidate )
346
+ return await this . # factory. registerCandidate ( candidate )
343
347
}
344
348
/**
345
349
* Submits and returns the memory to MyLife via API.
@@ -378,7 +382,7 @@ class MyLife extends Organization { // form=server
378
382
mbr_id,
379
383
name : `${ being } _${ title . substring ( 0 , 64 ) } _${ mbr_id } ` ,
380
384
}
381
- const savedStory = this . globals . sanitize ( await this . factory . summary ( story ) )
385
+ const savedStory = this . globals . sanitize ( await this . # factory. summary ( story ) )
382
386
return savedStory
383
387
}
384
388
/**
@@ -388,7 +392,7 @@ class MyLife extends Organization { // form=server
388
392
* @returns {boolean } returns true if partition key is valid
389
393
*/
390
394
async testPartitionKey ( _mbr_id ) {
391
- return await this . factory . testPartitionKey ( _mbr_id )
395
+ return await this . # factory. testPartitionKey ( _mbr_id )
392
396
}
393
397
/* getters/setters */
394
398
/**
0 commit comments