@donezone/cli 0.1.44 → 0.1.48

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 (2) hide show
  1. package/dist/index.js +709 -65
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -21452,6 +21452,452 @@ var require_dist2 = __commonJS((exports) => {
21452
21452
  global.eddsa = () => global._eddsa || (global._eddsa = new elliptic_1.eddsa("ed25519"));
21453
21453
  });
21454
21454
 
21455
+ // ../done-local-chain/node_modules/@cosmjs/encoding/build/ascii.js
21456
+ var require_ascii2 = __commonJS((exports) => {
21457
+ function toAscii(input) {
21458
+ const toNums = (str) => str.split("").map((x) => {
21459
+ const charCode = x.charCodeAt(0);
21460
+ if (charCode < 32 || charCode > 126) {
21461
+ throw new Error("Cannot encode character that is out of printable ASCII range: " + charCode);
21462
+ }
21463
+ return charCode;
21464
+ });
21465
+ return Uint8Array.from(toNums(input));
21466
+ }
21467
+ function fromAscii(data) {
21468
+ const fromNums = (listOfNumbers) => listOfNumbers.map((x) => {
21469
+ if (x < 32 || x > 126) {
21470
+ throw new Error("Cannot decode character that is out of printable ASCII range: " + x);
21471
+ }
21472
+ return String.fromCharCode(x);
21473
+ });
21474
+ return fromNums(Array.from(data)).join("");
21475
+ }
21476
+ Object.defineProperty(exports, "__esModule", { value: true });
21477
+ exports.fromAscii = exports.toAscii = undefined;
21478
+ exports.toAscii = toAscii;
21479
+ exports.fromAscii = fromAscii;
21480
+ });
21481
+
21482
+ // ../done-local-chain/node_modules/@cosmjs/encoding/build/base64.js
21483
+ var require_base642 = __commonJS((exports) => {
21484
+ function toBase64(data) {
21485
+ return base64js.fromByteArray(data);
21486
+ }
21487
+ function fromBase64(base64String) {
21488
+ if (!base64String.match(/^[a-zA-Z0-9+/]*={0,2}$/)) {
21489
+ throw new Error("Invalid base64 string format");
21490
+ }
21491
+ return base64js.toByteArray(base64String);
21492
+ }
21493
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
21494
+ if (k2 === undefined)
21495
+ k2 = k;
21496
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21497
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21498
+ desc = { enumerable: true, get: function() {
21499
+ return m[k];
21500
+ } };
21501
+ }
21502
+ Object.defineProperty(o, k2, desc);
21503
+ } : function(o, m, k, k2) {
21504
+ if (k2 === undefined)
21505
+ k2 = k;
21506
+ o[k2] = m[k];
21507
+ });
21508
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
21509
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21510
+ } : function(o, v) {
21511
+ o["default"] = v;
21512
+ });
21513
+ var __importStar = exports && exports.__importStar || function(mod) {
21514
+ if (mod && mod.__esModule)
21515
+ return mod;
21516
+ var result = {};
21517
+ if (mod != null) {
21518
+ for (var k in mod)
21519
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
21520
+ __createBinding(result, mod, k);
21521
+ }
21522
+ __setModuleDefault(result, mod);
21523
+ return result;
21524
+ };
21525
+ Object.defineProperty(exports, "__esModule", { value: true });
21526
+ exports.fromBase64 = exports.toBase64 = undefined;
21527
+ var base64js = __importStar(require_base64_js());
21528
+ exports.toBase64 = toBase64;
21529
+ exports.fromBase64 = fromBase64;
21530
+ });
21531
+
21532
+ // ../done-local-chain/node_modules/@cosmjs/encoding/node_modules/bech32/index.js
21533
+ var require_bech323 = __commonJS((exports, module) => {
21534
+ function polymodStep(pre) {
21535
+ var b = pre >> 25;
21536
+ return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059;
21537
+ }
21538
+ function prefixChk(prefix) {
21539
+ var chk = 1;
21540
+ for (var i = 0;i < prefix.length; ++i) {
21541
+ var c = prefix.charCodeAt(i);
21542
+ if (c < 33 || c > 126)
21543
+ return "Invalid prefix (" + prefix + ")";
21544
+ chk = polymodStep(chk) ^ c >> 5;
21545
+ }
21546
+ chk = polymodStep(chk);
21547
+ for (i = 0;i < prefix.length; ++i) {
21548
+ var v = prefix.charCodeAt(i);
21549
+ chk = polymodStep(chk) ^ v & 31;
21550
+ }
21551
+ return chk;
21552
+ }
21553
+ function encode(prefix, words, LIMIT) {
21554
+ LIMIT = LIMIT || 90;
21555
+ if (prefix.length + 7 + words.length > LIMIT)
21556
+ throw new TypeError("Exceeds length limit");
21557
+ prefix = prefix.toLowerCase();
21558
+ var chk = prefixChk(prefix);
21559
+ if (typeof chk === "string")
21560
+ throw new Error(chk);
21561
+ var result = prefix + "1";
21562
+ for (var i = 0;i < words.length; ++i) {
21563
+ var x2 = words[i];
21564
+ if (x2 >> 5 !== 0)
21565
+ throw new Error("Non 5-bit word");
21566
+ chk = polymodStep(chk) ^ x2;
21567
+ result += ALPHABET.charAt(x2);
21568
+ }
21569
+ for (i = 0;i < 6; ++i) {
21570
+ chk = polymodStep(chk);
21571
+ }
21572
+ chk ^= 1;
21573
+ for (i = 0;i < 6; ++i) {
21574
+ var v = chk >> (5 - i) * 5 & 31;
21575
+ result += ALPHABET.charAt(v);
21576
+ }
21577
+ return result;
21578
+ }
21579
+ function __decode(str, LIMIT) {
21580
+ LIMIT = LIMIT || 90;
21581
+ if (str.length < 8)
21582
+ return str + " too short";
21583
+ if (str.length > LIMIT)
21584
+ return "Exceeds length limit";
21585
+ var lowered = str.toLowerCase();
21586
+ var uppered = str.toUpperCase();
21587
+ if (str !== lowered && str !== uppered)
21588
+ return "Mixed-case string " + str;
21589
+ str = lowered;
21590
+ var split = str.lastIndexOf("1");
21591
+ if (split === -1)
21592
+ return "No separator character for " + str;
21593
+ if (split === 0)
21594
+ return "Missing prefix for " + str;
21595
+ var prefix = str.slice(0, split);
21596
+ var wordChars = str.slice(split + 1);
21597
+ if (wordChars.length < 6)
21598
+ return "Data too short";
21599
+ var chk = prefixChk(prefix);
21600
+ if (typeof chk === "string")
21601
+ return chk;
21602
+ var words = [];
21603
+ for (var i = 0;i < wordChars.length; ++i) {
21604
+ var c = wordChars.charAt(i);
21605
+ var v = ALPHABET_MAP[c];
21606
+ if (v === undefined)
21607
+ return "Unknown character " + c;
21608
+ chk = polymodStep(chk) ^ v;
21609
+ if (i + 6 >= wordChars.length)
21610
+ continue;
21611
+ words.push(v);
21612
+ }
21613
+ if (chk !== 1)
21614
+ return "Invalid checksum for " + str;
21615
+ return { prefix, words };
21616
+ }
21617
+ function decodeUnsafe() {
21618
+ var res = __decode.apply(null, arguments);
21619
+ if (typeof res === "object")
21620
+ return res;
21621
+ }
21622
+ function decode(str) {
21623
+ var res = __decode.apply(null, arguments);
21624
+ if (typeof res === "object")
21625
+ return res;
21626
+ throw new Error(res);
21627
+ }
21628
+ function convert(data, inBits, outBits, pad) {
21629
+ var value = 0;
21630
+ var bits = 0;
21631
+ var maxV = (1 << outBits) - 1;
21632
+ var result = [];
21633
+ for (var i = 0;i < data.length; ++i) {
21634
+ value = value << inBits | data[i];
21635
+ bits += inBits;
21636
+ while (bits >= outBits) {
21637
+ bits -= outBits;
21638
+ result.push(value >> bits & maxV);
21639
+ }
21640
+ }
21641
+ if (pad) {
21642
+ if (bits > 0) {
21643
+ result.push(value << outBits - bits & maxV);
21644
+ }
21645
+ } else {
21646
+ if (bits >= inBits)
21647
+ return "Excess padding";
21648
+ if (value << outBits - bits & maxV)
21649
+ return "Non-zero padding";
21650
+ }
21651
+ return result;
21652
+ }
21653
+ function toWordsUnsafe(bytes2) {
21654
+ var res = convert(bytes2, 8, 5, true);
21655
+ if (Array.isArray(res))
21656
+ return res;
21657
+ }
21658
+ function toWords(bytes2) {
21659
+ var res = convert(bytes2, 8, 5, true);
21660
+ if (Array.isArray(res))
21661
+ return res;
21662
+ throw new Error(res);
21663
+ }
21664
+ function fromWordsUnsafe(words) {
21665
+ var res = convert(words, 5, 8, false);
21666
+ if (Array.isArray(res))
21667
+ return res;
21668
+ }
21669
+ function fromWords(words) {
21670
+ var res = convert(words, 5, 8, false);
21671
+ if (Array.isArray(res))
21672
+ return res;
21673
+ throw new Error(res);
21674
+ }
21675
+ var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
21676
+ var ALPHABET_MAP = {};
21677
+ for (z = 0;z < ALPHABET.length; z++) {
21678
+ x = ALPHABET.charAt(z);
21679
+ if (ALPHABET_MAP[x] !== undefined)
21680
+ throw new TypeError(x + " is ambiguous");
21681
+ ALPHABET_MAP[x] = z;
21682
+ }
21683
+ var x;
21684
+ var z;
21685
+ module.exports = {
21686
+ decodeUnsafe,
21687
+ decode,
21688
+ encode,
21689
+ toWordsUnsafe,
21690
+ toWords,
21691
+ fromWordsUnsafe,
21692
+ fromWords
21693
+ };
21694
+ });
21695
+
21696
+ // ../done-local-chain/node_modules/@cosmjs/encoding/build/bech32.js
21697
+ var require_bech324 = __commonJS((exports) => {
21698
+ function toBech32(prefix, data, limit) {
21699
+ const address = bech32.encode(prefix, bech32.toWords(data), limit);
21700
+ return address;
21701
+ }
21702
+ function fromBech32(address, limit = Infinity) {
21703
+ const decodedAddress = bech32.decode(address, limit);
21704
+ return {
21705
+ prefix: decodedAddress.prefix,
21706
+ data: new Uint8Array(bech32.fromWords(decodedAddress.words))
21707
+ };
21708
+ }
21709
+ function normalizeBech32(address) {
21710
+ const { prefix, data } = fromBech32(address);
21711
+ return toBech32(prefix, data);
21712
+ }
21713
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
21714
+ if (k2 === undefined)
21715
+ k2 = k;
21716
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21717
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21718
+ desc = { enumerable: true, get: function() {
21719
+ return m[k];
21720
+ } };
21721
+ }
21722
+ Object.defineProperty(o, k2, desc);
21723
+ } : function(o, m, k, k2) {
21724
+ if (k2 === undefined)
21725
+ k2 = k;
21726
+ o[k2] = m[k];
21727
+ });
21728
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
21729
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21730
+ } : function(o, v) {
21731
+ o["default"] = v;
21732
+ });
21733
+ var __importStar = exports && exports.__importStar || function(mod) {
21734
+ if (mod && mod.__esModule)
21735
+ return mod;
21736
+ var result = {};
21737
+ if (mod != null) {
21738
+ for (var k in mod)
21739
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
21740
+ __createBinding(result, mod, k);
21741
+ }
21742
+ __setModuleDefault(result, mod);
21743
+ return result;
21744
+ };
21745
+ Object.defineProperty(exports, "__esModule", { value: true });
21746
+ exports.normalizeBech32 = exports.fromBech32 = exports.toBech32 = undefined;
21747
+ var bech32 = __importStar(require_bech323());
21748
+ exports.toBech32 = toBech32;
21749
+ exports.fromBech32 = fromBech32;
21750
+ exports.normalizeBech32 = normalizeBech32;
21751
+ });
21752
+
21753
+ // ../done-local-chain/node_modules/@cosmjs/encoding/build/hex.js
21754
+ var require_hex2 = __commonJS((exports) => {
21755
+ function toHex(data) {
21756
+ let out = "";
21757
+ for (const byte of data) {
21758
+ out += ("0" + byte.toString(16)).slice(-2);
21759
+ }
21760
+ return out;
21761
+ }
21762
+ function fromHex(hexstring) {
21763
+ if (hexstring.length % 2 !== 0) {
21764
+ throw new Error("hex string length must be a multiple of 2");
21765
+ }
21766
+ const out = new Uint8Array(hexstring.length / 2);
21767
+ for (let i = 0;i < out.length; i++) {
21768
+ const j = 2 * i;
21769
+ const hexByteAsString = hexstring.slice(j, j + 2);
21770
+ if (!hexByteAsString.match(/[0-9a-f]{2}/i)) {
21771
+ throw new Error("hex string contains invalid characters");
21772
+ }
21773
+ out[i] = parseInt(hexByteAsString, 16);
21774
+ }
21775
+ return out;
21776
+ }
21777
+ Object.defineProperty(exports, "__esModule", { value: true });
21778
+ exports.fromHex = exports.toHex = undefined;
21779
+ exports.toHex = toHex;
21780
+ exports.fromHex = fromHex;
21781
+ });
21782
+
21783
+ // ../done-local-chain/node_modules/@cosmjs/encoding/build/rfc3339.js
21784
+ var require_rfc33392 = __commonJS((exports) => {
21785
+ function padded(integer, length = 2) {
21786
+ return integer.toString().padStart(length, "0");
21787
+ }
21788
+ function fromRfc3339(str) {
21789
+ const matches = rfc3339Matcher.exec(str);
21790
+ if (!matches) {
21791
+ throw new Error("Date string is not in RFC3339 format");
21792
+ }
21793
+ const year = +matches[1];
21794
+ const month = +matches[2];
21795
+ const day = +matches[3];
21796
+ const hour = +matches[4];
21797
+ const minute = +matches[5];
21798
+ const second = +matches[6];
21799
+ const milliSeconds = matches[7] ? Math.floor(+matches[7] * 1000) : 0;
21800
+ let tzOffsetSign;
21801
+ let tzOffsetHours;
21802
+ let tzOffsetMinutes;
21803
+ if (matches[8] === "Z") {
21804
+ tzOffsetSign = 1;
21805
+ tzOffsetHours = 0;
21806
+ tzOffsetMinutes = 0;
21807
+ } else {
21808
+ tzOffsetSign = matches[8].substring(0, 1) === "-" ? -1 : 1;
21809
+ tzOffsetHours = +matches[8].substring(1, 3);
21810
+ tzOffsetMinutes = +matches[8].substring(4, 6);
21811
+ }
21812
+ const tzOffset = tzOffsetSign * (tzOffsetHours * 60 + tzOffsetMinutes) * 60;
21813
+ const date = new Date;
21814
+ date.setUTCFullYear(year, month - 1, day);
21815
+ date.setUTCHours(hour, minute, second, milliSeconds);
21816
+ return new Date(date.getTime() - tzOffset * 1000);
21817
+ }
21818
+ function toRfc3339(date) {
21819
+ const year = date.getUTCFullYear();
21820
+ const month = padded(date.getUTCMonth() + 1);
21821
+ const day = padded(date.getUTCDate());
21822
+ const hour = padded(date.getUTCHours());
21823
+ const minute = padded(date.getUTCMinutes());
21824
+ const second = padded(date.getUTCSeconds());
21825
+ const ms = padded(date.getUTCMilliseconds(), 3);
21826
+ return `${year}-${month}-${day}T${hour}:${minute}:${second}.${ms}Z`;
21827
+ }
21828
+ Object.defineProperty(exports, "__esModule", { value: true });
21829
+ exports.toRfc3339 = exports.fromRfc3339 = undefined;
21830
+ var rfc3339Matcher = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?((?:[+-]\d{2}:\d{2})|Z)$/;
21831
+ exports.fromRfc3339 = fromRfc3339;
21832
+ exports.toRfc3339 = toRfc3339;
21833
+ });
21834
+
21835
+ // ../done-local-chain/node_modules/@cosmjs/encoding/build/utf8.js
21836
+ var require_utf82 = __commonJS((exports) => {
21837
+ function toUtf8(str) {
21838
+ return new TextEncoder().encode(str);
21839
+ }
21840
+ function fromUtf8(data, lossy = false) {
21841
+ const fatal = !lossy;
21842
+ return new TextDecoder("utf-8", { fatal }).decode(data);
21843
+ }
21844
+ Object.defineProperty(exports, "__esModule", { value: true });
21845
+ exports.fromUtf8 = exports.toUtf8 = undefined;
21846
+ exports.toUtf8 = toUtf8;
21847
+ exports.fromUtf8 = fromUtf8;
21848
+ });
21849
+
21850
+ // ../done-local-chain/node_modules/@cosmjs/encoding/build/index.js
21851
+ var require_build2 = __commonJS((exports) => {
21852
+ Object.defineProperty(exports, "__esModule", { value: true });
21853
+ exports.toUtf8 = exports.fromUtf8 = exports.toRfc3339 = exports.fromRfc3339 = exports.toHex = exports.fromHex = exports.toBech32 = exports.normalizeBech32 = exports.fromBech32 = exports.toBase64 = exports.fromBase64 = exports.toAscii = exports.fromAscii = undefined;
21854
+ var ascii_1 = require_ascii2();
21855
+ Object.defineProperty(exports, "fromAscii", { enumerable: true, get: function() {
21856
+ return ascii_1.fromAscii;
21857
+ } });
21858
+ Object.defineProperty(exports, "toAscii", { enumerable: true, get: function() {
21859
+ return ascii_1.toAscii;
21860
+ } });
21861
+ var base64_1 = require_base642();
21862
+ Object.defineProperty(exports, "fromBase64", { enumerable: true, get: function() {
21863
+ return base64_1.fromBase64;
21864
+ } });
21865
+ Object.defineProperty(exports, "toBase64", { enumerable: true, get: function() {
21866
+ return base64_1.toBase64;
21867
+ } });
21868
+ var bech32_1 = require_bech324();
21869
+ Object.defineProperty(exports, "fromBech32", { enumerable: true, get: function() {
21870
+ return bech32_1.fromBech32;
21871
+ } });
21872
+ Object.defineProperty(exports, "normalizeBech32", { enumerable: true, get: function() {
21873
+ return bech32_1.normalizeBech32;
21874
+ } });
21875
+ Object.defineProperty(exports, "toBech32", { enumerable: true, get: function() {
21876
+ return bech32_1.toBech32;
21877
+ } });
21878
+ var hex_1 = require_hex2();
21879
+ Object.defineProperty(exports, "fromHex", { enumerable: true, get: function() {
21880
+ return hex_1.fromHex;
21881
+ } });
21882
+ Object.defineProperty(exports, "toHex", { enumerable: true, get: function() {
21883
+ return hex_1.toHex;
21884
+ } });
21885
+ var rfc3339_1 = require_rfc33392();
21886
+ Object.defineProperty(exports, "fromRfc3339", { enumerable: true, get: function() {
21887
+ return rfc3339_1.fromRfc3339;
21888
+ } });
21889
+ Object.defineProperty(exports, "toRfc3339", { enumerable: true, get: function() {
21890
+ return rfc3339_1.toRfc3339;
21891
+ } });
21892
+ var utf8_1 = require_utf82();
21893
+ Object.defineProperty(exports, "fromUtf8", { enumerable: true, get: function() {
21894
+ return utf8_1.fromUtf8;
21895
+ } });
21896
+ Object.defineProperty(exports, "toUtf8", { enumerable: true, get: function() {
21897
+ return utf8_1.toUtf8;
21898
+ } });
21899
+ });
21900
+
21455
21901
  // ../../node_modules/fast-decode-uri-component/index.js
