pico-engine 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/RulesetRegistryLoaderFs.js +2 -0
- package/dist/auth/AuthService.js +77 -13
- package/dist/bundledKrl.js +42 -0
- package/dist/identity/IdentityService.js +340 -0
- package/dist/identity/crossPico.js +238 -0
- package/dist/identity/dbHelpers.js +67 -0
- package/dist/identity/didcommIngressRoutes.js +44 -0
- package/dist/identity/didoModule.js +252 -0
- package/dist/identity/errors.js +11 -0
- package/dist/identity/establishSubscription.js +97 -0
- package/dist/identity/index.js +15 -0
- package/dist/identity/peerDid.js +9 -0
- package/dist/identity/skyIntro.js +194 -0
- package/dist/identity/skyProtocol.js +105 -0
- package/dist/identity/store.js +233 -0
- package/dist/identity/types.js +13 -0
- package/dist/identity/veramoDidComm.js +260 -0
- package/dist/identity/webvh.js +266 -0
- package/dist/identity/webvhCrypto.js +128 -0
- package/dist/identity/webvhRoutes.js +61 -0
- package/dist/index.js +26 -2
- package/dist/oauth/OAuthService.js +32 -0
- package/dist/provisionRoot.js +56 -18
- package/dist/server.js +52 -1
- package/dist/uiChannelPolicies.js +48 -0
- package/krl/io.picolabs.did-o.krl +5 -1
- package/krl/io.picolabs.pico-engine-ui.krl +106 -18
- package/krl/io.picolabs.subscription.krl +242 -23
- package/krl/io.picolabs.wrangler.krl +221 -12
- package/package.json +29 -6
- package/public/docs/krl/_sidebar.md +1 -0
- package/public/docs/krl/discovery.md +144 -0
- package/public/docs/krl/modules/ctx.md +8 -0
- package/public/docs/krl/modules/event.md +41 -0
- package/public/pico-engine-ui.css +1 -1
- package/public/pico-engine-ui.js +21 -18
- package/src/RulesetRegistryLoaderFs.ts +2 -0
- package/src/auth/AuthService.ts +109 -14
- package/src/bundledKrl.ts +42 -0
- package/src/identity/IdentityService.ts +571 -0
- package/src/identity/crossPico.ts +371 -0
- package/src/identity/dbHelpers.ts +51 -0
- package/src/identity/didcommIngressRoutes.ts +54 -0
- package/src/identity/didoModule.ts +388 -0
- package/src/identity/errors.ts +8 -0
- package/src/identity/establishSubscription.ts +160 -0
- package/src/identity/index.ts +24 -0
- package/src/identity/peerDid.ts +22 -0
- package/src/identity/skyIntro.ts +321 -0
- package/src/identity/skyProtocol.ts +192 -0
- package/src/identity/store.ts +343 -0
- package/src/identity/types.ts +63 -0
- package/src/identity/veramoDidComm.ts +363 -0
- package/src/identity/webvh.ts +325 -0
- package/src/identity/webvhCrypto.ts +200 -0
- package/src/identity/webvhRoutes.ts +64 -0
- package/src/index.ts +31 -2
- package/src/oauth/OAuthService.ts +36 -0
- package/src/provisionRoot.ts +75 -21
- package/src/server.ts +58 -1
- package/src/uiChannelPolicies.ts +49 -0
|
@@ -6,8 +6,8 @@ ruleset io.picolabs.subscription {
|
|
|
6
6
|
>>
|
|
7
7
|
author "Tedrub Modulus"
|
|
8
8
|
use module io.picolabs.wrangler alias wrangler
|
|
9
|
-
provides established, outbound, inbound, wellKnown_Rx, autoAcceptConfig
|
|
10
|
-
shares established, outbound, inbound, wellKnown_Rx, autoAcceptConfig
|
|
9
|
+
provides established, outbound, inbound, wellKnown_Rx, autoAcceptConfig, queryOnSub
|
|
10
|
+
shares established, outbound, inbound, wellKnown_Rx, autoAcceptConfig, queryOnSub
|
|
11
11
|
logging on
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -62,11 +62,14 @@ ent:outbound [
|
|
|
62
62
|
|
|
63
63
|
ent:established [
|
|
64
64
|
{
|
|
65
|
-
"Tx":"", //
|
|
66
|
-
"Rx":"", //
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
65
|
+
"Tx":"", // Legacy: remote channel ECI. Layer 2: use Tx_did instead.
|
|
66
|
+
"Rx":"", // Internal Rx channel ECI (policy eval); not shared as address
|
|
67
|
+
"Tx_did":"", // Layer 2: remote peer DID for outbound traffic
|
|
68
|
+
"Rx_did":"", // Layer 2: local peer DID for this subscription
|
|
69
|
+
"layer2": false, // true when formed via SKY intro (1.6+)
|
|
70
|
+
"Tx_role":"",
|
|
71
|
+
"Rx_role":"",
|
|
72
|
+
"Tx_host": ""
|
|
70
73
|
},...,...
|
|
71
74
|
]
|
|
72
75
|
*/
|
|
@@ -146,6 +149,21 @@ ent:established [
|
|
|
146
149
|
buses.filter( function(bus){ bus{"Rx"} == meta:eci }).head() ;
|
|
147
150
|
}
|
|
148
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Query a function on a remote pico via an established subscription.
|
|
154
|
+
* Layer 2 subs use DIDComm / verified local dispatch; legacy subs use Tx ECI.
|
|
155
|
+
*/
|
|
156
|
+
queryOnSub = function(subId, rid, name, args) {
|
|
157
|
+
bus = established("Id", subId).head()
|
|
158
|
+
bus.isnull() => null |
|
|
159
|
+
bus{"layer2"} == true => dido:crossPicoQuery(subId, {
|
|
160
|
+
"rid": rid,
|
|
161
|
+
"name": name,
|
|
162
|
+
"args": args.defaultsTo({})
|
|
163
|
+
}) |
|
|
164
|
+
wrangler:picoQuery(bus{"Tx"}, rid, name, args.defaultsTo({}), bus{"Tx_host"})
|
|
165
|
+
}
|
|
166
|
+
|
|
149
167
|
pending_entry = function(){
|
|
150
168
|
host = event:attr("Tx_host") == meta:host => null | event:attr("Tx_host")
|
|
151
169
|
roles = event:attr("Rx_role") => { // add possible roles
|
|
@@ -293,36 +311,87 @@ ent:established [
|
|
|
293
311
|
rule createRxBus {
|
|
294
312
|
select when wrangler subscription
|
|
295
313
|
pre {
|
|
314
|
+
layer2 = event:attr("layer2") == true
|
|
296
315
|
channel_name = event:attr("name").defaultsTo(random:word())
|
|
297
316
|
channel_type = event:attr("channel_type").defaultsTo("Tx_Rx","Tx_Rx channel_type used.")
|
|
298
317
|
pending_entry = pending_entry().put(["wellKnown_Tx"],event:attr("wellKnown_Tx"))
|
|
299
318
|
}
|
|
300
|
-
if
|
|
319
|
+
if not layer2 && pending_entry{"wellKnown_Tx"} then // check if we have someone to send a request to
|
|
301
320
|
ctx:newChannel([channel_name,channel_type],allow_all_eventPolicy,allow_all_queryPolicy) setting(channel); // create Rx
|
|
302
321
|
fired {
|
|
303
322
|
newBus = pending_entry.put({ "Rx" : channel{"id"} });
|
|
304
323
|
fullNewBus = newBus.put(
|
|
305
|
-
{ "
|
|
324
|
+
{ "name": channel_name,
|
|
325
|
+
"channel_name": channel_name,
|
|
306
326
|
"channel_type": channel_type,
|
|
307
327
|
}
|
|
308
328
|
);
|
|
309
|
-
ent:outbound := outbound().append(
|
|
329
|
+
ent:outbound := outbound().append( fullNewBus );
|
|
310
330
|
raise wrangler event "subscription_request_needed"
|
|
311
331
|
attributes event:attrs.put(fullNewBus);
|
|
312
332
|
raise wrangler event "outbound_pending_subscription_added" attributes event:attrs.put(fullNewBus)// API event
|
|
313
333
|
}
|
|
314
|
-
else {
|
|
315
|
-
raise wrangler event "wellKnown_Tx_format_failure" attributes event:attrs // API event
|
|
316
|
-
}
|
|
317
334
|
}//end createMySubscription rule
|
|
318
335
|
|
|
336
|
+
rule createRxBusLegacyFailure {
|
|
337
|
+
select when wrangler subscription
|
|
338
|
+
pre {
|
|
339
|
+
layer2 = event:attr("layer2") == true
|
|
340
|
+
hasWellKnown = event:attr("wellKnown_Tx")
|
|
341
|
+
}
|
|
342
|
+
if not layer2 && not hasWellKnown then noop()
|
|
343
|
+
fired {
|
|
344
|
+
raise wrangler event "wellKnown_Tx_format_failure" attributes event:attrs
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
rule createRxBusLayer2 {
|
|
349
|
+
select when wrangler subscription
|
|
350
|
+
pre {
|
|
351
|
+
layer2 = event:attr("layer2") == true
|
|
352
|
+
target_did = event:attr("target_did")
|
|
353
|
+
channel_name = event:attr("name").defaultsTo(random:word())
|
|
354
|
+
channel_type = event:attr("channel_type").defaultsTo("Tx_Rx","Tx_Rx channel_type used.")
|
|
355
|
+
pending_entry = pending_entry()
|
|
356
|
+
.put(["target_did"], target_did)
|
|
357
|
+
.put(["layer2"], true)
|
|
358
|
+
}
|
|
359
|
+
if layer2 && target_did then
|
|
360
|
+
ctx:newChannel([channel_name,channel_type],allow_all_eventPolicy,allow_all_queryPolicy) setting(channel)
|
|
361
|
+
fired {
|
|
362
|
+
newBus = pending_entry.put({ "Rx" : channel{"id"} })
|
|
363
|
+
fullNewBus = newBus.put({
|
|
364
|
+
"name": channel_name,
|
|
365
|
+
"channel_name": channel_name,
|
|
366
|
+
"channel_type": channel_type,
|
|
367
|
+
})
|
|
368
|
+
ent:outbound := outbound().append(fullNewBus)
|
|
369
|
+
raise wrangler event "subscription_request_needed" attributes event:attrs.put(fullNewBus)
|
|
370
|
+
raise wrangler event "outbound_pending_subscription_added" attributes event:attrs.put(fullNewBus)
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
rule createRxBusLayer2Failure {
|
|
375
|
+
select when wrangler subscription
|
|
376
|
+
pre {
|
|
377
|
+
layer2 = event:attr("layer2") == true
|
|
378
|
+
target_did = event:attr("target_did")
|
|
379
|
+
}
|
|
380
|
+
if layer2 && not target_did then noop()
|
|
381
|
+
fired {
|
|
382
|
+
raise wrangler event "target_did_format_failure" attributes event:attrs
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
319
386
|
rule requestSubscription {
|
|
320
387
|
select when wrangler subscription_request_needed
|
|
321
388
|
pre {
|
|
389
|
+
layer2 = event:attr("layer2") == true
|
|
322
390
|
myHost = event:attr("Rx_host") == "localhost" => null |
|
|
323
391
|
event:attr("Rx_host") => event:attr("Rx_host") |
|
|
324
392
|
meta:host
|
|
325
393
|
}
|
|
394
|
+
if not layer2 && event:attr("wellKnown_Tx") then
|
|
326
395
|
event:send({
|
|
327
396
|
"eci" : event:attr("wellKnown_Tx"),
|
|
328
397
|
"domain": "wrangler", "type": "new_subscription_request",
|
|
@@ -336,6 +405,44 @@ ent:established [
|
|
|
336
405
|
}, event:attr("Tx_host")); //send event to this host if provided
|
|
337
406
|
}
|
|
338
407
|
|
|
408
|
+
rule sendLayer2Intro {
|
|
409
|
+
select when wrangler subscription_request_needed
|
|
410
|
+
pre {
|
|
411
|
+
layer2 = event:attr("layer2") == true
|
|
412
|
+
target = event:attr("target_did")
|
|
413
|
+
sent = layer2 && target => dido:sendSkyIntro({
|
|
414
|
+
"subscriptionId": event:attr("Id"),
|
|
415
|
+
"targetDid": target,
|
|
416
|
+
"name": event:attr("name").defaultsTo(event:attr("channel_name")),
|
|
417
|
+
"Tx_role": event:attr("Tx_role"),
|
|
418
|
+
"Rx_role": event:attr("Rx_role"),
|
|
419
|
+
"channel_type": event:attr("channel_type"),
|
|
420
|
+
"Tx_host": meta:host
|
|
421
|
+
}) | null
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
rule addInboundPendingFromSkyIntro {
|
|
426
|
+
select when wrangler sky_intro
|
|
427
|
+
pre {
|
|
428
|
+
sub_name = event:attr("name").defaultsTo(event:attr("channel_name"))
|
|
429
|
+
pending_entry = pending_entry()
|
|
430
|
+
.put(["Tx_did"], event:attr("peer_did_long"))
|
|
431
|
+
.put(["layer2"], true)
|
|
432
|
+
.put(["Rx"], event:attr("Rx"))
|
|
433
|
+
.put(["name"], sub_name)
|
|
434
|
+
.put(["channel_name"], sub_name)
|
|
435
|
+
}
|
|
436
|
+
if pending_entry{"Rx"} && pending_entry{"Tx_did"} then noop()
|
|
437
|
+
fired {
|
|
438
|
+
ent:inbound := inbound().append(pending_entry)
|
|
439
|
+
raise wrangler event "inbound_pending_subscription_added" attributes event:attrs
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
raise wrangler event "no_Tx_did_failure" attributes event:attrs
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
339
446
|
rule addInboundPendingSubscription {
|
|
340
447
|
select when wrangler new_subscription_request
|
|
341
448
|
pre {
|
|
@@ -346,6 +453,8 @@ ent:established [
|
|
|
346
453
|
fired {
|
|
347
454
|
Rx = channel{"id"};
|
|
348
455
|
newBus = pending_entry.put({"Rx" : Rx,
|
|
456
|
+
"name": event:attr("channel_name"),
|
|
457
|
+
"channel_name": event:attr("channel_name"),
|
|
349
458
|
});
|
|
350
459
|
ent:inbound := inbound().append( newBus );
|
|
351
460
|
raise wrangler event "inbound_pending_subscription_added" attributes event:attrs.put(["Rx"], Rx); // API event
|
|
@@ -355,11 +464,24 @@ ent:established [
|
|
|
355
464
|
}
|
|
356
465
|
}
|
|
357
466
|
|
|
467
|
+
rule approveInboundPendingSubscriptionLayer2 {
|
|
468
|
+
select when wrangler pending_subscription_approval
|
|
469
|
+
pre {
|
|
470
|
+
bus = findBus(inbound())
|
|
471
|
+
response = bus{"layer2"} == true => dido:sendSkyIntroResponse(bus{"Id"}, bus{"Tx_did"}, {"status": "accepted"}) | null
|
|
472
|
+
}
|
|
473
|
+
if bus{"layer2"} == true then noop()
|
|
474
|
+
fired {
|
|
475
|
+
raise wrangler event "inbound_pending_subscription_approved" attributes event:attrs.put("Id", bus{"Id"}).put(["bus"],bus)
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
358
479
|
rule approveInboundPendingSubscription {
|
|
359
480
|
select when wrangler pending_subscription_approval
|
|
360
481
|
pre {
|
|
361
482
|
bus = findBus(inbound())
|
|
362
483
|
}
|
|
484
|
+
if not bus{"layer2"} == true && bus then
|
|
363
485
|
event:send({
|
|
364
486
|
"eci": bus{"Tx"},
|
|
365
487
|
"domain": "wrangler", "type": "outbound_pending_subscription_approved",
|
|
@@ -368,11 +490,30 @@ ent:established [
|
|
|
368
490
|
"Tx" : bus{"Rx"} ,
|
|
369
491
|
})
|
|
370
492
|
}, bus{"Tx_host"})
|
|
371
|
-
|
|
493
|
+
fired {
|
|
372
494
|
raise wrangler event "inbound_pending_subscription_approved" attributes event:attrs.put("Id", bus{"Id"}).put(["bus"],bus)
|
|
373
495
|
}
|
|
374
496
|
}
|
|
375
497
|
|
|
498
|
+
rule addOutboundSubscriptionLayer2 {
|
|
499
|
+
select when wrangler sky_intro_response
|
|
500
|
+
pre {
|
|
501
|
+
buses = outbound()
|
|
502
|
+
bus = findBus(buses)
|
|
503
|
+
index = indexOfId(buses, bus{"Id"})
|
|
504
|
+
}
|
|
505
|
+
if event:attr("status") == "accepted" && bus{"layer2"} == true && index >= 0 then noop()
|
|
506
|
+
fired {
|
|
507
|
+
updated = bus.put({
|
|
508
|
+
"Tx_did": event:attr("peer_did_long"),
|
|
509
|
+
"Tx_host": event:attr("Tx_host")
|
|
510
|
+
}).delete(["target_did"]).delete(["wellKnown_Tx"])
|
|
511
|
+
ent:established := established().append(updated)
|
|
512
|
+
ent:outbound := buses.splice(index, 1)
|
|
513
|
+
raise wrangler event "subscription_added" attributes event:attrs.put(["bus"], updated)
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
376
517
|
rule addOutboundSubscription {
|
|
377
518
|
select when wrangler outbound_pending_subscription_approved
|
|
378
519
|
pre{
|
|
@@ -408,19 +549,53 @@ ent:established [
|
|
|
408
549
|
}
|
|
409
550
|
}
|
|
410
551
|
|
|
552
|
+
// Layer 2 (1.6+): provision did:peer + internal Rx identity when bus.layer2 is set.
|
|
553
|
+
rule establish_layer2_subscription_identity {
|
|
554
|
+
select when wrangler subscription_added
|
|
555
|
+
pre {
|
|
556
|
+
bus = event:attr("bus").defaultsTo({})
|
|
557
|
+
layer2_identity = bus{"layer2"} == true => dido:establishSubscription(bus) | null
|
|
558
|
+
}
|
|
559
|
+
if bus{"layer2"} == true && layer2_identity then noop()
|
|
560
|
+
fired {
|
|
561
|
+
enriched = bus
|
|
562
|
+
.put("Rx_did", layer2_identity{"peerDid"})
|
|
563
|
+
.put("Rx", layer2_identity{"rxEci"})
|
|
564
|
+
buses = established()
|
|
565
|
+
index = indexOfId(buses, bus{"Id"})
|
|
566
|
+
ent:established := index >= 0 => buses.splice(index, 1).append(enriched) | buses
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
rule cancelEstablishedLayer2 {
|
|
571
|
+
select when wrangler subscription_cancellation
|
|
572
|
+
pre {
|
|
573
|
+
bus = findBus(established())
|
|
574
|
+
sent = bus{"layer2"} == true => dido:crossPicoEvent(bus{"Id"}, {
|
|
575
|
+
"domain": "wrangler",
|
|
576
|
+
"name": "established_removal",
|
|
577
|
+
"attrs": event:attrs.put("Id", bus{"Id"})
|
|
578
|
+
}) | null
|
|
579
|
+
}
|
|
580
|
+
if bus{"layer2"} == true then noop()
|
|
581
|
+
fired {
|
|
582
|
+
raise wrangler event "established_removal" attributes event:attrs.put("Id", bus{"Id"})
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
411
586
|
rule cancelEstablished {
|
|
412
587
|
select when wrangler subscription_cancellation
|
|
413
588
|
pre{
|
|
414
589
|
bus = findBus(established())
|
|
415
590
|
Tx_host = bus{"Tx_host"}
|
|
416
591
|
}
|
|
417
|
-
if bus then
|
|
592
|
+
if not bus{"layer2"} == true && bus then
|
|
418
593
|
event:send({
|
|
419
594
|
"eci" : bus{"Tx"},
|
|
420
595
|
"domain": "wrangler", "type": "established_removal",
|
|
421
596
|
"attrs" : event:attrs.put({
|
|
422
|
-
"Rx": bus{"Tx"},
|
|
423
|
-
"Tx": bus{"Rx"},
|
|
597
|
+
"Rx": bus{"Tx"},
|
|
598
|
+
"Tx": bus{"Rx"},
|
|
424
599
|
"Id": bus{"Id"}
|
|
425
600
|
})
|
|
426
601
|
}, Tx_host)
|
|
@@ -435,6 +610,7 @@ ent:established [
|
|
|
435
610
|
buses = established()
|
|
436
611
|
bus = findBus(buses)
|
|
437
612
|
index = indexOfId(buses, bus{"Id"})
|
|
613
|
+
teardown = bus{"layer2"} == true => dido:teardownSubscription(bus{"Id"}) | null
|
|
438
614
|
}
|
|
439
615
|
if index >= 0 then
|
|
440
616
|
wrangler:deleteChannel(bus{"Rx"})
|
|
@@ -444,13 +620,30 @@ ent:established [
|
|
|
444
620
|
}
|
|
445
621
|
}
|
|
446
622
|
|
|
623
|
+
rule cancelInboundLayer2 {
|
|
624
|
+
select when wrangler inbound_rejection
|
|
625
|
+
pre {
|
|
626
|
+
bus = findBus(inbound())
|
|
627
|
+
sent = bus{"layer2"} == true => dido:crossPicoEvent(bus{"Id"}, {
|
|
628
|
+
"domain": "wrangler",
|
|
629
|
+
"name": "outbound_removal",
|
|
630
|
+
"attrs": event:attrs.put("Id", bus{"Id"})
|
|
631
|
+
}) | null
|
|
632
|
+
}
|
|
633
|
+
if bus{"layer2"} == true then noop()
|
|
634
|
+
always {
|
|
635
|
+
raise wrangler event "inbound_removal" attributes event:attrs.put("Id", bus{"Id"})
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
447
639
|
rule cancelInbound {
|
|
448
640
|
select when wrangler inbound_rejection
|
|
449
641
|
pre{
|
|
450
642
|
bus = findBus(inbound())
|
|
451
643
|
Tx_host = bus{"Tx_host"}
|
|
452
644
|
}
|
|
453
|
-
|
|
645
|
+
if not bus{"layer2"} == true && bus then
|
|
646
|
+
event:send({
|
|
454
647
|
"eci" : bus{"Tx"},
|
|
455
648
|
"domain": "wrangler", "type": "outbound_removal",
|
|
456
649
|
"attrs" : event:attrs.put({
|
|
@@ -468,6 +661,7 @@ ent:established [
|
|
|
468
661
|
buses = inbound()
|
|
469
662
|
bus = findBus(buses)
|
|
470
663
|
index = indexOfId(buses, bus{"Id"})
|
|
664
|
+
teardown = bus{"layer2"} == true => dido:teardownSubscription(bus{"Id"}) | null
|
|
471
665
|
}
|
|
472
666
|
if index >= 0 then
|
|
473
667
|
wrangler:deleteChannel(bus{"Rx"})
|
|
@@ -477,13 +671,30 @@ ent:established [
|
|
|
477
671
|
}
|
|
478
672
|
}
|
|
479
673
|
|
|
674
|
+
rule cancelOutboundLayer2 {
|
|
675
|
+
select when wrangler outbound_cancellation
|
|
676
|
+
pre {
|
|
677
|
+
bus = findBus(outbound())
|
|
678
|
+
sent = bus{"layer2"} == true => dido:crossPicoEvent(bus{"Id"}, {
|
|
679
|
+
"domain": "wrangler",
|
|
680
|
+
"name": "inbound_removal",
|
|
681
|
+
"attrs": event:attrs.put("Id", bus{"Id"}).put("Tx", bus{"Rx"})
|
|
682
|
+
}) | null
|
|
683
|
+
}
|
|
684
|
+
if bus{"layer2"} == true then noop()
|
|
685
|
+
always {
|
|
686
|
+
raise wrangler event "outbound_removal" attributes event:attrs.put("Id", bus{"Id"})
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
480
690
|
rule cancelOutbound {
|
|
481
691
|
select when wrangler outbound_cancellation
|
|
482
692
|
pre{
|
|
483
693
|
bus = findBus(outbound())
|
|
484
694
|
Tx_host = bus{"Tx_host"}
|
|
485
695
|
}
|
|
486
|
-
|
|
696
|
+
if not bus{"layer2"} == true && bus then
|
|
697
|
+
event:send({
|
|
487
698
|
"eci" : bus{"wellKnown_Tx"},
|
|
488
699
|
"domain": "wrangler", "type": "inbound_removal",
|
|
489
700
|
"attrs" : event:attrs.put({
|
|
@@ -502,6 +713,7 @@ ent:established [
|
|
|
502
713
|
buses = outbound()
|
|
503
714
|
bus = findBus(buses)
|
|
504
715
|
index = indexOfId(buses,bus{"Id"})
|
|
716
|
+
teardown = bus{"layer2"} == true => dido:teardownSubscription(bus{"Id"}) | null
|
|
505
717
|
}
|
|
506
718
|
if index >= 0 then
|
|
507
719
|
wrangler:deleteChannel(bus{"Rx"})
|
|
@@ -539,10 +751,17 @@ ent:established [
|
|
|
539
751
|
select when wrangler send_event_to_subs
|
|
540
752
|
foreach event:attr("subs") setting (sub)
|
|
541
753
|
pre {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
754
|
+
layer2 = sub{"layer2"} == true
|
|
755
|
+
sent = layer2 => dido:crossPicoEvent(sub{"Id"}, {
|
|
756
|
+
"domain": event:attr("domain"),
|
|
757
|
+
"name": event:attr("type"),
|
|
758
|
+
"attrs": event:attr("attrs").defaultsTo({})
|
|
759
|
+
}) | null
|
|
760
|
+
tx = sub{"Tx"}
|
|
761
|
+
host = sub{"Tx_host"}
|
|
762
|
+
}
|
|
763
|
+
if not layer2 && tx then
|
|
764
|
+
event:send({"eci":tx, "domain":event:attr("domain"), "type":event:attr("type"), "attrs":event:attr("attrs").defaultsTo({})}, host)
|
|
546
765
|
}
|
|
547
766
|
|
|
548
767
|
rule autoAccept {
|