tutuca 0.9.75 → 0.9.76
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/dist/tutuca-cli.js +36 -3
- package/dist/tutuca-dev.ext.js +36 -3
- package/dist/tutuca-dev.js +36 -3
- package/dist/tutuca-dev.min.js +2 -2
- package/dist/tutuca-extra.ext.js +36 -3
- package/dist/tutuca-extra.js +36 -3
- package/dist/tutuca-extra.min.js +2 -2
- package/dist/tutuca.ext.js +36 -3
- package/dist/tutuca.js +36 -3
- package/dist/tutuca.min.js +2 -2
- package/package.json +1 -1
- package/skill/tutuca-source/tutuca.ext.js +36 -3
package/dist/tutuca-extra.ext.js
CHANGED
|
@@ -17,6 +17,9 @@ class Step {
|
|
|
17
17
|
toAbstractPathStep() {
|
|
18
18
|
return this;
|
|
19
19
|
}
|
|
20
|
+
pinKey(_v) {
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
class BindStep extends Step {
|
|
@@ -98,6 +101,10 @@ class SeqAccessStep extends Step {
|
|
|
98
101
|
const key = root?.get(this.keyField, NONE);
|
|
99
102
|
return seq === NONE || key === NONE ? root : root.set(this.seqField, seq.set(key, v));
|
|
100
103
|
}
|
|
104
|
+
pinKey(v) {
|
|
105
|
+
const key = v?.get(this.keyField, NONE);
|
|
106
|
+
return key === NONE ? this : new SeqStep(this.seqField, key);
|
|
107
|
+
}
|
|
101
108
|
}
|
|
102
109
|
|
|
103
110
|
class EachBindStep extends Step {
|
|
@@ -220,6 +227,20 @@ class Path {
|
|
|
220
227
|
}
|
|
221
228
|
return new Path(out);
|
|
222
229
|
}
|
|
230
|
+
pinKeys(root) {
|
|
231
|
+
let curVal = root;
|
|
232
|
+
let out = null;
|
|
233
|
+
for (let i = 0;i < this.steps.length; i++) {
|
|
234
|
+
const step = this.steps[i];
|
|
235
|
+
const pinned = step.pinKey(curVal);
|
|
236
|
+
if (pinned !== step)
|
|
237
|
+
(out ??= this.steps.slice())[i] = pinned;
|
|
238
|
+
curVal = step.lookup(curVal, NONE);
|
|
239
|
+
if (curVal === NONE)
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
return out ? new Path(out) : this;
|
|
243
|
+
}
|
|
223
244
|
lookup(v, dval = null) {
|
|
224
245
|
let curVal = v;
|
|
225
246
|
for (const step of this.steps) {
|
|
@@ -2664,12 +2685,14 @@ class Transactor {
|
|
|
2664
2685
|
}
|
|
2665
2686
|
async pushRequest(path, name, args = [], opts = {}, parent = null) {
|
|
2666
2687
|
const curRoot = this.state.val;
|
|
2667
|
-
const
|
|
2688
|
+
const txnPath = path.toTransactionPath();
|
|
2689
|
+
const curLeaf = txnPath.lookup(curRoot);
|
|
2668
2690
|
const handler = this.comps.getRequestFor(curLeaf, name) ?? mkReq404(name);
|
|
2669
2691
|
const resHandlerName = opts?.onResName ?? name;
|
|
2692
|
+
const resPath = opts?.livePath ? null : txnPath.pinKeys(curRoot);
|
|
2670
2693
|
const push = (specificName, baseName, singleArg, result, error) => {
|
|
2671
2694
|
const resArgs = specificName ? [singleArg] : [result, error];
|
|
2672
|
-
const t = new ResponseEvent(path, this, specificName ?? baseName, resArgs, parent);
|
|
2695
|
+
const t = new ResponseEvent(path, this, specificName ?? baseName, resArgs, parent, resPath);
|
|
2673
2696
|
this.pushTransaction(t);
|
|
2674
2697
|
};
|
|
2675
2698
|
try {
|
|
@@ -2744,8 +2767,11 @@ class Transaction {
|
|
|
2744
2767
|
getHandlerAndArgs(_root, _instance, _comps) {
|
|
2745
2768
|
return null;
|
|
2746
2769
|
}
|
|
2770
|
+
getTransactionPath() {
|
|
2771
|
+
return this.path.toTransactionPath();
|
|
2772
|
+
}
|
|
2747
2773
|
updateRootValue(curRoot, comps) {
|
|
2748
|
-
const txnPath = this.
|
|
2774
|
+
const txnPath = this.getTransactionPath();
|
|
2749
2775
|
const curLeaf = txnPath.lookup(curRoot);
|
|
2750
2776
|
const newLeaf = this.callHandler(curRoot, curLeaf, comps);
|
|
2751
2777
|
this._task?.complete?.({ value: newLeaf, old: curLeaf });
|
|
@@ -2854,6 +2880,13 @@ class NameArgsTransaction extends Transaction {
|
|
|
2854
2880
|
|
|
2855
2881
|
class ResponseEvent extends NameArgsTransaction {
|
|
2856
2882
|
handlerProp = "response";
|
|
2883
|
+
constructor(path, transactor, name, args, parent, txnPath = null) {
|
|
2884
|
+
super(path, transactor, name, args, parent);
|
|
2885
|
+
this._txnPath = txnPath;
|
|
2886
|
+
}
|
|
2887
|
+
getTransactionPath() {
|
|
2888
|
+
return this._txnPath ?? super.getTransactionPath();
|
|
2889
|
+
}
|
|
2857
2890
|
}
|
|
2858
2891
|
|
|
2859
2892
|
class SendEvent extends NameArgsTransaction {
|
package/dist/tutuca-extra.js
CHANGED
|
@@ -4390,6 +4390,9 @@ class Step {
|
|
|
4390
4390
|
toAbstractPathStep() {
|
|
4391
4391
|
return this;
|
|
4392
4392
|
}
|
|
4393
|
+
pinKey(_v) {
|
|
4394
|
+
return this;
|
|
4395
|
+
}
|
|
4393
4396
|
}
|
|
4394
4397
|
|
|
4395
4398
|
class BindStep extends Step {
|
|
@@ -4471,6 +4474,10 @@ class SeqAccessStep extends Step {
|
|
|
4471
4474
|
const key = root?.get(this.keyField, NONE);
|
|
4472
4475
|
return seq === NONE || key === NONE ? root : root.set(this.seqField, seq.set(key, v));
|
|
4473
4476
|
}
|
|
4477
|
+
pinKey(v) {
|
|
4478
|
+
const key = v?.get(this.keyField, NONE);
|
|
4479
|
+
return key === NONE ? this : new SeqStep(this.seqField, key);
|
|
4480
|
+
}
|
|
4474
4481
|
}
|
|
4475
4482
|
|
|
4476
4483
|
class EachBindStep extends Step {
|
|
@@ -4593,6 +4600,20 @@ class Path {
|
|
|
4593
4600
|
}
|
|
4594
4601
|
return new Path(out);
|
|
4595
4602
|
}
|
|
4603
|
+
pinKeys(root) {
|
|
4604
|
+
let curVal = root;
|
|
4605
|
+
let out = null;
|
|
4606
|
+
for (let i = 0;i < this.steps.length; i++) {
|
|
4607
|
+
const step = this.steps[i];
|
|
4608
|
+
const pinned = step.pinKey(curVal);
|
|
4609
|
+
if (pinned !== step)
|
|
4610
|
+
(out ??= this.steps.slice())[i] = pinned;
|
|
4611
|
+
curVal = step.lookup(curVal, NONE);
|
|
4612
|
+
if (curVal === NONE)
|
|
4613
|
+
break;
|
|
4614
|
+
}
|
|
4615
|
+
return out ? new Path(out) : this;
|
|
4616
|
+
}
|
|
4596
4617
|
lookup(v, dval = null) {
|
|
4597
4618
|
let curVal = v;
|
|
4598
4619
|
for (const step of this.steps) {
|
|
@@ -7037,12 +7058,14 @@ class Transactor {
|
|
|
7037
7058
|
}
|
|
7038
7059
|
async pushRequest(path, name, args = [], opts = {}, parent = null) {
|
|
7039
7060
|
const curRoot = this.state.val;
|
|
7040
|
-
const
|
|
7061
|
+
const txnPath = path.toTransactionPath();
|
|
7062
|
+
const curLeaf = txnPath.lookup(curRoot);
|
|
7041
7063
|
const handler = this.comps.getRequestFor(curLeaf, name) ?? mkReq404(name);
|
|
7042
7064
|
const resHandlerName = opts?.onResName ?? name;
|
|
7065
|
+
const resPath = opts?.livePath ? null : txnPath.pinKeys(curRoot);
|
|
7043
7066
|
const push = (specificName, baseName, singleArg, result, error) => {
|
|
7044
7067
|
const resArgs = specificName ? [singleArg] : [result, error];
|
|
7045
|
-
const t = new ResponseEvent(path, this, specificName ?? baseName, resArgs, parent);
|
|
7068
|
+
const t = new ResponseEvent(path, this, specificName ?? baseName, resArgs, parent, resPath);
|
|
7046
7069
|
this.pushTransaction(t);
|
|
7047
7070
|
};
|
|
7048
7071
|
try {
|
|
@@ -7117,8 +7140,11 @@ class Transaction {
|
|
|
7117
7140
|
getHandlerAndArgs(_root, _instance, _comps) {
|
|
7118
7141
|
return null;
|
|
7119
7142
|
}
|
|
7143
|
+
getTransactionPath() {
|
|
7144
|
+
return this.path.toTransactionPath();
|
|
7145
|
+
}
|
|
7120
7146
|
updateRootValue(curRoot, comps) {
|
|
7121
|
-
const txnPath = this.
|
|
7147
|
+
const txnPath = this.getTransactionPath();
|
|
7122
7148
|
const curLeaf = txnPath.lookup(curRoot);
|
|
7123
7149
|
const newLeaf = this.callHandler(curRoot, curLeaf, comps);
|
|
7124
7150
|
this._task?.complete?.({ value: newLeaf, old: curLeaf });
|
|
@@ -7227,6 +7253,13 @@ class NameArgsTransaction extends Transaction {
|
|
|
7227
7253
|
|
|
7228
7254
|
class ResponseEvent extends NameArgsTransaction {
|
|
7229
7255
|
handlerProp = "response";
|
|
7256
|
+
constructor(path, transactor, name, args, parent, txnPath = null) {
|
|
7257
|
+
super(path, transactor, name, args, parent);
|
|
7258
|
+
this._txnPath = txnPath;
|
|
7259
|
+
}
|
|
7260
|
+
getTransactionPath() {
|
|
7261
|
+
return this._txnPath ?? super.getTransactionPath();
|
|
7262
|
+
}
|
|
7230
7263
|
}
|
|
7231
7264
|
|
|
7232
7265
|
class SendEvent extends NameArgsTransaction {
|