21456
21902
  var require_fast_decode_uri_component = __commonJS((exports, module) => {
21457
21903
  function decodeURIComponent2(uri) {
@@ -22221,6 +22667,9 @@ class AbstractTokenizer {
22221
22667
  return token.get(this.numBuffer, 0);
22222
22668
  }
22223
22669
  async ignore(length) {
22670
+ if (length < 0) {
22671
+ throw new RangeError("ignore length must be \u2265 0 bytes");
22672
+ }
22224
22673
  if (this.fileInfo.size !== undefined) {
22225
22674
  const bytesLeft = this.fileInfo.size - this.position;
22226
22675
  if (length > bytesLeft) {
@@ -22319,6 +22768,9 @@ var init_ReadStreamTokenizer = __esm(() => {
22319
22768
  return bytesRead;
22320
22769
  }
22321
22770
  async ignore(length) {
22771
+ if (length < 0) {
22772
+ throw new RangeError("ignore length must be \u2265 0 bytes");
22773
+ }
22322
22774
  const bufSize = Math.min(maxBufferSize, length);
22323
22775
  const buf = new Uint8Array(bufSize);
22324
22776
  let totBytesRead = 0;
@@ -24248,6 +24700,23 @@ var init_supported = __esm(() => {
24248
24700
  });
24249
24701
 
24250
24702
  // ../../node_modules/file-type/core.js
24703
+ function patchWebByobTokenizerClose(tokenizer) {
24704
+ const streamReader = tokenizer?.streamReader;
24705
+ if (streamReader?.constructor?.name !== "WebStreamByobReader") {
24706
+ return tokenizer;
24707
+ }
24708
+ const { reader } = streamReader;
24709
+ const cancelAndRelease = async () => {
24710
+ await reader.cancel();
24711
+ reader.releaseLock();
24712
+ };
24713
+ streamReader.close = cancelAndRelease;
24714
+ streamReader.abort = async () => {
24715
+ streamReader.interrupted = true;
24716
+ await cancelAndRelease();
24717
+ };
24718
+ return tokenizer;
24719
+ }
24251
24720
  function getSafeBound(value, maximum, reason) {
24252
24721
  if (!Number.isFinite(value) || value < 0 || value > maximum) {
24253
24722
  throw new ParserHardLimitError(`${reason} has invalid size ${value} (maximum ${maximum} bytes)`);
@@ -24589,6 +25058,39 @@ function normalizeSampleSize(sampleSize) {
24589
25058
  }
24590
25059
  return Math.max(1, Math.trunc(sampleSize));
24591
25060
  }
25061
+ function readByobReaderWithSignal(reader, buffer, signal) {
25062
+ if (signal === undefined) {
25063
+ return reader.read(buffer);
25064
+ }
25065
+ signal.throwIfAborted();
25066
+ return new Promise((resolve3, reject) => {
25067
+ const cleanup = () => {
25068
+ signal.removeEventListener("abort", onAbort);
25069
+ };
25070
+ const onAbort = () => {
25071
+ const abortReason = signal.reason;
25072
+ cleanup();
25073
+ (async () => {
25074
+ try {
25075
+ await reader.cancel(abortReason);
25076
+ } catch {
25077
+ }
25078
+ })();
25079
+ reject(abortReason);
25080
+ };
25081
+ signal.addEventListener("abort", onAbort, { once: true });
25082
+ (async () => {
25083
+ try {
25084
+ const result = await reader.read(buffer);
25085
+ cleanup();
25086
+ resolve3(result);
25087
+ } catch (error) {
25088
+ cleanup();
25089
+ reject(error);
25090
+ }
25091
+ })();
25092
+ });
25093
+ }
24592
25094
  function normalizeMpegOffsetTolerance(mpegOffsetTolerance) {
24593
25095
  if (!Number.isFinite(mpegOffsetTolerance)) {
24594
25096
  return 0;
@@ -24739,7 +25241,10 @@ class FileTypeParser {
24739
25241
  ...this.tokenizerOptions
24740
25242
  };
24741
25243
  }
24742
- async fromTokenizer(tokenizer, detectionReentryCount = 0) {
25244
+ createTokenizerFromWebStream(stream) {
25245
+ return patchWebByobTokenizerClose(fromWebStream(stream, this.getTokenizerOptions()));
25246
+ }
25247
+ async parseTokenizer(tokenizer, detectionReentryCount = 0) {
24743
25248
  this.detectionReentryCount = detectionReentryCount;
24744
25249
  const initialPosition = tokenizer.position;
24745
25250
  for (const detector of this.detectors) {
@@ -24763,6 +25268,13 @@ class FileTypeParser {
24763
25268
  }
24764
25269
  }
24765
25270
  }
25271
+ async fromTokenizer(tokenizer) {
25272
+ try {
25273
+ return await this.parseTokenizer(tokenizer);
25274
+ } finally {
25275
+ await tokenizer.close();
25276
+ }
25277
+ }
24766
25278
  async fromBuffer(input) {
24767
25279
  if (!(input instanceof Uint8Array || input instanceof ArrayBuffer)) {
24768
25280
  throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof input}\``);
@@ -24774,20 +25286,14 @@ class FileTypeParser {
24774
25286
  return this.fromTokenizer(fromBuffer(buffer, this.getTokenizerOptions()));
24775
25287
  }
24776
25288
  async fromBlob(blob) {
25289
+ this.options.signal?.throwIfAborted();
24777
25290
  const tokenizer = fromBlob(blob, this.getTokenizerOptions());
24778
- try {
24779
- return await this.fromTokenizer(tokenizer);
24780
- } finally {
24781
- await tokenizer.close();
24782
- }
25291
+ return this.fromTokenizer(tokenizer);
24783
25292
  }
24784
25293
  async fromStream(stream) {
24785
- const tokenizer = fromWebStream(stream, this.getTokenizerOptions());
24786
- try {
24787
- return await this.fromTokenizer(tokenizer);
24788
- } finally {
24789
- await tokenizer.close();
24790
- }
25294
+ this.options.signal?.throwIfAborted();
25295
+ const tokenizer = this.createTokenizerFromWebStream(stream);
25296
+ return this.fromTokenizer(tokenizer);
24791
25297
  }
24792
25298
  async toDetectionStream(stream, options) {
24793
25299
  const sampleSize = normalizeSampleSize(options?.sampleSize ?? reasonableDetectionSizeInBytes);
@@ -24795,7 +25301,7 @@ class FileTypeParser {
24795
25301
  let firstChunk;
24796
25302
  const reader = stream.getReader({ mode: "byob" });
24797
25303
  try {
24798
- const { value: chunk, done } = await reader.read(new Uint8Array(sampleSize));
25304
+ const { value: chunk, done } = await readByobReaderWithSignal(reader, new Uint8Array(sampleSize), this.options.signal);
24799
25305
  firstChunk = chunk;
24800
25306
  if (!done && chunk) {
24801
25307
  try {
@@ -24823,6 +25329,57 @@ class FileTypeParser {
24823
25329
  newStream.fileType = detectedFileType;
24824
25330
  return newStream;
24825
25331
  }
25332
+ async detectGzip(tokenizer) {
25333
+ if (this.gzipProbeDepth >= maximumNestedGzipProbeDepth) {
25334
+ return {
25335
+ ext: "gz",
25336
+ mime: "application/gzip"
25337
+ };
25338
+ }
25339
+ const gzipHandler = new GzipHandler(tokenizer);
25340
+ const limitedInflatedStream = createByteLimitedReadableStream(gzipHandler.inflate(), maximumNestedGzipDetectionSizeInBytes);
25341
+ const hasUnknownSize = hasUnknownFileSize(tokenizer);
25342
+ let timeout;
25343
+ let probeSignal;
25344
+ let probeParser;
25345
+ let compressedFileType;
25346
+ if (hasUnknownSize) {
25347
+ const timeoutController = new AbortController;
25348
+ timeout = setTimeout(() => {
25349
+ timeoutController.abort(new DOMException(`Operation timed out after ${unknownSizeGzipProbeTimeoutInMilliseconds} ms`, "TimeoutError"));
25350
+ }, unknownSizeGzipProbeTimeoutInMilliseconds);
25351
+ probeSignal = this.options.signal === undefined ? timeoutController.signal : AbortSignal.any([this.options.signal, timeoutController.signal]);
25352
+ probeParser = new FileTypeParser({
25353
+ ...this.options,
25354
+ signal: probeSignal
25355
+ });
25356
+ probeParser.gzipProbeDepth = this.gzipProbeDepth + 1;
25357
+ } else {
25358
+ this.gzipProbeDepth++;
25359
+ }
25360
+ try {
25361
+ compressedFileType = await (probeParser ?? this).fromStream(limitedInflatedStream);
25362
+ } catch (error) {
25363
+ if (error?.name === "AbortError" && probeSignal?.reason?.name !== "TimeoutError") {
25364
+ throw error;
25365
+ }
25366
+ } finally {
25367
+ clearTimeout(timeout);
25368
+ if (!hasUnknownSize) {
25369
+ this.gzipProbeDepth--;
25370
+ }
25371
+ }
25372
+ if (compressedFileType?.ext === "tar") {
25373
+ return {
25374
+ ext: "tar.gz",
25375
+ mime: "application/gzip"
25376
+ };
25377
+ }
25378
+ return {
25379
+ ext: "gz",
25380
+ mime: "application/gzip"
25381
+ };
25382
+ }
24826
25383
  check(header, options) {
24827
25384
  return _check(this.buffer, header, options);
24828
25385
  }
@@ -24835,6 +25392,12 @@ class FileTypeParser {
24835
25392
  tokenizer.fileInfo.size = Number.MAX_SAFE_INTEGER;
24836
25393
  }
24837
25394
  this.tokenizer = tokenizer;
25395
+ if (hasUnknownFileSize(tokenizer)) {
25396
+ await tokenizer.peekBuffer(this.buffer, { length: 3, mayBeLess: true });
25397
+ if (this.check([31, 139, 8])) {
25398
+ return this.detectGzip(tokenizer);
25399
+ }
25400
+ }
24838
25401
  await tokenizer.peekBuffer(this.buffer, { length: 32, mayBeLess: true });
24839
25402
  if (this.check([66, 77])) {
24840
25403
  return {
@@ -24912,35 +25475,7 @@ class FileTypeParser {
24912
25475
  };
24913
25476
  }
24914
25477
  if (this.check([31, 139, 8])) {
24915
- if (this.gzipProbeDepth >= maximumNestedGzipProbeDepth) {
24916
- return {
24917
- ext: "gz",
24918
- mime: "application/gzip"
24919
- };
24920
- }
24921
- const gzipHandler = new GzipHandler(tokenizer);
24922
- const limitedInflatedStream = createByteLimitedReadableStream(gzipHandler.inflate(), maximumNestedGzipDetectionSizeInBytes);
24923
- let compressedFileType;
24924
- try {
24925
- this.gzipProbeDepth++;
24926
- compressedFileType = await this.fromStream(limitedInflatedStream);
24927
- } catch (error) {
24928
- if (error?.name === "AbortError") {
24929
- throw error;
24930
- }
24931
- } finally {
24932
- this.gzipProbeDepth--;
24933
- }
24934
- if (compressedFileType?.ext === "tar") {
24935
- return {
24936
- ext: "tar.gz",
24937
- mime: "application/gzip"
24938
- };
24939
- }
24940
- return {
24941
- ext: "gz",
24942
- mime: "application/gzip"
24943
- };
25478
+ return this.detectGzip(tokenizer);
24944
25479
  }
24945
25480
  if (this.check([66, 90, 104])) {
24946
25481
  return {
@@ -24982,7 +25517,7 @@ class FileTypeParser {
24982
25517
  return;
24983
25518
  }
24984
25519
  this.detectionReentryCount++;
24985
- return this.fromTokenizer(tokenizer, this.detectionReentryCount);
25520
+ return this.parseTokenizer(tokenizer, this.detectionReentryCount);
24986
25521
  }
24987
25522
  if (this.checkString("MP+")) {
24988
25523
  return {
@@ -26264,7 +26799,7 @@ class FileTypeParser {
26264
26799
  }
26265
26800
  }
26266
26801
  }
26267
- var reasonableDetectionSizeInBytes = 4100, maximumMpegOffsetTolerance, maximumZipEntrySizeInBytes, maximumZipEntryCount = 1024, maximumZipBufferedReadSizeInBytes, maximumUntrustedSkipSizeInBytes, maximumUnknownSizePayloadProbeSizeInBytes, maximumZipTextEntrySizeInBytes, maximumNestedGzipDetectionSizeInBytes, maximumNestedGzipProbeDepth = 1, maximumId3HeaderSizeInBytes, maximumEbmlDocumentTypeSizeInBytes = 64, maximumEbmlElementPayloadSizeInBytes, maximumEbmlElementCount = 256, maximumPngChunkCount = 512, maximumPngStreamScanBudgetInBytes, maximumAsfHeaderObjectCount = 512, maximumTiffTagCount = 512, maximumDetectionReentryCount = 256, maximumPngChunkSizeInBytes, maximumAsfHeaderPayloadSizeInBytes, maximumTiffStreamIfdOffsetInBytes, maximumTiffIfdOffsetInBytes, recoverableZipErrorMessages, recoverableZipErrorMessagePrefixes, recoverableZipErrorCodes, ParserHardLimitError, zipDataDescriptorSignature = 134695760, zipDataDescriptorLengthInBytes = 16, zipDataDescriptorOverlapLengthInBytes, supportedExtensions, supportedMimeTypes;
26802
+ var reasonableDetectionSizeInBytes = 4100, maximumMpegOffsetTolerance, maximumZipEntrySizeInBytes, maximumZipEntryCount = 1024, maximumZipBufferedReadSizeInBytes, maximumUntrustedSkipSizeInBytes, maximumUnknownSizePayloadProbeSizeInBytes, maximumZipTextEntrySizeInBytes, maximumNestedGzipDetectionSizeInBytes, maximumNestedGzipProbeDepth = 1, unknownSizeGzipProbeTimeoutInMilliseconds = 100, maximumId3HeaderSizeInBytes, maximumEbmlDocumentTypeSizeInBytes = 64, maximumEbmlElementPayloadSizeInBytes, maximumEbmlElementCount = 256, maximumPngChunkCount = 512, maximumPngStreamScanBudgetInBytes, maximumAsfHeaderObjectCount = 512, maximumTiffTagCount = 512, maximumDetectionReentryCount = 256, maximumPngChunkSizeInBytes, maximumAsfHeaderPayloadSizeInBytes, maximumTiffStreamIfdOffsetInBytes, maximumTiffIfdOffsetInBytes, recoverableZipErrorMessages, recoverableZipErrorMessagePrefixes, recoverableZipErrorCodes, ParserHardLimitError, zipDataDescriptorSignature = 134695760, zipDataDescriptorLengthInBytes = 16, zipDataDescriptorOverlapLengthInBytes, supportedExtensions, supportedMimeTypes;
26268
26803
  var init_core2 = __esm(() => {
26269
26804
  init_lib3();
26270
26805
  init_core();
@@ -26295,7 +26830,8 @@ var init_core2 = __esm(() => {
26295
26830
  "ZIP entry count exceeds ",
26296
26831
  "Unsupported ZIP compression method:",
26297
26832
  "ZIP entry compressed data exceeds ",
26298
- "ZIP entry decompressed data exceeds "
26833
+ "ZIP entry decompressed data exceeds ",
26834
+ "Expected data-descriptor-signature at position "
26299
26835
  ];
26300
26836
  recoverableZipErrorCodes = new Set([
26301
26837
  "Z_BUF_ERROR",
@@ -26397,7 +26933,8 @@ var init_file_type = __esm(() => {
26397
26933
  init_core2();
26398
26934
  FileTypeParser2 = class FileTypeParser2 extends FileTypeParser {
26399
26935
  async fromStream(stream) {
26400
- const tokenizer = await (stream instanceof WebReadableStream ? fromWebStream(stream, this.getTokenizerOptions()) : fromStream2(stream, this.getTokenizerOptions()));
26936
+ this.options.signal?.throwIfAborted();
26937
+ const tokenizer = await (stream instanceof WebReadableStream ? this.createTokenizerFromWebStream(stream) : fromStream2(stream, this.getTokenizerOptions()));
26401
26938
  try {
26402
26939
  return await super.fromTokenizer(tokenizer);
26403
26940
  } catch (error) {
@@ -26406,10 +26943,13 @@ var init_file_type = __esm(() => {
26406
26943
  }
26407
26944
  throw error;
26408
26945
  } finally {
26409
- await tokenizer.close();
26946
+ if (stream instanceof Readable && !stream.destroyed) {
26947
+ stream.destroy();
26948
+ }
26410
26949
  }
26411
26950
  }
26412
26951
  async fromFile(path) {
26952
+ this.options.signal?.throwIfAborted();
26413
26953
  const fileHandle = await fs.open(path, fileSystemConstants.O_RDONLY | fileSystemConstants.O_NONBLOCK);
26414
26954
  const fileStat = await fileHandle.stat();
26415
26955
  if (!fileStat.isFile()) {
@@ -26423,41 +26963,65 @@ var init_file_type = __esm(() => {
26423
26963
  size: fileStat.size
26424
26964
  }
26425
26965
  });
26426
- try {
26427
- return await super.fromTokenizer(tokenizer);
26428
- } finally {
26429
- await tokenizer.close();
26430
- }
26966
+ return super.fromTokenizer(tokenizer);
26431
26967
  }
26432
26968
  async toDetectionStream(readableStream, options = {}) {
26433
26969
  if (!(readableStream instanceof Readable)) {
26434
26970
  return super.toDetectionStream(readableStream, options);
26435
26971
  }
26436
- const sampleSize = normalizeSampleSize(options.sampleSize ?? reasonableDetectionSizeInBytes);
26972
+ const { sampleSize = reasonableDetectionSizeInBytes } = options;
26973
+ const { signal } = this.options;
26974
+ const normalizedSampleSize = normalizeSampleSize(sampleSize);
26975
+ signal?.throwIfAborted();
26437
26976
  return new Promise((resolve3, reject) => {
26438
- readableStream.on("error", reject);
26439
- readableStream.once("readable", () => {
26977
+ let isSettled = false;
26978
+ const cleanup = () => {
26979
+ readableStream.off("error", onError);
26980
+ readableStream.off("readable", onReadable);
26981
+ signal?.removeEventListener("abort", onAbort);
26982
+ };
26983
+ const settle = (callback, value) => {
26984
+ if (isSettled) {
26985
+ return;
26986
+ }
26987
+ isSettled = true;
26988
+ cleanup();
26989
+ callback(value);
26990
+ };
26991
+ const onError = (error) => {
26992
+ settle(reject, error);
26993
+ };
26994
+ const onAbort = () => {
26995
+ if (!readableStream.destroyed) {
26996
+ readableStream.destroy();
26997
+ }
26998
+ settle(reject, signal.reason);
26999
+ };
27000
+ const onReadable = () => {
26440
27001
  (async () => {
26441
27002
  try {
26442
27003
  const pass = new PassThrough;
26443
27004
  const outputStream = pipeline ? pipeline(readableStream, pass, () => {
26444
27005
  }) : readableStream.pipe(pass);
26445
- const chunk = readableStream.read(sampleSize) ?? readableStream.read() ?? new Uint8Array(0);
27006
+ const chunk = readableStream.read(normalizedSampleSize) ?? readableStream.read() ?? new Uint8Array(0);
26446
27007
  try {
26447
27008
  pass.fileType = await this.fromBuffer(chunk);
26448
27009
  } catch (error) {
26449
27010
  if (error instanceof EndOfStreamError) {
26450
27011
  pass.fileType = undefined;
26451
27012
  } else {
26452
- reject(error);
27013
+ settle(reject, error);
26453
27014
  }
26454
27015
  }
26455
- resolve3(outputStream);
27016
+ settle(resolve3, outputStream);
26456
27017
  } catch (error) {
26457
- reject(error);
27018
+ settle(reject, error);
26458
27019
  }
26459
27020
  })();
26460
- });
27021
+ };
27022
+ readableStream.on("error", onError);
27023
+ readableStream.once("readable", onReadable);
27024
+ signal?.addEventListener("abort", onAbort, { once: true });
26461
27025
  });
26462
27026
  }
26463
27027
  };
@@ -26717,6 +27281,7 @@ import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:f
26717
27281
  import * as fs2 from "node:fs/promises";
26718
27282
  import path from "node:path";
26719
27283
  import { TextDecoder as TextDecoder2 } from "node:util";
27284
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
26720
27285
 
26721
27286
  // ../../node_modules/commander/esm.mjs
26722
27287
  var import__ = __toESM(require_commander(), 1);
@@ -27793,6 +28358,7 @@ class DoneInstance {
27793
28358
  var Done = new DoneInstance;
27794
28359
  // ../done-local-chain/src/chain.ts
27795
28360
  var import_cosmwasm_vm_js = __toESM(require_dist2(), 1);
28361
+ var import_encoding = __toESM(require_build2(), 1);
27796
28362
  var import_backend = __toESM(require_backend(), 1);
27797
28363
  var import_bech32 = __toESM(require_dist(), 1);
27798
28364
 
@@ -28323,7 +28889,7 @@ class DoneLocalChain {
28323
28889
  const height = this.blockHeight;
28324
28890
  const blockTime = this.blockTime;
28325
28891
  try {
28326
- const region = record.vm[entrypoint](env, info, msg);
28892
+ const region = entrypoint === "query" ? record.vm[entrypoint](env, msg) : record.vm[entrypoint](env, info, msg);
28327
28893
  const json = region?.json ?? { err: "contract returned empty response" };
28328
28894
  this.emitContractEvent(record, entrypoint, env, info, json, height, blockTime);
28329
28895
  return json;
@@ -28371,6 +28937,23 @@ class DoneLocalChain {
28371
28937
  view.setUint32(28, this.nextAddressNonce++);
28372
28938
  return import_bech32.bech32.encode(this.bech32Prefix, import_bech32.bech32.toWords(data));
28373
28939
  }
28940
+ restoreStorage(address, entries) {
28941
+ const record = this.contracts.get(address);
28942
+ if (!record) {
28943
+ throw new Error(`contract ${address} not found`);
28944
+ }
28945
+ const storage = record.backend.storage;
28946
+ if (!(storage instanceof import_backend.BasicKVIterStorage)) {
28947
+ return;
28948
+ }
28949
+ for (const entry of entries) {
28950
+ if (!entry.key || !entry.value)
28951
+ continue;
28952
+ const keyBytes = import_encoding.fromBase64(entry.key);
28953
+ const valueBytes = import_encoding.fromBase64(entry.value);
28954
+ storage.set(keyBytes, valueBytes);
28955
+ }
28956
+ }
28374
28957
  }
28375
28958
  // ../done-local-chain/src/js-contract.ts
28376
28959
  import { readFileSync as readFileSync2 } from "node:fs";
@@ -42962,7 +43545,7 @@ var sharedRouteSchemas = {
42962
43545
  };
42963
43546
  // ../done-http-local/src/server.ts
42964
43547
  async function createDoneHttpLocalServer(config, chain) {
42965
- const runtime = chain ?? new DoneLocalChain;
43548
+ const runtime = chain ?? loadChainWithArtifacts();
42966
43549
  if (config.scriptPath) {
42967
43550
  await deployJsContract({
42968
43551
  chain: runtime,
@@ -43153,6 +43736,9 @@ function unwrapQueryResult(result) {
43153
43736
  if (result.err) {
43154
43737
  throw new Error(result.err);
43155
43738
  }
43739
+ if (typeof result.ok === "string") {
43740
+ return decodeData(result.ok);
43741
+ }
43156
43742
  if (result.ok?.data) {
43157
43743
  return decodeData(result.ok.data);
43158
43744
  }
@@ -43654,8 +44240,7 @@ interface SetGreetingBody {
43654
44240
 
43655
44241
  export default Done.serve()
43656
44242
  .instantiate(async () => {
43657
- const existing = await Greeting.load();
43658
- if (!existing) {
44243
+ if (!(await Greeting.exists())) {
43659
44244
  await Greeting.save("${defaultGreeting}");
43660
44245
  }
43661
44246
  })
@@ -43794,7 +44379,7 @@ function updateDependencyIfPresent(pkg, name, version) {
43794
44379
  }
43795
44380
  async function syncWorkspaceDependencyVersions(targetDir) {
43796
44381
  await updatePackageJson(path.join(targetDir, "package.json"), (pkg) => {
43797
- ensureDependency(pkg, "devDependencies", "@donezone/cli", CLI_VERSION_RANGE);
44382
+ ensureDependency(pkg, "devDependencies", "@donezone/cli", CLI_DEPENDENCY_SPEC);
43798
44383
  ensureDependency(pkg, "devDependencies", "done.zone", DONE_ZONE_VERSION_RANGE);
43799
44384
  });
43800
44385
  await updatePackageJson(path.join(targetDir, "frontend", "package.json"), (pkg) => {
@@ -44116,6 +44701,31 @@ async function readDevEnvFile(file2) {
44116
44701
  }
44117
44702
  return entries;
44118
44703
  }
44704
+ async function readStorageSnapshot(file2) {
44705
+ try {
44706
+ const raw = await fs2.readFile(file2, "utf8");
44707
+ return JSON.parse(raw);
44708
+ } catch (error) {
44709
+ if (error.code === "ENOENT") {
44710
+ return null;
44711
+ }
44712
+ throw error;
44713
+ }
44714
+ }
44715
+ function extractStorageEntries(snapshot) {
44716
+ if (!snapshot?.entries) {
44717
+ return [];
44718
+ }
44719
+ const entries = [];
44720
+ for (const entry of snapshot.entries) {
44721
+ const keyBase64 = entry.key?.base64;
44722
+ const valueBase64 = entry.value?.base64;
44723
+ if (!keyBase64 || !valueBase64)
44724
+ continue;
44725
+ entries.push({ key: keyBase64, value: valueBase64 });
44726
+ }
44727
+ return entries;
44728
+ }
44119
44729
  function toEnvVarKey(name) {
44120
44730
  return name.replace(/[^a-zA-Z0-9]+/g, "_").replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
44121
44731
  }
@@ -44144,6 +44754,7 @@ function openBrowser(url) {
44144
44754
  var packageMetadata = readCliPackageMetadata();
44145
44755
  var CLI_VERSION = normalizeVersion(packageMetadata.version) ?? "0.0.0-spec";
44146
44756
  var CLI_VERSION_RANGE = toCaretRange(CLI_VERSION);
44757
+ var CLI_DEPENDENCY_SPEC = process.env.DONE_CLI_LOCAL_SPEC ?? CLI_VERSION_RANGE;
44147
44758
  var DONE_ZONE_VERSION = normalizeVersion(packageMetadata.doneZoneVersion) ?? CLI_VERSION;
44148
44759
  var DONE_ZONE_VERSION_RANGE = toCaretRange(DONE_ZONE_VERSION);
44149
44760
  var DONE_CLIENT_VERSION = normalizeVersion(packageMetadata.doneClientVersion) ?? CLI_VERSION;
@@ -44161,6 +44772,11 @@ if (typeof bunRuntime === "undefined") {
44161
44772
  process.exit(rerun.status ?? 1);
44162
44773
  }
44163
44774
  var DEFAULT_TEMPLATE_REPO = "https://github.com/mccallofthewild/done-template.git";
44775
+ var CLI_DIR = path.dirname(fileURLToPath2(import.meta.url));
44776
+ var CLI_ARTIFACTS_DIR = path.resolve(CLI_DIR, "..", "artifacts");
44777
+ if (!process.env.DONE_ARTIFACTS_DIR && existsSync2(CLI_ARTIFACTS_DIR)) {
44778
+ process.env.DONE_ARTIFACTS_DIR = CLI_ARTIFACTS_DIR;
44779
+ }
44164
44780
  var program2 = new Command;
44165
44781
  program2.name("done").description("Done developer toolkit (spec-first stub)").version(CLI_VERSION);
44166
44782
  program2.command("build").description("Bundle Done contracts defined in done.json").option("-j, --contracts <path>", "Path to done.json").option("-n, --name <name...>", "Filter contract names").action(async (options) => {
@@ -44362,9 +44978,13 @@ class DoneDevOrchestrator {
44362
44978
  if (deployment.result.err) {
44363
44979
  throw new Error(`Failed to deploy ${contract.name}: ${deployment.result.err}`);
44364
44980
  }
44981
+ const restored = await this.restoreStorageFromSnapshot(contract, deployment.address);
44365
44982
  contract.address = deployment.address;
44366
44983
  this.chain.advanceBlock();
44367
44984
  this.logInfo(`${import_picocolors.default.green("\u2022")} ${contract.name} deployed at ${deployment.address}`);
44985
+ if (restored) {
44986
+ this.logInfo(` ${import_picocolors.default.dim("\u21BA state")}: restored snapshot for ${contract.name}`);
44987
+ }
44368
44988
  await this.dumpContractStorage(contract);
44369
44989
  }
44370
44990
  }
@@ -44459,6 +45079,30 @@ class DoneDevOrchestrator {
44459
45079
  const filePath = path.join(storageDir, `${contract.slug}.json`);
44460
45080
  await writeJson(filePath, snapshot);
44461
45081
  }
45082
+ async restoreStorageFromSnapshot(contract, address) {
45083
+ if (!this.chain) {
45084
+ return false;
45085
+ }
45086
+ const filePath = this.resolveStorageSnapshotPath(contract);
45087
+ try {
45088
+ const snapshot = await readStorageSnapshot(filePath);
45089
+ const entries = extractStorageEntries(snapshot);
45090
+ if (entries.length === 0) {
45091
+ return false;
45092
+ }
45093
+ this.chain.restoreStorage(address, entries);
45094
+ return true;
45095
+ } catch (error) {
45096
+ if (error.code !== "ENOENT") {
45097
+ this.logWarn(`Unable to restore storage for ${contract.name}: ${error.message}`);
45098
+ }
45099
+ return false;
45100
+ }
45101
+ }
45102
+ resolveStorageSnapshotPath(contract) {
45103
+ const storageDir = path.join(this.options.workspace.root, ".done", "storage");
45104
+ return path.join(storageDir, `${contract.slug}.json`);
45105
+ }
44462
45106
  async launchFrontend() {
44463
45107
  const frontend = this.options.devConfig.frontend;
44464
45108
  if (!existsSync2(frontend.cwd)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donezone/cli",
3
- "version": "0.1.44",
3
+ "version": "0.1.48",
4
4
  "doneZoneVersion": "0.1.41",
5
5
  "doneClientVersion": "0.1.41",
6
6
  "private": false,