@goodpeanuts/dsh-sui 0.0.0-stage → 0.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.
- package/README.md +100 -3
- package/THIRD_PARTY_NOTICES.txt +1064 -0
- package/apps/cli/dist/_virtual/_rolldown/runtime.mjs +35 -0
- package/apps/cli/dist/args.mjs +204 -0
- package/apps/cli/dist/cli.mjs +392 -0
- package/apps/cli/dist/errors.mjs +32 -0
- package/apps/cli/dist/help.mjs +73 -0
- package/apps/cli/dist/io.mjs +37 -0
- package/apps/cli/dist/main.mjs +10 -0
- package/apps/cli/dist/node_modules/.pnpm/@keyv_serialize@1.1.1/node_modules/@keyv/serialize/dist/index.mjs +37 -0
- package/apps/cli/dist/node_modules/.pnpm/@sec-ant_readable-stream@0.4.1/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.mjs +81 -0
- package/apps/cli/dist/node_modules/.pnpm/@sec-ant_readable-stream@0.4.1/node_modules/@sec-ant/readable-stream/dist/ponyfill/index.mjs +1 -0
- package/apps/cli/dist/node_modules/.pnpm/@sindresorhus_is@7.2.0/node_modules/@sindresorhus/is/distribution/index.mjs +1015 -0
- package/apps/cli/dist/node_modules/.pnpm/@sindresorhus_is@7.2.0/node_modules/@sindresorhus/is/distribution/utilities.mjs +6 -0
- package/apps/cli/dist/node_modules/.pnpm/boolbase@1.0.0/node_modules/boolbase/index.mjs +15 -0
- package/apps/cli/dist/node_modules/.pnpm/byte-counter@0.1.0/node_modules/byte-counter/utilities.mjs +9 -0
- package/apps/cli/dist/node_modules/.pnpm/cacheable-lookup@7.0.0/node_modules/cacheable-lookup/source/index.mjs +279 -0
- package/apps/cli/dist/node_modules/.pnpm/cacheable-request@13.0.19/node_modules/cacheable-request/dist/index.mjs +274 -0
- package/apps/cli/dist/node_modules/.pnpm/cacheable-request@13.0.19/node_modules/cacheable-request/dist/types.mjs +15 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio-select@2.1.0/node_modules/cheerio-select/lib/esm/helpers.mjs +15 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio-select@2.1.0/node_modules/cheerio-select/lib/esm/index.mjs +159 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio-select@2.1.0/node_modules/cheerio-select/lib/esm/positionals.mjs +33 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/attributes.mjs +465 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/css.mjs +94 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/extract.mjs +39 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/forms.mjs +63 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/manipulation.mjs +731 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/traversing.mjs +828 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/cheerio.mjs +53 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/index.mjs +11 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/load-parse.mjs +25 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/load.mjs +73 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/options.mjs +27 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/parse.mjs +53 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/parsers/parse5-adapter.mjs +42 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/static.mjs +165 -0
- package/apps/cli/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/utils.mjs +78 -0
- package/apps/cli/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/attributes.mjs +187 -0
- package/apps/cli/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/compile.mjs +77 -0
- package/apps/cli/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/general.mjs +89 -0
- package/apps/cli/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/index.mjs +43 -0
- package/apps/cli/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/aliases.mjs +32 -0
- package/apps/cli/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/filters.mjs +114 -0
- package/apps/cli/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/index.mjs +35 -0
- package/apps/cli/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/pseudos.mjs +53 -0
- package/apps/cli/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/subselects.mjs +68 -0
- package/apps/cli/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/sort.mjs +60 -0
- package/apps/cli/dist/node_modules/.pnpm/css-what@6.2.2/node_modules/css-what/lib/commonjs/index.mjs +50 -0
- package/apps/cli/dist/node_modules/.pnpm/css-what@6.2.2/node_modules/css-what/lib/commonjs/parse.mjs +320 -0
- package/apps/cli/dist/node_modules/.pnpm/css-what@6.2.2/node_modules/css-what/lib/commonjs/stringify.mjs +102 -0
- package/apps/cli/dist/node_modules/.pnpm/css-what@6.2.2/node_modules/css-what/lib/commonjs/types.mjs +45 -0
- package/apps/cli/dist/node_modules/.pnpm/decompress-response@10.0.0/node_modules/decompress-response/index.mjs +59 -0
- package/apps/cli/dist/node_modules/.pnpm/dom-serializer@2.0.0/node_modules/dom-serializer/lib/esm/foreignNames.mjs +103 -0
- package/apps/cli/dist/node_modules/.pnpm/dom-serializer@2.0.0/node_modules/dom-serializer/lib/esm/index.mjs +144 -0
- package/apps/cli/dist/node_modules/.pnpm/domelementtype@2.3.0/node_modules/domelementtype/lib/esm/index.mjs +51 -0
- package/apps/cli/dist/node_modules/.pnpm/domhandler@5.0.3/node_modules/domhandler/lib/esm/index.mjs +128 -0
- package/apps/cli/dist/node_modules/.pnpm/domhandler@5.0.3/node_modules/domhandler/lib/esm/node.mjs +312 -0
- package/apps/cli/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/feeds.mjs +161 -0
- package/apps/cli/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/helpers.mjs +113 -0
- package/apps/cli/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/index.mjs +56 -0
- package/apps/cli/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/legacy.mjs +141 -0
- package/apps/cli/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/manipulation.mjs +117 -0
- package/apps/cli/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/querying.mjs +124 -0
- package/apps/cli/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/stringify.mjs +69 -0
- package/apps/cli/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/traversal.mjs +109 -0
- package/apps/cli/dist/node_modules/.pnpm/encoding-sniffer@0.2.1/node_modules/encoding-sniffer/dist/esm/index.mjs +7 -0
- package/apps/cli/dist/node_modules/.pnpm/encoding-sniffer@0.2.1/node_modules/encoding-sniffer/dist/esm/sniffer.mjs +112 -0
- package/apps/cli/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/escape.mjs +83 -0
- package/apps/cli/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode-codepoint.mjs +43 -0
- package/apps/cli/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode.mjs +330 -0
- package/apps/cli/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/escape.mjs +49 -0
- package/apps/cli/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/generated/decode-data-html.mjs +4 -0
- package/apps/cli/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/decode-codepoint.mjs +57 -0
- package/apps/cli/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/decode.mjs +351 -0
- package/apps/cli/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/generated/decode-data-html.mjs +5 -0
- package/apps/cli/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/generated/decode-data-xml.mjs +5 -0
- package/apps/cli/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/internal/bin-trie-flags.mjs +20 -0
- package/apps/cli/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/internal/decode-shared.mjs +14 -0
- package/apps/cli/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/index.mjs +871 -0
- package/apps/cli/dist/node_modules/.pnpm/form-data-encoder@4.1.0/node_modules/form-data-encoder/lib/index.mjs +279 -0
- package/apps/cli/dist/node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/array-buffer.mjs +54 -0
- package/apps/cli/dist/node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/buffer.mjs +14 -0
- package/apps/cli/dist/node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/contents.mjs +80 -0
- package/apps/cli/dist/node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/stream.mjs +41 -0
- package/apps/cli/dist/node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/utils.mjs +8 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/as-promise/index.mjs +154 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/as-promise/types.mjs +20 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/calculate-retry-delay.mjs +20 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/diagnostics-channel.mjs +38 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/errors.mjs +132 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/index.mjs +923 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/options.mjs +1622 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/parse-link-header.mjs +27 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/response.mjs +36 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/timed-out.mjs +107 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/defer-to-connect.mjs +28 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/get-body-size.mjs +23 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/is-client-request.mjs +6 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/is-form-data.mjs +7 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/is-unix-socket-url.mjs +25 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/proxy-events.mjs +16 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/timer.mjs +114 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/unhandle.mjs +23 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/url-to-options.mjs +20 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/weakable-map.mjs +19 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/create.mjs +166 -0
- package/apps/cli/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/index.mjs +17 -0
- package/apps/cli/dist/node_modules/.pnpm/htmlparser2@10.1.0/node_modules/htmlparser2/dist/esm/Parser.mjs +441 -0
- package/apps/cli/dist/node_modules/.pnpm/htmlparser2@10.1.0/node_modules/htmlparser2/dist/esm/Tokenizer.mjs +661 -0
- package/apps/cli/dist/node_modules/.pnpm/htmlparser2@10.1.0/node_modules/htmlparser2/dist/esm/index.mjs +19 -0
- package/apps/cli/dist/node_modules/.pnpm/http-cache-semantics@4.3.0/node_modules/http-cache-semantics/index.mjs +608 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/agent.mjs +441 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/auto.mjs +145 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/client-request.mjs +318 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/incoming-message.mjs +58 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/index.mjs +51 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/get-auth-headers.mjs +19 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h1-over-h2.mjs +84 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-h1.mjs +49 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-h2.mjs +38 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-hx.mjs +39 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/initialize.mjs +23 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/unexpected-status-code-error.mjs +15 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/calculate-server-name.mjs +24 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/check-type.mjs +17 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/delay-async-destroy.mjs +28 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/errors.mjs +30 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.mjs +16 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/js-stream-socket.mjs +9 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/proxy-events.mjs +10 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/proxy-socket-handler.mjs +77 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/validate-header-name.mjs +15 -0
- package/apps/cli/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/validate-header-value.mjs +14 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/dbcs-codec.mjs +355 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/dbcs-data.mjs +191 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/index.mjs +31 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/internal.mjs +140 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-codec.mjs +50 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-data-generated.mjs +455 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-data.mjs +151 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/big5-added.mjs +169 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/cp936.mjs +2584 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/cp949.mjs +2220 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/cp950.mjs +227 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/eucjp.mjs +425 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/gb18030-ranges.mjs +427 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/gbk-added.mjs +230 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/shiftjis.mjs +292 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf16.mjs +123 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf32.mjs +197 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf7.mjs +182 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/bom-handling.mjs +42 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/index.mjs +108 -0
- package/apps/cli/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/streams.mjs +90 -0
- package/apps/cli/dist/node_modules/.pnpm/is-stream@4.0.1/node_modules/is-stream/index.mjs +9 -0
- package/apps/cli/dist/node_modules/.pnpm/js-sha256@0.11.1/node_modules/js-sha256/src/sha256.mjs +495 -0
- package/apps/cli/dist/node_modules/.pnpm/keyv@5.6.0/node_modules/keyv/dist/index.mjs +740 -0
- package/apps/cli/dist/node_modules/.pnpm/lowercase-keys@3.0.0/node_modules/lowercase-keys/index.mjs +6 -0
- package/apps/cli/dist/node_modules/.pnpm/mimic-response@4.0.0/node_modules/mimic-response/index.mjs +53 -0
- package/apps/cli/dist/node_modules/.pnpm/normalize-url@8.1.1/node_modules/normalize-url/index.mjs +145 -0
- package/apps/cli/dist/node_modules/.pnpm/nth-check@2.1.1/node_modules/nth-check/lib/esm/compile.mjs +37 -0
- package/apps/cli/dist/node_modules/.pnpm/nth-check@2.1.1/node_modules/nth-check/lib/esm/index.mjs +31 -0
- package/apps/cli/dist/node_modules/.pnpm/nth-check@2.1.1/node_modules/nth-check/lib/esm/parse.mjs +60 -0
- package/apps/cli/dist/node_modules/.pnpm/p-cancelable@4.0.1/node_modules/p-cancelable/index.mjs +86 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@7.1.0/node_modules/parse5-htmlparser2-tree-adapter/dist/index.mjs +187 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5-parser-stream@7.1.2/node_modules/parse5-parser-stream/dist/index.mjs +2 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/doctype.mjs +101 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/error-codes.mjs +66 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/foreign-content.mjs +259 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/html.mjs +544 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/token.mjs +19 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/unicode.mjs +91 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/index.mjs +41 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/formatting-element-list.mjs +91 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/index.mjs +2492 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/open-element-stack.mjs +292 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/serializer/index.mjs +111 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/tokenizer/index.mjs +2067 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/tokenizer/preprocessor.mjs +154 -0
- package/apps/cli/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/tree-adapters/default.mjs +164 -0
- package/apps/cli/dist/node_modules/.pnpm/quick-lru@5.1.1/node_modules/quick-lru/index.mjs +77 -0
- package/apps/cli/dist/node_modules/.pnpm/resolve-alpn@1.2.1/node_modules/resolve-alpn/index.mjs +47 -0
- package/apps/cli/dist/node_modules/.pnpm/responselike@4.0.2/node_modules/responselike/index.mjs +32 -0
- package/apps/cli/dist/node_modules/.pnpm/safer-buffer@2.1.2/node_modules/safer-buffer/safer.mjs +45 -0
- package/apps/cli/dist/node_modules/.pnpm/tldts@7.4.18/node_modules/tldts/dist/cjs/index.mjs +22542 -0
- package/apps/cli/dist/node_modules/.pnpm/tough-cookie@6.0.0/node_modules/tough-cookie/dist/index.mjs +1761 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/index.mjs +221 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/abort-signal.mjs +44 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/api-connect.mjs +85 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/api-pipeline.mjs +174 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/api-request.mjs +155 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/api-stream.mjs +136 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/api-upgrade.mjs +88 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/index.mjs +17 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/readable.mjs +418 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/cache/memory-cache-store.mjs +190 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/cache/sqlite-cache-store.mjs +324 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/connect.mjs +115 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/constants.mjs +134 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/diagnostics.mjs +114 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/errors.mjs +412 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/request.mjs +282 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/socks5-client.mjs +288 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/socks5-utils.mjs +166 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/symbols.mjs +80 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/tree.mjs +124 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/util.mjs +940 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/agent.mjs +119 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/balanced-pool.mjs +129 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/client-h1.mjs +1091 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/client-h2.mjs +588 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/client.mjs +385 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/dispatcher-base.mjs +121 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/dispatcher.mjs +35 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/env-http-proxy-agent.mjs +105 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/fixed-queue.mjs +75 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/h2c-client.mjs +31 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/pool-base.mjs +155 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/pool.mjs +76 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/proxy-agent.mjs +233 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/retry-agent.mjs +37 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/round-robin-pool.mjs +94 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/socks5-proxy-agent.mjs +194 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/encoding/index.mjs +18 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/global.mjs +48 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/cache-handler.mjs +457 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/cache-revalidation-handler.mjs +82 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/decorator-handler.mjs +57 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/deduplication-handler.mjs +341 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/redirect-handler.mjs +131 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/retry-handler.mjs +332 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/unwrap-handler.mjs +88 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/wrap-handler.mjs +68 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/cache.mjs +350 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/decompress.mjs +416 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/deduplicate.mjs +69 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/dns.mjs +323 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/dump.mjs +65 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/redirect.mjs +20 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/response-error.mjs +73 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/retry.mjs +25 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/llhttp/constants.mjs +590 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/llhttp/llhttp-wasm.mjs +13 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/llhttp/llhttp_simd-wasm.mjs +13 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/llhttp/utils.mjs +16 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-agent.mjs +154 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-call-history.mjs +159 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-client.mjs +59 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-errors.mjs +28 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-interceptor.mjs +150 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-pool.mjs +59 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-symbols.mjs +37 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-utils.mjs +302 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/pending-interceptors-formatter.mjs +38 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/snapshot-agent.mjs +268 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/snapshot-recorder.mjs +424 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/snapshot-utils.mjs +121 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/cache.mjs +440 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/date.mjs +332 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/promise.mjs +31 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/runtime-features.mjs +101 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/stats.mjs +31 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/timers.mjs +341 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cache/cache.mjs +462 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cache/cachestorage.mjs +103 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cache/util.mjs +39 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cookies/constants.mjs +11 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cookies/index.mjs +169 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cookies/parse.mjs +108 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cookies/util.mjs +239 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/eventsource/eventsource-stream.mjs +317 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/eventsource/eventsource.mjs +345 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/eventsource/util.mjs +29 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/body.mjs +271 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/constants.mjs +224 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/data-url.mjs +247 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/formdata-parser.mjs +255 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/formdata.mjs +153 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/global.mjs +34 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/headers.mjs +400 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/index.mjs +776 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/request.mjs +602 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/response.mjs +358 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/util.mjs +795 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/infra/index.mjs +154 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.mjs +170 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/webidl/index.mjs +505 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/connection.mjs +166 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/constants.mjs +47 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/events.mjs +268 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/frame.mjs +105 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/permessage-deflate.mjs +85 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/receiver.mjs +323 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/sender.mjs +90 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/stream/websocketerror.mjs +78 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/stream/websocketstream.mjs +270 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/util.mjs +212 -0
- package/apps/cli/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/websocket.mjs +432 -0
- package/apps/cli/dist/node_modules/.pnpm/whatwg-encoding@3.1.1/node_modules/whatwg-encoding/lib/labels-to-names.mjs +224 -0
- package/apps/cli/dist/node_modules/.pnpm/whatwg-encoding@3.1.1/node_modules/whatwg-encoding/lib/supported-names.mjs +45 -0
- package/apps/cli/dist/node_modules/.pnpm/whatwg-encoding@3.1.1/node_modules/whatwg-encoding/lib/whatwg-encoding.mjs +40 -0
- package/apps/cli/dist/node_modules/.pnpm/whatwg-mimetype@4.0.0/node_modules/whatwg-mimetype/lib/mime-type-parameters.mjs +54 -0
- package/apps/cli/dist/node_modules/.pnpm/whatwg-mimetype@4.0.0/node_modules/whatwg-mimetype/lib/mime-type.mjs +92 -0
- package/apps/cli/dist/node_modules/.pnpm/whatwg-mimetype@4.0.0/node_modules/whatwg-mimetype/lib/parser.mjs +62 -0
- package/apps/cli/dist/node_modules/.pnpm/whatwg-mimetype@4.0.0/node_modules/whatwg-mimetype/lib/serializer.mjs +24 -0
- package/apps/cli/dist/node_modules/.pnpm/whatwg-mimetype@4.0.0/node_modules/whatwg-mimetype/lib/utils.mjs +47 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.mjs +26 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.mjs +35 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.mjs +17 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.mjs +800 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.mjs +508 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.mjs +366 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.mjs +60 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.mjs +32 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.mjs +63 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.mjs +253 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.mjs +118 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.mjs +65 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.mjs +48 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.mjs +1235 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.mjs +297 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.mjs +316 -0
- package/apps/cli/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.mjs +8 -0
- package/apps/cli/dist/packages/data-maintenance/src/archive.mjs +143 -0
- package/apps/cli/dist/packages/data-maintenance/src/contracts.mjs +17 -0
- package/apps/cli/dist/packages/data-maintenance/src/files.mjs +121 -0
- package/apps/cli/dist/packages/data-maintenance/src/index.mjs +494 -0
- package/apps/cli/dist/packages/data-maintenance/src/lease.mjs +53 -0
- package/apps/cli/dist/packages/data-maintenance/src/migration-backup.mjs +57 -0
- package/apps/cli/dist/packages/data-maintenance/src/paths.mjs +15 -0
- package/apps/cli/dist/packages/feidee/src/client.mjs +635 -0
- package/apps/cli/dist/packages/feidee/src/hash.mjs +10 -0
- package/apps/cli/dist/packages/feidee/src/index.mjs +8 -0
- package/apps/cli/dist/packages/feidee/src/mutation-gateway.mjs +165 -0
- package/apps/cli/dist/packages/feidee/src/parsers.mjs +634 -0
- package/apps/cli/dist/packages/feidee/src/transaction-text.mjs +39 -0
- package/apps/cli/dist/packages/feidee/src/write-contract.mjs +273 -0
- package/apps/cli/dist/packages/finance/src/date-range.mjs +74 -0
- package/apps/cli/dist/packages/finance/src/domain.mjs +18 -0
- package/apps/cli/dist/packages/finance/src/errors.mjs +221 -0
- package/apps/cli/dist/packages/finance/src/index.mjs +16 -0
- package/apps/cli/dist/packages/finance/src/metadata-query.mjs +32 -0
- package/apps/cli/dist/packages/finance/src/sync/progress.mjs +27 -0
- package/apps/cli/dist/packages/finance/src/sync/service.mjs +282 -0
- package/apps/cli/dist/packages/finance/src/transactions/audit.mjs +104 -0
- package/apps/cli/dist/packages/finance/src/transactions/canary.mjs +85 -0
- package/apps/cli/dist/packages/finance/src/transactions/compare.mjs +76 -0
- package/apps/cli/dist/packages/finance/src/transactions/contracts.mjs +92 -0
- package/apps/cli/dist/packages/finance/src/transactions/memo-policy.mjs +79 -0
- package/apps/cli/dist/packages/finance/src/transactions/mutation.mjs +656 -0
- package/apps/cli/dist/packages/finance/src/transactions/query.mjs +59 -0
- package/apps/cli/dist/packages/finance/src/transactions/statistics.mjs +67 -0
- package/apps/cli/dist/packages/finance/src/write-policy.mjs +4 -0
- package/apps/cli/dist/packages/finance-module/src/balance-preview.mjs +4 -0
- package/apps/cli/dist/packages/finance-module/src/contracts.mjs +13 -0
- package/apps/cli/dist/packages/finance-module/src/database.mjs +1292 -0
- package/apps/cli/dist/packages/finance-module/src/draft-entries.mjs +89 -0
- package/apps/cli/dist/packages/finance-module/src/draft-receipts.mjs +8 -0
- package/apps/cli/dist/packages/finance-module/src/historical-task-archives.mjs +24 -0
- package/apps/cli/dist/packages/finance-module/src/node.mjs +76 -0
- package/apps/cli/dist/packages/finance-module/src/personal-preferences.mjs +29 -0
- package/apps/cli/dist/packages/finance-module/src/route-contracts.mjs +11 -0
- package/apps/cli/dist/packages/finance-module/src/schema-compatibility.mjs +142 -0
- package/apps/cli/dist/packages/finance-module/src/service-record-domain.mjs +16 -0
- package/apps/cli/dist/packages/finance-module/src/service-record-store.mjs +119 -0
- package/apps/cli/dist/packages/finance-module/src/shared-draft-migration.mjs +39 -0
- package/apps/cli/dist/packages/finance-module/src/single-draft-migration.mjs +70 -0
- package/apps/cli/dist/packages/finance-module/src/storage.mjs +282 -0
- package/apps/cli/dist/packages/finance-module/src/web-contracts.mjs +38 -0
- package/apps/cli/dist/packages/local-store/src/checkpoint-backup.mjs +40 -0
- package/apps/cli/dist/packages/local-store/src/checkpoint-history.mjs +77 -0
- package/apps/cli/dist/packages/local-store/src/database.mjs +1523 -0
- package/apps/cli/dist/packages/local-store/src/exchange-rates.mjs +169 -0
- package/apps/cli/dist/packages/local-store/src/node.mjs +71 -0
- package/apps/cli/dist/packages/sdk/src/account-snapshot-service.mjs +582 -0
- package/apps/cli/dist/packages/sdk/src/auth.mjs +89 -0
- package/apps/cli/dist/packages/sdk/src/cache-analysis.mjs +393 -0
- package/apps/cli/dist/packages/sdk/src/config.mjs +64 -0
- package/apps/cli/dist/packages/sdk/src/credential-identity.mjs +8 -0
- package/apps/cli/dist/packages/sdk/src/credentials.mjs +86 -0
- package/apps/cli/dist/packages/sdk/src/exchange-rate-service.mjs +253 -0
- package/apps/cli/dist/packages/sdk/src/finance-cookie-cache.mjs +93 -0
- package/apps/cli/dist/packages/sdk/src/finance-session.mjs +215 -0
- package/apps/cli/dist/packages/sdk/src/frankfurter.mjs +125 -0
- package/apps/cli/dist/packages/sdk/src/node.mjs +53 -0
- package/apps/cli/dist/packages/sdk/src/probe.mjs +65 -0
- package/apps/cli/dist/packages/sdk/src/resource-lease-node.mjs +27 -0
- package/apps/cli/dist/packages/sdk/src/resource-lease-owner-node.mjs +68 -0
- package/apps/cli/dist/packages/sdk/src/resource-lease.mjs +143 -0
- package/apps/cli/dist/packages/sdk/src/runtime.mjs +643 -0
- package/apps/cli/dist/storage.mjs +11 -0
- package/bundles/sui-ledger/dist/_virtual/_rolldown/runtime.mjs +35 -0
- package/bundles/sui-ledger/dist/capabilities/tools.mjs +32 -0
- package/bundles/sui-ledger/dist/client.js +23511 -0
- package/bundles/sui-ledger/dist/finance-prompt.mjs +30 -0
- package/bundles/sui-ledger/dist/finance-state-context.mjs +38 -0
- package/bundles/sui-ledger/dist/index.mjs +198 -0
- package/bundles/sui-ledger/dist/maintenance-cli.mjs +76 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/@deepseek-ai_dsh-home-paths_159c15e70066431314381a350c2ee56a/node_modules/@deepseek-ai/dsh-home-paths/lib/index.mjs +67 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/@keyv_serialize@1.1.1/node_modules/@keyv/serialize/dist/index.mjs +37 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/@sec-ant_readable-stream@0.4.1/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.mjs +81 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/@sec-ant_readable-stream@0.4.1/node_modules/@sec-ant/readable-stream/dist/ponyfill/index.mjs +1 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/@sindresorhus_is@7.2.0/node_modules/@sindresorhus/is/distribution/index.mjs +1015 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/@sindresorhus_is@7.2.0/node_modules/@sindresorhus/is/distribution/utilities.mjs +6 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/boolbase@1.0.0/node_modules/boolbase/index.mjs +15 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/byte-counter@0.1.0/node_modules/byte-counter/utilities.mjs +9 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cacheable-lookup@7.0.0/node_modules/cacheable-lookup/source/index.mjs +279 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cacheable-request@13.0.19/node_modules/cacheable-request/dist/index.mjs +274 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cacheable-request@13.0.19/node_modules/cacheable-request/dist/types.mjs +15 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio-select@2.1.0/node_modules/cheerio-select/lib/esm/helpers.mjs +15 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio-select@2.1.0/node_modules/cheerio-select/lib/esm/index.mjs +159 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio-select@2.1.0/node_modules/cheerio-select/lib/esm/positionals.mjs +33 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/attributes.mjs +465 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/css.mjs +94 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/extract.mjs +39 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/forms.mjs +63 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/manipulation.mjs +731 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/traversing.mjs +828 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/cheerio.mjs +53 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/index.mjs +11 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/load-parse.mjs +25 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/load.mjs +73 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/options.mjs +27 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/parse.mjs +53 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/parsers/parse5-adapter.mjs +42 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/static.mjs +165 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/utils.mjs +78 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/attributes.mjs +187 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/compile.mjs +77 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/general.mjs +89 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/index.mjs +43 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/aliases.mjs +32 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/filters.mjs +114 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/index.mjs +35 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/pseudos.mjs +53 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/subselects.mjs +68 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/sort.mjs +60 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-what@6.2.2/node_modules/css-what/lib/commonjs/index.mjs +50 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-what@6.2.2/node_modules/css-what/lib/commonjs/parse.mjs +320 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-what@6.2.2/node_modules/css-what/lib/commonjs/stringify.mjs +102 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/css-what@6.2.2/node_modules/css-what/lib/commonjs/types.mjs +45 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/decompress-response@10.0.0/node_modules/decompress-response/index.mjs +59 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/dom-serializer@2.0.0/node_modules/dom-serializer/lib/esm/foreignNames.mjs +103 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/dom-serializer@2.0.0/node_modules/dom-serializer/lib/esm/index.mjs +144 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/domelementtype@2.3.0/node_modules/domelementtype/lib/esm/index.mjs +51 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/domhandler@5.0.3/node_modules/domhandler/lib/esm/index.mjs +128 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/domhandler@5.0.3/node_modules/domhandler/lib/esm/node.mjs +312 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/feeds.mjs +161 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/helpers.mjs +113 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/index.mjs +56 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/legacy.mjs +141 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/manipulation.mjs +117 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/querying.mjs +124 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/stringify.mjs +69 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/traversal.mjs +109 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/encoding-sniffer@0.2.1/node_modules/encoding-sniffer/dist/esm/index.mjs +7 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/encoding-sniffer@0.2.1/node_modules/encoding-sniffer/dist/esm/sniffer.mjs +112 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/escape.mjs +83 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode-codepoint.mjs +43 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode.mjs +330 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/escape.mjs +49 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/generated/decode-data-html.mjs +4 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/decode-codepoint.mjs +57 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/decode.mjs +351 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/generated/decode-data-html.mjs +5 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/generated/decode-data-xml.mjs +5 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/internal/bin-trie-flags.mjs +20 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/esm/internal/decode-shared.mjs +14 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/index.mjs +871 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/form-data-encoder@4.1.0/node_modules/form-data-encoder/lib/index.mjs +279 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/array-buffer.mjs +54 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/buffer.mjs +14 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/contents.mjs +80 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/stream.mjs +41 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/utils.mjs +8 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/as-promise/index.mjs +154 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/as-promise/types.mjs +20 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/calculate-retry-delay.mjs +20 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/diagnostics-channel.mjs +38 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/errors.mjs +132 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/index.mjs +923 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/options.mjs +1622 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/parse-link-header.mjs +27 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/response.mjs +36 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/timed-out.mjs +107 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/defer-to-connect.mjs +28 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/get-body-size.mjs +23 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/is-client-request.mjs +6 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/is-form-data.mjs +7 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/is-unix-socket-url.mjs +25 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/proxy-events.mjs +16 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/timer.mjs +114 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/unhandle.mjs +23 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/url-to-options.mjs +20 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/core/utils/weakable-map.mjs +19 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/create.mjs +166 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/got@14.6.5/node_modules/got/dist/source/index.mjs +17 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/htmlparser2@10.1.0/node_modules/htmlparser2/dist/esm/Parser.mjs +441 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/htmlparser2@10.1.0/node_modules/htmlparser2/dist/esm/Tokenizer.mjs +661 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/htmlparser2@10.1.0/node_modules/htmlparser2/dist/esm/index.mjs +19 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http-cache-semantics@4.3.0/node_modules/http-cache-semantics/index.mjs +608 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/agent.mjs +441 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/auto.mjs +145 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/client-request.mjs +318 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/incoming-message.mjs +58 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/index.mjs +51 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/get-auth-headers.mjs +19 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h1-over-h2.mjs +84 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-h1.mjs +49 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-h2.mjs +38 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/h2-over-hx.mjs +39 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/initialize.mjs +23 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/proxies/unexpected-status-code-error.mjs +15 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/calculate-server-name.mjs +24 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/check-type.mjs +17 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/delay-async-destroy.mjs +28 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/errors.mjs +30 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.mjs +16 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/js-stream-socket.mjs +9 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/proxy-events.mjs +10 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/proxy-socket-handler.mjs +77 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/validate-header-name.mjs +15 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/http2-wrapper@2.2.1/node_modules/http2-wrapper/source/utils/validate-header-value.mjs +14 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/dbcs-codec.mjs +355 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/dbcs-data.mjs +191 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/index.mjs +31 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/internal.mjs +140 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-codec.mjs +50 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-data-generated.mjs +455 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-data.mjs +151 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/big5-added.mjs +169 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/cp936.mjs +2584 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/cp949.mjs +2220 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/cp950.mjs +227 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/eucjp.mjs +425 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/gb18030-ranges.mjs +427 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/gbk-added.mjs +230 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/shiftjis.mjs +292 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf16.mjs +123 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf32.mjs +197 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf7.mjs +182 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/bom-handling.mjs +42 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/index.mjs +108 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/streams.mjs +90 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/is-stream@4.0.1/node_modules/is-stream/index.mjs +9 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/js-sha256@0.11.1/node_modules/js-sha256/src/sha256.mjs +495 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/keyv@5.6.0/node_modules/keyv/dist/index.mjs +740 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/lowercase-keys@3.0.0/node_modules/lowercase-keys/index.mjs +6 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/mimic-response@4.0.0/node_modules/mimic-response/index.mjs +53 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/normalize-url@8.1.1/node_modules/normalize-url/index.mjs +145 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/nth-check@2.1.1/node_modules/nth-check/lib/esm/compile.mjs +37 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/nth-check@2.1.1/node_modules/nth-check/lib/esm/index.mjs +31 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/nth-check@2.1.1/node_modules/nth-check/lib/esm/parse.mjs +60 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/p-cancelable@4.0.1/node_modules/p-cancelable/index.mjs +86 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5-htmlparser2-tree-adapter@7.1.0/node_modules/parse5-htmlparser2-tree-adapter/dist/index.mjs +187 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5-parser-stream@7.1.2/node_modules/parse5-parser-stream/dist/index.mjs +2 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/doctype.mjs +101 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/error-codes.mjs +66 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/foreign-content.mjs +259 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/html.mjs +544 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/token.mjs +19 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/unicode.mjs +91 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/index.mjs +41 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/formatting-element-list.mjs +91 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/index.mjs +2492 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/open-element-stack.mjs +292 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/serializer/index.mjs +111 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/tokenizer/index.mjs +2067 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/tokenizer/preprocessor.mjs +154 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/tree-adapters/default.mjs +164 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/quick-lru@5.1.1/node_modules/quick-lru/index.mjs +77 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/resolve-alpn@1.2.1/node_modules/resolve-alpn/index.mjs +47 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/responselike@4.0.2/node_modules/responselike/index.mjs +32 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/safer-buffer@2.1.2/node_modules/safer-buffer/safer.mjs +45 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/tldts@7.4.18/node_modules/tldts/dist/cjs/index.mjs +22542 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/tough-cookie@6.0.0/node_modules/tough-cookie/dist/index.mjs +1761 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/index.mjs +221 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/abort-signal.mjs +44 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/api-connect.mjs +85 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/api-pipeline.mjs +174 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/api-request.mjs +155 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/api-stream.mjs +136 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/api-upgrade.mjs +88 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/index.mjs +17 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/api/readable.mjs +418 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/cache/memory-cache-store.mjs +190 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/cache/sqlite-cache-store.mjs +324 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/connect.mjs +115 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/constants.mjs +134 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/diagnostics.mjs +114 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/errors.mjs +412 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/request.mjs +282 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/socks5-client.mjs +288 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/socks5-utils.mjs +166 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/symbols.mjs +80 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/tree.mjs +124 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/core/util.mjs +940 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/agent.mjs +119 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/balanced-pool.mjs +129 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/client-h1.mjs +1091 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/client-h2.mjs +588 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/client.mjs +385 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/dispatcher-base.mjs +121 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/dispatcher.mjs +35 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/env-http-proxy-agent.mjs +105 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/fixed-queue.mjs +75 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/h2c-client.mjs +31 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/pool-base.mjs +155 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/pool.mjs +76 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/proxy-agent.mjs +233 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/retry-agent.mjs +37 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/round-robin-pool.mjs +94 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/dispatcher/socks5-proxy-agent.mjs +194 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/encoding/index.mjs +18 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/global.mjs +48 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/cache-handler.mjs +457 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/cache-revalidation-handler.mjs +82 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/decorator-handler.mjs +57 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/deduplication-handler.mjs +341 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/redirect-handler.mjs +131 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/retry-handler.mjs +332 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/unwrap-handler.mjs +88 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/handler/wrap-handler.mjs +68 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/cache.mjs +350 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/decompress.mjs +416 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/deduplicate.mjs +69 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/dns.mjs +323 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/dump.mjs +65 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/redirect.mjs +20 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/response-error.mjs +73 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/interceptor/retry.mjs +25 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/llhttp/constants.mjs +590 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/llhttp/llhttp-wasm.mjs +13 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/llhttp/llhttp_simd-wasm.mjs +13 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/llhttp/utils.mjs +16 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-agent.mjs +154 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-call-history.mjs +159 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-client.mjs +59 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-errors.mjs +28 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-interceptor.mjs +150 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-pool.mjs +59 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-symbols.mjs +37 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/mock-utils.mjs +302 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/pending-interceptors-formatter.mjs +38 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/snapshot-agent.mjs +268 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/snapshot-recorder.mjs +424 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/mock/snapshot-utils.mjs +121 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/cache.mjs +440 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/date.mjs +332 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/promise.mjs +31 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/runtime-features.mjs +101 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/stats.mjs +31 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/util/timers.mjs +341 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cache/cache.mjs +462 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cache/cachestorage.mjs +103 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cache/util.mjs +39 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cookies/constants.mjs +11 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cookies/index.mjs +169 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cookies/parse.mjs +108 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/cookies/util.mjs +239 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/eventsource/eventsource-stream.mjs +317 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/eventsource/eventsource.mjs +345 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/eventsource/util.mjs +29 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/body.mjs +271 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/constants.mjs +224 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/data-url.mjs +247 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/formdata-parser.mjs +255 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/formdata.mjs +153 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/global.mjs +34 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/headers.mjs +400 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/index.mjs +776 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/request.mjs +602 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/response.mjs +358 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/fetch/util.mjs +795 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/infra/index.mjs +154 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.mjs +170 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/webidl/index.mjs +505 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/connection.mjs +166 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/constants.mjs +47 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/events.mjs +268 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/frame.mjs +105 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/permessage-deflate.mjs +85 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/receiver.mjs +323 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/sender.mjs +90 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/stream/websocketerror.mjs +78 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/stream/websocketstream.mjs +270 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/util.mjs +212 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/undici@7.30.0/node_modules/undici/lib/web/websocket/websocket.mjs +432 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/whatwg-encoding@3.1.1/node_modules/whatwg-encoding/lib/labels-to-names.mjs +224 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/whatwg-encoding@3.1.1/node_modules/whatwg-encoding/lib/supported-names.mjs +45 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/whatwg-encoding@3.1.1/node_modules/whatwg-encoding/lib/whatwg-encoding.mjs +40 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/whatwg-mimetype@4.0.0/node_modules/whatwg-mimetype/lib/mime-type-parameters.mjs +54 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/whatwg-mimetype@4.0.0/node_modules/whatwg-mimetype/lib/mime-type.mjs +92 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/whatwg-mimetype@4.0.0/node_modules/whatwg-mimetype/lib/parser.mjs +62 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/whatwg-mimetype@4.0.0/node_modules/whatwg-mimetype/lib/serializer.mjs +24 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/whatwg-mimetype@4.0.0/node_modules/whatwg-mimetype/lib/utils.mjs +47 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/dist/cpexcel.mjs +3348 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx.mjs +26473 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.mjs +26 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.mjs +35 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.mjs +17 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.mjs +800 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.mjs +508 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.mjs +366 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.mjs +60 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.mjs +32 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.mjs +63 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.mjs +253 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.mjs +118 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.mjs +65 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.mjs +48 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.mjs +1235 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.mjs +297 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.mjs +316 -0
- package/bundles/sui-ledger/dist/node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.mjs +8 -0
- package/bundles/sui-ledger/dist/packages/data-maintenance/src/archive.mjs +143 -0
- package/bundles/sui-ledger/dist/packages/data-maintenance/src/contracts.mjs +17 -0
- package/bundles/sui-ledger/dist/packages/data-maintenance/src/files.mjs +158 -0
- package/bundles/sui-ledger/dist/packages/data-maintenance/src/index.mjs +494 -0
- package/bundles/sui-ledger/dist/packages/data-maintenance/src/lease.mjs +53 -0
- package/bundles/sui-ledger/dist/packages/data-maintenance/src/migration-backup.mjs +57 -0
- package/bundles/sui-ledger/dist/packages/data-maintenance/src/paths.mjs +15 -0
- package/bundles/sui-ledger/dist/packages/data-maintenance/src/runtime.mjs +132 -0
- package/bundles/sui-ledger/dist/packages/feidee/src/client.mjs +635 -0
- package/bundles/sui-ledger/dist/packages/feidee/src/hash.mjs +10 -0
- package/bundles/sui-ledger/dist/packages/feidee/src/index.mjs +8 -0
- package/bundles/sui-ledger/dist/packages/feidee/src/mutation-gateway.mjs +165 -0
- package/bundles/sui-ledger/dist/packages/feidee/src/parsers.mjs +634 -0
- package/bundles/sui-ledger/dist/packages/feidee/src/transaction-text.mjs +39 -0
- package/bundles/sui-ledger/dist/packages/feidee/src/write-contract.mjs +273 -0
- package/bundles/sui-ledger/dist/packages/finance/src/date-range.mjs +74 -0
- package/bundles/sui-ledger/dist/packages/finance/src/domain.mjs +18 -0
- package/bundles/sui-ledger/dist/packages/finance/src/errors.mjs +221 -0
- package/bundles/sui-ledger/dist/packages/finance/src/index.mjs +17 -0
- package/bundles/sui-ledger/dist/packages/finance/src/json-schema.mjs +212 -0
- package/bundles/sui-ledger/dist/packages/finance/src/metadata-query.mjs +32 -0
- package/bundles/sui-ledger/dist/packages/finance/src/money.mjs +39 -0
- package/bundles/sui-ledger/dist/packages/finance/src/public-error.mjs +10 -0
- package/bundles/sui-ledger/dist/packages/finance/src/sync/progress.mjs +27 -0
- package/bundles/sui-ledger/dist/packages/finance/src/sync/service.mjs +282 -0
- package/bundles/sui-ledger/dist/packages/finance/src/transactions/audit.mjs +104 -0
- package/bundles/sui-ledger/dist/packages/finance/src/transactions/canary.mjs +85 -0
- package/bundles/sui-ledger/dist/packages/finance/src/transactions/compare.mjs +76 -0
- package/bundles/sui-ledger/dist/packages/finance/src/transactions/contracts.mjs +83 -0
- package/bundles/sui-ledger/dist/packages/finance/src/transactions/memo-policy.mjs +79 -0
- package/bundles/sui-ledger/dist/packages/finance/src/transactions/mutation.mjs +656 -0
- package/bundles/sui-ledger/dist/packages/finance/src/transactions/query.mjs +59 -0
- package/bundles/sui-ledger/dist/packages/finance/src/transactions/statistics.mjs +67 -0
- package/bundles/sui-ledger/dist/packages/finance/src/write-policy.mjs +4 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/balance-preview.mjs +119 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/capabilities.mjs +1306 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/checkpoint-review.mjs +75 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/commit-failure.mjs +161 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/commit-recovery.mjs +41 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/contracts.mjs +13 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/data-version.mjs +8 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/database.mjs +1292 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/draft-entries.mjs +216 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/draft-receipts.mjs +16 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/finance-guidance.mjs +23 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/historical-task-archives.mjs +24 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/index.mjs +17 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/interactions.mjs +229 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/model-pages.mjs +61 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/model-views.mjs +206 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/node.mjs +76 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/personal-preferences.mjs +103 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/route-contracts.mjs +11 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/routes.mjs +427 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/schema-compatibility.mjs +142 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/sdk-adapter.mjs +100 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/service-record-domain.mjs +207 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/service-record-routes.mjs +91 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/service-record-store.mjs +119 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/service-record-tools.mjs +283 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/service-records.mjs +626 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/service.mjs +2525 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/shared-draft-migration.mjs +39 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/single-draft-migration.mjs +70 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/source-reader.mjs +354 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/storage.mjs +282 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/tool-contracts.mjs +42 -0
- package/bundles/sui-ledger/dist/packages/finance-module/src/web-contracts.mjs +74 -0
- package/bundles/sui-ledger/dist/packages/interaction/src/registry.mjs +36 -0
- package/bundles/sui-ledger/dist/packages/interaction/src/service.mjs +424 -0
- package/bundles/sui-ledger/dist/packages/local-store/src/checkpoint-backup.mjs +40 -0
- package/bundles/sui-ledger/dist/packages/local-store/src/checkpoint-history.mjs +77 -0
- package/bundles/sui-ledger/dist/packages/local-store/src/database.mjs +1523 -0
- package/bundles/sui-ledger/dist/packages/local-store/src/exchange-rates.mjs +169 -0
- package/bundles/sui-ledger/dist/packages/local-store/src/node.mjs +71 -0
- package/bundles/sui-ledger/dist/packages/local-store/src/readonly-node.mjs +486 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/account-snapshot-service.mjs +582 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/cache-analysis.mjs +597 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/config.mjs +64 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/credential-identity.mjs +7 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/credentials.mjs +86 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/exchange-rate-service.mjs +253 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/finance-cookie-cache.mjs +93 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/finance-session.mjs +215 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/frankfurter.mjs +125 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/ledger-money.mjs +183 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/node-readonly.mjs +381 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/node.mjs +53 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/probe.mjs +65 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/resource-lease-node.mjs +27 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/resource-lease-owner-node.mjs +68 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/resource-lease.mjs +143 -0
- package/bundles/sui-ledger/dist/packages/sdk/src/runtime.mjs +643 -0
- package/bundles/sui-ledger/dist/preferences-context.mjs +21 -0
- package/bundles/sui-ledger/dist/remote-write-policy.mjs +51 -0
- package/bundles/sui-ledger/dist/routes/finance-api.mjs +380 -0
- package/bundles/sui-ledger/dist/session/attachment-ownership.mjs +53 -0
- package/bundles/sui-ledger/dist/session/call-context.mjs +14 -0
- package/bundles/sui-ledger/dist/session/source-ports.mjs +74 -0
- package/bundles/sui-ledger/dist/storage/business-runtime.mjs +116 -0
- package/bundles/sui-ledger/dist/storage/maintenance-http.mjs +159 -0
- package/bundles/sui-ledger/dist/storage/paths.mjs +15 -0
- package/bundles/sui-ledger/dist/style.css +15416 -0
- package/bundles/sui-ledger/icon.svg +1 -0
- package/bundles/sui-ledger/locale/en.json +6 -0
- package/bundles/sui-ledger/locale/zh-CN.json +6 -0
- package/cordis.patch.yml +4 -0
- package/package.json +111 -3
|
@@ -0,0 +1,1292 @@
|
|
|
1
|
+
import { financialDateRange } from "../../finance/src/date-range.mjs";
|
|
2
|
+
import "../../finance/src/index.mjs";
|
|
3
|
+
import { commitCanResume, operationCanContinue, operationIsVerified } from "./web-contracts.mjs";
|
|
4
|
+
import { FINANCE_BUSINESS_EVENT_KINDS, assertAgentWritable } from "./contracts.mjs";
|
|
5
|
+
import { SqliteServiceRecordsStore } from "./service-record-store.mjs";
|
|
6
|
+
import { draftMutationReceiptPrefix } from "./draft-receipts.mjs";
|
|
7
|
+
import { migrateSharedDraft } from "./shared-draft-migration.mjs";
|
|
8
|
+
import { projectDraftEntry, storedDraftEntry } from "./draft-entries.mjs";
|
|
9
|
+
import { createHash } from "node:crypto";
|
|
10
|
+
//#region ../../packages/finance-module/src/database.ts
|
|
11
|
+
var FinanceDatabase = class {
|
|
12
|
+
db;
|
|
13
|
+
serviceRecords;
|
|
14
|
+
constructor(db, prepared = false) {
|
|
15
|
+
this.db = db;
|
|
16
|
+
try {
|
|
17
|
+
this.db.exec(prepared ? "PRAGMA foreign_keys = ON; PRAGMA busy_timeout = 50;" : "PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON; PRAGMA busy_timeout = 5000;");
|
|
18
|
+
if (!prepared) this.migrate();
|
|
19
|
+
this.serviceRecords = new SqliteServiceRecordsStore(db, !prepared);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
try {
|
|
22
|
+
this.db.close();
|
|
23
|
+
} catch {}
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
close() {
|
|
28
|
+
this.db.close();
|
|
29
|
+
}
|
|
30
|
+
transaction(operation) {
|
|
31
|
+
return this.db.transaction(operation)();
|
|
32
|
+
}
|
|
33
|
+
createReadOperation(operation) {
|
|
34
|
+
this.db.transaction(() => {
|
|
35
|
+
if (this.db.prepare("SELECT 1 FROM finance_read_operations WHERE kind=? AND scope_id=? AND status='running'").get(operation.kind, operation.scopeId)) throw new Error("finance_read_operation_in_progress");
|
|
36
|
+
if (operation.kind === "prepare") this.assertStagingAllowed(operation.scopeId);
|
|
37
|
+
this.db.prepare("INSERT INTO finance_read_operations(id,kind,scope_id,status,data_json) VALUES(?,?,?,?,?)").run(operation.id, operation.kind, operation.scopeId, operation.status, stringify(operation));
|
|
38
|
+
this.pruneReadOperations();
|
|
39
|
+
})();
|
|
40
|
+
}
|
|
41
|
+
saveReadOperation(operation) {
|
|
42
|
+
this.db.transaction(() => {
|
|
43
|
+
this.db.prepare("UPDATE finance_read_operations SET status=?,data_json=? WHERE id=? AND status='running'").run(operation.status, stringify(operation), operation.id);
|
|
44
|
+
if (operation.status !== "running") this.pruneReadOperations();
|
|
45
|
+
})();
|
|
46
|
+
}
|
|
47
|
+
pruneReadOperations() {
|
|
48
|
+
this.db.prepare(`DELETE FROM finance_read_operations WHERE status!='running' AND rowid NOT IN (
|
|
49
|
+
SELECT rowid FROM finance_read_operations WHERE status!='running' ORDER BY rowid DESC LIMIT 100
|
|
50
|
+
)`).run();
|
|
51
|
+
}
|
|
52
|
+
listReadOperations(kind, scopeId) {
|
|
53
|
+
return this.db.prepare(`SELECT data_json FROM finance_read_operations
|
|
54
|
+
WHERE (? IS NULL OR kind=?) AND (? IS NULL OR scope_id=?) ORDER BY rowid DESC`).all(kind ?? null, kind ?? null, scopeId ?? null, scopeId ?? null).map((row) => JSON.parse(row.data_json));
|
|
55
|
+
}
|
|
56
|
+
bindSubjectGrant(input) {
|
|
57
|
+
if ("subjectType" in input) throw new Error("finance_grant_role_unsupported");
|
|
58
|
+
assertText(input.id, "grantId");
|
|
59
|
+
assertText(input.subjectId, "subjectId");
|
|
60
|
+
assertText(input.bookId, "bookId");
|
|
61
|
+
assertTimestamp(input.now, "now");
|
|
62
|
+
return this.db.transaction(() => {
|
|
63
|
+
const current = this.getActiveGrant(input.subjectId);
|
|
64
|
+
if (input.expectedRevision !== void 0 && current?.revision !== input.expectedRevision) throw new Error("finance_grant_revision_conflict");
|
|
65
|
+
if (current?.bookId === input.bookId) return current;
|
|
66
|
+
const revision = (current?.revision ?? 0) + 1;
|
|
67
|
+
if (current) this.db.prepare("UPDATE book_read_grants SET replaced_at=? WHERE id=? AND replaced_at IS NULL").run(input.now, current.id);
|
|
68
|
+
this.db.prepare(`INSERT INTO book_read_grants(
|
|
69
|
+
id,subject_id,book_id,revision,bound_at,replaced_at
|
|
70
|
+
) VALUES(?,?,?,?,?,NULL)`).run(input.id, input.subjectId, input.bookId, revision, input.now);
|
|
71
|
+
return this.getActiveGrant(input.subjectId);
|
|
72
|
+
})();
|
|
73
|
+
}
|
|
74
|
+
getActiveGrant(subjectId) {
|
|
75
|
+
const row = this.db.prepare(`SELECT * FROM book_read_grants
|
|
76
|
+
WHERE subject_id=? AND replaced_at IS NULL ORDER BY revision DESC LIMIT 1`).get(subjectId);
|
|
77
|
+
return row ? mapGrant(row) : void 0;
|
|
78
|
+
}
|
|
79
|
+
ensureCanonicalWorkset(input) {
|
|
80
|
+
if ("createdByRunId" in input) throw new Error("finance_workset_role_unsupported");
|
|
81
|
+
this.assertBookMutationAllowed(input.bookId);
|
|
82
|
+
const existing = this.getCanonicalWorkset(input.bookId);
|
|
83
|
+
if (existing) return existing;
|
|
84
|
+
try {
|
|
85
|
+
this.db.prepare(`INSERT INTO worksets(
|
|
86
|
+
id,book_id,title,description,source_json,created_by_subject_id,revision,created_at,updated_at,is_canonical
|
|
87
|
+
) VALUES(?,?,?,NULL,NULL,?,1,?,?,1)`).run(input.id, input.bookId, input.title ?? "待入账", input.createdBySubjectId ?? null, input.createdAt, input.createdAt);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
const concurrent = this.getCanonicalWorkset(input.bookId);
|
|
90
|
+
if (concurrent) return concurrent;
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
return this.getCanonicalWorkset(input.bookId);
|
|
94
|
+
}
|
|
95
|
+
getCanonicalWorkset(bookId) {
|
|
96
|
+
const row = this.db.prepare("SELECT * FROM worksets WHERE book_id=? AND is_canonical=1 LIMIT 1").get(bookId);
|
|
97
|
+
return row ? this.mapWorkset(row) : void 0;
|
|
98
|
+
}
|
|
99
|
+
getEntry(bookId, entryId) {
|
|
100
|
+
const row = this.db.prepare("SELECT * FROM entries WHERE book_id=? AND id=? AND removed_at IS NULL").get(bookId, entryId);
|
|
101
|
+
return row ? mapEntry(row) : void 0;
|
|
102
|
+
}
|
|
103
|
+
readBusinessSnapshot(bookId) {
|
|
104
|
+
return this.db.transaction(() => {
|
|
105
|
+
const workset = this.getCanonicalWorkset(bookId);
|
|
106
|
+
const commits = this.db.prepare(`SELECT c.* FROM commits c
|
|
107
|
+
JOIN worksets w ON w.id=c.workset_id WHERE w.book_id=? ORDER BY c.created_at DESC,c.id DESC`).all(bookId).map((row) => this.mapCommit(row));
|
|
108
|
+
return {
|
|
109
|
+
...workset ? { workset } : {},
|
|
110
|
+
commits
|
|
111
|
+
};
|
|
112
|
+
})();
|
|
113
|
+
}
|
|
114
|
+
isBookMutationBlocked(bookId) {
|
|
115
|
+
return Boolean(this.db.prepare("SELECT 1 FROM finance_book_migration_state WHERE book_id=? AND mutation_blocked=1").get(bookId));
|
|
116
|
+
}
|
|
117
|
+
saveDraftRow(row) {
|
|
118
|
+
return this.db.transaction(() => this.writeDraftRow(row))();
|
|
119
|
+
}
|
|
120
|
+
saveDraftRowWithEvent(row, event) {
|
|
121
|
+
return this.db.transaction(() => {
|
|
122
|
+
const saved = this.writeDraftRow(row);
|
|
123
|
+
this.insertBusinessEvent(event, saved);
|
|
124
|
+
return saved;
|
|
125
|
+
})();
|
|
126
|
+
}
|
|
127
|
+
writeDraftRow(row) {
|
|
128
|
+
if ("subjectType" in row) throw new Error("finance_draft_role_unsupported");
|
|
129
|
+
assertText(row.id, "draft id");
|
|
130
|
+
assertText(row.subjectId, "draft subjectId");
|
|
131
|
+
assertTimestamp(row.createdAt, "draft createdAt");
|
|
132
|
+
assertTimestamp(row.updatedAt, "draft updatedAt");
|
|
133
|
+
if (row.status === "booked") assertTimestamp(row.bookedAt, "draft bookedAt");
|
|
134
|
+
this.assertBookMutationAllowed(row.bookId);
|
|
135
|
+
const stored = this.getDraftRow(row.id);
|
|
136
|
+
if (stored && (stored.subjectId !== row.subjectId || stored.grantId !== row.grantId || stored.bookId !== row.bookId)) throw new Error("finance_draft_identity_conflict");
|
|
137
|
+
if (stored?.status === "booked") throw new Error("finance_draft_row_frozen");
|
|
138
|
+
if (row.status === "open") {
|
|
139
|
+
const open = this.getOpenDraftRow(row.subjectId);
|
|
140
|
+
if (open && open.id !== row.id) throw new Error("finance_draft_open_row_exists");
|
|
141
|
+
}
|
|
142
|
+
this.db.prepare(`INSERT INTO finance_drafts(
|
|
143
|
+
id,subject_id,grant_id,book_id,status,entries_json,source_json,reference_json,
|
|
144
|
+
booked_at,booked_summary_json,created_at,updated_at
|
|
145
|
+
) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)
|
|
146
|
+
ON CONFLICT(id) DO UPDATE SET status=excluded.status,entries_json=excluded.entries_json,
|
|
147
|
+
source_json=excluded.source_json,reference_json=excluded.reference_json,
|
|
148
|
+
booked_at=excluded.booked_at,booked_summary_json=excluded.booked_summary_json,
|
|
149
|
+
updated_at=excluded.updated_at`).run(row.id, row.subjectId, row.grantId, row.bookId, row.status, stringify({ entries: row.entries.map(storedDraftEntry) }), row.source ? stringify(row.source) : null, row.referenceData ? stringify(row.referenceData) : null, row.status === "booked" ? row.bookedAt : null, row.status === "booked" ? stringify(row.bookedSummary ?? {
|
|
150
|
+
moved: 0,
|
|
151
|
+
left: 0
|
|
152
|
+
}) : null, row.createdAt, row.updatedAt);
|
|
153
|
+
return this.getDraftRow(row.id);
|
|
154
|
+
}
|
|
155
|
+
getDraftRow(id) {
|
|
156
|
+
const row = this.db.prepare("SELECT * FROM finance_drafts WHERE id=?").get(id);
|
|
157
|
+
return row ? mapDraftRow(row) : void 0;
|
|
158
|
+
}
|
|
159
|
+
getOpenDraftRow(subjectId) {
|
|
160
|
+
const row = this.db.prepare("SELECT * FROM finance_drafts WHERE subject_id=? AND status='open' LIMIT 1").get(subjectId);
|
|
161
|
+
return row ? mapDraftRow(row) : void 0;
|
|
162
|
+
}
|
|
163
|
+
listBookedDraftRows(subjectId) {
|
|
164
|
+
return this.db.prepare(`SELECT * FROM finance_drafts WHERE status='booked'
|
|
165
|
+
AND (? IS NULL OR subject_id=?) ORDER BY booked_at,rowid`).all(subjectId ?? null, subjectId ?? null).map(mapDraftRow);
|
|
166
|
+
}
|
|
167
|
+
deleteDraftRow(id) {
|
|
168
|
+
const result = this.db.prepare("DELETE FROM finance_drafts WHERE id=? AND status='open'").run(id);
|
|
169
|
+
if (Number(result.changes) !== 1) throw new Error("finance_draft_not_found");
|
|
170
|
+
}
|
|
171
|
+
listSubjectResourceOwners() {
|
|
172
|
+
return this.db.prepare(`SELECT subject_id AS id FROM finance_drafts
|
|
173
|
+
UNION SELECT subject_id FROM book_read_grants
|
|
174
|
+
UNION SELECT subject_id FROM finance_business_events
|
|
175
|
+
UNION SELECT created_by_run_id FROM worksets WHERE created_by_run_id IS NOT NULL
|
|
176
|
+
UNION SELECT created_by_subject_id FROM worksets WHERE created_by_subject_id IS NOT NULL
|
|
177
|
+
UNION SELECT json_extract(source_json,'$.runId') FROM worksets
|
|
178
|
+
WHERE json_extract(source_json,'$.type') IN ('conversation','conversation-attachment')
|
|
179
|
+
UNION SELECT json_extract(evidence.value,'$.source.runId') FROM entries,json_each(entries.evidence_json) AS evidence
|
|
180
|
+
WHERE json_extract(evidence.value,'$.source.type') IN ('conversation','conversation-attachment')
|
|
181
|
+
AND COALESCE(json_extract(evidence.value,'$.sourceDeleted'),0)=0`).all().filter((row) => typeof row.id === "string").map((row) => row.id);
|
|
182
|
+
}
|
|
183
|
+
deleteSubjectResources(subjectId) {
|
|
184
|
+
assertText(subjectId, "subjectId");
|
|
185
|
+
this.db.transaction(() => {
|
|
186
|
+
this.db.prepare("DELETE FROM finance_business_events WHERE subject_id=?").run(subjectId);
|
|
187
|
+
this.db.prepare("DELETE FROM finance_drafts WHERE subject_id=?").run(subjectId);
|
|
188
|
+
this.db.prepare("DELETE FROM book_read_grants WHERE subject_id=?").run(subjectId);
|
|
189
|
+
const draftReceiptPrefix = draftMutationReceiptPrefix(subjectId);
|
|
190
|
+
this.db.prepare("DELETE FROM workspace_idempotency_receipts WHERE substr(receipt_key,1,length(?))=?").run(draftReceiptPrefix, draftReceiptPrefix);
|
|
191
|
+
for (const row of this.db.prepare("SELECT id,evidence_json FROM entries").all()) {
|
|
192
|
+
const evidence = parseJson(row.evidence_json, "Entry evidence");
|
|
193
|
+
let changed = false;
|
|
194
|
+
const next = evidence.map((item) => {
|
|
195
|
+
if ((item.source.type === "conversation" || item.source.type === "conversation-attachment") && item.source.runId === subjectId && !item.sourceDeleted) {
|
|
196
|
+
changed = true;
|
|
197
|
+
return {
|
|
198
|
+
...item,
|
|
199
|
+
sourceDeleted: true
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
return item;
|
|
203
|
+
});
|
|
204
|
+
if (changed) this.db.prepare("UPDATE entries SET evidence_json=? WHERE id=?").run(stringify(next), row.id);
|
|
205
|
+
}
|
|
206
|
+
this.db.prepare("UPDATE worksets SET created_by_run_id=NULL WHERE created_by_run_id=?").run(subjectId);
|
|
207
|
+
this.db.prepare("UPDATE worksets SET created_by_subject_id=NULL WHERE created_by_subject_id=?").run(subjectId);
|
|
208
|
+
this.db.prepare(`UPDATE worksets SET source_json=NULL WHERE json_extract(source_json,'$.type') IN ('conversation','conversation-attachment')
|
|
209
|
+
AND json_extract(source_json,'$.runId')=?`).run(subjectId);
|
|
210
|
+
})();
|
|
211
|
+
}
|
|
212
|
+
recordDraftEvent(event) {
|
|
213
|
+
this.db.transaction(() => this.insertBusinessEvent(event, {
|
|
214
|
+
subjectId: event.subjectId,
|
|
215
|
+
id: event.domainReference
|
|
216
|
+
}))();
|
|
217
|
+
}
|
|
218
|
+
listBusinessEvents() {
|
|
219
|
+
return this.db.prepare(`SELECT * FROM finance_business_events
|
|
220
|
+
ORDER BY created_at,idempotency_key`).all().map(mapBusinessEvent);
|
|
221
|
+
}
|
|
222
|
+
createWorkset(input) {
|
|
223
|
+
const workset = this.ensureCanonicalWorkset(input);
|
|
224
|
+
if (workset.id === input.id && (input.description || input.source !== void 0)) {
|
|
225
|
+
this.db.prepare("UPDATE worksets SET description=?,source_json=?,updated_at=? WHERE id=?").run(input.description ?? null, input.source === void 0 ? null : stringify(input.source), input.createdAt, input.id);
|
|
226
|
+
return this.getWorkset(input.id);
|
|
227
|
+
}
|
|
228
|
+
return workset;
|
|
229
|
+
}
|
|
230
|
+
getWorkset(id) {
|
|
231
|
+
const row = this.db.prepare("SELECT * FROM worksets WHERE id=?").get(id);
|
|
232
|
+
return row ? this.mapWorkset(row) : void 0;
|
|
233
|
+
}
|
|
234
|
+
describeWorksets(bookId, worksetId) {
|
|
235
|
+
return this.db.prepare("SELECT * FROM worksets WHERE is_canonical=1 AND (? IS NULL OR book_id=?) AND (? IS NULL OR id=?) ORDER BY updated_at DESC,id").all(bookId ?? null, bookId ?? null, worksetId ?? null, worksetId ?? null).map((row) => {
|
|
236
|
+
const states = this.db.prepare("SELECT state,COUNT(*) AS count FROM entries WHERE workset_id=? AND removed_at IS NULL GROUP BY state").all(row.id);
|
|
237
|
+
return {
|
|
238
|
+
id: row.id,
|
|
239
|
+
bookId: row.book_id,
|
|
240
|
+
...row.title ? { title: row.title } : {},
|
|
241
|
+
version: versionFor(row),
|
|
242
|
+
entryCount: states.reduce((total, state) => total + Number(state.count), 0),
|
|
243
|
+
counts: Object.fromEntries(states.map((state) => [state.state, Number(state.count)])),
|
|
244
|
+
createdAt: row.created_at,
|
|
245
|
+
updatedAt: row.updated_at
|
|
246
|
+
};
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
listWorksets(bookId) {
|
|
250
|
+
return (bookId ? this.db.prepare("SELECT * FROM worksets WHERE book_id=? AND is_canonical=1 ORDER BY updated_at DESC,id").all(bookId) : this.db.prepare("SELECT * FROM worksets WHERE is_canonical=1 ORDER BY updated_at DESC,id").all()).map((row) => this.mapWorkset(row));
|
|
251
|
+
}
|
|
252
|
+
addEntry(input) {
|
|
253
|
+
assertEntryActor(input.subjectId, input.evidence);
|
|
254
|
+
this.assertBookMutationAllowed(input.bookId);
|
|
255
|
+
return this.db.transaction(() => {
|
|
256
|
+
if (this.requireWorksetVersion(input.worksetId, input.expectedVersion).bookId !== input.bookId) throw new Error("finance_cross_book_write");
|
|
257
|
+
this.db.prepare(`INSERT INTO entries(
|
|
258
|
+
id,workset_id,book_id,proposal_json,state,locked_commit_id,evidence_json,
|
|
259
|
+
created_by_task_id,last_modified_by_task_id,created_by_subject_id,last_modified_by_subject_id,result,created_at,updated_at
|
|
260
|
+
) VALUES(?,?,?,?,'changed',NULL,?,'','',?,?,NULL,?,?)`).run(input.id, input.worksetId, input.bookId, stringify(input.proposal), stringify([input.evidence]), input.subjectId, input.subjectId, input.now, input.now);
|
|
261
|
+
this.bumpWorkset(input.worksetId, input.now);
|
|
262
|
+
return this.getWorkset(input.worksetId);
|
|
263
|
+
})();
|
|
264
|
+
}
|
|
265
|
+
updateEntry(input) {
|
|
266
|
+
assertEntryActor(input.subjectId, input.evidence);
|
|
267
|
+
this.assertBookMutationAllowed(input.bookId);
|
|
268
|
+
return this.db.transaction(() => {
|
|
269
|
+
const row = this.requireEntry(input.entryId);
|
|
270
|
+
const workset = this.requireWorksetVersion(row.workset_id, input.expectedVersion);
|
|
271
|
+
if (row.book_id !== input.bookId || workset.bookId !== input.bookId) throw new Error("finance_cross_book_write");
|
|
272
|
+
assertAgentWritable(row.state, row.locked_commit_id ?? void 0);
|
|
273
|
+
const evidence = parseJson(row.evidence_json, "Entry evidence");
|
|
274
|
+
if (!evidence.some((item) => sameEvidence(item, input.evidence))) evidence.push(input.evidence);
|
|
275
|
+
this.db.prepare(`UPDATE entries SET proposal_json=?,evidence_json=?,last_modified_by_subject_id=?,version=version+1,updated_at=? WHERE id=?`).run(stringify(input.proposal), stringify(evidence), input.subjectId, input.now, input.entryId);
|
|
276
|
+
this.bumpWorkset(row.workset_id, input.now);
|
|
277
|
+
return this.getWorkset(row.workset_id);
|
|
278
|
+
})();
|
|
279
|
+
}
|
|
280
|
+
removeEntry(input) {
|
|
281
|
+
this.assertBookMutationAllowed(input.bookId);
|
|
282
|
+
return this.db.transaction(() => {
|
|
283
|
+
const row = this.requireEntry(input.entryId);
|
|
284
|
+
const workset = this.requireWorksetVersion(row.workset_id, input.expectedVersion);
|
|
285
|
+
if (row.book_id !== input.bookId || workset.bookId !== input.bookId) throw new Error("finance_cross_book_write");
|
|
286
|
+
assertAgentWritable(row.state, row.locked_commit_id ?? void 0);
|
|
287
|
+
this.db.prepare("DELETE FROM entries WHERE id=?").run(input.entryId);
|
|
288
|
+
this.bumpWorkset(row.workset_id, input.now);
|
|
289
|
+
return this.getWorkset(row.workset_id);
|
|
290
|
+
})();
|
|
291
|
+
}
|
|
292
|
+
searchEntries(input, context) {
|
|
293
|
+
const states = input.states?.length ? [...new Set(input.states)] : ["changed", "staged"];
|
|
294
|
+
if (states.some((state) => state !== "changed" && state !== "staged")) throw new Error("finance_entry_search_state_invalid");
|
|
295
|
+
const limit = input.limit ?? 50;
|
|
296
|
+
const offset = input.offset ?? 0;
|
|
297
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100 || !Number.isSafeInteger(offset) || offset < 0) throw new Error("finance_entry_page_invalid");
|
|
298
|
+
const versionRows = this.db.prepare("SELECT id,revision,updated_at FROM worksets WHERE book_id=? AND is_canonical=1 ORDER BY id").all(input.bookId);
|
|
299
|
+
const { offset: _offset, limit: _limit, ...filters } = input;
|
|
300
|
+
const stamp = createHash("sha256").update(JSON.stringify([
|
|
301
|
+
context.ledgerRevision,
|
|
302
|
+
context.timezone,
|
|
303
|
+
versionRows,
|
|
304
|
+
{
|
|
305
|
+
...filters,
|
|
306
|
+
states: [...states].sort()
|
|
307
|
+
}
|
|
308
|
+
], (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).sort(([a], [b]) => a.localeCompare(b))) : item)).digest("hex").slice(0, 20);
|
|
309
|
+
const range = financialDateRange(input.beginDate, input.endDate, context.timezone);
|
|
310
|
+
const rows = this.db.prepare(`SELECT * FROM entries WHERE book_id=? AND removed_at IS NULL
|
|
311
|
+
AND state IN (${states.map(() => "?").join(",")}) ORDER BY updated_at DESC,id`).all(input.bookId, ...states);
|
|
312
|
+
const text = input.text?.trim().toLowerCase();
|
|
313
|
+
const matches = rows.map((row) => {
|
|
314
|
+
const entry = mapEntry(row);
|
|
315
|
+
return {
|
|
316
|
+
...entry,
|
|
317
|
+
facts: context.facts(entry)
|
|
318
|
+
};
|
|
319
|
+
}).filter(({ facts }) => {
|
|
320
|
+
const instant = typeof facts.occurredAt === "string" ? Date.parse(facts.occurredAt) : NaN;
|
|
321
|
+
return (!input.accountId || facts.accountId === input.accountId) && (!range.begin || instant >= Date.parse(range.begin)) && (!range.endExclusive || instant < Date.parse(range.endExclusive)) && (input.amountCents === void 0 || facts.amountCents === input.amountCents) && (!text || [
|
|
322
|
+
"memo",
|
|
323
|
+
"transactionName",
|
|
324
|
+
"content"
|
|
325
|
+
].some((field) => typeof facts[field] === "string" && facts[field].toLowerCase().includes(text)));
|
|
326
|
+
});
|
|
327
|
+
const entries = matches.slice(offset, offset + limit);
|
|
328
|
+
const workset = this.describeWorksets(input.bookId)[0];
|
|
329
|
+
return {
|
|
330
|
+
entries,
|
|
331
|
+
total: matches.length,
|
|
332
|
+
returnedCount: entries.length,
|
|
333
|
+
dataVersion: stamp,
|
|
334
|
+
workset: workset ? {
|
|
335
|
+
id: workset.id,
|
|
336
|
+
version: workset.version
|
|
337
|
+
} : null
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
patchWorkset(worksetId, expectedVersion, changes, now, expectedReviewVersion) {
|
|
341
|
+
const mutationWorkset = this.getWorkset(worksetId);
|
|
342
|
+
if (!mutationWorkset) throw new Error("finance_workset_not_found");
|
|
343
|
+
this.assertBookMutationAllowed(mutationWorkset.bookId);
|
|
344
|
+
return this.db.transaction(() => {
|
|
345
|
+
if (expectedReviewVersion !== void 0) {
|
|
346
|
+
if (!changes.length || changes.some((change) => change.operation !== "edit" && change.operation !== "remove")) throw new Error("finance_workset_review_scope_invalid");
|
|
347
|
+
if (this.getWorkset(worksetId).reviewVersion !== expectedReviewVersion) throw new Error("finance_workset_review_version_conflict");
|
|
348
|
+
} else this.requireWorksetVersion(worksetId, expectedVersion);
|
|
349
|
+
if (changes.some((change) => change.operation === "stage")) this.assertStagingAllowed(worksetId);
|
|
350
|
+
for (const change of changes) {
|
|
351
|
+
const row = this.requireEntry(change.entryId);
|
|
352
|
+
if (row.state === "staged") this.assertStagingAllowed(worksetId);
|
|
353
|
+
if (row.workset_id !== worksetId) throw new Error("finance_entry_workset_mismatch");
|
|
354
|
+
if (entryVersionFor(row) !== change.expectedEntryVersion) throw new Error("finance_entry_version_conflict");
|
|
355
|
+
if (expectedReviewVersion !== void 0) assertAgentWritable(row.workflow_state ?? row.state, row.locked_commit_id ?? void 0);
|
|
356
|
+
if (change.operation === "stage") {
|
|
357
|
+
assertAgentWritable(row.state, row.locked_commit_id ?? void 0);
|
|
358
|
+
this.db.prepare("UPDATE entries SET state='staged',workflow_state='staged',version=version+1,updated_at=? WHERE id=?").run(now, row.id);
|
|
359
|
+
} else if (change.operation === "unstage") {
|
|
360
|
+
if (row.state !== "staged" || row.locked_commit_id) throw new Error("finance_entry_not_unstageable");
|
|
361
|
+
this.db.prepare("UPDATE entries SET state='changed',workflow_state='changed',result=NULL,workflow_result=NULL,version=version+1,updated_at=? WHERE id=?").run(now, row.id);
|
|
362
|
+
} else if (change.operation === "edit") {
|
|
363
|
+
assertAgentWritable(row.state, row.locked_commit_id ?? void 0);
|
|
364
|
+
this.db.prepare("UPDATE entries SET proposal_json=?,version=version+1,updated_at=? WHERE id=?").run(stringify(change.proposal), now, row.id);
|
|
365
|
+
} else {
|
|
366
|
+
assertAgentWritable(row.state, row.locked_commit_id ?? void 0);
|
|
367
|
+
this.db.prepare("DELETE FROM entries WHERE id=?").run(row.id);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
if (changes.length) this.bumpWorkset(worksetId, now);
|
|
371
|
+
return this.getWorkset(worksetId);
|
|
372
|
+
})();
|
|
373
|
+
}
|
|
374
|
+
getWorkspaceReceipt(key) {
|
|
375
|
+
const row = this.db.prepare("SELECT result_json FROM workspace_idempotency_receipts WHERE receipt_key=?").get(key);
|
|
376
|
+
return row ? parseJson(row.result_json, "Workspace receipt") : void 0;
|
|
377
|
+
}
|
|
378
|
+
saveWorkspaceReceipt(key, value, now) {
|
|
379
|
+
this.db.prepare("INSERT INTO workspace_idempotency_receipts(receipt_key,result_json,created_at) VALUES(?,?,?)").run(key, stringify(value), now);
|
|
380
|
+
}
|
|
381
|
+
getSetting(key) {
|
|
382
|
+
const row = this.db.prepare("SELECT value_json FROM finance_settings WHERE key=?").get(key);
|
|
383
|
+
return row ? parseJson(row.value_json, "Finance setting") : void 0;
|
|
384
|
+
}
|
|
385
|
+
setSetting(key, value, now) {
|
|
386
|
+
assertText(key, "Finance setting key");
|
|
387
|
+
this.db.prepare(`INSERT INTO finance_settings(key,value_json,updated_at) VALUES(?,?,?)
|
|
388
|
+
ON CONFLICT(key) DO UPDATE SET value_json=excluded.value_json,updated_at=excluded.updated_at`).run(key, stringify(value), now);
|
|
389
|
+
}
|
|
390
|
+
createCommit(commit, preparationId) {
|
|
391
|
+
const mutationWorkset = this.getWorkset(commit.worksetId);
|
|
392
|
+
if (!mutationWorkset) throw new Error("finance_workset_not_found");
|
|
393
|
+
this.assertBookMutationAllowed(mutationWorkset.bookId);
|
|
394
|
+
return this.db.transaction(() => {
|
|
395
|
+
const workset = this.requireWorksetVersion(commit.worksetId, commit.worksetVersion);
|
|
396
|
+
this.assertStagingAllowed(commit.worksetId, preparationId);
|
|
397
|
+
if (!commit.operations.length) throw new Error("finance_commit_empty");
|
|
398
|
+
const entryIds = /* @__PURE__ */ new Set();
|
|
399
|
+
for (const operation of commit.operations) {
|
|
400
|
+
if (operation.commitId !== commit.id || operation.bookId !== workset.bookId || entryIds.has(operation.entryId)) throw new Error("finance_commit_operation_invalid");
|
|
401
|
+
entryIds.add(operation.entryId);
|
|
402
|
+
const entry = this.requireEntry(operation.entryId);
|
|
403
|
+
if (entry.workset_id !== workset.id || entry.state !== "staged" || entry.locked_commit_id) throw new Error("finance_commit_entry_not_available");
|
|
404
|
+
}
|
|
405
|
+
this.db.prepare(`INSERT INTO commits(
|
|
406
|
+
id,workset_id,workset_version,status,workflow_status,operations_hash,created_at,approved_at,started_at,ended_at,error,
|
|
407
|
+
ledger_revision,checkpoint_revision,account_impacts_json,checkpoint_impacts_json,override_checkpoint_ids_json,auto_login_used,
|
|
408
|
+
progress_json,read_scope_json
|
|
409
|
+
) VALUES(?,?,?,?,?,?,?,NULL,NULL,NULL,NULL,?,?,?,?,?,?,?,?)`).run(commit.id, commit.worksetId, commit.worksetVersion, legacyCommitStatus(commit.status), commit.status, commit.operationsHash, commit.createdAt, commit.ledgerRevision ?? null, commit.checkpointRevision ?? null, commit.accountImpacts ? stringify(commit.accountImpacts) : null, commit.checkpointImpacts ? stringify(commit.checkpointImpacts) : null, commit.overrideCheckpointIds ? stringify(commit.overrideCheckpointIds) : null, commit.autoLoginUsed ? 1 : 0, commit.progress ? stringify(commit.progress) : null, commit.readScope ? stringify(commit.readScope) : null);
|
|
410
|
+
for (const operation of commit.operations) {
|
|
411
|
+
this.db.prepare(`INSERT INTO commit_operations(
|
|
412
|
+
id,commit_id,entry_id,sequence,operation,book_id,target_remote_id,request_json,before_json,status,workflow_status,
|
|
413
|
+
result_json,verification_json,started_at,ended_at,receipt_ref,readback_verification_ref,readback_attempt,next_readback_at
|
|
414
|
+
) VALUES(?,?,?,?,?,?,?,?,?,?,?,NULL,NULL,NULL,NULL,?,?,?,?)`).run(operation.id, commit.id, operation.entryId, operation.sequence, operation.operation, operation.bookId, operation.targetRemoteId ?? null, stringify(operation.request), operation.before ? stringify(operation.before) : null, legacyOperationStatus(operation.status), operation.status, operation.receiptRef ?? null, operation.readbackVerificationRef ?? null, operation.readbackAttempt ?? null, operation.nextReadbackAt ?? null);
|
|
415
|
+
this.db.prepare("UPDATE entries SET locked_commit_id=?,workflow_state='commit_locked',version=version+1,updated_at=? WHERE id=?").run(commit.id, commit.createdAt, operation.entryId);
|
|
416
|
+
}
|
|
417
|
+
this.bumpWorkset(commit.worksetId, commit.createdAt);
|
|
418
|
+
return this.getCommit(commit.id);
|
|
419
|
+
})();
|
|
420
|
+
}
|
|
421
|
+
getCommit(id) {
|
|
422
|
+
const row = this.db.prepare("SELECT * FROM commits WHERE id=?").get(id);
|
|
423
|
+
return row ? this.mapCommit(row) : void 0;
|
|
424
|
+
}
|
|
425
|
+
assertStagingAllowed(worksetId, preparationId) {
|
|
426
|
+
const pending = this.db.prepare(`SELECT id FROM commits WHERE workset_id=? AND ended_at IS NULL
|
|
427
|
+
AND COALESCE(workflow_status,status) IN ('prepared','awaiting_confirmation','checking','executing','paused','awaiting_readback','outcome_unknown') LIMIT 1`).get(worksetId);
|
|
428
|
+
const preparing = this.db.prepare(`SELECT id FROM finance_read_operations WHERE kind='prepare'
|
|
429
|
+
AND scope_id=? AND status='running' AND id!=? LIMIT 1`).get(worksetId, preparationId ?? "");
|
|
430
|
+
if (pending || preparing) throw new Error("finance_workset_confirmation_pending");
|
|
431
|
+
}
|
|
432
|
+
listCommits(status) {
|
|
433
|
+
return (status ? this.db.prepare("SELECT * FROM commits WHERE COALESCE(workflow_status,status)=? ORDER BY created_at,id").all(status) : this.db.prepare("SELECT * FROM commits ORDER BY created_at,id").all()).map((row) => this.mapCommit(row));
|
|
434
|
+
}
|
|
435
|
+
setCommitStatus(id, status, patch, now) {
|
|
436
|
+
const current = this.requireCommit(id);
|
|
437
|
+
assertCommitTransition(current.workflow_status ?? current.status, status);
|
|
438
|
+
this.db.prepare(`UPDATE commits SET status=?,workflow_status=?,approved_at=COALESCE(?,approved_at),started_at=COALESCE(?,started_at),
|
|
439
|
+
ended_at=COALESCE(?,ended_at),error=? WHERE id=?`).run(legacyCommitStatus(status), status, patch.approvedAt ?? null, patch.startedAt ?? null, patch.endedAt ?? null, patch.error ?? null, id);
|
|
440
|
+
return this.getCommit(id);
|
|
441
|
+
}
|
|
442
|
+
setCommitOperationStatus(commitId, operationId, status, patch, now) {
|
|
443
|
+
const storageStatus = legacyOperationStatus(status);
|
|
444
|
+
const result = this.db.prepare(`UPDATE commit_operations SET status=?,workflow_status=?,result_json=COALESCE(?,result_json),verification_json=COALESCE(?,verification_json),
|
|
445
|
+
receipt_ref=COALESCE(?,receipt_ref),readback_verification_ref=COALESCE(?,readback_verification_ref),
|
|
446
|
+
readback_attempt=COALESCE(?,readback_attempt),next_readback_at=?,
|
|
447
|
+
started_at=COALESCE(?,started_at),ended_at=COALESCE(?,ended_at) WHERE commit_id=? AND id=?`).run(storageStatus, status, patch.result ? stringify(patch.result) : null, patch.verification ? stringify(patch.verification) : null, patch.receiptRef ?? null, patch.readbackVerificationRef ?? null, patch.readbackAttempt ?? null, patch.nextReadbackAt ?? null, patch.startedAt ?? null, patch.endedAt ?? null, commitId, operationId);
|
|
448
|
+
if (Number(result.changes) !== 1) throw new Error("finance_commit_operation_not_found");
|
|
449
|
+
return this.getCommit(commitId);
|
|
450
|
+
}
|
|
451
|
+
claimCommit(id, now) {
|
|
452
|
+
const result = this.db.prepare(`UPDATE commits SET status='executing',workflow_status='checking',approved_at=?
|
|
453
|
+
WHERE id=? AND COALESCE(workflow_status,status)='awaiting_confirmation'`).run(now, id);
|
|
454
|
+
return Number(result.changes) === 1;
|
|
455
|
+
}
|
|
456
|
+
recoveryEvents(commitId) {
|
|
457
|
+
return this.db.prepare("SELECT event_json FROM commit_recovery_events WHERE commit_id=? ORDER BY id").all(commitId).map((row) => parseJson(row.event_json, "Commit recovery"));
|
|
458
|
+
}
|
|
459
|
+
appendRecoveryEvent(commitId, key, event) {
|
|
460
|
+
this.db.transaction(() => {
|
|
461
|
+
const commit = this.getCommit(commitId);
|
|
462
|
+
if (!commit || commit.endedAt) throw new Error("finance_commit_not_resumable");
|
|
463
|
+
const previous = this.db.prepare("SELECT event_json FROM commit_recovery_events WHERE commit_id=? AND event_key=?").get(commitId, key);
|
|
464
|
+
if (previous) {
|
|
465
|
+
if (previous.event_json !== stringify(event)) throw new Error("finance_recovery_event_conflict");
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (event.kind !== "observed" && (![
|
|
469
|
+
"paused",
|
|
470
|
+
"outcome_unknown",
|
|
471
|
+
"awaiting_readback"
|
|
472
|
+
].includes(commit.status) || commit.readback?.status === "running")) throw new Error("finance_commit_busy");
|
|
473
|
+
if (event.kind === "proposed" && commit.recovery) throw new Error("finance_recovery_already_proposed");
|
|
474
|
+
if (event.kind === "approved" && (commit.recovery?.hash !== event.hash || commit.recovery.approvedAt)) throw new Error("finance_recovery_approval_changed");
|
|
475
|
+
if (event.kind === "observed" && (commit.recovery?.hash !== event.hash || !commit.recovery.approvedAt)) throw new Error("finance_recovery_approval_required");
|
|
476
|
+
if (event.kind === "creation_replaced") {
|
|
477
|
+
if (commit.recovery?.hash !== event.previousHash || !commit.recovery.approvedAt) throw new Error("finance_recovery_approval_changed");
|
|
478
|
+
const operation = commit.operations.find((item) => item.id === event.originalOperation.id);
|
|
479
|
+
const correction = event.recovery.corrections.find((item) => item.operationId === operation?.id);
|
|
480
|
+
if (!operation || operation.operation !== "create" || !["unknown", "readback_pending"].includes(operation.status) || stringify(operation) !== stringify(event.originalOperation) || correction?.mode !== "replacement" || !correction.clientRequestId || correction.clientRequestId === operation.request.clientRequestId) throw new Error("finance_recovery_request_changed");
|
|
481
|
+
const entry = this.requireEntry(operation.entryId);
|
|
482
|
+
if (entry.removed_at || entry.workset_id !== commit.worksetId || entry.locked_commit_id && entry.locked_commit_id !== commitId) throw new Error("finance_commit_entry_not_available");
|
|
483
|
+
this.db.prepare(`UPDATE commit_operations SET status='pending',workflow_status='pending',result_json=NULL,
|
|
484
|
+
verification_json=NULL,receipt_ref=NULL,readback_verification_ref=NULL,started_at=NULL,ended_at=NULL,
|
|
485
|
+
readback_attempt=NULL,next_readback_at=NULL WHERE id=? AND commit_id=?`).run(operation.id, commitId);
|
|
486
|
+
this.db.prepare(`UPDATE entries SET state='staged',workflow_state='commit_locked',result=NULL,workflow_result=NULL,
|
|
487
|
+
locked_commit_id=?,unknown_resolution_json=NULL,version=version+1,updated_at=? WHERE id=?`).run(commitId, event.at, entry.id);
|
|
488
|
+
this.db.prepare(`UPDATE commits SET readback_json=NULL,failure_json=NULL WHERE id=?`).run(commitId);
|
|
489
|
+
this.bumpWorkset(commit.worksetId, event.at);
|
|
490
|
+
}
|
|
491
|
+
this.db.prepare("INSERT INTO commit_recovery_events(commit_id,event_key,event_json) VALUES(?,?,?)").run(commitId, key, stringify(event));
|
|
492
|
+
})();
|
|
493
|
+
}
|
|
494
|
+
claimCommitResume(id, operationsHash, worksetVersion, now, recoveryHash) {
|
|
495
|
+
return this.db.transaction(() => {
|
|
496
|
+
const commit = this.getCommit(id);
|
|
497
|
+
if (!commit || commit.operationsHash !== operationsHash) throw new Error("finance_commit_operations_changed");
|
|
498
|
+
if (commit.recovery && (!commit.recovery.approvedAt || commit.recovery.hash !== recoveryHash)) throw new Error("finance_recovery_approval_required");
|
|
499
|
+
if (!commitCanResume(commit) || commit.readback?.status === "running") return false;
|
|
500
|
+
this.requireWorksetVersion(commit.worksetId, worksetVersion);
|
|
501
|
+
if (this.listCommits().some((item) => item.id !== id && item.worksetId === commit.worksetId && !item.endedAt && [
|
|
502
|
+
"prepared",
|
|
503
|
+
"awaiting_confirmation",
|
|
504
|
+
"checking",
|
|
505
|
+
"executing",
|
|
506
|
+
"paused",
|
|
507
|
+
"awaiting_readback",
|
|
508
|
+
"outcome_unknown"
|
|
509
|
+
].includes(item.status))) throw new Error("finance_workset_confirmation_pending");
|
|
510
|
+
for (const operation of commit.operations.filter(operationCanContinue)) {
|
|
511
|
+
const entry = this.requireEntry(operation.entryId);
|
|
512
|
+
if (entry.removed_at || entry.workset_id !== commit.worksetId || entry.state !== "staged" || entry.locked_commit_id && entry.locked_commit_id !== id) throw new Error("finance_commit_entry_not_available");
|
|
513
|
+
this.db.prepare(`UPDATE entries SET locked_commit_id=?,workflow_state='commit_locked',version=version+1,updated_at=? WHERE id=?`).run(id, now, entry.id);
|
|
514
|
+
this.db.prepare(`UPDATE commit_operations SET status='pending',workflow_status='pending',
|
|
515
|
+
started_at=NULL,ended_at=NULL,next_readback_at=NULL WHERE commit_id=? AND id=?`).run(id, operation.id);
|
|
516
|
+
}
|
|
517
|
+
this.db.prepare(`UPDATE commits SET status='executing',workflow_status='checking',failure_json=NULL,
|
|
518
|
+
progress_json=? WHERE id=?`).run(stringify({ stage: "queued" }), id);
|
|
519
|
+
this.bumpWorkset(commit.worksetId, now);
|
|
520
|
+
return true;
|
|
521
|
+
})();
|
|
522
|
+
}
|
|
523
|
+
pauseCommit(id, now, failure) {
|
|
524
|
+
return this.db.transaction(() => {
|
|
525
|
+
const commit = this.getCommit(id);
|
|
526
|
+
if (!commit || ![
|
|
527
|
+
"checking",
|
|
528
|
+
"executing",
|
|
529
|
+
"paused",
|
|
530
|
+
"awaiting_readback",
|
|
531
|
+
"outcome_unknown"
|
|
532
|
+
].includes(commit.status) || commit.endedAt) throw new Error("finance_commit_not_executing");
|
|
533
|
+
for (const operation of commit.operations) if (operation.status === "executing") {
|
|
534
|
+
this.setCommitOperationStatus(id, operation.id, "unknown", {
|
|
535
|
+
result: {
|
|
536
|
+
failure: {
|
|
537
|
+
...failure,
|
|
538
|
+
boundary: "sent_unknown"
|
|
539
|
+
},
|
|
540
|
+
boundary: "sent_unknown"
|
|
541
|
+
},
|
|
542
|
+
endedAt: now
|
|
543
|
+
}, now);
|
|
544
|
+
this.db.prepare(`UPDATE entries SET workflow_state='unknown',workflow_result='unknown',updated_at=?
|
|
545
|
+
WHERE id=? AND locked_commit_id=?`).run(now, operation.entryId, id);
|
|
546
|
+
}
|
|
547
|
+
this.db.prepare(`UPDATE commits SET status='executing',workflow_status='paused',failure_json=? WHERE id=?`).run(stringify({
|
|
548
|
+
...failure,
|
|
549
|
+
...failure.checkStage ? {} : commit.progress ? {
|
|
550
|
+
checkStage: commit.progress.stage,
|
|
551
|
+
...commit.progress.month ? { month: commit.progress.month } : {},
|
|
552
|
+
...commit.progress.pass ? { pass: commit.progress.pass } : {}
|
|
553
|
+
} : {}
|
|
554
|
+
}), id);
|
|
555
|
+
this.bumpWorkset(commit.worksetId, now);
|
|
556
|
+
return this.getCommit(id);
|
|
557
|
+
})();
|
|
558
|
+
}
|
|
559
|
+
endPausedCommit(id, now) {
|
|
560
|
+
return this.db.transaction(() => {
|
|
561
|
+
const commit = this.getCommit(id);
|
|
562
|
+
if (!commit || commit.endedAt || ![
|
|
563
|
+
"paused",
|
|
564
|
+
"awaiting_readback",
|
|
565
|
+
"outcome_unknown"
|
|
566
|
+
].includes(commit.status) || commit.readback?.status === "running") throw new Error("finance_commit_not_paused");
|
|
567
|
+
this.db.prepare(`UPDATE commit_operations SET status='skipped',workflow_status='not_executed',ended_at=?
|
|
568
|
+
WHERE commit_id=? AND COALESCE(workflow_status,status)='pending'`).run(now, id);
|
|
569
|
+
this.db.prepare("UPDATE commits SET status='executing',workflow_status='executing' WHERE id=?").run(id);
|
|
570
|
+
this.finishCommitInTransaction(id, now, commit.failure);
|
|
571
|
+
this.db.prepare("UPDATE commits SET ended_at=? WHERE id=?").run(now, id);
|
|
572
|
+
return this.getCommit(id);
|
|
573
|
+
})();
|
|
574
|
+
}
|
|
575
|
+
saveCommitReadback(id, readback) {
|
|
576
|
+
this.db.prepare("UPDATE commits SET readback_json=? WHERE id=?").run(stringify(readback), id);
|
|
577
|
+
}
|
|
578
|
+
consumeCommitAutoLogin(id) {
|
|
579
|
+
this.db.prepare("UPDATE commits SET auto_login_used=1 WHERE id=?").run(id);
|
|
580
|
+
}
|
|
581
|
+
saveCommitProgress(id, progress) {
|
|
582
|
+
this.db.prepare("UPDATE commits SET progress_json=? WHERE id=?").run(stringify(progress), id);
|
|
583
|
+
}
|
|
584
|
+
finishCommit(id, now, failure) {
|
|
585
|
+
return this.db.transaction(() => this.finishCommitInTransaction(id, now, failure))();
|
|
586
|
+
}
|
|
587
|
+
finishCommitInTransaction(id, now, failure) {
|
|
588
|
+
let commit = this.getCommit(id);
|
|
589
|
+
if (!commit || commit.status !== "executing" && commit.status !== "checking") throw new Error("finance_commit_not_executing");
|
|
590
|
+
if (commit.status === "checking") {
|
|
591
|
+
if (!failure || failure.boundary !== "not_sent" || commit.operations.some((operation) => operation.status !== "pending")) throw new Error("finance_commit_checking_not_safe");
|
|
592
|
+
this.db.prepare(`UPDATE commit_operations SET status='skipped',workflow_status='not_executed',ended_at=?,result_json=?
|
|
593
|
+
WHERE commit_id=?`).run(now, stringify({ failure }), id);
|
|
594
|
+
commit = this.getCommit(id);
|
|
595
|
+
}
|
|
596
|
+
let readbackPending = 0;
|
|
597
|
+
let unknown = 0;
|
|
598
|
+
let failed = 0;
|
|
599
|
+
let succeeded = 0;
|
|
600
|
+
for (const operation of commit.operations) if (operationIsVerified(operation)) {
|
|
601
|
+
succeeded += 1;
|
|
602
|
+
this.db.prepare(`UPDATE entries SET state='committed',workflow_state='committed',result='succeeded',
|
|
603
|
+
workflow_result='succeeded',locked_commit_id=NULL,removed_at=?,version=version+1,updated_at=?
|
|
604
|
+
WHERE id=? AND locked_commit_id=?`).run(now, now, operation.entryId, id);
|
|
605
|
+
} else if (operation.status === "readback_pending") {
|
|
606
|
+
readbackPending += 1;
|
|
607
|
+
this.db.prepare("UPDATE entries SET state='committed',workflow_state='readback_pending',result='succeeded',workflow_result='readback_pending',version=version+1,updated_at=? WHERE id=? AND locked_commit_id=?").run(now, operation.entryId, id);
|
|
608
|
+
} else if (operation.status === "unknown") {
|
|
609
|
+
unknown += 1;
|
|
610
|
+
this.db.prepare(`UPDATE entries SET state='staged',workflow_state='unknown',result='skipped',workflow_result='unknown',
|
|
611
|
+
unknown_resolution_json=?,version=version+1,updated_at=? WHERE id=? AND locked_commit_id=?`).run(stringify({
|
|
612
|
+
attempt: operation.readbackAttempt ?? 0,
|
|
613
|
+
nextReadbackAt: operation.nextReadbackAt
|
|
614
|
+
}), now, operation.entryId, id);
|
|
615
|
+
} else if (operation.status === "failed" || operation.status === "not_executed" || operation.status === "skipped") {
|
|
616
|
+
failed += 1;
|
|
617
|
+
this.db.prepare(`UPDATE entries SET state='staged',workflow_state=?,locked_commit_id=?,
|
|
618
|
+
result=?,workflow_result=?,version=version+1,updated_at=? WHERE id=? AND locked_commit_id=?`).run("staged", null, operation.status === "failed" ? "failed" : "skipped", operation.status === "failed" ? "failed" : "not_executed", now, operation.entryId, id);
|
|
619
|
+
} else throw new Error("finance_commit_operation_not_settled");
|
|
620
|
+
const status = unknown > 0 ? "outcome_unknown" : readbackPending > 0 ? "awaiting_readback" : failed > 0 ? succeeded > 0 ? "partial_failed" : "failed" : "succeeded";
|
|
621
|
+
this.db.prepare("UPDATE commits SET status=?,workflow_status=?,ended_at=?,failure_json=? WHERE id=?").run(legacyCommitStatus(status), status, status === "awaiting_readback" ? null : now, failure && !(status === "succeeded" && failure.boundary === "sent_unknown") ? stringify(failure) : null, id);
|
|
622
|
+
this.bumpWorkset(commit.worksetId, now);
|
|
623
|
+
return this.getCommit(id);
|
|
624
|
+
}
|
|
625
|
+
settleCommitOperation(input) {
|
|
626
|
+
return this.db.transaction(() => {
|
|
627
|
+
const commit = this.getCommit(input.commitId);
|
|
628
|
+
if (!commit || ![
|
|
629
|
+
"paused",
|
|
630
|
+
"awaiting_readback",
|
|
631
|
+
"outcome_unknown",
|
|
632
|
+
"checking",
|
|
633
|
+
"executing"
|
|
634
|
+
].includes(commit.status)) throw new Error("finance_commit_not_waiting_readback");
|
|
635
|
+
const operation = commit.operations.find((item) => item.id === input.operationId);
|
|
636
|
+
if (!operation || operation.status !== "readback_pending" && operation.status !== "unknown") throw new Error("finance_commit_operation_not_waiting_readback");
|
|
637
|
+
const status = input.outcome;
|
|
638
|
+
this.setCommitOperationStatus(input.commitId, input.operationId, status, {
|
|
639
|
+
...input.verificationRef ? { readbackVerificationRef: input.verificationRef } : {},
|
|
640
|
+
readbackAttempt: input.attempt,
|
|
641
|
+
...input.nextReadbackAt ? { nextReadbackAt: input.nextReadbackAt } : {},
|
|
642
|
+
...input.outcome !== "unknown" ? { endedAt: input.now } : {}
|
|
643
|
+
}, input.now);
|
|
644
|
+
if (operationIsVerified({ status })) this.db.prepare(`UPDATE entries SET state='committed',workflow_state='committed',workflow_result='succeeded',locked_commit_id=NULL,
|
|
645
|
+
readback_verification_ref=COALESCE(?,readback_verification_ref),removed_at=?,unknown_resolution_json=NULL,
|
|
646
|
+
version=version+1,updated_at=? WHERE id=?`).run(input.verificationRef ?? null, input.now, input.now, operation.entryId);
|
|
647
|
+
else if (input.outcome === "failed") this.db.prepare(`UPDATE entries SET state='staged',workflow_state='staged',workflow_result='failed',locked_commit_id=NULL,
|
|
648
|
+
readback_verification_ref=COALESCE(?,readback_verification_ref),unknown_resolution_json=NULL,
|
|
649
|
+
version=version+1,updated_at=? WHERE id=?`).run(input.verificationRef ?? null, input.now, operation.entryId);
|
|
650
|
+
else this.db.prepare(`UPDATE entries SET state='staged',workflow_state='unknown',workflow_result='unknown',
|
|
651
|
+
unknown_resolution_json=?,version=version+1,updated_at=? WHERE id=?`).run(stringify({
|
|
652
|
+
attempt: input.attempt,
|
|
653
|
+
...input.nextReadbackAt ? { nextReadbackAt: input.nextReadbackAt } : {}
|
|
654
|
+
}), input.now, operation.entryId);
|
|
655
|
+
const refreshed = this.getCommit(input.commitId);
|
|
656
|
+
const waiting = refreshed.operations.some((item) => item.status === "readback_pending");
|
|
657
|
+
const hasUnknown = refreshed.operations.some((item) => item.status === "unknown");
|
|
658
|
+
const settled = refreshed.operations.every((item) => ![
|
|
659
|
+
"pending",
|
|
660
|
+
"executing",
|
|
661
|
+
"readback_pending"
|
|
662
|
+
].includes(item.status));
|
|
663
|
+
const succeeded = refreshed.operations.filter(operationIsVerified).length;
|
|
664
|
+
const unsuccessful = refreshed.operations.filter((item) => item.status === "failed" || item.status === "not_executed" || item.status === "skipped").length;
|
|
665
|
+
const running = commit.status === "executing" || commit.status === "checking";
|
|
666
|
+
const resumable = !commit.endedAt && refreshed.operations.some(operationCanContinue);
|
|
667
|
+
const nextStatus = running ? commit.status : resumable ? "paused" : waiting ? "awaiting_readback" : hasUnknown ? "outcome_unknown" : settled ? unsuccessful === 0 ? "succeeded" : succeeded > 0 ? "partial_failed" : "failed" : refreshed.status;
|
|
668
|
+
this.db.prepare("UPDATE commits SET status=?,workflow_status=?,ended_at=? WHERE id=?").run(legacyCommitStatus(nextStatus), nextStatus, commit.endedAt ?? (!running && !resumable && settled ? input.now : null), input.commitId);
|
|
669
|
+
if (nextStatus === "succeeded") this.db.prepare("UPDATE commits SET failure_json=NULL WHERE id=?").run(input.commitId);
|
|
670
|
+
this.bumpWorkset(refreshed.worksetId, input.now);
|
|
671
|
+
return this.getCommit(input.commitId);
|
|
672
|
+
})();
|
|
673
|
+
}
|
|
674
|
+
authorizeCommitOverrides(input) {
|
|
675
|
+
const commit = this.getCommit(input.commitId);
|
|
676
|
+
if (!commit || commit.status !== "awaiting_confirmation" && commit.status !== "checking") throw new Error("finance_commit_not_awaiting_confirmation");
|
|
677
|
+
const required = new Set((commit.checkpointImpacts ?? []).filter((item) => item.overrideRequired).map((item) => item.checkpointId));
|
|
678
|
+
const supplied = new Set(input.checkpointIds);
|
|
679
|
+
if ([...required].some((id) => !supplied.has(id)) || [...supplied].some((id) => !required.has(id))) throw new Error("finance_commit_checkpoint_override_invalid");
|
|
680
|
+
this.db.prepare("UPDATE commits SET override_checkpoint_ids_json=? WHERE id=?").run(stringify([...supplied].sort()), input.commitId);
|
|
681
|
+
input.now;
|
|
682
|
+
return this.getCommit(input.commitId);
|
|
683
|
+
}
|
|
684
|
+
cancelCommit(id, now) {
|
|
685
|
+
return this.db.transaction(() => {
|
|
686
|
+
const commit = this.getCommit(id);
|
|
687
|
+
if (!commit || commit.status !== "prepared" && commit.status !== "awaiting_confirmation") throw new Error("finance_commit_not_cancellable");
|
|
688
|
+
this.db.prepare("UPDATE commits SET status='cancelled',workflow_status='cancelled',ended_at=? WHERE id=?").run(now, id);
|
|
689
|
+
this.db.prepare("UPDATE entries SET locked_commit_id=NULL,workflow_state='staged',version=version+1,updated_at=? WHERE locked_commit_id=? AND state='staged'").run(now, id);
|
|
690
|
+
this.bumpWorkset(commit.worksetId, now);
|
|
691
|
+
return this.getCommit(id);
|
|
692
|
+
})();
|
|
693
|
+
}
|
|
694
|
+
requireWorksetVersion(id, expectedVersion) {
|
|
695
|
+
const workset = this.getWorkset(id);
|
|
696
|
+
if (!workset) throw new Error("finance_workset_not_found");
|
|
697
|
+
if (workset.version !== expectedVersion) throw new Error("finance_workset_version_conflict");
|
|
698
|
+
return workset;
|
|
699
|
+
}
|
|
700
|
+
assertBookMutationAllowed(bookId) {
|
|
701
|
+
if (this.isBookMutationBlocked(bookId)) throw new Error("finance_book_migration_blocked");
|
|
702
|
+
}
|
|
703
|
+
requireEntry(id) {
|
|
704
|
+
const row = this.db.prepare("SELECT * FROM entries WHERE id=?").get(id);
|
|
705
|
+
if (!row) throw new Error("finance_entry_not_found");
|
|
706
|
+
return row;
|
|
707
|
+
}
|
|
708
|
+
requireCommit(id) {
|
|
709
|
+
const row = this.db.prepare("SELECT * FROM commits WHERE id=?").get(id);
|
|
710
|
+
if (!row) throw new Error("finance_commit_not_found");
|
|
711
|
+
return row;
|
|
712
|
+
}
|
|
713
|
+
bumpWorkset(id, now) {
|
|
714
|
+
const result = this.db.prepare("UPDATE worksets SET revision=revision+1,updated_at=? WHERE id=?").run(now, id);
|
|
715
|
+
if (Number(result.changes) !== 1) throw new Error("finance_workset_not_found");
|
|
716
|
+
}
|
|
717
|
+
mapWorkset(row) {
|
|
718
|
+
const entries = this.db.prepare("SELECT * FROM entries WHERE workset_id=? AND removed_at IS NULL ORDER BY created_at,id").all(row.id);
|
|
719
|
+
return {
|
|
720
|
+
id: row.id,
|
|
721
|
+
bookId: row.book_id,
|
|
722
|
+
...row.title ? { title: row.title } : {},
|
|
723
|
+
...row.description ? { description: row.description } : {},
|
|
724
|
+
...row.source_json ? { source: parseJson(row.source_json, "Workset source") } : {},
|
|
725
|
+
...row.created_by_run_id ? { createdByRunId: row.created_by_run_id } : {},
|
|
726
|
+
...row.created_by_subject_id ? { createdBySubjectId: row.created_by_subject_id } : {},
|
|
727
|
+
version: versionFor(row),
|
|
728
|
+
reviewVersion: `fr_${createHash("sha256").update(JSON.stringify([row.id, entries.filter((entry) => (entry.workflow_state ?? entry.state) === "changed" && !entry.locked_commit_id).sort((a, b) => a.id.localeCompare(b.id)).map((entry) => [entry.id, entryVersionFor(entry)])])).digest("hex").slice(0, 20)}`,
|
|
729
|
+
entries: entries.map(mapEntry),
|
|
730
|
+
createdAt: row.created_at,
|
|
731
|
+
updatedAt: row.updated_at
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
mapCommit(row) {
|
|
735
|
+
const operations = this.db.prepare("SELECT * FROM commit_operations WHERE commit_id=? ORDER BY sequence,id").all(row.id);
|
|
736
|
+
const events = this.recoveryEvents(row.id);
|
|
737
|
+
const proposal = [...events].reverse().find((event) => event.kind === "proposed" || event.kind === "creation_replaced");
|
|
738
|
+
const approval = events.find((event) => event.kind === "approved" && event.hash === proposal?.recovery.hash);
|
|
739
|
+
return {
|
|
740
|
+
id: row.id,
|
|
741
|
+
worksetId: row.workset_id,
|
|
742
|
+
worksetVersion: row.workset_version,
|
|
743
|
+
status: row.workflow_status ?? row.status,
|
|
744
|
+
...row.failure_json ? { failure: parseJson(row.failure_json, "Commit failure") } : {},
|
|
745
|
+
autoLoginUsed: Boolean(row.auto_login_used),
|
|
746
|
+
...row.progress_json ? { progress: parseJson(row.progress_json, "Commit progress") } : {},
|
|
747
|
+
...row.readback_json ? { readback: parseJson(row.readback_json, "Commit readback") } : {},
|
|
748
|
+
...row.read_scope_json ? { readScope: parseJson(row.read_scope_json, "Commit read scope") } : {},
|
|
749
|
+
operationsHash: row.operations_hash,
|
|
750
|
+
operations: operations.map(mapCommitOperation),
|
|
751
|
+
...proposal ? { recovery: {
|
|
752
|
+
...proposal.recovery,
|
|
753
|
+
...approval?.kind === "approved" ? {
|
|
754
|
+
approvedAt: approval.at,
|
|
755
|
+
authority: approval.authority
|
|
756
|
+
} : {}
|
|
757
|
+
} } : {},
|
|
758
|
+
...row.ledger_revision !== null && row.ledger_revision !== void 0 ? { ledgerRevision: row.ledger_revision } : {},
|
|
759
|
+
...row.checkpoint_revision !== null && row.checkpoint_revision !== void 0 ? { checkpointRevision: row.checkpoint_revision } : {},
|
|
760
|
+
...row.account_impacts_json ? { accountImpacts: parseJson(row.account_impacts_json, "Account impacts") } : {},
|
|
761
|
+
...row.checkpoint_impacts_json ? { checkpointImpacts: parseJson(row.checkpoint_impacts_json, "Checkpoint impacts") } : {},
|
|
762
|
+
...row.override_checkpoint_ids_json ? { overrideCheckpointIds: parseJson(row.override_checkpoint_ids_json, "Checkpoint overrides") } : {},
|
|
763
|
+
createdAt: row.created_at,
|
|
764
|
+
...row.approved_at ? { approvedAt: row.approved_at } : {},
|
|
765
|
+
...row.started_at ? { startedAt: row.started_at } : {},
|
|
766
|
+
...row.ended_at ? { endedAt: row.ended_at } : {},
|
|
767
|
+
...row.error ? { error: row.error } : {}
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
migrate() {
|
|
771
|
+
this.db.exec(`
|
|
772
|
+
CREATE TABLE IF NOT EXISTS finance_read_operations (
|
|
773
|
+
id TEXT PRIMARY KEY, kind TEXT NOT NULL, scope_id TEXT NOT NULL, status TEXT NOT NULL, data_json TEXT NOT NULL
|
|
774
|
+
);
|
|
775
|
+
CREATE UNIQUE INDEX IF NOT EXISTS finance_read_operations_active
|
|
776
|
+
ON finance_read_operations(kind,scope_id) WHERE status='running';
|
|
777
|
+
CREATE TABLE IF NOT EXISTS worksets (
|
|
778
|
+
id TEXT PRIMARY KEY,
|
|
779
|
+
book_id TEXT NOT NULL,
|
|
780
|
+
title TEXT,
|
|
781
|
+
description TEXT,
|
|
782
|
+
source_json TEXT,
|
|
783
|
+
created_by_run_id TEXT,
|
|
784
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
785
|
+
created_at TEXT NOT NULL,
|
|
786
|
+
updated_at TEXT NOT NULL
|
|
787
|
+
);
|
|
788
|
+
CREATE INDEX IF NOT EXISTS idx_worksets_book_updated ON worksets(book_id,updated_at,id);
|
|
789
|
+
CREATE TABLE IF NOT EXISTS entries (
|
|
790
|
+
id TEXT PRIMARY KEY,
|
|
791
|
+
workset_id TEXT NOT NULL REFERENCES worksets(id) ON DELETE CASCADE,
|
|
792
|
+
book_id TEXT NOT NULL,
|
|
793
|
+
proposal_json TEXT NOT NULL,
|
|
794
|
+
state TEXT NOT NULL CHECK(state IN ('changed','staged','committed')),
|
|
795
|
+
locked_commit_id TEXT,
|
|
796
|
+
evidence_json TEXT NOT NULL,
|
|
797
|
+
created_by_task_id TEXT NOT NULL,
|
|
798
|
+
last_modified_by_task_id TEXT NOT NULL,
|
|
799
|
+
result TEXT CHECK(result IS NULL OR result IN ('pending','executing','succeeded','failed','skipped','conflict')),
|
|
800
|
+
created_at TEXT NOT NULL,
|
|
801
|
+
updated_at TEXT NOT NULL
|
|
802
|
+
);
|
|
803
|
+
CREATE INDEX IF NOT EXISTS idx_entries_book_state_updated ON entries(book_id,state,updated_at,id);
|
|
804
|
+
CREATE INDEX IF NOT EXISTS idx_entries_workset ON entries(workset_id,created_at,id);
|
|
805
|
+
CREATE TABLE IF NOT EXISTS workspace_idempotency_receipts (
|
|
806
|
+
receipt_key TEXT PRIMARY KEY,
|
|
807
|
+
result_json TEXT NOT NULL,
|
|
808
|
+
created_at TEXT NOT NULL
|
|
809
|
+
);
|
|
810
|
+
CREATE TABLE IF NOT EXISTS finance_settings (
|
|
811
|
+
key TEXT PRIMARY KEY,
|
|
812
|
+
value_json TEXT NOT NULL,
|
|
813
|
+
updated_at TEXT NOT NULL
|
|
814
|
+
);
|
|
815
|
+
CREATE TABLE IF NOT EXISTS commits (
|
|
816
|
+
id TEXT PRIMARY KEY,
|
|
817
|
+
workset_id TEXT NOT NULL REFERENCES worksets(id),
|
|
818
|
+
workset_version TEXT NOT NULL,
|
|
819
|
+
status TEXT NOT NULL CHECK(status IN ('prepared','awaiting_confirmation','executing','succeeded','partial_failed','failed','cancelled')),
|
|
820
|
+
operations_hash TEXT NOT NULL,
|
|
821
|
+
created_at TEXT NOT NULL,
|
|
822
|
+
approved_at TEXT,
|
|
823
|
+
started_at TEXT,
|
|
824
|
+
ended_at TEXT,
|
|
825
|
+
error TEXT
|
|
826
|
+
);
|
|
827
|
+
CREATE INDEX IF NOT EXISTS idx_commits_status_created ON commits(status,created_at,id);
|
|
828
|
+
CREATE TABLE IF NOT EXISTS commit_operations (
|
|
829
|
+
id TEXT PRIMARY KEY,
|
|
830
|
+
commit_id TEXT NOT NULL REFERENCES commits(id) ON DELETE CASCADE,
|
|
831
|
+
entry_id TEXT NOT NULL REFERENCES entries(id),
|
|
832
|
+
sequence INTEGER NOT NULL,
|
|
833
|
+
operation TEXT NOT NULL CHECK(operation IN ('create','update','delete')),
|
|
834
|
+
book_id TEXT NOT NULL,
|
|
835
|
+
target_remote_id TEXT,
|
|
836
|
+
request_json TEXT NOT NULL,
|
|
837
|
+
before_json TEXT,
|
|
838
|
+
status TEXT NOT NULL CHECK(status IN ('pending','executing','succeeded','failed','skipped')),
|
|
839
|
+
result_json TEXT,
|
|
840
|
+
verification_json TEXT,
|
|
841
|
+
started_at TEXT,
|
|
842
|
+
ended_at TEXT,
|
|
843
|
+
UNIQUE(commit_id,sequence),
|
|
844
|
+
UNIQUE(commit_id,entry_id)
|
|
845
|
+
);
|
|
846
|
+
CREATE TABLE IF NOT EXISTS commit_recovery_events (
|
|
847
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
848
|
+
commit_id TEXT NOT NULL REFERENCES commits(id),
|
|
849
|
+
event_key TEXT NOT NULL,
|
|
850
|
+
event_json TEXT NOT NULL,
|
|
851
|
+
UNIQUE(commit_id,event_key)
|
|
852
|
+
);
|
|
853
|
+
CREATE TRIGGER IF NOT EXISTS commit_recovery_events_no_update
|
|
854
|
+
BEFORE UPDATE ON commit_recovery_events BEGIN SELECT RAISE(ABORT,'recovery audit is immutable'); END;
|
|
855
|
+
CREATE TRIGGER IF NOT EXISTS commit_recovery_events_no_delete
|
|
856
|
+
BEFORE DELETE ON commit_recovery_events BEGIN SELECT RAISE(ABORT,'recovery audit is immutable'); END;
|
|
857
|
+
`);
|
|
858
|
+
this.migrateWorkflowSchema();
|
|
859
|
+
}
|
|
860
|
+
migrateWorkflowSchema() {
|
|
861
|
+
if (this.db.prepare("SELECT 1 FROM sqlite_master WHERE name='finance_task_scopes'").get()) this.addColumnIfMissing("finance_task_scopes", "grant_id", "TEXT");
|
|
862
|
+
this.migrateSubjectAttribution();
|
|
863
|
+
this.addColumnIfMissing("worksets", "is_canonical", "INTEGER NOT NULL DEFAULT 0");
|
|
864
|
+
this.addColumnIfMissing("entries", "version", "INTEGER NOT NULL DEFAULT 1");
|
|
865
|
+
this.addColumnIfMissing("entries", "workflow_state", "TEXT");
|
|
866
|
+
this.addColumnIfMissing("entries", "receipt_ref", "TEXT");
|
|
867
|
+
this.addColumnIfMissing("entries", "readback_verification_ref", "TEXT");
|
|
868
|
+
this.addColumnIfMissing("entries", "unknown_resolution_json", "TEXT");
|
|
869
|
+
this.addColumnIfMissing("entries", "workflow_result", "TEXT");
|
|
870
|
+
this.addColumnIfMissing("entries", "removed_at", "TEXT");
|
|
871
|
+
this.addColumnIfMissing("commits", "workflow_status", "TEXT");
|
|
872
|
+
this.addColumnIfMissing("commits", "failure_json", "TEXT");
|
|
873
|
+
this.addColumnIfMissing("commits", "auto_login_used", "INTEGER");
|
|
874
|
+
this.addColumnIfMissing("commits", "progress_json", "TEXT");
|
|
875
|
+
this.addColumnIfMissing("commits", "readback_json", "TEXT");
|
|
876
|
+
if (this.db.prepare("PRAGMA table_info(commits)").all().some((column) => column.name === "balance_preview_json")) this.db.exec("ALTER TABLE commits DROP COLUMN balance_preview_json");
|
|
877
|
+
this.addColumnIfMissing("commits", "read_scope_json", "TEXT");
|
|
878
|
+
this.addColumnIfMissing("commits", "ledger_revision", "INTEGER");
|
|
879
|
+
this.addColumnIfMissing("commits", "checkpoint_revision", "INTEGER");
|
|
880
|
+
this.addColumnIfMissing("commits", "account_impacts_json", "TEXT");
|
|
881
|
+
this.addColumnIfMissing("commits", "checkpoint_impacts_json", "TEXT");
|
|
882
|
+
this.addColumnIfMissing("commits", "override_checkpoint_ids_json", "TEXT");
|
|
883
|
+
this.addColumnIfMissing("commit_operations", "workflow_status", "TEXT");
|
|
884
|
+
this.addColumnIfMissing("commit_operations", "receipt_ref", "TEXT");
|
|
885
|
+
this.addColumnIfMissing("commit_operations", "readback_verification_ref", "TEXT");
|
|
886
|
+
this.addColumnIfMissing("commit_operations", "readback_attempt", "INTEGER");
|
|
887
|
+
this.addColumnIfMissing("commit_operations", "next_readback_at", "TEXT");
|
|
888
|
+
const grantsExisted = Boolean(this.db.prepare("SELECT name FROM sqlite_master WHERE name='book_read_grants'").get());
|
|
889
|
+
this.db.exec(`
|
|
890
|
+
CREATE TABLE IF NOT EXISTS finance_schema_migrations (
|
|
891
|
+
version TEXT PRIMARY KEY,
|
|
892
|
+
applied_at TEXT NOT NULL,
|
|
893
|
+
checksum TEXT NOT NULL
|
|
894
|
+
);
|
|
895
|
+
CREATE TABLE IF NOT EXISTS book_read_grants (
|
|
896
|
+
id TEXT PRIMARY KEY,
|
|
897
|
+
subject_id TEXT NOT NULL,
|
|
898
|
+
book_id TEXT NOT NULL,
|
|
899
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
900
|
+
bound_at TEXT NOT NULL,
|
|
901
|
+
replaced_at TEXT
|
|
902
|
+
);
|
|
903
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_book_read_grants_active_subject
|
|
904
|
+
ON book_read_grants(subject_id) WHERE replaced_at IS NULL;
|
|
905
|
+
CREATE TABLE IF NOT EXISTS finance_drafts (
|
|
906
|
+
id TEXT PRIMARY KEY,
|
|
907
|
+
subject_id TEXT NOT NULL,
|
|
908
|
+
grant_id TEXT NOT NULL REFERENCES book_read_grants(id),
|
|
909
|
+
book_id TEXT NOT NULL,
|
|
910
|
+
status TEXT NOT NULL CHECK(status IN ('open','booked')),
|
|
911
|
+
entries_json TEXT NOT NULL,
|
|
912
|
+
source_json TEXT,
|
|
913
|
+
reference_json TEXT,
|
|
914
|
+
booked_at TEXT,
|
|
915
|
+
booked_summary_json TEXT,
|
|
916
|
+
created_at TEXT NOT NULL,
|
|
917
|
+
updated_at TEXT NOT NULL
|
|
918
|
+
);
|
|
919
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_finance_drafts_open_subject
|
|
920
|
+
ON finance_drafts(subject_id) WHERE status='open';
|
|
921
|
+
CREATE INDEX IF NOT EXISTS idx_finance_drafts_booked
|
|
922
|
+
ON finance_drafts(subject_id,booked_at,id) WHERE status='booked';
|
|
923
|
+
CREATE TABLE IF NOT EXISTS finance_business_events (
|
|
924
|
+
idempotency_key TEXT PRIMARY KEY,
|
|
925
|
+
kind TEXT NOT NULL CHECK(kind IN (
|
|
926
|
+
'finance_draft_entry_added','finance_draft_entry_updated','finance_draft_entry_removed',
|
|
927
|
+
'finance_draft_moved','finance_draft_cleared'
|
|
928
|
+
)),
|
|
929
|
+
subject_id TEXT NOT NULL,
|
|
930
|
+
domain_reference TEXT NOT NULL,
|
|
931
|
+
correlation_id TEXT NOT NULL,
|
|
932
|
+
created_at TEXT NOT NULL
|
|
933
|
+
);
|
|
934
|
+
CREATE INDEX IF NOT EXISTS idx_finance_business_events_created
|
|
935
|
+
ON finance_business_events(created_at,idempotency_key);
|
|
936
|
+
CREATE TABLE IF NOT EXISTS finance_book_migration_state (
|
|
937
|
+
book_id TEXT PRIMARY KEY,
|
|
938
|
+
mutation_blocked INTEGER NOT NULL DEFAULT 0 CHECK(mutation_blocked IN (0,1)),
|
|
939
|
+
reason TEXT,
|
|
940
|
+
updated_at TEXT NOT NULL
|
|
941
|
+
);
|
|
942
|
+
CREATE TABLE IF NOT EXISTS finance_legacy_evidence (
|
|
943
|
+
id TEXT PRIMARY KEY,
|
|
944
|
+
book_id TEXT NOT NULL,
|
|
945
|
+
source_kind TEXT NOT NULL CHECK(source_kind IN ('entry','task_result')),
|
|
946
|
+
source_id TEXT NOT NULL,
|
|
947
|
+
evidence_json TEXT NOT NULL,
|
|
948
|
+
recorded_at TEXT NOT NULL,
|
|
949
|
+
UNIQUE(source_kind,source_id)
|
|
950
|
+
);
|
|
951
|
+
CREATE INDEX IF NOT EXISTS idx_finance_legacy_evidence_book
|
|
952
|
+
ON finance_legacy_evidence(book_id,source_kind,source_id);
|
|
953
|
+
`);
|
|
954
|
+
if (!grantsExisted) {
|
|
955
|
+
this.db.exec(`CREATE TABLE IF NOT EXISTS finance_roleless_migrations (
|
|
956
|
+
id TEXT PRIMARY KEY, applied_at TEXT NOT NULL
|
|
957
|
+
)`);
|
|
958
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
959
|
+
this.db.prepare("INSERT OR IGNORE INTO finance_roleless_migrations(id,applied_at) VALUES(?,?)").run("business-subject-ids-v8", now);
|
|
960
|
+
this.db.prepare("INSERT OR IGNORE INTO finance_roleless_migrations(id,applied_at) VALUES(?,?)").run("roleless-schema-v1", now);
|
|
961
|
+
this.db.prepare("INSERT OR IGNORE INTO finance_roleless_migrations(id,applied_at) VALUES(?,?)").run("single-draft-v1", now);
|
|
962
|
+
}
|
|
963
|
+
migrateSharedDraft(this.db);
|
|
964
|
+
this.migrateCanonicalWorksets();
|
|
965
|
+
this.db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_worksets_one_canonical_book ON worksets(book_id) WHERE is_canonical=1;");
|
|
966
|
+
this.db.exec("UPDATE entries SET workflow_state=state WHERE workflow_state IS NULL; UPDATE entries SET workflow_result=result WHERE workflow_result IS NULL; UPDATE entries SET removed_at=updated_at WHERE state='committed' AND result='succeeded' AND removed_at IS NULL; UPDATE commits SET workflow_status=status WHERE workflow_status IS NULL; UPDATE commit_operations SET workflow_status=status WHERE workflow_status IS NULL;");
|
|
967
|
+
}
|
|
968
|
+
migrateSubjectAttribution() {
|
|
969
|
+
this.db.transaction(() => {
|
|
970
|
+
this.db.exec("CREATE TABLE IF NOT EXISTS finance_attribution_migrations(id TEXT PRIMARY KEY)");
|
|
971
|
+
const id = "subject-attribution-v1";
|
|
972
|
+
if (this.db.prepare("SELECT id FROM finance_attribution_migrations WHERE id<>?").get(id)) throw new Error("finance_attribution_migration_unknown");
|
|
973
|
+
if (this.db.prepare("SELECT id FROM finance_attribution_migrations WHERE id=?").get(id)) {
|
|
974
|
+
for (const [table, column] of [
|
|
975
|
+
["worksets", "created_by_subject_id"],
|
|
976
|
+
["entries", "created_by_subject_id"],
|
|
977
|
+
["entries", "last_modified_by_subject_id"]
|
|
978
|
+
]) if (!this.db.prepare(`PRAGMA table_info(${table})`).all().some((item) => item.name === column)) throw new Error("finance_attribution_schema_inconsistent");
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
this.addColumnIfMissing("worksets", "created_by_subject_id", "TEXT");
|
|
982
|
+
this.addColumnIfMissing("entries", "created_by_subject_id", "TEXT");
|
|
983
|
+
this.addColumnIfMissing("entries", "last_modified_by_subject_id", "TEXT");
|
|
984
|
+
this.db.prepare("INSERT OR IGNORE INTO finance_attribution_migrations VALUES(?)").run(id);
|
|
985
|
+
})();
|
|
986
|
+
}
|
|
987
|
+
migrateCanonicalWorksets() {
|
|
988
|
+
const books = this.db.prepare("SELECT DISTINCT book_id FROM worksets ORDER BY book_id").all();
|
|
989
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
990
|
+
for (const { book_id } of books) try {
|
|
991
|
+
this.db.transaction(() => this.migrateCanonicalBook(book_id, now))();
|
|
992
|
+
this.db.prepare(`INSERT INTO finance_book_migration_state(book_id,mutation_blocked,reason,updated_at)
|
|
993
|
+
VALUES(?,0,NULL,?) ON CONFLICT(book_id) DO UPDATE SET mutation_blocked=0,reason=NULL,updated_at=excluded.updated_at`).run(book_id, now);
|
|
994
|
+
} catch (error) {
|
|
995
|
+
this.db.prepare(`INSERT INTO finance_book_migration_state(book_id,mutation_blocked,reason,updated_at)
|
|
996
|
+
VALUES(?,1,?,?) ON CONFLICT(book_id) DO UPDATE SET mutation_blocked=1,reason=excluded.reason,updated_at=excluded.updated_at`).run(book_id, migrationError(error), now);
|
|
997
|
+
}
|
|
998
|
+
this.captureLegacyTaskResults(now);
|
|
999
|
+
}
|
|
1000
|
+
migrateCanonicalBook(bookId, now) {
|
|
1001
|
+
const rows = this.db.prepare("SELECT * FROM worksets WHERE book_id=? ORDER BY is_canonical DESC,created_at,id").all(bookId);
|
|
1002
|
+
if (!rows.length) return;
|
|
1003
|
+
const canonical = rows[0];
|
|
1004
|
+
const entries = this.db.prepare("SELECT * FROM entries WHERE book_id=? ORDER BY created_at,id").all(bookId);
|
|
1005
|
+
const byHash = /* @__PURE__ */ new Map();
|
|
1006
|
+
for (const entry of entries) {
|
|
1007
|
+
this.captureLegacyEntryEvidence(entry, now);
|
|
1008
|
+
const hash = proposalHash(entry.proposal_json);
|
|
1009
|
+
const candidates = byHash.get(hash) ?? [];
|
|
1010
|
+
candidates.push(entry);
|
|
1011
|
+
byHash.set(hash, candidates);
|
|
1012
|
+
}
|
|
1013
|
+
this.db.prepare("UPDATE worksets SET is_canonical=CASE WHEN id=? THEN 1 ELSE 0 END WHERE book_id=?").run(canonical.id, bookId);
|
|
1014
|
+
for (const duplicates of byHash.values()) {
|
|
1015
|
+
const locked = duplicates.filter((entry) => Boolean(entry.locked_commit_id));
|
|
1016
|
+
if (locked.length > 1) throw new Error(`ambiguous_locked_duplicate:${locked.map((entry) => entry.id).join(",")}`);
|
|
1017
|
+
const preferred = chooseCanonicalEntry(duplicates);
|
|
1018
|
+
const mergedEvidence = duplicates.reduce((value, entry) => mergeEvidenceJson(value, entry.evidence_json), "[]");
|
|
1019
|
+
const preferredState = preferred.workflow_state ?? preferred.state;
|
|
1020
|
+
const verifiedCommitted = preferredState === "committed" && (preferred.workflow_result ?? preferred.result) === "succeeded";
|
|
1021
|
+
this.db.prepare(`UPDATE entries SET workset_id=?,evidence_json=?,state=?,workflow_state=?,removed_at=COALESCE(removed_at,?),
|
|
1022
|
+
version=version+1,updated_at=? WHERE id=?`).run(canonical.id, mergedEvidence, legacyState(preferredState), preferredState, verifiedCommitted ? preferred.updated_at : null, now, preferred.id);
|
|
1023
|
+
for (const duplicate of duplicates) {
|
|
1024
|
+
if (duplicate.id === preferred.id) continue;
|
|
1025
|
+
const referenced = Boolean(this.db.prepare("SELECT 1 FROM commit_operations WHERE entry_id=? LIMIT 1").get(duplicate.id));
|
|
1026
|
+
if (duplicate.locked_commit_id || referenced) {
|
|
1027
|
+
const removedAt = (duplicate.workflow_state ?? duplicate.state) === "committed" && (duplicate.workflow_result ?? duplicate.result) === "succeeded" ? duplicate.removed_at ?? duplicate.updated_at : duplicate.removed_at ?? now;
|
|
1028
|
+
this.db.prepare(`UPDATE entries SET workset_id=?,removed_at=?,version=version+1,updated_at=? WHERE id=?`).run(canonical.id, removedAt, now, duplicate.id);
|
|
1029
|
+
} else this.db.prepare("DELETE FROM entries WHERE id=?").run(duplicate.id);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
captureLegacyEntryEvidence(entry, now) {
|
|
1034
|
+
const evidence = parseJson(entry.evidence_json, "Entry evidence");
|
|
1035
|
+
this.db.prepare(`INSERT OR IGNORE INTO finance_legacy_evidence(
|
|
1036
|
+
id,book_id,source_kind,source_id,evidence_json,recorded_at
|
|
1037
|
+
) VALUES(?,?,?,?,?,?)`).run(legacyEvidenceId("entry", entry.id), entry.book_id, "entry", entry.id, stringify({
|
|
1038
|
+
evidence,
|
|
1039
|
+
legacyState: entry.state,
|
|
1040
|
+
legacyResult: entry.result
|
|
1041
|
+
}), now);
|
|
1042
|
+
}
|
|
1043
|
+
captureLegacyTaskResults(now) {
|
|
1044
|
+
if (!this.db.prepare("SELECT name FROM sqlite_master WHERE name='finance_task_results'").get()) return;
|
|
1045
|
+
if (!this.db.prepare("SELECT 1 FROM sqlite_master WHERE name='finance_task_scopes'").get()) return;
|
|
1046
|
+
const rows = this.db.prepare(`SELECT r.task_id,r.result_json,s.book_id FROM finance_task_results r
|
|
1047
|
+
JOIN finance_task_scopes s ON s.task_id=r.task_id WHERE s.book_id IS NOT NULL`).all();
|
|
1048
|
+
for (const row of rows) {
|
|
1049
|
+
const result = parseJson(row.result_json, "Finance Task Result");
|
|
1050
|
+
if (!("processedSources" in result) && !stringify(result).includes("needs_review")) continue;
|
|
1051
|
+
this.db.prepare(`INSERT OR IGNORE INTO finance_legacy_evidence(
|
|
1052
|
+
id,book_id,source_kind,source_id,evidence_json,recorded_at
|
|
1053
|
+
) VALUES(?,?,?,?,?,?)`).run(legacyEvidenceId("task_result", row.task_id), row.book_id, "task_result", row.task_id, stringify(result), now);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
addColumnIfMissing(table, column, definition) {
|
|
1057
|
+
if (!this.db.prepare(`PRAGMA table_info(${table})`).all().some((item) => item.name === column)) this.db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition};`);
|
|
1058
|
+
}
|
|
1059
|
+
insertBusinessEvent(event, owner) {
|
|
1060
|
+
if ("contextType" in event || "contextId" in event) throw new Error("finance_event_role_unsupported");
|
|
1061
|
+
if (!FINANCE_BUSINESS_EVENT_KINDS.includes(event.kind)) throw new Error("finance_event_kind_unsupported");
|
|
1062
|
+
if (event.subjectId !== owner.subjectId || event.domainReference !== owner.id) throw new Error("finance_event_subject_mismatch");
|
|
1063
|
+
for (const [label, value] of [
|
|
1064
|
+
["subjectId", event.subjectId],
|
|
1065
|
+
["domainReference", event.domainReference],
|
|
1066
|
+
["correlationId", event.correlationId],
|
|
1067
|
+
["idempotencyKey", event.idempotencyKey]
|
|
1068
|
+
]) assertText(value, label);
|
|
1069
|
+
assertTimestamp(event.now, "event.now");
|
|
1070
|
+
this.db.prepare(`INSERT OR IGNORE INTO finance_business_events(
|
|
1071
|
+
idempotency_key,kind,subject_id,domain_reference,correlation_id,created_at
|
|
1072
|
+
) VALUES(?,?,?,?,?,?)`).run(event.idempotencyKey, event.kind, event.subjectId, event.domainReference, event.correlationId, event.now);
|
|
1073
|
+
const row = this.db.prepare("SELECT * FROM finance_business_events WHERE idempotency_key=?").get(event.idempotencyKey);
|
|
1074
|
+
if (!row || row.kind !== event.kind || row.subject_id !== event.subjectId || row.domain_reference !== event.domainReference || row.correlation_id !== event.correlationId) throw new Error("finance_trusted_event_identity_conflict");
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
function mapBusinessEvent(row) {
|
|
1078
|
+
return {
|
|
1079
|
+
kind: row.kind,
|
|
1080
|
+
subjectId: row.subject_id,
|
|
1081
|
+
domainReference: row.domain_reference,
|
|
1082
|
+
correlationId: row.correlation_id,
|
|
1083
|
+
idempotencyKey: row.idempotency_key,
|
|
1084
|
+
now: row.created_at
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
function mapEntry(row) {
|
|
1088
|
+
return {
|
|
1089
|
+
id: row.id,
|
|
1090
|
+
worksetId: row.workset_id,
|
|
1091
|
+
bookId: row.book_id,
|
|
1092
|
+
proposal: parseJson(row.proposal_json, "Entry proposal"),
|
|
1093
|
+
state: row.workflow_state ?? row.state,
|
|
1094
|
+
version: entryVersionFor(row),
|
|
1095
|
+
...row.locked_commit_id ? { lockedCommitId: row.locked_commit_id } : {},
|
|
1096
|
+
evidence: parseJson(row.evidence_json, "Entry evidence"),
|
|
1097
|
+
...row.created_by_task_id ? { createdByTaskId: row.created_by_task_id } : {},
|
|
1098
|
+
...row.last_modified_by_task_id ? { lastModifiedByTaskId: row.last_modified_by_task_id } : {},
|
|
1099
|
+
...row.created_by_subject_id ? { createdBySubjectId: row.created_by_subject_id } : {},
|
|
1100
|
+
...row.last_modified_by_subject_id ? { lastModifiedBySubjectId: row.last_modified_by_subject_id } : {},
|
|
1101
|
+
createdAt: row.created_at,
|
|
1102
|
+
updatedAt: row.updated_at,
|
|
1103
|
+
...row.workflow_result ?? row.result ? { result: row.workflow_result ?? row.result } : {},
|
|
1104
|
+
...row.receipt_ref ? { receiptRef: row.receipt_ref } : {},
|
|
1105
|
+
...row.readback_verification_ref ? { readbackVerificationRef: row.readback_verification_ref } : {},
|
|
1106
|
+
...row.unknown_resolution_json ? { unknownResolution: parseJson(row.unknown_resolution_json, "Unknown resolution") } : {}
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
function mapCommitOperation(row) {
|
|
1110
|
+
return {
|
|
1111
|
+
id: row.id,
|
|
1112
|
+
commitId: row.commit_id,
|
|
1113
|
+
entryId: row.entry_id,
|
|
1114
|
+
sequence: row.sequence,
|
|
1115
|
+
operation: row.operation,
|
|
1116
|
+
bookId: row.book_id,
|
|
1117
|
+
...row.target_remote_id ? { targetRemoteId: row.target_remote_id } : {},
|
|
1118
|
+
request: parseJson(row.request_json, "Commit request"),
|
|
1119
|
+
...row.before_json ? { before: parseJson(row.before_json, "Commit before") } : {},
|
|
1120
|
+
status: row.workflow_status ?? row.status,
|
|
1121
|
+
...row.result_json ? { result: parseJson(row.result_json, "Commit result") } : {},
|
|
1122
|
+
...row.verification_json ? { verification: parseJson(row.verification_json, "Commit verification") } : {},
|
|
1123
|
+
...row.receipt_ref ? { receiptRef: row.receipt_ref } : {},
|
|
1124
|
+
...row.readback_verification_ref ? { readbackVerificationRef: row.readback_verification_ref } : {},
|
|
1125
|
+
...row.readback_attempt !== null && row.readback_attempt !== void 0 ? { readbackAttempt: row.readback_attempt } : {},
|
|
1126
|
+
...row.next_readback_at ? { nextReadbackAt: row.next_readback_at } : {},
|
|
1127
|
+
...row.started_at ? { startedAt: row.started_at } : {},
|
|
1128
|
+
...row.ended_at ? { endedAt: row.ended_at } : {}
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
function mapGrant(row) {
|
|
1132
|
+
return {
|
|
1133
|
+
id: row.id,
|
|
1134
|
+
subjectId: row.subject_id,
|
|
1135
|
+
bookId: row.book_id,
|
|
1136
|
+
revision: row.revision,
|
|
1137
|
+
boundAt: row.bound_at,
|
|
1138
|
+
...row.replaced_at ? { replacedAt: row.replaced_at } : {}
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
function mapDraftRow(row) {
|
|
1142
|
+
const content = parseJson(row.entries_json, "Draft entries");
|
|
1143
|
+
return {
|
|
1144
|
+
id: row.id,
|
|
1145
|
+
subjectId: row.subject_id,
|
|
1146
|
+
grantId: row.grant_id,
|
|
1147
|
+
bookId: row.book_id,
|
|
1148
|
+
status: row.status,
|
|
1149
|
+
entries: content.entries.map((entry) => projectDraftEntry(entry)),
|
|
1150
|
+
...row.source_json ? { source: parseJson(row.source_json, "Draft source") } : {},
|
|
1151
|
+
...row.reference_json ? { referenceData: parseJson(row.reference_json, "Draft referenceData") } : {},
|
|
1152
|
+
...row.booked_at ? { bookedAt: row.booked_at } : {},
|
|
1153
|
+
...row.booked_summary_json ? { bookedSummary: parseJson(row.booked_summary_json, "Draft booked summary") } : {},
|
|
1154
|
+
createdAt: row.created_at,
|
|
1155
|
+
updatedAt: row.updated_at
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
function versionFor(row) {
|
|
1159
|
+
return `fw_${createHash("sha256").update(`${row.id}\0${row.revision}\0${row.updated_at}`).digest("hex").slice(0, 20)}`;
|
|
1160
|
+
}
|
|
1161
|
+
function entryVersionFor(row) {
|
|
1162
|
+
return `fe_${createHash("sha256").update(`${row.id}\0${row.version ?? 1}\0${row.updated_at}`).digest("hex").slice(0, 20)}`;
|
|
1163
|
+
}
|
|
1164
|
+
function assertCommitTransition(from, to) {
|
|
1165
|
+
if (!{
|
|
1166
|
+
prepared: ["awaiting_confirmation", "cancelled"],
|
|
1167
|
+
awaiting_confirmation: [
|
|
1168
|
+
"checking",
|
|
1169
|
+
"executing",
|
|
1170
|
+
"cancelled"
|
|
1171
|
+
],
|
|
1172
|
+
checking: [
|
|
1173
|
+
"executing",
|
|
1174
|
+
"paused",
|
|
1175
|
+
"failed"
|
|
1176
|
+
],
|
|
1177
|
+
executing: [
|
|
1178
|
+
"paused",
|
|
1179
|
+
"awaiting_readback",
|
|
1180
|
+
"outcome_unknown",
|
|
1181
|
+
"succeeded",
|
|
1182
|
+
"partial_failed",
|
|
1183
|
+
"failed"
|
|
1184
|
+
],
|
|
1185
|
+
paused: [
|
|
1186
|
+
"checking",
|
|
1187
|
+
"executing",
|
|
1188
|
+
"awaiting_readback",
|
|
1189
|
+
"outcome_unknown",
|
|
1190
|
+
"succeeded",
|
|
1191
|
+
"partial_failed",
|
|
1192
|
+
"failed"
|
|
1193
|
+
],
|
|
1194
|
+
awaiting_readback: [
|
|
1195
|
+
"paused",
|
|
1196
|
+
"outcome_unknown",
|
|
1197
|
+
"succeeded",
|
|
1198
|
+
"partial_failed",
|
|
1199
|
+
"failed"
|
|
1200
|
+
],
|
|
1201
|
+
outcome_unknown: [
|
|
1202
|
+
"paused",
|
|
1203
|
+
"awaiting_readback",
|
|
1204
|
+
"succeeded",
|
|
1205
|
+
"partial_failed",
|
|
1206
|
+
"failed"
|
|
1207
|
+
],
|
|
1208
|
+
succeeded: [],
|
|
1209
|
+
partial_failed: [],
|
|
1210
|
+
failed: [],
|
|
1211
|
+
cancelled: []
|
|
1212
|
+
}[from].includes(to)) throw new Error(`finance_commit_transition_invalid:${from}:${to}`);
|
|
1213
|
+
}
|
|
1214
|
+
function legacyCommitStatus(status) {
|
|
1215
|
+
return status === "checking" || status === "paused" || status === "awaiting_readback" || status === "outcome_unknown" ? "executing" : status;
|
|
1216
|
+
}
|
|
1217
|
+
function legacyOperationStatus(status) {
|
|
1218
|
+
if (status === "externally_verified") return "succeeded";
|
|
1219
|
+
if (status === "readback_pending" || status === "unknown") return "executing";
|
|
1220
|
+
if (status === "not_executed") return "skipped";
|
|
1221
|
+
return status;
|
|
1222
|
+
}
|
|
1223
|
+
function legacyState(state) {
|
|
1224
|
+
if (state === "changed" || state === "staged" || state === "committed") return state;
|
|
1225
|
+
return state === "readback_pending" ? "committed" : "staged";
|
|
1226
|
+
}
|
|
1227
|
+
function entryRank(state) {
|
|
1228
|
+
return state === "unknown" || state === "commit_locked" || state === "readback_pending" ? 4 : state === "staged" ? 3 : state === "changed" ? 2 : 1;
|
|
1229
|
+
}
|
|
1230
|
+
function chooseCanonicalEntry(entries) {
|
|
1231
|
+
const locked = entries.find((entry) => Boolean(entry.locked_commit_id));
|
|
1232
|
+
if (locked) return locked;
|
|
1233
|
+
return [...entries].sort((left, right) => {
|
|
1234
|
+
const rank = entryRank(right.workflow_state ?? right.state) - entryRank(left.workflow_state ?? left.state);
|
|
1235
|
+
if (rank !== 0) return rank;
|
|
1236
|
+
return left.created_at.localeCompare(right.created_at) || left.id.localeCompare(right.id);
|
|
1237
|
+
})[0];
|
|
1238
|
+
}
|
|
1239
|
+
function proposalHash(proposalJson) {
|
|
1240
|
+
const proposal = parseJson(proposalJson, "Entry proposal");
|
|
1241
|
+
return createHash("sha256").update(canonicalJson(proposal)).digest("hex");
|
|
1242
|
+
}
|
|
1243
|
+
function canonicalJson(value) {
|
|
1244
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
1245
|
+
if (value && typeof value === "object") {
|
|
1246
|
+
const record = value;
|
|
1247
|
+
return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${canonicalJson(record[key])}`).join(",")}}`;
|
|
1248
|
+
}
|
|
1249
|
+
const encoded = JSON.stringify(value);
|
|
1250
|
+
if (encoded === void 0) throw new Error("finance_json_invalid");
|
|
1251
|
+
return encoded;
|
|
1252
|
+
}
|
|
1253
|
+
function legacyEvidenceId(kind, sourceId) {
|
|
1254
|
+
return `legacy_${createHash("sha256").update(`${kind}\0${sourceId}`).digest("hex").slice(0, 32)}`;
|
|
1255
|
+
}
|
|
1256
|
+
function migrationError(error) {
|
|
1257
|
+
return (error instanceof Error ? error.message : "finance_migration_conflict").slice(0, 500);
|
|
1258
|
+
}
|
|
1259
|
+
function mergeEvidenceJson(leftJson, rightJson) {
|
|
1260
|
+
const left = parseJson(leftJson, "Entry evidence");
|
|
1261
|
+
const right = parseJson(rightJson, "Entry evidence");
|
|
1262
|
+
for (const evidence of right) if (!left.some((item) => sameEvidence(item, evidence))) left.push(evidence);
|
|
1263
|
+
return stringify(left);
|
|
1264
|
+
}
|
|
1265
|
+
function sameEvidence(left, right) {
|
|
1266
|
+
return left.subjectId === right.subjectId && left.callId === right.callId && left.taskId === right.taskId && left.runId === right.runId && stringify(left.source) === stringify(right.source) && left.summary === right.summary && left.locator === right.locator && left.checksum === right.checksum;
|
|
1267
|
+
}
|
|
1268
|
+
function assertEntryActor(subjectId, evidence) {
|
|
1269
|
+
assertText(subjectId, "subjectId");
|
|
1270
|
+
if ("taskId" in evidence || "runId" in evidence || evidence.subjectId !== subjectId || typeof evidence.callId !== "string" || !evidence.callId.trim()) throw new Error("finance_evidence_actor_invalid");
|
|
1271
|
+
if (evidence.source.type === "task-attachment") throw new Error("finance_legacy_source_not_writable");
|
|
1272
|
+
}
|
|
1273
|
+
function stringify(value) {
|
|
1274
|
+
const result = JSON.stringify(value);
|
|
1275
|
+
if (result === void 0) throw new Error("finance_json_invalid");
|
|
1276
|
+
return result;
|
|
1277
|
+
}
|
|
1278
|
+
function parseJson(value, label) {
|
|
1279
|
+
try {
|
|
1280
|
+
return JSON.parse(value);
|
|
1281
|
+
} catch {
|
|
1282
|
+
throw new Error(`${label} is corrupt`);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
function assertText(value, label) {
|
|
1286
|
+
if (!value.trim()) throw new Error(`${label} must not be empty`);
|
|
1287
|
+
}
|
|
1288
|
+
function assertTimestamp(value, label) {
|
|
1289
|
+
if (Number.isNaN(Date.parse(value))) throw new Error(`${label} must be an ISO timestamp`);
|
|
1290
|
+
}
|
|
1291
|
+
//#endregion
|
|
1292
|
+
export { FinanceDatabase };
|