@chocbite/ts-lib-state 1.0.3 → 1.1.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +230 -366
  2. package/dist/index.js +488 -851
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -89,8 +89,15 @@ var RXS = class extends StateBase {
89
89
  if (setter === true)
90
90
  this.#setter = (value, state2, old) => {
91
91
  if (old && !old.err && value === old.value)
92
- return ok(void 0);
93
- return this.#helper?.limit ? this.#helper?.limit(value).map((e) => state2.set_ok(e)) : ok(state2.set_ok(value));
92
+ return Promise.resolve(ok(void 0));
93
+ if (this.#helper) {
94
+ return this.#helper.limit(value).then((e) => {
95
+ if (e.err) return err(e.error);
96
+ state2.set_ok(e.value);
97
+ return ok(void 0);
98
+ });
99
+ }
100
+ return Promise.resolve(ok(state2.set_ok(value)));
94
101
  };
95
102
  else this.#setter = setter;
96
103
  if (helper) this.#helper = helper;
@@ -147,26 +154,18 @@ var RXS = class extends StateBase {
147
154
  get writable() {
148
155
  return this.#setter !== void 0;
149
156
  }
150
- get wsync() {
151
- return this.writable;
152
- }
153
- async write(value) {
154
- return this.write_sync(value);
155
- }
156
- write_sync(value) {
157
+ write(value) {
157
158
  if (this.#setter)
158
- return this.#setter(
159
- value,
160
- this,
161
- this.#value
159
+ return Promise.resolve(
160
+ this.#setter(value, this, this.#value)
162
161
  );
163
- return err("State not writable");
162
+ return Promise.resolve(err("not writable"));
164
163
  }
165
164
  limit(value) {
166
- return this.#helper?.limit ? this.#helper.limit(value) : ok(value);
165
+ return this.#helper?.limit ? this.#helper.limit(value) : Promise.resolve(ok(value));
167
166
  }
168
167
  check(value) {
169
- return this.#helper?.check ? this.#helper.check(value) : ok(value);
168
+ return this.#helper?.check ? this.#helper.check(value) : Promise.resolve(ok(value));
170
169
  }
171
170
  };
172
171
  var ros = {
@@ -368,13 +367,13 @@ var RXS2 = class extends StateBase {
368
367
  write_sync(value) {
369
368
  if (this.#setter)
370
369
  return this.#setter(value, this, this.get());
371
- return err2("State not writable");
370
+ return err2("not writable");
372
371
  }
373
372
  limit(value) {
374
- return this.#helper?.limit ? this.#helper.limit(value) : ok2(value);
373
+ return this.#helper?.limit ? this.#helper.limit(value) : Promise.resolve(ok2(value));
375
374
  }
376
375
  check(value) {
377
- return this.#helper?.check ? this.#helper.check(value) : ok2(value);
376
+ return this.#helper?.check ? this.#helper.check(value) : Promise.resolve(ok2(value));
378
377
  }
379
378
  //Array/Owner Context
380
379
  get array() {
@@ -1216,22 +1215,19 @@ import {
1216
1215
  ok as ok4
1217
1216
  } from "@chocbite/ts-lib-result";
1218
1217
  var RXA = class extends StateBase {
1219
- constructor(init, helper, setter_sync, setter_async) {
1218
+ constructor(init, helper, setter) {
1220
1219
  super();
1221
- if (setter_sync === true)
1222
- this.#setter_sync = (value, state2, old) => {
1223
- if (old && !old.err && value === old.value)
1224
- return ok4(void 0);
1225
- return this.#helper?.limit ? this.#helper?.limit(value).map((e) => state2.set_ok(e)) : ok4(state2.set_ok(value));
1226
- };
1227
- else this.#setter_sync = setter_sync;
1228
- if (setter_async === true)
1229
- this.#setter_async = async (value, state2, old) => {
1220
+ if (setter === true)
1221
+ this.#setter = async (value, state2, old) => {
1230
1222
  if (old && !old.err && value === old.value)
1223
+ return Promise.resolve(ok4(void 0));
1224
+ return this.#helper ? this.#helper.limit(value).then((e) => {
1225
+ if (e.err) return err5(e.error);
1226
+ state2.set_ok(e);
1231
1227
  return ok4(void 0);
1232
- return this.#helper?.limit ? this.#helper?.limit(value).map((e) => state2.set_ok(e)) : ok4(state2.set_ok(value));
1228
+ }) : Promise.resolve(ok4(state2.set_ok(value)));
1233
1229
  };
1234
- else this.#setter_async = setter_async;
1230
+ else this.#setter = setter;
1235
1231
  if (helper) this.#helper = helper;
1236
1232
  let initializing = false;
1237
1233
  this.then = async (func) => {
@@ -1255,19 +1251,14 @@ var RXA = class extends StateBase {
1255
1251
  this.#clean();
1256
1252
  this.set(this.ful_r_prom(value));
1257
1253
  };
1258
- const write_sync = this.write_sync.bind(this);
1259
- this.write_sync = (value) => write_sync(value).map((val) => this.#clean() ?? val);
1260
1254
  const write = this.write.bind(this);
1261
1255
  this.write = async (value) => (await write(value)).map((val) => this.#clean() ?? val);
1262
1256
  }
1263
1257
  #clean() {
1264
- ["then", "set", "write", "write_sync"].forEach(
1265
- (k) => delete this[k]
1266
- );
1258
+ ["then", "set", "write"].forEach((k) => delete this[k]);
1267
1259
  }
1268
1260
  #value;
1269
- #setter_sync;
1270
- #setter_async;
1261
+ #setter;
1271
1262
  #helper;
1272
1263
  //#Owner Context
1273
1264
  set(value) {
@@ -1279,17 +1270,11 @@ var RXA = class extends StateBase {
1279
1270
  set_err(error) {
1280
1271
  this.set(err5(error));
1281
1272
  }
1282
- set setter_sync(setter) {
1283
- this.#setter_sync = setter;
1284
- }
1285
- get setter_sync() {
1286
- return this.#setter_sync;
1287
- }
1288
- set setter_async(setter) {
1289
- this.#setter_async = setter;
1273
+ set setter(setter) {
1274
+ this.#setter = setter;
1290
1275
  }
1291
- get setter_async() {
1292
- return this.#setter_async;
1276
+ get setter() {
1277
+ return this.#setter;
1293
1278
  }
1294
1279
  get state() {
1295
1280
  return this;
@@ -1297,11 +1282,8 @@ var RXA = class extends StateBase {
1297
1282
  get read_only() {
1298
1283
  return this;
1299
1284
  }
1300
- get read_write_sync() {
1301
- return this.#setter_sync ? this : void 0;
1302
- }
1303
- get read_write_async() {
1304
- return this.#setter_async ? this : void 0;
1285
+ get read_write() {
1286
+ return this.#setter ? this : void 0;
1305
1287
  }
1306
1288
  //#Reader Context
1307
1289
  get rok() {
@@ -1317,48 +1299,30 @@ var RXA = class extends StateBase {
1317
1299
  ok() {
1318
1300
  return this.#value.value;
1319
1301
  }
1320
- async then(func) {
1321
- return func(this.#value);
1302
+ then(func) {
1303
+ return Promise.resolve(func(this.#value));
1322
1304
  }
1323
1305
  related() {
1324
1306
  return this.#helper?.related ? this.#helper.related() : none7();
1325
1307
  }
1326
1308
  //#Writer Context
1327
1309
  get writable() {
1328
- return Boolean(this.#setter_sync || this.#setter_async);
1329
- }
1330
- get wsync() {
1331
- return Boolean(this.#setter_sync);
1332
- }
1333
- async write(value) {
1334
- if (this.#setter_async)
1335
- return this.#setter_async(
1336
- value,
1337
- this,
1338
- this.#value
1339
- );
1340
- else if (this.#setter_sync)
1341
- return this.#setter_sync(
1342
- value,
1343
- this,
1344
- this.#value
1345
- );
1346
- return err5("State not writable");
1310
+ return Boolean(this.#setter);
1347
1311
  }
1348
- write_sync(value) {
1349
- if (this.#setter_sync)
1350
- return this.#setter_sync(
1312
+ write(value) {
1313
+ if (this.#setter)
1314
+ return this.#setter(
1351
1315
  value,
1352
1316
  this,
1353
1317
  this.#value
1354
1318
  );
1355
- return err5("State not writable");
1319
+ return Promise.resolve(err5("not writable"));
1356
1320
  }
1357
1321
  limit(value) {
1358
- return this.#helper?.limit ? this.#helper.limit(value) : ok4(value);
1322
+ return this.#helper?.limit ? this.#helper.limit(value) : Promise.resolve(ok4(value));
1359
1323
  }
1360
1324
  check(value) {
1361
- return this.#helper?.check ? this.#helper.check(value) : ok4(value);
1325
+ return this.#helper?.check ? this.#helper.check(value) : Promise.resolve(ok4(value));
1362
1326
  }
1363
1327
  };
1364
1328
  var roa = {
@@ -1378,29 +1342,7 @@ var roa = {
1378
1342
  return new RXA(init, helper);
1379
1343
  }
1380
1344
  };
1381
- var roa_ws = {
1382
- /**Creates a delayed ok state from an initial value, delayed meaning the value is a promise evaluated on first access.
1383
- * @param init initial value for state.
1384
- * @param helper functions to check and limit the value, and to return related states.*/
1385
- ok(init, setter = true, helper) {
1386
- return new RXA(
1387
- init ? async () => ok4(await init()) : void 0,
1388
- helper,
1389
- setter
1390
- );
1391
- },
1392
- /**Creates a delayed ok state from an initial result, delayed meaning the value is a promise evaluated on first access.
1393
- * @param init initial result for state.
1394
- * @param helper functions to check and limit the value, and to return related states.*/
1395
- result(init, setter = true, helper) {
1396
- return new RXA(
1397
- init,
1398
- helper,
1399
- setter
1400
- );
1401
- }
1402
- };
1403
- var roa_wa = {
1345
+ var roaw = {
1404
1346
  /**Creates a delayed ok state from an initial value, delayed meaning the value is a promise evaluated on first access.
1405
1347
  * @param init initial value for state.
1406
1348
  * @param helper functions to check and limit the value, and to return related states.*/
@@ -1408,7 +1350,6 @@ var roa_wa = {
1408
1350
  return new RXA(
1409
1351
  init ? async () => ok4(await init()) : void 0,
1410
1352
  helper,
1411
- void 0,
1412
1353
  setter
1413
1354
  );
1414
1355
  },
@@ -1419,7 +1360,6 @@ var roa_wa = {
1419
1360
  return new RXA(
1420
1361
  init,
1421
1362
  helper,
1422
- void 0,
1423
1363
  setter
1424
1364
  );
1425
1365
  }
@@ -1453,39 +1393,7 @@ var rea = {
1453
1393
  );
1454
1394
  }
1455
1395
  };
1456
- var rea_ws = {
1457
- /**Creates a delayed ok state from an initial value, delayed meaning the value is a promise evaluated on first access.
1458
- * @param init initial value for state.
1459
- * @param helper functions to check and limit the value, and to return related states.*/
1460
- ok(init, setter = true, helper) {
1461
- return new RXA(
1462
- init ? async () => ok4(await init()) : void 0,
1463
- helper,
1464
- setter
1465
- );
1466
- },
1467
- /**Creates a writable delayed state from an initial error, delayed meaning the value is a promise evaluated on first access.
1468
- * @param init initial error for state.
1469
- * @param helper functions to check and limit the value, and to return related states.*/
1470
- err(init, setter = true, helper) {
1471
- return new RXA(
1472
- init ? async () => err5(await init()) : void 0,
1473
- helper,
1474
- setter
1475
- );
1476
- },
1477
- /**Creates a delayed ok state from an initial result, delayed meaning the value is a promise evaluated on first access.
1478
- * @param init initial result for state.
1479
- * @param helper functions to check and limit the value, and to return related states.*/
1480
- result(init, setter = true, helper) {
1481
- return new RXA(
1482
- init,
1483
- helper,
1484
- setter
1485
- );
1486
- }
1487
- };
1488
- var rea_wa = {
1396
+ var reaw = {
1489
1397
  /**Creates a delayed ok state from an initial value, delayed meaning the value is a promise evaluated on first access.
1490
1398
  * @param init initial value for state.
1491
1399
  * @param helper functions to check and limit the value, and to return related states.*/
@@ -1493,7 +1401,6 @@ var rea_wa = {
1493
1401
  return new RXA(
1494
1402
  init ? async () => ok4(await init()) : void 0,
1495
1403
  helper,
1496
- void 0,
1497
1404
  setter
1498
1405
  );
1499
1406
  },
@@ -1504,7 +1411,6 @@ var rea_wa = {
1504
1411
  return new RXA(
1505
1412
  init ? async () => err5(await init()) : void 0,
1506
1413
  helper,
1507
- void 0,
1508
1414
  setter
1509
1415
  );
1510
1416
  },
@@ -1515,7 +1421,6 @@ var rea_wa = {
1515
1421
  return new RXA(
1516
1422
  init,
1517
1423
  helper,
1518
- void 0,
1519
1424
  setter
1520
1425
  );
1521
1426
  }
@@ -1523,16 +1428,12 @@ var rea_wa = {
1523
1428
  var STATE_DELAYED = {
1524
1429
  /**Read only delayed states with guarenteed ok, delayed meaning the value is a promise evaluated on first access. */
1525
1430
  roa,
1526
- /**Read write delayed states with guarenteed ok and sync write, delayed meaning the value is a promise evaluated on first access. */
1527
- roa_ws,
1528
1431
  /**Read write delayed states with guarenteed ok and async write, delayed meaning the value is a promise evaluated on first access. */
1529
- roa_wa,
1432
+ roaw,
1530
1433
  /**Read only delayed states with error, delayed meaning the value is a promise evaluated on first access. */
1531
1434
  rea,
1532
- /**Read write delayed states with error and sync write, delayed meaning the value is a promise evaluated on first access. */
1533
- rea_ws,
1534
1435
  /**Read write delayed state with error and async write, delayed meaning the value is a promise evaluated on first access. */
1535
- rea_wa
1436
+ reaw
1536
1437
  };
1537
1438
 
1538
1439
  // src/helpers.ts
@@ -1542,64 +1443,57 @@ import {
1542
1443
  ok as ok5,
1543
1444
  some
1544
1445
  } from "@chocbite/ts-lib-result";
1545
- var StateNumberHelper = class {
1446
+ var StateHelper = class {
1447
+ writable;
1448
+ constructor(writable) {
1449
+ if (writable) this.writable = writable;
1450
+ }
1451
+ };
1452
+ var StateNumberHelper = class extends StateHelper {
1546
1453
  min;
1547
1454
  max;
1548
1455
  unit;
1549
1456
  decimals;
1550
1457
  step;
1551
1458
  start;
1552
- constructor(min, max, unit, decimals, step, start) {
1553
- if (min !== void 0) this.min = min;
1554
- if (max !== void 0) this.max = max;
1555
- if (unit !== void 0) this.unit = unit;
1556
- if (decimals !== void 0) {
1557
- this.decimals = decimals;
1558
- if (step !== void 0) this.step = step;
1559
- if (start !== void 0) this.start = start;
1560
- } else {
1561
- if (step !== void 0) {
1562
- this.step = step;
1563
- const match = String(step).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
1564
- this.decimals = match ? Math.max(
1565
- 0,
1566
- (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0)
1567
- ) : 0;
1568
- if (start !== void 0) {
1569
- this.start = start;
1570
- const match2 = String(start).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
1571
- this.decimals = Math.max(
1572
- this.decimals,
1573
- match2 ? Math.max(
1574
- 0,
1575
- (match2[1] ? match2[1].length : 0) - (match2[2] ? +match2[2] : 0)
1576
- ) : 0
1577
- );
1578
- }
1579
- }
1580
- }
1581
- }
1582
- limit(value) {
1459
+ constructor(min, max, unit, decimals, step, start, writable) {
1460
+ super(writable);
1461
+ if (min) this.min = min;
1462
+ if (max) this.max = max;
1463
+ if (unit) this.unit = unit;
1464
+ if (step) this.step = step;
1465
+ if (start) this.start = start;
1466
+ if (decimals) this.decimals = decimals;
1467
+ }
1468
+ async limit(value) {
1469
+ const [min, max, step, start, decimals] = await Promise.all([
1470
+ this.min,
1471
+ this.max,
1472
+ this.step,
1473
+ this.start,
1474
+ this.decimals
1475
+ ]);
1583
1476
  return ok5(
1584
1477
  Math.min(
1585
- this.max ?? Infinity,
1478
+ max?.unwrap_or(Infinity) ?? Infinity,
1586
1479
  Math.max(
1587
- this.min ?? -Infinity,
1480
+ min?.unwrap_or(-Infinity) ?? -Infinity,
1588
1481
  number_step_start_decimal(
1589
1482
  value,
1590
- this.step,
1591
- this.start,
1592
- this.decimals
1483
+ step?.unwrap_or(void 0),
1484
+ start?.unwrap_or(void 0),
1485
+ decimals?.unwrap_or(void 0)
1593
1486
  )
1594
1487
  )
1595
1488
  )
1596
1489
  );
1597
1490
  }
1598
- check(value) {
1599
- if (this.max !== void 0 && value > this.max)
1600
- return err6(value + " is bigger than the limit of " + this.max);
1601
- if (this.min !== void 0 && value < this.min)
1602
- return err6(value + " is smaller than the limit of " + this.min);
1491
+ async check(value) {
1492
+ const [min, max] = await Promise.all([this.min, this.max]);
1493
+ if (max?.ok && value > max.value)
1494
+ return err6(value + " is bigger than the limit of " + max.value);
1495
+ if (min?.ok && value < min.value)
1496
+ return err6(value + " is smaller than the limit of " + min.value);
1603
1497
  return ok5(value);
1604
1498
  }
1605
1499
  related() {
@@ -1614,37 +1508,53 @@ var nums = {
1614
1508
  * @param decimals number of suggested decimals to show
1615
1509
  * @param step allowed step size for number 0.1 allows 0,0.1,0.2,0.3...
1616
1510
  * @param start start offset for step, 0.5 and step 2 allows 0.5,2.5,4.5,6.5*/
1617
- helper(min, max, unit, decimals, step, start) {
1618
- return new StateNumberHelper(min, max, unit, decimals, step, start);
1511
+ helper(min, max, unit, decimals, step, start, writable) {
1512
+ return new StateNumberHelper(
1513
+ min,
1514
+ max,
1515
+ unit,
1516
+ decimals,
1517
+ step,
1518
+ start,
1519
+ writable
1520
+ );
1619
1521
  }
1620
1522
  };
1621
- var StateStringHelper = class {
1523
+ var StateStringHelper = class extends StateHelper {
1622
1524
  max_length;
1623
1525
  max_length_bytes;
1624
- constructor(max_length, max_length_bytes) {
1625
- if (max_length !== void 0) this.max_length = max_length;
1626
- if (max_length_bytes !== void 0)
1627
- this.max_length_bytes = max_length_bytes;
1628
- }
1629
- limit(value) {
1630
- if (this.max_length && value.length > this.max_length)
1631
- value = value.slice(0, this.max_length);
1632
- if (this.max_length_bytes) {
1526
+ constructor(max_length, max_length_bytes, writable) {
1527
+ super(writable);
1528
+ if (max_length) this.max_length = max_length;
1529
+ if (max_length_bytes) this.max_length_bytes = max_length_bytes;
1530
+ }
1531
+ async limit(value) {
1532
+ const [max_length, max_length_bytes] = await Promise.all([
1533
+ this.max_length,
1534
+ this.max_length_bytes
1535
+ ]);
1536
+ if (max_length?.ok && value.length > max_length.value)
1537
+ value = value.slice(0, max_length.value);
1538
+ if (max_length_bytes?.ok) {
1633
1539
  value = new TextDecoder().decode(
1634
- new TextEncoder().encode(value).slice(0, this.max_length_bytes)
1540
+ new TextEncoder().encode(value).slice(0, max_length_bytes.value)
1635
1541
  );
1636
1542
  if (value.at(-1)?.charCodeAt(0) === 65533) value = value.slice(0, -1);
1637
1543
  }
1638
1544
  return ok5(value);
1639
1545
  }
1640
- check(value) {
1641
- if (this.max_length !== void 0 && value.length > this.max_length)
1546
+ async check(value) {
1547
+ const [max_length, max_length_bytes] = await Promise.all([
1548
+ this.max_length,
1549
+ this.max_length_bytes
1550
+ ]);
1551
+ if (max_length?.ok && value.length > max_length.value)
1642
1552
  return err6(
1643
- "the text is longer than the limit of " + this.max_length + " characters"
1553
+ "the text is longer than the limit of " + max_length.value + " characters"
1644
1554
  );
1645
- if (this.max_length_bytes !== void 0 && new TextEncoder().encode(value).length > this.max_length_bytes)
1555
+ if (max_length_bytes?.ok && new TextEncoder().encode(value).length > max_length_bytes.value)
1646
1556
  return err6(
1647
- "the text is longer than the limit of " + this.max_length_bytes + " bytes"
1557
+ "the text is longer than the limit of " + max_length_bytes.value + " bytes"
1648
1558
  );
1649
1559
  return ok5(value);
1650
1560
  }
@@ -1656,25 +1566,30 @@ var strings = {
1656
1566
  /**String limiter struct
1657
1567
  * @param max_length max length for string
1658
1568
  * @param max_length_bytes max byte length for string*/
1659
- helper(max_length, max_length_bytes) {
1660
- return new StateStringHelper(max_length, max_length_bytes);
1569
+ helper(max_length, max_length_bytes, writable) {
1570
+ return new StateStringHelper(max_length, max_length_bytes, writable);
1661
1571
  }
1662
1572
  };
1663
- var StateEnumHelper = class {
1573
+ var StateEnumHelper = class extends StateHelper {
1664
1574
  list;
1665
- constructor(list) {
1575
+ constructor(list, writable) {
1576
+ super(writable);
1666
1577
  this.list = list;
1667
1578
  }
1668
- map(func) {
1669
- return Object.keys(this.list).map(
1670
- (key) => func(key, this.list[key])
1579
+ async map(func) {
1580
+ const list = await this.list;
1581
+ if (list.err) return [];
1582
+ return Object.keys(list.value).map(
1583
+ (key) => func(key, list.value[key])
1671
1584
  );
1672
1585
  }
1673
- limit(value) {
1586
+ async limit(value) {
1674
1587
  return ok5(value);
1675
1588
  }
1676
- check(value) {
1677
- if (value in this.list) return ok5(value);
1589
+ async check(value) {
1590
+ const list = await this.list;
1591
+ if (list.err) return err6("list is not available");
1592
+ if (value in list.value) return ok5(value);
1678
1593
  return err6(String(value) + " is not in list");
1679
1594
  }
1680
1595
  related() {
@@ -1683,8 +1598,8 @@ var StateEnumHelper = class {
1683
1598
  };
1684
1599
  var enums = {
1685
1600
  /**Creates an enum helper struct, use list method to make a list with correct typing*/
1686
- helper(list) {
1687
- return new StateEnumHelper(list);
1601
+ helper(list, writable) {
1602
+ return new StateEnumHelper(list, writable);
1688
1603
  },
1689
1604
  /**Creates an enum description list, passing the enum as a generic type to this function makes things look a bit nicer */
1690
1605
  list(list) {
@@ -1730,29 +1645,17 @@ var is = {
1730
1645
  ros(s) {
1731
1646
  return s instanceof StateBase && s.rsync && s.rok;
1732
1647
  },
1733
- rea_wa(s) {
1648
+ reaw(s) {
1734
1649
  return s instanceof StateBase && s.writable;
1735
1650
  },
1736
- rea_ws(s) {
1737
- return s instanceof StateBase && s.writable && s.wsync;
1738
- },
1739
- roa_wa(s) {
1651
+ roaw(s) {
1740
1652
  return s instanceof StateBase && s.writable && s.rok;
1741
1653
  },
1742
- roa_ws(s) {
1743
- return s instanceof StateBase && s.writable && s.wsync && s.rok;
1744
- },
1745
- res_wa(s) {
1654
+ resw(s) {
1746
1655
  return s instanceof StateBase && s.writable && s.rsync;
1747
1656
  },
1748
- res_ws(s) {
1749
- return s instanceof StateBase && s.writable && s.wsync && s.rsync;
1750
- },
1751
- ros_wa(s) {
1657
+ rosw(s) {
1752
1658
  return s instanceof StateBase && s.writable && s.rsync && s.rok;
1753
- },
1754
- ros_ws(s) {
1755
- return s instanceof StateBase && s.writable && s.wsync && s.rsync && s.rok;
1756
1659
  }
1757
1660
  };
1758
1661
  var STATE_HELPERS = {
@@ -1777,18 +1680,22 @@ var RXS3 = class extends StateBase {
1777
1680
  if (setter === true)
1778
1681
  this.#setter = (value, state2, old) => {
1779
1682
  if (old && !old.err && value === old.value)
1683
+ return Promise.resolve(ok6(void 0));
1684
+ return this.#helper ? this.#helper.limit(value).then((e) => {
1685
+ if (e.err) return err7(e.error);
1686
+ state2.set_ok(e);
1780
1687
  return ok6(void 0);
1781
- return this.#helper?.limit ? this.#helper?.limit(value).map((e) => state2.set_ok(e)) : ok6(state2.set_ok(value));
1688
+ }) : Promise.resolve(ok6(state2.set_ok(value)));
1782
1689
  };
1783
1690
  else this.#setter = setter;
1784
1691
  if (helper) this.#helper = helper;
1785
1692
  this.get = () => this.#clean() ?? (this.#value = init());
1786
1693
  this.set = (value) => this.set(this.#clean() ?? value);
1787
- const write_sync = this.write_sync.bind(this);
1788
- this.write_sync = (value) => write_sync(value).map((val) => this.#clean() ?? val);
1694
+ const write = this.write.bind(this);
1695
+ this.write = (value) => write(value).then((val) => val.map((valu) => this.#clean() ?? valu));
1789
1696
  }
1790
1697
  #clean() {
1791
- ["get", "set", "write_sync"].forEach((k) => delete this[k]);
1698
+ ["get", "set", "write"].forEach((k) => delete this[k]);
1792
1699
  }
1793
1700
  #value;
1794
1701
  #setter;
@@ -1841,26 +1748,20 @@ var RXS3 = class extends StateBase {
1841
1748
  get writable() {
1842
1749
  return this.#setter !== void 0;
1843
1750
  }
1844
- get wsync() {
1845
- return this.writable;
1846
- }
1847
- async write(value) {
1848
- return this.write_sync(value);
1849
- }
1850
- write_sync(value) {
1751
+ write(value) {
1851
1752
  if (this.#setter)
1852
1753
  return this.#setter(
1853
1754
  value,
1854
1755
  this,
1855
1756
  this.#value
1856
1757
  );
1857
- return err7("State not writable");
1758
+ return Promise.resolve(err7("not writable"));
1858
1759
  }
1859
1760
  limit(value) {
1860
- return this.#helper?.limit ? this.#helper.limit(value) : ok6(value);
1761
+ return this.#helper?.limit ? this.#helper.limit(value) : Promise.resolve(ok6(value));
1861
1762
  }
1862
1763
  check(value) {
1863
- return this.#helper?.check ? this.#helper.check(value) : ok6(value);
1764
+ return this.#helper?.check ? this.#helper.check(value) : Promise.resolve(ok6(value));
1864
1765
  }
1865
1766
  };
1866
1767
  var ros2 = {
@@ -1977,7 +1878,8 @@ var STATE_LAZY = {
1977
1878
  // src/proxy/rea.ts
1978
1879
  import {
1979
1880
  err as err8,
1980
- none as none9
1881
+ none as none9,
1882
+ ok as ok7
1981
1883
  } from "@chocbite/ts-lib-result";
1982
1884
  var REA2 = class extends StateBase {
1983
1885
  constructor(state2, transform_read) {
@@ -1994,7 +1896,8 @@ var REA2 = class extends StateBase {
1994
1896
  transform_read(value) {
1995
1897
  return value;
1996
1898
  }
1997
- transform_write;
1899
+ transform_wout_win;
1900
+ transform_win_wout;
1998
1901
  on_subscribe(run = false) {
1999
1902
  this.#state.sub(this.#subscriber, run);
2000
1903
  }
@@ -2017,8 +1920,9 @@ var REA2 = class extends StateBase {
2017
1920
  this.on_subscribe(true);
2018
1921
  } else this.transform_read = transform;
2019
1922
  }
2020
- set_transform_write(transform) {
2021
- this.transform_write = transform;
1923
+ set_transform_write(wout_win, win_wout) {
1924
+ this.transform_wout_win = wout_win;
1925
+ this.transform_win_wout = win_wout;
2022
1926
  }
2023
1927
  get state() {
2024
1928
  return this;
@@ -2044,35 +1948,50 @@ var REA2 = class extends StateBase {
2044
1948
  get writable() {
2045
1949
  return this.#state.writable;
2046
1950
  }
2047
- get wsync() {
2048
- return this.#state.wsync;
2049
- }
2050
- async write(value) {
2051
- if (!this.#state.write) return err8("State not writable");
2052
- if (!this.transform_write) return err8("State not writable");
2053
- return this.#state.write(this.transform_write(value));
2054
- }
2055
- write_sync(value) {
2056
- if (!this.#state.write_sync) return err8("State not writable");
2057
- if (!this.transform_write) return err8("State not writable");
2058
- return this.#state.write_sync(this.transform_write(value));
2059
- }
2060
- limit(_value) {
2061
- return err8("Limit not supported on proxy states");
2062
- }
2063
- check(_value) {
2064
- return err8("Check not supported on proxy states");
1951
+ write(value) {
1952
+ if (!this.#state.write) return Promise.resolve(err8("not writable"));
1953
+ if (!this.transform_wout_win) return Promise.resolve(err8("not writable"));
1954
+ return this.#state.write(this.transform_wout_win(value));
1955
+ }
1956
+ //@ts-expect-error typescript workaround
1957
+ get limit() {
1958
+ const limit = this.#state.limit;
1959
+ return limit ? (value) => {
1960
+ if (!this.transform_wout_win)
1961
+ return Promise.resolve(err8("not writable"));
1962
+ return limit(this.transform_wout_win(value)).then((res3) => {
1963
+ if (!this.transform_win_wout) return err8("not writable");
1964
+ if (res3.err) return err8(res3.error);
1965
+ return ok7(this.transform_win_wout(res3.value));
1966
+ });
1967
+ } : void 0;
1968
+ }
1969
+ //@ts-expect-error typescript workaround
1970
+ get check() {
1971
+ const check = this.#state.check;
1972
+ return check ? (value) => {
1973
+ if (!this.transform_wout_win)
1974
+ return Promise.resolve(err8("not writable"));
1975
+ return check(this.transform_wout_win(value)).then((res3) => {
1976
+ if (!this.transform_win_wout) return err8("not writable");
1977
+ if (res3.err) return err8(res3.error);
1978
+ return ok7(this.transform_win_wout(res3.value));
1979
+ });
1980
+ } : void 0;
2065
1981
  }
2066
1982
  };
2067
1983
  function rea_from(state2, transform) {
2068
1984
  return new REA2(state2, transform);
2069
1985
  }
2070
- var REAWS = class extends StateBase {
1986
+ var REAW = class extends StateBase {
2071
1987
  constructor(state2, transform_read, transform_write) {
2072
1988
  super();
2073
1989
  this.#state = state2;
2074
1990
  if (transform_read) this.transform_read = transform_read;
2075
- if (transform_write) this.transform_write = transform_write;
1991
+ if (transform_write) {
1992
+ this.transform_wout_win = transform_write.wout_win;
1993
+ this.transform_win_wout = transform_write.win_wout;
1994
+ }
2076
1995
  }
2077
1996
  #state;
2078
1997
  #subscriber = (value) => {
@@ -2083,7 +2002,10 @@ var REAWS = class extends StateBase {
2083
2002
  transform_read(value) {
2084
2003
  return value;
2085
2004
  }
2086
- transform_write(value) {
2005
+ transform_wout_win(value) {
2006
+ return value;
2007
+ }
2008
+ transform_win_wout(value) {
2087
2009
  return value;
2088
2010
  }
2089
2011
  on_subscribe(run = false) {
@@ -2108,8 +2030,9 @@ var REAWS = class extends StateBase {
2108
2030
  this.on_subscribe(true);
2109
2031
  } else this.transform_read = transform;
2110
2032
  }
2111
- set_transform_write(transform) {
2112
- this.transform_write = transform;
2033
+ set_transform_write(wout_win, win_wout) {
2034
+ this.transform_wout_win = wout_win;
2035
+ this.transform_win_wout = win_wout;
2113
2036
  }
2114
2037
  get state() {
2115
2038
  return this;
@@ -2138,35 +2061,53 @@ var REAWS = class extends StateBase {
2138
2061
  get writable() {
2139
2062
  return true;
2140
2063
  }
2141
- get wsync() {
2142
- return true;
2143
- }
2144
2064
  write(value) {
2145
- return this.#state.write(this.transform_write(value));
2146
- }
2147
- write_sync(value) {
2148
- return this.#state.write_sync(this.transform_write(value));
2149
- }
2150
- limit(_value) {
2151
- return err8("Limit not supported on proxy states");
2152
- }
2153
- check(_value) {
2154
- return err8("Check not supported on proxy states");
2065
+ return this.#state.write(this.transform_wout_win(value));
2066
+ }
2067
+ //@ts-expect-error typescript workaround
2068
+ get limit() {
2069
+ const limit = this.#state.limit;
2070
+ return limit ? (value) => {
2071
+ return limit(this.transform_wout_win(value)).then((res3) => {
2072
+ if (res3.err) return err8(res3.error);
2073
+ return ok7(this.transform_win_wout(res3.value));
2074
+ });
2075
+ } : void 0;
2076
+ }
2077
+ //@ts-expect-error typescript workaround
2078
+ get check() {
2079
+ const check = this.#state.check;
2080
+ return check ? (value) => {
2081
+ return check(this.transform_wout_win(value)).then((res3) => {
2082
+ if (res3.err) return err8(res3.error);
2083
+ return ok7(this.transform_win_wout(res3.value));
2084
+ });
2085
+ } : void 0;
2155
2086
  }
2156
2087
  };
2157
- function rea_ws_from(state2, transform_read, transform_write) {
2158
- return new REAWS(
2088
+ function reaw_from(state2, transform_read, transform_write) {
2089
+ return new REAW(
2159
2090
  state2,
2160
2091
  transform_read,
2161
2092
  transform_write
2162
2093
  );
2163
2094
  }
2164
- var REAWA = class extends StateBase {
2165
- constructor(state2, transform_read, transform_write) {
2095
+ var STATE_PROXY_REA = {
2096
+ rea: rea_from,
2097
+ reaw: reaw_from
2098
+ };
2099
+
2100
+ // src/proxy/res.ts
2101
+ import {
2102
+ err as err9,
2103
+ none as none10,
2104
+ ok as ok8
2105
+ } from "@chocbite/ts-lib-result";
2106
+ var RES3 = class extends StateBase {
2107
+ constructor(state2, transform_read) {
2166
2108
  super();
2167
2109
  this.#state = state2;
2168
2110
  if (transform_read) this.transform_read = transform_read;
2169
- if (transform_write) this.transform_write = transform_write;
2170
2111
  }
2171
2112
  #state;
2172
2113
  #subscriber = (value) => {
@@ -2177,9 +2118,8 @@ var REAWA = class extends StateBase {
2177
2118
  transform_read(value) {
2178
2119
  return value;
2179
2120
  }
2180
- transform_write(value) {
2181
- return value;
2182
- }
2121
+ transform_wout_win;
2122
+ transform_win_wout;
2183
2123
  on_subscribe(run = false) {
2184
2124
  this.#state.sub(this.#subscriber, run);
2185
2125
  }
@@ -2202,8 +2142,9 @@ var REAWA = class extends StateBase {
2202
2142
  this.on_subscribe(true);
2203
2143
  } else this.transform_read = transform;
2204
2144
  }
2205
- set_transform_write(transform) {
2206
- this.transform_write = transform;
2145
+ set_transform_write(wout_win, win_wout) {
2146
+ this.transform_wout_win = wout_win;
2147
+ this.transform_win_wout = win_wout;
2207
2148
  }
2208
2149
  get state() {
2209
2150
  return this;
@@ -2211,63 +2152,71 @@ var REAWA = class extends StateBase {
2211
2152
  get read_only() {
2212
2153
  return this;
2213
2154
  }
2214
- get read_write() {
2215
- return this;
2216
- }
2217
2155
  //#Reader Context
2218
2156
  get rok() {
2219
2157
  return this.#state.rok;
2220
2158
  }
2221
2159
  get rsync() {
2222
- return this.#state.rsync;
2160
+ return true;
2223
2161
  }
2224
2162
  async then(func) {
2225
- if (this.#buffer) return func(this.#buffer);
2226
- return func(this.transform_read(await this.#state));
2163
+ return func(this.get());
2164
+ }
2165
+ get() {
2166
+ if (this.#buffer) return this.#buffer;
2167
+ return this.transform_read(this.#state.get());
2227
2168
  }
2228
2169
  related() {
2229
- return none9();
2170
+ return none10();
2230
2171
  }
2231
2172
  //#Writer Context
2232
2173
  get writable() {
2233
- return true;
2234
- }
2235
- get wsync() {
2236
- return this.#state.wsync;
2174
+ return this.#state.writable;
2237
2175
  }
2238
2176
  write(value) {
2239
- return this.#state.write(this.transform_write(value));
2240
- }
2241
- limit(_value) {
2242
- return err8("Limit not supported on proxy states");
2243
- }
2244
- check(_value) {
2245
- return err8("Check not supported on proxy states");
2177
+ if (!this.#state.write) return Promise.resolve(err9("not writable"));
2178
+ if (!this.transform_wout_win) return Promise.resolve(err9("not writable"));
2179
+ return this.#state.write(this.transform_wout_win(value));
2180
+ }
2181
+ //@ts-expect-error typescript workaround
2182
+ get limit() {
2183
+ const limit = this.#state.limit;
2184
+ return limit ? (value) => {
2185
+ if (!this.transform_wout_win)
2186
+ return Promise.resolve(err9("not writable"));
2187
+ return limit(this.transform_wout_win(value)).then((res3) => {
2188
+ if (!this.transform_win_wout) return err9("not writable");
2189
+ if (res3.err) return err9(res3.error);
2190
+ return ok8(this.transform_win_wout(res3.value));
2191
+ });
2192
+ } : void 0;
2193
+ }
2194
+ //@ts-expect-error typescript workaround
2195
+ get check() {
2196
+ const check = this.#state.check;
2197
+ return check ? (value) => {
2198
+ if (!this.transform_wout_win)
2199
+ return Promise.resolve(err9("not writable"));
2200
+ return check(this.transform_wout_win(value)).then((res3) => {
2201
+ if (!this.transform_win_wout) return err9("not writable");
2202
+ if (res3.err) return err9(res3.error);
2203
+ return ok8(this.transform_win_wout(res3.value));
2204
+ });
2205
+ } : void 0;
2246
2206
  }
2247
2207
  };
2248
- function rea_wa_from(state2, transform_read, transform_write) {
2249
- return new REAWA(
2250
- state2,
2251
- transform_read,
2252
- transform_write
2253
- );
2208
+ function res_from(state2, transform) {
2209
+ return new RES3(state2, transform);
2254
2210
  }
2255
- var STATE_PROXY_REA = {
2256
- rea: rea_from,
2257
- rea_ws: rea_ws_from,
2258
- rea_wa: rea_wa_from
2259
- };
2260
-
2261
- // src/proxy/res.ts
2262
- import {
2263
- err as err9,
2264
- none as none10
2265
- } from "@chocbite/ts-lib-result";
2266
- var RES3 = class extends StateBase {
2267
- constructor(state2, transform_read) {
2211
+ var RESW = class extends StateBase {
2212
+ constructor(state2, transform_read, transform_write) {
2268
2213
  super();
2269
2214
  this.#state = state2;
2270
2215
  if (transform_read) this.transform_read = transform_read;
2216
+ if (transform_write) {
2217
+ this.transform_wout_win = transform_write.wout_win;
2218
+ this.transform_win_wout = transform_write.win_wout;
2219
+ }
2271
2220
  }
2272
2221
  #state;
2273
2222
  #subscriber = (value) => {
@@ -2278,7 +2227,12 @@ var RES3 = class extends StateBase {
2278
2227
  transform_read(value) {
2279
2228
  return value;
2280
2229
  }
2281
- transform_write;
2230
+ transform_wout_win(value) {
2231
+ return value;
2232
+ }
2233
+ transform_win_wout(value) {
2234
+ return value;
2235
+ }
2282
2236
  on_subscribe(run = false) {
2283
2237
  this.#state.sub(this.#subscriber, run);
2284
2238
  }
@@ -2287,6 +2241,7 @@ var RES3 = class extends StateBase {
2287
2241
  this.#buffer = void 0;
2288
2242
  }
2289
2243
  //#Owner Context
2244
+ /**Sets the state that is being proxied, and updates subscribers with new value*/
2290
2245
  set_state(state2) {
2291
2246
  if (this.in_use()) {
2292
2247
  this.on_unsubscribe();
@@ -2301,8 +2256,9 @@ var RES3 = class extends StateBase {
2301
2256
  this.on_subscribe(true);
2302
2257
  } else this.transform_read = transform;
2303
2258
  }
2304
- set_transform_write(transform) {
2305
- this.transform_write = transform;
2259
+ set_transform_write(wout_win, win_wout) {
2260
+ this.transform_wout_win = wout_win;
2261
+ this.transform_win_wout = win_wout;
2306
2262
  }
2307
2263
  get state() {
2308
2264
  return this;
@@ -2310,6 +2266,9 @@ var RES3 = class extends StateBase {
2310
2266
  get read_only() {
2311
2267
  return this;
2312
2268
  }
2269
+ get read_write() {
2270
+ return this;
2271
+ }
2313
2272
  //#Reader Context
2314
2273
  get rok() {
2315
2274
  return this.#state.rok;
@@ -2318,7 +2277,8 @@ var RES3 = class extends StateBase {
2318
2277
  return true;
2319
2278
  }
2320
2279
  async then(func) {
2321
- return func(this.get());
2280
+ if (this.#buffer) return func(this.#buffer);
2281
+ return func(this.transform_read(await this.#state));
2322
2282
  }
2323
2283
  get() {
2324
2284
  if (this.#buffer) return this.#buffer;
@@ -2329,37 +2289,55 @@ var RES3 = class extends StateBase {
2329
2289
  }
2330
2290
  //#Writer Context
2331
2291
  get writable() {
2332
- return this.#state.writable;
2333
- }
2334
- get wsync() {
2335
- return this.#state.wsync;
2336
- }
2337
- async write(value) {
2338
- if (!this.#state.write) return err9("State not writable");
2339
- if (!this.transform_write) return err9("State not writable");
2340
- return this.#state.write(this.transform_write(value));
2341
- }
2342
- write_sync(value) {
2343
- if (!this.#state.write_sync) return err9("State not writable");
2344
- if (!this.transform_write) return err9("State not writable");
2345
- return this.#state.write_sync(this.transform_write(value));
2346
- }
2347
- limit() {
2348
- return err9("Limit not supported on proxy states");
2292
+ return true;
2349
2293
  }
2350
- check() {
2351
- return err9("Check not supported on proxy states");
2294
+ write(value) {
2295
+ return this.#state.write(this.transform_wout_win(value));
2296
+ }
2297
+ //@ts-expect-error typescript workaround
2298
+ get limit() {
2299
+ const limit = this.#state.limit;
2300
+ return limit ? (value) => {
2301
+ return limit(this.transform_wout_win(value)).then((res3) => {
2302
+ if (res3.err) return err9(res3.error);
2303
+ return ok8(this.transform_win_wout(res3.value));
2304
+ });
2305
+ } : void 0;
2306
+ }
2307
+ //@ts-expect-error typescript workaround
2308
+ get check() {
2309
+ const check = this.#state.check;
2310
+ return check ? (value) => {
2311
+ return check(this.transform_wout_win(value)).then((res3) => {
2312
+ if (res3.err) return err9(res3.error);
2313
+ return ok8(this.transform_win_wout(res3.value));
2314
+ });
2315
+ } : void 0;
2352
2316
  }
2353
2317
  };
2354
- function res_from(state2, transform) {
2355
- return new RES3(state2, transform);
2318
+ function resw_from(state2, transform_read, transform_write) {
2319
+ return new RESW(
2320
+ state2,
2321
+ transform_read,
2322
+ transform_write
2323
+ );
2356
2324
  }
2357
- var RESWS = class extends StateBase {
2358
- constructor(state2, transform_read, transform_write) {
2325
+ var STATE_PROXY_RES = {
2326
+ res: res_from,
2327
+ resw: resw_from
2328
+ };
2329
+
2330
+ // src/proxy/roa.ts
2331
+ import {
2332
+ err as err10,
2333
+ none as none11,
2334
+ ok as ok9
2335
+ } from "@chocbite/ts-lib-result";
2336
+ var ROA2 = class extends StateBase {
2337
+ constructor(state2, transform_read) {
2359
2338
  super();
2360
2339
  this.#state = state2;
2361
2340
  if (transform_read) this.transform_read = transform_read;
2362
- if (transform_write) this.transform_write = transform_write;
2363
2341
  }
2364
2342
  #state;
2365
2343
  #subscriber = (value) => {
@@ -2370,9 +2348,8 @@ var RESWS = class extends StateBase {
2370
2348
  transform_read(value) {
2371
2349
  return value;
2372
2350
  }
2373
- transform_write(value) {
2374
- return value;
2375
- }
2351
+ transform_wout_win;
2352
+ transform_win_wout;
2376
2353
  on_subscribe(run = false) {
2377
2354
  this.#state.sub(this.#subscriber, run);
2378
2355
  }
@@ -2381,7 +2358,6 @@ var RESWS = class extends StateBase {
2381
2358
  this.#buffer = void 0;
2382
2359
  }
2383
2360
  //#Owner Context
2384
- /**Sets the state that is being proxied, and updates subscribers with new value*/
2385
2361
  set_state(state2) {
2386
2362
  if (this.in_use()) {
2387
2363
  this.on_unsubscribe();
@@ -2389,7 +2365,6 @@ var RESWS = class extends StateBase {
2389
2365
  this.on_subscribe(true);
2390
2366
  } else this.#state = state2;
2391
2367
  }
2392
- /**Changes the transform function of the proxy, and updates subscribers with new value*/
2393
2368
  set_transform_read(transform) {
2394
2369
  if (this.in_use()) {
2395
2370
  this.on_unsubscribe();
@@ -2397,213 +2372,9 @@ var RESWS = class extends StateBase {
2397
2372
  this.on_subscribe(true);
2398
2373
  } else this.transform_read = transform;
2399
2374
  }
2400
- /**Changes the transform function of the proxy, and updates subscribers with new value*/
2401
- set_transform_write(transform) {
2402
- this.transform_write = transform;
2403
- }
2404
- get state() {
2405
- return this;
2406
- }
2407
- get read_only() {
2408
- return this;
2409
- }
2410
- get read_write() {
2411
- return this;
2412
- }
2413
- //#Reader Context
2414
- get rok() {
2415
- return this.#state.rok;
2416
- }
2417
- get rsync() {
2418
- return true;
2419
- }
2420
- async then(func) {
2421
- if (this.#buffer) return func(this.#buffer);
2422
- return func(this.transform_read(await this.#state));
2423
- }
2424
- get() {
2425
- if (this.#buffer) return this.#buffer;
2426
- return this.transform_read(this.#state.get());
2427
- }
2428
- related() {
2429
- return none10();
2430
- }
2431
- //#Writer Context
2432
- get writable() {
2433
- return true;
2434
- }
2435
- get wsync() {
2436
- return true;
2437
- }
2438
- write(value) {
2439
- return this.#state.write(this.transform_write(value));
2440
- }
2441
- write_sync(value) {
2442
- return this.#state.write_sync(this.transform_write(value));
2443
- }
2444
- limit() {
2445
- return err9("Limit not supported on proxy states");
2446
- }
2447
- check() {
2448
- return err9("Check not supported on proxy states");
2449
- }
2450
- };
2451
- function res_ws_from(state2, transform_read, transform_write) {
2452
- return new RESWS(
2453
- state2,
2454
- transform_read,
2455
- transform_write
2456
- );
2457
- }
2458
- var RESWA = class extends StateBase {
2459
- constructor(state2, transform_read, transform_write) {
2460
- super();
2461
- this.#state = state2;
2462
- if (transform_read) this.transform_read = transform_read;
2463
- if (transform_write) this.transform_write = transform_write;
2464
- }
2465
- #state;
2466
- #subscriber = (value) => {
2467
- this.#buffer = this.transform_read(value);
2468
- this.update_subs(this.#buffer);
2469
- };
2470
- #buffer;
2471
- transform_read(value) {
2472
- return value;
2473
- }
2474
- transform_write(value) {
2475
- return value;
2476
- }
2477
- on_subscribe(run = false) {
2478
- this.#state.sub(this.#subscriber, run);
2479
- }
2480
- on_unsubscribe() {
2481
- this.#state.unsub(this.#subscriber);
2482
- this.#buffer = void 0;
2483
- }
2484
- //#Owner Context
2485
- /**Sets the state that is being proxied, and updates subscribers with new value*/
2486
- set_state(state2) {
2487
- if (this.in_use()) {
2488
- this.on_unsubscribe();
2489
- this.#state = state2;
2490
- this.on_subscribe(true);
2491
- } else this.#state = state2;
2492
- }
2493
- /**Changes the transform function of the proxy, and updates subscribers with new value*/
2494
- set_transform_read(transform) {
2495
- if (this.in_use()) {
2496
- this.on_unsubscribe();
2497
- this.transform_read = transform;
2498
- this.on_subscribe(true);
2499
- } else this.transform_read = transform;
2500
- }
2501
- /**Changes the transform function of the proxy, and updates subscribers with new value*/
2502
- set_transform_write(transform) {
2503
- this.transform_write = transform;
2504
- }
2505
- get state() {
2506
- return this;
2507
- }
2508
- get read_only() {
2509
- return this;
2510
- }
2511
- get read_write() {
2512
- return this;
2513
- }
2514
- //#Reader Context
2515
- get rok() {
2516
- return this.#state.rok;
2517
- }
2518
- get rsync() {
2519
- return true;
2520
- }
2521
- async then(func) {
2522
- if (this.#buffer) return func(this.#buffer);
2523
- return func(this.transform_read(await this.#state));
2524
- }
2525
- get() {
2526
- if (this.#buffer) return this.#buffer;
2527
- return this.transform_read(this.#state.get());
2528
- }
2529
- related() {
2530
- return none10();
2531
- }
2532
- //#Writer Context
2533
- get writable() {
2534
- return true;
2535
- }
2536
- get wsync() {
2537
- return this.#state.wsync;
2538
- }
2539
- write(value) {
2540
- return this.#state.write(this.transform_write(value));
2541
- }
2542
- limit() {
2543
- return err9("Limit not supported on proxy states");
2544
- }
2545
- check() {
2546
- return err9("Check not supported on proxy states");
2547
- }
2548
- };
2549
- function res_wa_from(state2, transform_read, transform_write) {
2550
- return new RESWA(
2551
- state2,
2552
- transform_read,
2553
- transform_write
2554
- );
2555
- }
2556
- var STATE_PROXY_RES = {
2557
- res: res_from,
2558
- res_ws: res_ws_from,
2559
- res_wa: res_wa_from
2560
- };
2561
-
2562
- // src/proxy/roa.ts
2563
- import {
2564
- err as err10,
2565
- none as none11
2566
- } from "@chocbite/ts-lib-result";
2567
- var ROA2 = class extends StateBase {
2568
- constructor(state2, transform_read) {
2569
- super();
2570
- this.#state = state2;
2571
- if (transform_read) this.transform_read = transform_read;
2572
- }
2573
- #state;
2574
- #subscriber = (value) => {
2575
- this.#buffer = this.transform_read(value);
2576
- this.update_subs(this.#buffer);
2577
- };
2578
- #buffer;
2579
- transform_read(value) {
2580
- return value;
2581
- }
2582
- transform_write;
2583
- on_subscribe(run = false) {
2584
- this.#state.sub(this.#subscriber, run);
2585
- }
2586
- on_unsubscribe() {
2587
- this.#state.unsub(this.#subscriber);
2588
- this.#buffer = void 0;
2589
- }
2590
- //#Owner Context
2591
- set_state(state2) {
2592
- if (this.in_use()) {
2593
- this.on_unsubscribe();
2594
- this.#state = state2;
2595
- this.on_subscribe(true);
2596
- } else this.#state = state2;
2597
- }
2598
- set_transform_read(transform) {
2599
- if (this.in_use()) {
2600
- this.on_unsubscribe();
2601
- this.transform_read = transform;
2602
- this.on_subscribe(true);
2603
- } else this.transform_read = transform;
2604
- }
2605
- set_transform_write(transform) {
2606
- this.transform_write = transform;
2375
+ set_transform_write(wout_win, win_wout) {
2376
+ this.transform_wout_win = wout_win;
2377
+ this.transform_win_wout = win_wout;
2607
2378
  }
2608
2379
  get state() {
2609
2380
  return this;
@@ -2629,35 +2400,50 @@ var ROA2 = class extends StateBase {
2629
2400
  get writable() {
2630
2401
  return this.#state.writable;
2631
2402
  }
2632
- get wsync() {
2633
- return this.#state.wsync;
2634
- }
2635
- async write(value) {
2636
- if (!this.#state.write) return err10("State not writable");
2637
- if (!this.transform_write) return err10("State not writable");
2638
- return this.#state.write(this.transform_write(value));
2639
- }
2640
- write_sync(value) {
2641
- if (!this.#state.write_sync) return err10("State not writable");
2642
- if (!this.transform_write) return err10("State not writable");
2643
- return this.#state.write_sync(this.transform_write(value));
2644
- }
2645
- limit(_value) {
2646
- return err10("Limit not supported on proxy states");
2647
- }
2648
- check(_value) {
2649
- return err10("Check not supported on proxy states");
2403
+ write(value) {
2404
+ if (!this.#state.write) return Promise.resolve(err10("not writable"));
2405
+ if (!this.transform_wout_win) return Promise.resolve(err10("not writable"));
2406
+ return this.#state.write(this.transform_wout_win(value));
2407
+ }
2408
+ //@ts-expect-error typescript workaround
2409
+ get limit() {
2410
+ const limit = this.#state.limit;
2411
+ return limit ? (value) => {
2412
+ if (!this.transform_wout_win)
2413
+ return Promise.resolve(err10("not writable"));
2414
+ return limit(this.transform_wout_win(value)).then((res3) => {
2415
+ if (!this.transform_win_wout) return err10("not writable");
2416
+ if (res3.err) return err10(res3.error);
2417
+ return ok9(this.transform_win_wout(res3.value));
2418
+ });
2419
+ } : void 0;
2420
+ }
2421
+ //@ts-expect-error typescript workaround
2422
+ get check() {
2423
+ const check = this.#state.check;
2424
+ return check ? (value) => {
2425
+ if (!this.transform_wout_win)
2426
+ return Promise.resolve(err10("not writable"));
2427
+ return check(this.transform_wout_win(value)).then((res3) => {
2428
+ if (!this.transform_win_wout) return err10("not writable");
2429
+ if (res3.err) return err10(res3.error);
2430
+ return ok9(this.transform_win_wout(res3.value));
2431
+ });
2432
+ } : void 0;
2650
2433
  }
2651
2434
  };
2652
2435
  function roa_from(state2, transform) {
2653
2436
  return new ROA2(state2, transform);
2654
2437
  }
2655
- var ROAWS = class extends StateBase {
2438
+ var ROAW = class extends StateBase {
2656
2439
  constructor(state2, transform_read, transform_write) {
2657
2440
  super();
2658
2441
  this.#state = state2;
2659
2442
  if (transform_read) this.transform_read = transform_read;
2660
- if (transform_write) this.transform_write = transform_write;
2443
+ if (transform_write) {
2444
+ this.transform_wout_win = transform_write.wout_win;
2445
+ this.transform_win_wout = transform_write.win_wout;
2446
+ }
2661
2447
  }
2662
2448
  #state;
2663
2449
  #subscriber = (value) => {
@@ -2668,101 +2454,10 @@ var ROAWS = class extends StateBase {
2668
2454
  transform_read(value) {
2669
2455
  return value;
2670
2456
  }
2671
- transform_write(value) {
2457
+ transform_wout_win(value) {
2672
2458
  return value;
2673
2459
  }
2674
- on_subscribe(run = false) {
2675
- this.#state.sub(this.#subscriber, run);
2676
- }
2677
- on_unsubscribe() {
2678
- this.#state.unsub(this.#subscriber);
2679
- this.#buffer = void 0;
2680
- }
2681
- //#Owner Context
2682
- set_state(state2) {
2683
- if (this.in_use()) {
2684
- this.on_unsubscribe();
2685
- this.#state = state2;
2686
- this.on_subscribe(true);
2687
- } else this.#state = state2;
2688
- }
2689
- set_transform_read(transform) {
2690
- if (this.in_use()) {
2691
- this.on_unsubscribe();
2692
- this.transform_read = transform;
2693
- this.on_subscribe(true);
2694
- } else this.transform_read = transform;
2695
- }
2696
- set_transform_write(transform) {
2697
- this.transform_write = transform;
2698
- }
2699
- get state() {
2700
- return this;
2701
- }
2702
- get read_only() {
2703
- return this;
2704
- }
2705
- get read_write() {
2706
- return this;
2707
- }
2708
- //#Reader Context
2709
- get rok() {
2710
- return true;
2711
- }
2712
- get rsync() {
2713
- return this.#state.rsync;
2714
- }
2715
- async then(func) {
2716
- if (this.#buffer) return func(this.#buffer);
2717
- return func(this.transform_read(await this.#state));
2718
- }
2719
- related() {
2720
- return none11();
2721
- }
2722
- //#Writer Context
2723
- get writable() {
2724
- return true;
2725
- }
2726
- get wsync() {
2727
- return true;
2728
- }
2729
- write(value) {
2730
- return this.#state.write(this.transform_write(value));
2731
- }
2732
- write_sync(value) {
2733
- return this.#state.write_sync(this.transform_write(value));
2734
- }
2735
- limit(_value) {
2736
- return err10("Limit not supported on proxy states");
2737
- }
2738
- check(_value) {
2739
- return err10("Check not supported on proxy states");
2740
- }
2741
- };
2742
- function roa_ws_from(state2, transform_read, transform_write) {
2743
- return new ROAWS(
2744
- state2,
2745
- transform_read,
2746
- transform_write
2747
- );
2748
- }
2749
- var ROAWA = class extends StateBase {
2750
- constructor(state2, transform_read, transform_write) {
2751
- super();
2752
- this.#state = state2;
2753
- if (transform_read) this.transform_read = transform_read;
2754
- if (transform_write) this.transform_write = transform_write;
2755
- }
2756
- #state;
2757
- #subscriber = (value) => {
2758
- this.#buffer = this.transform_read(value);
2759
- this.update_subs(this.#buffer);
2760
- };
2761
- #buffer;
2762
- transform_read(value) {
2763
- return value;
2764
- }
2765
- transform_write(value) {
2460
+ transform_win_wout(value) {
2766
2461
  return value;
2767
2462
  }
2768
2463
  on_subscribe(run = false) {
@@ -2787,8 +2482,9 @@ var ROAWA = class extends StateBase {
2787
2482
  this.on_subscribe(true);
2788
2483
  } else this.transform_read = transform;
2789
2484
  }
2790
- set_transform_write(transform) {
2791
- this.transform_write = transform;
2485
+ set_transform_write(wout_win, win_wout) {
2486
+ this.transform_wout_win = wout_win;
2487
+ this.transform_win_wout = win_wout;
2792
2488
  }
2793
2489
  get state() {
2794
2490
  return this;
@@ -2817,21 +2513,32 @@ var ROAWA = class extends StateBase {
2817
2513
  get writable() {
2818
2514
  return true;
2819
2515
  }
2820
- get wsync() {
2821
- return this.#state.wsync;
2822
- }
2823
2516
  write(value) {
2824
- return this.#state.write(this.transform_write(value));
2825
- }
2826
- limit(_value) {
2827
- return err10("Limit not supported on proxy states");
2828
- }
2829
- check(_value) {
2830
- return err10("Check not supported on proxy states");
2517
+ return this.#state.write(this.transform_wout_win(value));
2518
+ }
2519
+ //@ts-expect-error typescript workaround
2520
+ get limit() {
2521
+ const limit = this.#state.limit;
2522
+ return limit ? (value) => {
2523
+ return limit(this.transform_wout_win(value)).then((res3) => {
2524
+ if (res3.err) return err10(res3.error);
2525
+ return ok9(this.transform_win_wout(res3.value));
2526
+ });
2527
+ } : void 0;
2528
+ }
2529
+ //@ts-expect-error typescript workaround
2530
+ get check() {
2531
+ const check = this.#state.check;
2532
+ return check ? (value) => {
2533
+ return check(this.transform_wout_win(value)).then((res3) => {
2534
+ if (res3.err) return err10(res3.error);
2535
+ return ok9(this.transform_win_wout(res3.value));
2536
+ });
2537
+ } : void 0;
2831
2538
  }
2832
2539
  };
2833
- function roa_wa_from(state2, transform_read, transform_write) {
2834
- return new ROAWA(
2540
+ function roaw_from(state2, transform_read, transform_write) {
2541
+ return new ROAW(
2835
2542
  state2,
2836
2543
  transform_read,
2837
2544
  transform_write
@@ -2839,14 +2546,14 @@ function roa_wa_from(state2, transform_read, transform_write) {
2839
2546
  }
2840
2547
  var STATE_PROXY_ROA = {
2841
2548
  roa: roa_from,
2842
- roa_ws: roa_ws_from,
2843
- roa_wa: roa_wa_from
2549
+ roaw: roaw_from
2844
2550
  };
2845
2551
 
2846
2552
  // src/proxy/ros.ts
2847
2553
  import {
2848
2554
  err as err11,
2849
- none as none12
2555
+ none as none12,
2556
+ ok as ok10
2850
2557
  } from "@chocbite/ts-lib-result";
2851
2558
  var ROS3 = class extends StateBase {
2852
2559
  constructor(state2, transform_read) {
@@ -2863,7 +2570,8 @@ var ROS3 = class extends StateBase {
2863
2570
  transform_read(value) {
2864
2571
  return value;
2865
2572
  }
2866
- transform_write;
2573
+ transform_wout_win;
2574
+ transform_win_wout;
2867
2575
  on_subscribe(run = false) {
2868
2576
  this.#state.sub(this.#subscriber, run);
2869
2577
  }
@@ -2886,8 +2594,9 @@ var ROS3 = class extends StateBase {
2886
2594
  this.on_subscribe(true);
2887
2595
  } else this.transform_read = transform;
2888
2596
  }
2889
- set_transform_write(transform) {
2890
- this.transform_write = transform;
2597
+ set_transform_write(wout_win, win_wout) {
2598
+ this.transform_wout_win = wout_win;
2599
+ this.transform_win_wout = win_wout;
2891
2600
  }
2892
2601
  get state() {
2893
2602
  return this;
@@ -2919,35 +2628,50 @@ var ROS3 = class extends StateBase {
2919
2628
  get writable() {
2920
2629
  return this.#state.writable;
2921
2630
  }
2922
- get wsync() {
2923
- return this.#state.wsync;
2924
- }
2925
- async write(value) {
2926
- if (!this.#state.write) return err11("State not writable");
2927
- if (!this.transform_write) return err11("State not writable");
2928
- return this.#state.write(this.transform_write(value));
2929
- }
2930
- write_sync(value) {
2931
- if (!this.#state.write_sync) return err11("State not writable");
2932
- if (!this.transform_write) return err11("State not writable");
2933
- return this.#state.write_sync(this.transform_write(value));
2934
- }
2935
- limit(_value) {
2936
- return err11("Limit not supported on proxy states");
2937
- }
2938
- check(_value) {
2939
- return err11("Check not supported on proxy states");
2631
+ write(value) {
2632
+ if (!this.#state.write) return Promise.resolve(err11("not writable"));
2633
+ if (!this.transform_wout_win) return Promise.resolve(err11("not writable"));
2634
+ return this.#state.write(this.transform_wout_win(value));
2635
+ }
2636
+ //@ts-expect-error typescript workaround
2637
+ get limit() {
2638
+ const limit = this.#state.limit;
2639
+ return limit ? (value) => {
2640
+ if (!this.transform_wout_win)
2641
+ return Promise.resolve(err11("not writable"));
2642
+ return limit(this.transform_wout_win(value)).then((res3) => {
2643
+ if (!this.transform_win_wout) return err11("not writable");
2644
+ if (res3.err) return err11(res3.error);
2645
+ return ok10(this.transform_win_wout(res3.value));
2646
+ });
2647
+ } : void 0;
2648
+ }
2649
+ //@ts-expect-error typescript workaround
2650
+ get check() {
2651
+ const check = this.#state.check;
2652
+ return check ? (value) => {
2653
+ if (!this.transform_wout_win)
2654
+ return Promise.resolve(err11("not writable"));
2655
+ return check(this.transform_wout_win(value)).then((res3) => {
2656
+ if (!this.transform_win_wout) return err11("not writable");
2657
+ if (res3.err) return err11(res3.error);
2658
+ return ok10(this.transform_win_wout(res3.value));
2659
+ });
2660
+ } : void 0;
2940
2661
  }
2941
2662
  };
2942
2663
  function ros_from(state2, transform) {
2943
2664
  return new ROS3(state2, transform);
2944
2665
  }
2945
- var ROSWS = class extends StateBase {
2666
+ var ROSW = class extends StateBase {
2946
2667
  constructor(state2, transform_read, transform_write) {
2947
2668
  super();
2948
2669
  this.#state = state2;
2949
2670
  if (transform_read) this.transform_read = transform_read;
2950
- if (transform_write) this.transform_write = transform_write;
2671
+ if (transform_write) {
2672
+ this.transform_wout_win = transform_write.wout_win;
2673
+ this.transform_win_wout = transform_write.win_wout;
2674
+ }
2951
2675
  }
2952
2676
  #state;
2953
2677
  #subscriber = (value) => {
@@ -2958,108 +2682,10 @@ var ROSWS = class extends StateBase {
2958
2682
  transform_read(value) {
2959
2683
  return value;
2960
2684
  }
2961
- transform_write(value) {
2685
+ transform_wout_win(value) {
2962
2686
  return value;
2963
2687
  }
2964
- on_subscribe(run = false) {
2965
- this.#state.sub(this.#subscriber, run);
2966
- }
2967
- on_unsubscribe() {
2968
- this.#state.unsub(this.#subscriber);
2969
- this.#buffer = void 0;
2970
- }
2971
- //#Owner Context
2972
- set_state(state2) {
2973
- if (this.in_use()) {
2974
- this.on_unsubscribe();
2975
- this.#state = state2;
2976
- this.on_subscribe(true);
2977
- } else this.#state = state2;
2978
- }
2979
- set_transform_read(transform) {
2980
- if (this.in_use()) {
2981
- this.on_unsubscribe();
2982
- this.transform_read = transform;
2983
- this.on_subscribe(true);
2984
- } else this.transform_read = transform;
2985
- }
2986
- set_transform_write(transform) {
2987
- this.transform_write = transform;
2988
- }
2989
- get state() {
2990
- return this;
2991
- }
2992
- get read_only() {
2993
- return this;
2994
- }
2995
- get read_write() {
2996
- return this;
2997
- }
2998
- //#Reader Context
2999
- get rok() {
3000
- return true;
3001
- }
3002
- get rsync() {
3003
- return true;
3004
- }
3005
- async then(func) {
3006
- if (this.#buffer) return func(this.#buffer);
3007
- return func(this.transform_read(await this.#state));
3008
- }
3009
- get() {
3010
- if (this.#buffer) return this.#buffer;
3011
- return this.transform_read(this.#state.get());
3012
- }
3013
- ok() {
3014
- return this.get().value;
3015
- }
3016
- related() {
3017
- return none12();
3018
- }
3019
- //#Writer Context
3020
- get writable() {
3021
- return true;
3022
- }
3023
- get wsync() {
3024
- return true;
3025
- }
3026
- write(value) {
3027
- return this.#state.write(this.transform_write(value));
3028
- }
3029
- write_sync(value) {
3030
- return this.#state.write_sync(this.transform_write(value));
3031
- }
3032
- limit(_value) {
3033
- return err11("Limit not supported on proxy states");
3034
- }
3035
- check(_value) {
3036
- return err11("Check not supported on proxy states");
3037
- }
3038
- };
3039
- function ros_ws_from(state2, transform_read, transform_write) {
3040
- return new ROSWS(
3041
- state2,
3042
- transform_read,
3043
- transform_write
3044
- );
3045
- }
3046
- var ROSWA = class extends StateBase {
3047
- constructor(state2, transform_read, transform_write) {
3048
- super();
3049
- this.#state = state2;
3050
- if (transform_read) this.transform_read = transform_read;
3051
- if (transform_write) this.transform_write = transform_write;
3052
- }
3053
- #state;
3054
- #subscriber = (value) => {
3055
- this.#buffer = this.transform_read(value);
3056
- this.update_subs(this.#buffer);
3057
- };
3058
- #buffer;
3059
- transform_read(value) {
3060
- return value;
3061
- }
3062
- transform_write(value) {
2688
+ transform_win_wout(value) {
3063
2689
  return value;
3064
2690
  }
3065
2691
  on_subscribe(run = false) {
@@ -3084,8 +2710,9 @@ var ROSWA = class extends StateBase {
3084
2710
  this.on_subscribe(true);
3085
2711
  } else this.transform_read = transform;
3086
2712
  }
3087
- set_transform_write(transform) {
3088
- this.transform_write = transform;
2713
+ set_transform_write(wout_win, win_wout) {
2714
+ this.transform_wout_win = wout_win;
2715
+ this.transform_win_wout = win_wout;
3089
2716
  }
3090
2717
  get state() {
3091
2718
  return this;
@@ -3121,21 +2748,32 @@ var ROSWA = class extends StateBase {
3121
2748
  get writable() {
3122
2749
  return true;
3123
2750
  }
3124
- get wsync() {
3125
- return this.#state.wsync;
3126
- }
3127
2751
  write(value) {
3128
- return this.#state.write(this.transform_write(value));
3129
- }
3130
- limit(_value) {
3131
- return err11("Limit not supported on proxy states");
3132
- }
3133
- check(_value) {
3134
- return err11("Check not supported on proxy states");
2752
+ return this.#state.write(this.transform_wout_win(value));
2753
+ }
2754
+ //@ts-expect-error typescript workaround
2755
+ get limit() {
2756
+ const limit = this.#state.limit;
2757
+ return limit ? (value) => {
2758
+ return limit(this.transform_wout_win(value)).then((res3) => {
2759
+ if (res3.err) return err11(res3.error);
2760
+ return ok10(this.transform_win_wout(res3.value));
2761
+ });
2762
+ } : void 0;
2763
+ }
2764
+ //@ts-expect-error typescript workaround
2765
+ get check() {
2766
+ const check = this.#state.check;
2767
+ return check ? (value) => {
2768
+ return check(this.transform_wout_win(value)).then((res3) => {
2769
+ if (res3.err) return err11(res3.error);
2770
+ return ok10(this.transform_win_wout(res3.value));
2771
+ });
2772
+ } : void 0;
3135
2773
  }
3136
2774
  };
3137
- function ros_wa_from(state2, transform_read, transform_write) {
3138
- return new ROSWA(
2775
+ function rosw_from(state2, transform_read, transform_write) {
2776
+ return new ROSW(
3139
2777
  state2,
3140
2778
  transform_read,
3141
2779
  transform_write
@@ -3143,15 +2781,14 @@ function ros_wa_from(state2, transform_read, transform_write) {
3143
2781
  }
3144
2782
  var STATE_PROXY_ROS = {
3145
2783
  ros: ros_from,
3146
- ros_ws: ros_ws_from,
3147
- ros_wa: ros_wa_from
2784
+ rosw: rosw_from
3148
2785
  };
3149
2786
 
3150
2787
  // src/resource/rea.ts
3151
2788
  import {
3152
2789
  err as err12,
3153
2790
  none as none13,
3154
- ok as ok7
2791
+ ok as ok11
3155
2792
  } from "@chocbite/ts-lib-result";
3156
2793
  var StateResourceREA = class extends StateBase {
3157
2794
  #valid = 0;
@@ -3448,19 +3085,19 @@ var FuncREAWA = class extends StateResourceREAWA {
3448
3085
  }
3449
3086
  /**Called after write debounce finished with the last written value*/
3450
3087
  async write_action(_value, _state) {
3451
- return err12("State not writable");
3088
+ return err12("not writable");
3452
3089
  }
3453
3090
  limit(value) {
3454
- return this.#helper?.limit ? this.#helper.limit(value) : ok7(value);
3091
+ return this.#helper?.limit ? this.#helper.limit(value) : Promise.resolve(ok11(value));
3455
3092
  }
3456
3093
  check(value) {
3457
- return this.#helper?.check ? this.#helper.check(value) : ok7(value);
3094
+ return this.#helper?.check ? this.#helper.check(value) : Promise.resolve(ok11(value));
3458
3095
  }
3459
3096
  related() {
3460
3097
  return this.#helper?.related ? this.#helper.related() : none13();
3461
3098
  }
3462
3099
  };
3463
- var rea_wa2 = {
3100
+ var rea_wa = {
3464
3101
  /**Alternative state resource which can be initialized with functions
3465
3102
  * @template READ - The type of the state’s value when read.
3466
3103
  * @template WT - The type which can be written to the state.
@@ -3494,7 +3131,7 @@ var STATE_RESOURCE_REA = {
3494
3131
  /**Remote resource */
3495
3132
  rea: rea2,
3496
3133
  /**Remote resource with write cabability */
3497
- rea_wa: rea_wa2
3134
+ rea_wa
3498
3135
  };
3499
3136
 
3500
3137
  // src/resource/roa.ts