-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathμefkt-bundle.mjs
64 lines (63 loc) · 2.22 KB
/
μefkt-bundle.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import μefkt from './μefkt.core.mjs';
import './μefkt.BioBus.mjs';
export default μefkt;
// node client.js
const BioShellPushMxn = ($superclass,this$mx) => class extends $superclass {
initThis() {
super.initThis();
}
async sendXlinkPush(options) {
//🔰 assumes `sendXlinkPush().then..` or `await ..`
const btrq = {
...options,
type: '/loc.st/sendXlinkPush',
}
return this.sendAsyncBioMsg(btrq, μefkt.APromise());
}
}
const BioShellAcctMxn = ($superclass,this$mx) => class extends $superclass {
initThis() {
super.initThis();
}
async updateAcctDetails(options) {
//🔰 assumes `updateAcctDetails().then..` or `await ..`
const btrq = {
...options,
type: '/loc.st/updateAcctDetails',
}
return this.sendAsyncBioMsg(btrq, μefkt.APromise());
}
}
class BioShell extends μefkt.mixin(μefkt.ShellBase, μefkt.CoreBioApiMxn,
μefkt.EfsBioApiMxn, BioShellPushMxn, BioShellAcctMxn)
{
initThis() {
super.initThis();
//🚧 extend the API as appropriate to HCTA design 「acdn-EFS bio-pipe-api exposed-by-default for efs-file-io」
this.addEventListener('/:bio/acdn/updateAuthRp', e=>this.onUpdateAuthRp(e));
this.addEventListener('/:bio/bioPipeError', e=>this.onBioPipeError(e));
this.addEventListener('/:bio/bioPipeClosed', e=>this.onBioPipeClosedClosed(e));
}
async onUpdateAuthRp(e) {
//🦜 see: `onBioPipeChanged`. This call always follows `onBioPipeChanged`.
const detail = e?.detail, status = detail?.status;
// console.log(`RECV onUpdateAuthRp[${e.type}]:`, JSON.stringify(detail, null, 2));
//🚧 handle login success/failure notification
}
onBioPipeError(e) {
const detail = e?.detail;
console.log(`BioPipe error ${detail?.status?.code} ${detail?.status?.msg}`, detail?.status?.detail);
}
onBioPipeClosedClosed(e) {
const detail = e?.detail;
console.log(`BioPipe connection closed ${detail?.status?.code} ${detail?.status?.msg}`);
}
async example() {
let btrp; const btrp_apv = this.getFiles({
path: '/user/*',
});
try {btrp = await btrp_apv;} catch(e) {console.log(e);}
console.log(`FIN example[${btrp?.type}]:`, JSON.stringify(btrp, null, 2));
}
static #Shell = new this();
}