@iota-uz/sdk 0.46.0 → 0.47.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 +5 -0
- package/dist/client-host/identity.d.ts +4 -4
- package/dist/client-host/identity.js +2 -2
- package/dist/lens/{CascadePanel-Bha4qY7J.js → CascadePanel-BlYJd18G.js} +1 -1
- package/dist/lens/{ChartDataEquivalent-Bwgn4yYB.js → ChartDataEquivalent-B6xSOdzC.js} +1 -1
- package/dist/lens/{ChartPanel-BZpzBuwl.js → ChartPanel-BIJjrs5D.js} +159 -159
- package/dist/lens/{CoveragePanel-D40AuKkD.js → CoveragePanel-CHtXDMtt.js} +1 -1
- package/dist/lens/{GaugePanel-C9k2TuJH.js → GaugePanel-By0TOJPa.js} +1 -1
- package/dist/lens/LensDashboard.d.ts +13 -0
- package/dist/lens/LensDashboard.d.ts.map +1 -1
- package/dist/lens/{MapPanel-ZYxfDsPM.js → MapPanel-Cw4ELCiM.js} +3 -3
- package/dist/lens/{MetricFlowPanel-CmESLoLK.js → MetricFlowPanel-Gr5wi3nI.js} +2 -2
- package/dist/lens/{MetricHierarchyPanel-UZVuJ5P2.js → MetricHierarchyPanel-VLA_5LXX.js} +2 -2
- package/dist/lens/{MetricRelationshipPanel-CXLdScAy.js → MetricRelationshipPanel-DFP566_c.js} +2 -2
- package/dist/lens/{PrintReport-lrfdCTZO.js → PrintReport-C0OV1iHP.js} +5 -5
- package/dist/lens/{QualityChip-BYz-DHfs.js → QualityChip-DTi-0jdh.js} +1 -1
- package/dist/lens/SaveInvestigation-CX1Abyl8.js +309 -0
- package/dist/lens/TablePanel-BusKU7cU.js +994 -0
- package/dist/lens/{adapter-CeAqYWqm.js → adapter-CQg4-M7p.js} +7 -7
- package/dist/lens/contract/schemas.d.ts +2 -0
- package/dist/lens/contract/schemas.d.ts.map +1 -1
- package/dist/lens/contract/types.d.ts +12 -0
- package/dist/lens/contract/types.d.ts.map +1 -1
- package/dist/lens/{dashboardEdit-DKVE_6J_.js → dashboardEdit-CJgCVfi_.js} +1 -1
- package/dist/lens/explore/DrillOverlay.d.ts +38 -0
- package/dist/lens/explore/DrillOverlay.d.ts.map +1 -1
- package/dist/lens/explore/ExplorePanel.d.ts.map +1 -1
- package/dist/lens/explore/SaveInvestigation.d.ts +21 -0
- package/dist/lens/explore/SaveInvestigation.d.ts.map +1 -0
- package/dist/lens/explore/drillHost.d.ts +25 -0
- package/dist/lens/explore/drillHost.d.ts.map +1 -0
- package/dist/lens/explore/investigation.d.ts +174 -0
- package/dist/lens/explore/investigation.d.ts.map +1 -0
- package/dist/lens/explore/provenanceLabels.d.ts +10 -0
- package/dist/lens/explore/provenanceLabels.d.ts.map +1 -0
- package/dist/lens/index-DR7Hf8Km.js +19805 -0
- package/dist/lens/{index-DkVTXC8W.js → index-DZFw4cqF.js} +1 -1
- package/dist/lens/index.d.ts +7 -1
- package/dist/lens/index.d.ts.map +1 -1
- package/dist/lens/index.js +67 -53
- package/dist/lens/{install-CQ_iMuAE.js → install-B2lTK6uo.js} +1 -1
- package/dist/lens/{install-Ch0_qifK.js → install-BXr4Mnc0.js} +1 -1
- package/dist/lens/{install-CKmxqMe1.js → install-CicNQ_ks.js} +1 -1
- package/dist/lens/{install-BwD_xNlp.js → install-d8A0WPiw.js} +1 -1
- package/dist/lens/{keys-BBmWdfaH.js → keys-C-Akc9lZ.js} +2 -2
- package/dist/lens/panels/ChartPanel.d.ts.map +1 -1
- package/dist/lens/panels/TablePanel.d.ts.map +1 -1
- package/dist/lens/panels/actions.d.ts.map +1 -1
- package/dist/lens/panels/panelFailure.d.ts.map +1 -1
- package/dist/lens/{prefetch-BXoUIIgq.js → prefetch-C9kxuIs8.js} +2 -2
- package/dist/lens/{prefetchPanels-a-zs_bDm.js → prefetchPanels-gbY9RIqL.js} +1 -1
- package/dist/lens/{print-CpgWJxDG.js → print-CllsAP3d.js} +1 -1
- package/dist/lens/reports/ReportCompositionEditor.d.ts +8 -2
- package/dist/lens/reports/ReportCompositionEditor.d.ts.map +1 -1
- package/dist/lens/reports/ReportDefinitionEditor.d.ts +54 -0
- package/dist/lens/reports/ReportDefinitionEditor.d.ts.map +1 -0
- package/dist/lens/reports/ReportPicker.d.ts +6 -0
- package/dist/lens/reports/ReportPicker.d.ts.map +1 -1
- package/dist/lens/reports/dashboardEdit.d.ts +3 -0
- package/dist/lens/reports/dashboardEdit.d.ts.map +1 -1
- package/dist/lens/reports/editing.d.ts +35 -0
- package/dist/lens/reports/editing.d.ts.map +1 -1
- package/dist/lens/reports/picker.d.ts +4 -1
- package/dist/lens/reports/picker.d.ts.map +1 -1
- package/dist/lens/runtime/index.d.ts +0 -1
- package/dist/lens/runtime/index.d.ts.map +1 -1
- package/dist/lens/runtime/messages.d.ts +2 -2
- package/dist/lens/runtime/messages.d.ts.map +1 -1
- package/dist/lens/runtime/provider.d.ts +5 -1
- package/dist/lens/runtime/provider.d.ts.map +1 -1
- package/dist/lens/runtime/returnContext.d.ts +62 -0
- package/dist/lens/runtime/returnContext.d.ts.map +1 -0
- package/dist/lens/runtime/tableSummary.d.ts +9 -0
- package/dist/lens/runtime/tableSummary.d.ts.map +1 -0
- package/dist/lens/{scales-BLf9OweG.js → scales-CO6Q9RtG.js} +1 -1
- package/dist/lens/style.css +1 -1
- package/dist/runtime/README.md +24 -0
- package/dist/runtime/assert.d.ts +51 -0
- package/dist/runtime/assert.js +172 -0
- package/dist/runtime/build/README.txt +1 -0
- package/dist/runtime/build/extract.mjs +342 -0
- package/dist/runtime/build/shared-exports.json +388 -0
- package/dist/runtime/build/test-child.mjs +136 -0
- package/dist/runtime/build/theme/tailwind.config.js +121 -0
- package/dist/runtime/build/theme/theme.css +462 -0
- package/dist/runtime/build/theme/utilities.css +1 -0
- package/dist/runtime/build/vendor/lib/lib.d.ts +22 -0
- package/dist/runtime/build/vendor/lib/lib.decorators.d.ts +384 -0
- package/dist/runtime/build/vendor/lib/lib.decorators.legacy.d.ts +22 -0
- package/dist/runtime/build/vendor/lib/lib.dom.asynciterable.d.ts +41 -0
- package/dist/runtime/build/vendor/lib/lib.dom.d.ts +28983 -0
- package/dist/runtime/build/vendor/lib/lib.dom.iterable.d.ts +491 -0
- package/dist/runtime/build/vendor/lib/lib.es2015.collection.d.ts +147 -0
- package/dist/runtime/build/vendor/lib/lib.es2015.core.d.ts +597 -0
- package/dist/runtime/build/vendor/lib/lib.es2015.d.ts +28 -0
- package/dist/runtime/build/vendor/lib/lib.es2015.generator.d.ts +77 -0
- package/dist/runtime/build/vendor/lib/lib.es2015.iterable.d.ts +590 -0
- package/dist/runtime/build/vendor/lib/lib.es2015.promise.d.ts +81 -0
- package/dist/runtime/build/vendor/lib/lib.es2015.proxy.d.ts +128 -0
- package/dist/runtime/build/vendor/lib/lib.es2015.reflect.d.ts +144 -0
- package/dist/runtime/build/vendor/lib/lib.es2015.symbol.d.ts +46 -0
- package/dist/runtime/build/vendor/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/dist/runtime/build/vendor/lib/lib.es2016.array.include.d.ts +116 -0
- package/dist/runtime/build/vendor/lib/lib.es2016.d.ts +21 -0
- package/dist/runtime/build/vendor/lib/lib.es2016.full.d.ts +23 -0
- package/dist/runtime/build/vendor/lib/lib.es2016.intl.d.ts +31 -0
- package/dist/runtime/build/vendor/lib/lib.es2017.arraybuffer.d.ts +21 -0
- package/dist/runtime/build/vendor/lib/lib.es2017.d.ts +26 -0
- package/dist/runtime/build/vendor/lib/lib.es2017.date.d.ts +31 -0
- package/dist/runtime/build/vendor/lib/lib.es2017.full.d.ts +23 -0
- package/dist/runtime/build/vendor/lib/lib.es2017.intl.d.ts +44 -0
- package/dist/runtime/build/vendor/lib/lib.es2017.object.d.ts +49 -0
- package/dist/runtime/build/vendor/lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/dist/runtime/build/vendor/lib/lib.es2017.string.d.ts +45 -0
- package/dist/runtime/build/vendor/lib/lib.es2017.typedarrays.d.ts +53 -0
- package/dist/runtime/build/vendor/lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/dist/runtime/build/vendor/lib/lib.es2018.asynciterable.d.ts +53 -0
- package/dist/runtime/build/vendor/lib/lib.es2018.d.ts +24 -0
- package/dist/runtime/build/vendor/lib/lib.es2018.full.d.ts +24 -0
- package/dist/runtime/build/vendor/lib/lib.es2018.intl.d.ts +83 -0
- package/dist/runtime/build/vendor/lib/lib.es2018.promise.d.ts +30 -0
- package/dist/runtime/build/vendor/lib/lib.es2018.regexp.d.ts +37 -0
- package/dist/runtime/build/vendor/lib/lib.es2019.array.d.ts +79 -0
- package/dist/runtime/build/vendor/lib/lib.es2019.d.ts +24 -0
- package/dist/runtime/build/vendor/lib/lib.es2019.full.d.ts +24 -0
- package/dist/runtime/build/vendor/lib/lib.es2019.intl.d.ts +23 -0
- package/dist/runtime/build/vendor/lib/lib.es2019.object.d.ts +33 -0
- package/dist/runtime/build/vendor/lib/lib.es2019.string.d.ts +37 -0
- package/dist/runtime/build/vendor/lib/lib.es2019.symbol.d.ts +24 -0
- package/dist/runtime/build/vendor/lib/lib.es2020.bigint.d.ts +731 -0
- package/dist/runtime/build/vendor/lib/lib.es2020.d.ts +27 -0
- package/dist/runtime/build/vendor/lib/lib.es2020.date.d.ts +42 -0
- package/dist/runtime/build/vendor/lib/lib.es2020.full.d.ts +24 -0
- package/dist/runtime/build/vendor/lib/lib.es2020.intl.d.ts +474 -0
- package/dist/runtime/build/vendor/lib/lib.es2020.number.d.ts +28 -0
- package/dist/runtime/build/vendor/lib/lib.es2020.promise.d.ts +47 -0
- package/dist/runtime/build/vendor/lib/lib.es2020.sharedmemory.d.ts +99 -0
- package/dist/runtime/build/vendor/lib/lib.es2020.string.d.ts +44 -0
- package/dist/runtime/build/vendor/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/dist/runtime/build/vendor/lib/lib.es2021.d.ts +23 -0
- package/dist/runtime/build/vendor/lib/lib.es2021.full.d.ts +24 -0
- package/dist/runtime/build/vendor/lib/lib.es2021.intl.d.ts +166 -0
- package/dist/runtime/build/vendor/lib/lib.es2021.promise.d.ts +48 -0
- package/dist/runtime/build/vendor/lib/lib.es2021.string.d.ts +33 -0
- package/dist/runtime/build/vendor/lib/lib.es2021.weakref.d.ts +78 -0
- package/dist/runtime/build/vendor/lib/lib.es2022.array.d.ts +121 -0
- package/dist/runtime/build/vendor/lib/lib.es2022.d.ts +25 -0
- package/dist/runtime/build/vendor/lib/lib.es2022.error.d.ts +75 -0
- package/dist/runtime/build/vendor/lib/lib.es2022.full.d.ts +24 -0
- package/dist/runtime/build/vendor/lib/lib.es2022.intl.d.ts +121 -0
- package/dist/runtime/build/vendor/lib/lib.es2022.object.d.ts +26 -0
- package/dist/runtime/build/vendor/lib/lib.es2022.regexp.d.ts +39 -0
- package/dist/runtime/build/vendor/lib/lib.es2022.string.d.ts +25 -0
- package/dist/runtime/build/vendor/lib/lib.es2023.array.d.ts +924 -0
- package/dist/runtime/build/vendor/lib/lib.es2023.collection.d.ts +21 -0
- package/dist/runtime/build/vendor/lib/lib.es2023.d.ts +22 -0
- package/dist/runtime/build/vendor/lib/lib.es2023.full.d.ts +24 -0
- package/dist/runtime/build/vendor/lib/lib.es2023.intl.d.ts +56 -0
- package/dist/runtime/build/vendor/lib/lib.es2024.arraybuffer.d.ts +65 -0
- package/dist/runtime/build/vendor/lib/lib.es2024.collection.d.ts +29 -0
- package/dist/runtime/build/vendor/lib/lib.es2024.d.ts +26 -0
- package/dist/runtime/build/vendor/lib/lib.es2024.full.d.ts +24 -0
- package/dist/runtime/build/vendor/lib/lib.es2024.object.d.ts +29 -0
- package/dist/runtime/build/vendor/lib/lib.es2024.promise.d.ts +35 -0
- package/dist/runtime/build/vendor/lib/lib.es2024.regexp.d.ts +25 -0
- package/dist/runtime/build/vendor/lib/lib.es2024.sharedmemory.d.ts +68 -0
- package/dist/runtime/build/vendor/lib/lib.es2024.string.d.ts +29 -0
- package/dist/runtime/build/vendor/lib/lib.es5.d.ts +4585 -0
- package/dist/runtime/build/vendor/lib/lib.es6.d.ts +23 -0
- package/dist/runtime/build/vendor/lib/lib.esnext.array.d.ts +35 -0
- package/dist/runtime/build/vendor/lib/lib.esnext.collection.d.ts +96 -0
- package/dist/runtime/build/vendor/lib/lib.esnext.d.ts +25 -0
- package/dist/runtime/build/vendor/lib/lib.esnext.decorators.d.ts +28 -0
- package/dist/runtime/build/vendor/lib/lib.esnext.disposable.d.ts +193 -0
- package/dist/runtime/build/vendor/lib/lib.esnext.full.d.ts +24 -0
- package/dist/runtime/build/vendor/lib/lib.esnext.intl.d.ts +21 -0
- package/dist/runtime/build/vendor/lib/lib.esnext.iterator.d.ts +148 -0
- package/dist/runtime/build/vendor/node-types/assert/strict.d.ts +111 -0
- package/dist/runtime/build/vendor/node-types/assert.d.ts +1115 -0
- package/dist/runtime/build/vendor/node-types/async_hooks.d.ts +619 -0
- package/dist/runtime/build/vendor/node-types/buffer.buffer.d.ts +477 -0
- package/dist/runtime/build/vendor/node-types/buffer.d.ts +1941 -0
- package/dist/runtime/build/vendor/node-types/child_process.d.ts +1480 -0
- package/dist/runtime/build/vendor/node-types/cluster.d.ts +578 -0
- package/dist/runtime/build/vendor/node-types/compatibility/iterators.d.ts +21 -0
- package/dist/runtime/build/vendor/node-types/console.d.ts +453 -0
- package/dist/runtime/build/vendor/node-types/constants.d.ts +21 -0
- package/dist/runtime/build/vendor/node-types/crypto.d.ts +5484 -0
- package/dist/runtime/build/vendor/node-types/dgram.d.ts +715 -0
- package/dist/runtime/build/vendor/node-types/diagnostics_channel.d.ts +576 -0
- package/dist/runtime/build/vendor/node-types/dns/promises.d.ts +503 -0
- package/dist/runtime/build/vendor/node-types/dns.d.ts +923 -0
- package/dist/runtime/build/vendor/node-types/domain.d.ts +166 -0
- package/dist/runtime/build/vendor/node-types/events.d.ts +967 -0
- package/dist/runtime/build/vendor/node-types/fs/promises.d.ts +1354 -0
- package/dist/runtime/build/vendor/node-types/fs.d.ts +4777 -0
- package/dist/runtime/build/vendor/node-types/globals.d.ts +170 -0
- package/dist/runtime/build/vendor/node-types/globals.typedarray.d.ts +41 -0
- package/dist/runtime/build/vendor/node-types/http.d.ts +2246 -0
- package/dist/runtime/build/vendor/node-types/http2.d.ts +2882 -0
- package/dist/runtime/build/vendor/node-types/https.d.ts +585 -0
- package/dist/runtime/build/vendor/node-types/index.d.ts +101 -0
- package/dist/runtime/build/vendor/node-types/inspector.d.ts +323 -0
- package/dist/runtime/build/vendor/node-types/inspector.generated.d.ts +4406 -0
- package/dist/runtime/build/vendor/node-types/module.d.ts +844 -0
- package/dist/runtime/build/vendor/node-types/net.d.ts +1197 -0
- package/dist/runtime/build/vendor/node-types/os.d.ts +507 -0
- package/dist/runtime/build/vendor/node-types/package.json +140 -0
- package/dist/runtime/build/vendor/node-types/path.d.ts +200 -0
- package/dist/runtime/build/vendor/node-types/perf_hooks.d.ts +1054 -0
- package/dist/runtime/build/vendor/node-types/process.d.ts +2101 -0
- package/dist/runtime/build/vendor/node-types/punycode.d.ts +117 -0
- package/dist/runtime/build/vendor/node-types/querystring.d.ts +152 -0
- package/dist/runtime/build/vendor/node-types/readline/promises.d.ts +161 -0
- package/dist/runtime/build/vendor/node-types/readline.d.ts +600 -0
- package/dist/runtime/build/vendor/node-types/repl.d.ts +438 -0
- package/dist/runtime/build/vendor/node-types/sea.d.ts +162 -0
- package/dist/runtime/build/vendor/node-types/sqlite.d.ts +1182 -0
- package/dist/runtime/build/vendor/node-types/stream/consumers.d.ts +45 -0
- package/dist/runtime/build/vendor/node-types/stream/promises.d.ts +90 -0
- package/dist/runtime/build/vendor/node-types/stream/web.d.ts +596 -0
- package/dist/runtime/build/vendor/node-types/stream.d.ts +1707 -0
- package/dist/runtime/build/vendor/node-types/string_decoder.d.ts +67 -0
- package/dist/runtime/build/vendor/node-types/test.d.ts +2656 -0
- package/dist/runtime/build/vendor/node-types/timers/promises.d.ts +108 -0
- package/dist/runtime/build/vendor/node-types/timers.d.ts +285 -0
- package/dist/runtime/build/vendor/node-types/tls.d.ts +1314 -0
- package/dist/runtime/build/vendor/node-types/trace_events.d.ts +197 -0
- package/dist/runtime/build/vendor/node-types/ts5.6/buffer.buffer.d.ts +473 -0
- package/dist/runtime/build/vendor/node-types/ts5.6/compatibility/float16array.d.ts +71 -0
- package/dist/runtime/build/vendor/node-types/ts5.6/globals.typedarray.d.ts +36 -0
- package/dist/runtime/build/vendor/node-types/ts5.6/index.d.ts +103 -0
- package/dist/runtime/build/vendor/node-types/ts5.7/compatibility/float16array.d.ts +72 -0
- package/dist/runtime/build/vendor/node-types/ts5.7/index.d.ts +103 -0
- package/dist/runtime/build/vendor/node-types/tty.d.ts +209 -0
- package/dist/runtime/build/vendor/node-types/url.d.ts +1103 -0
- package/dist/runtime/build/vendor/node-types/util.d.ts +2379 -0
- package/dist/runtime/build/vendor/node-types/v8.d.ts +1010 -0
- package/dist/runtime/build/vendor/node-types/vm.d.ts +1160 -0
- package/dist/runtime/build/vendor/node-types/wasi.d.ts +202 -0
- package/dist/runtime/build/vendor/node-types/web-globals/abortcontroller.d.ts +34 -0
- package/dist/runtime/build/vendor/node-types/web-globals/crypto.d.ts +32 -0
- package/dist/runtime/build/vendor/node-types/web-globals/domexception.d.ts +68 -0
- package/dist/runtime/build/vendor/node-types/web-globals/events.d.ts +97 -0
- package/dist/runtime/build/vendor/node-types/web-globals/fetch.d.ts +62 -0
- package/dist/runtime/build/vendor/node-types/web-globals/navigator.d.ts +25 -0
- package/dist/runtime/build/vendor/node-types/web-globals/storage.d.ts +24 -0
- package/dist/runtime/build/vendor/node-types/web-globals/streams.d.ts +22 -0
- package/dist/runtime/build/vendor/node-types/worker_threads.d.ts +894 -0
- package/dist/runtime/build/vendor/node-types/zlib.d.ts +768 -0
- package/dist/runtime/build/vendor/node_modules/csstype/LICENSE +19 -0
- package/dist/runtime/build/vendor/node_modules/csstype/index.d.ts +22569 -0
- package/dist/runtime/build/vendor/node_modules/csstype/index.js.flow +6863 -0
- package/dist/runtime/build/vendor/node_modules/csstype/package.json +70 -0
- package/dist/runtime/build/vendor/node_modules/seroval/LICENSE +7 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/cjs/development/index.cjs +4232 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/cjs/production/index.cjs +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/esm/development/index.mjs +4209 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/esm/production/index.mjs +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/Serializer.d.ts +28 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/base-primitives.d.ts +28 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/compat.d.ts +15 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/constants.d.ts +105 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/constructors.d.ts +50 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/context/async-parser.d.ts +20 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/context/deserializer.d.ts +52 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/context/parser.d.ts +62 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/context/serializer.d.ts +103 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/context/sync-parser.d.ts +61 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/cross/index.d.ts +24 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/errors.d.ts +47 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/function-string.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/keys.d.ts +4 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/literals.d.ts +10 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/node.d.ts +8 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/opaque-reference.d.ts +9 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/plugin.d.ts +52 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/reference.d.ts +6 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/sequence.d.ts +11 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/special-reference.d.ts +16 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/stream.d.ts +17 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/string.d.ts +4 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/symbols.d.ts +14 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/tree/index.d.ts +21 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/types.d.ts +233 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/utils/error.d.ts +6 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/utils/get-identifier.d.ts +2 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/utils/get-object-flag.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/utils/is-valid-identifier.d.ts +2 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/utils/promise-to-result.d.ts +2 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/utils/typed-array.d.ts +6 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/core/utils/valid-properties.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval/dist/types/index.d.ts +18 -0
- package/dist/runtime/build/vendor/node_modules/seroval/package.json +67 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/Serializer.ts +119 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/base-primitives.ts +537 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/compat.ts +23 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/constants.ts +202 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/constructors.ts +265 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/context/async-parser.ts +666 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/context/deserializer.ts +832 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/context/parser.ts +335 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/context/serializer.ts +1524 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/context/sync-parser.ts +943 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/cross/index.ts +190 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/errors.ts +196 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/function-string.ts +31 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/keys.ts +17 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/literals.ts +43 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/node.ts +40 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/opaque-reference.ts +9 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/plugin.ts +105 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/reference.ts +66 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/sequence.ts +59 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/special-reference.ts +42 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/stream.ts +71 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/string.ts +86 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/symbols.ts +20 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/tree/index.ts +134 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/types.ts +377 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/utils/error.ts +73 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/utils/get-identifier.ts +18 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/utils/get-object-flag.ts +14 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/utils/is-valid-identifier.ts +12 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/utils/promise-to-result.ts +9 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/utils/typed-array.ts +56 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/core/utils/valid-properties.ts +34 -0
- package/dist/runtime/build/vendor/node_modules/seroval/src/index.ts +36 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/LICENSE +7 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/cjs/development/web.cjs +826 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/cjs/production/web.cjs +1 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/esm/development/web.mjs +803 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/esm/production/web.mjs +1 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/abort-signal.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/blob.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/custom-event.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/dom-exception.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/event.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/file.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/form-data.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/headers.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/image-data.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/index.d.ts +15 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/readable-stream.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/request.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/response.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/url-search-params.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/dist/types/web/url.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/package.json +70 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/abort-signal.ts +131 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/blob.ts +41 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/custom-event.ts +66 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/dom-exception.ts +57 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/event.ts +62 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/file.ts +50 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/form-data.ts +105 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/headers.ts +49 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/image-data.ts +74 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/index.ts +14 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/readable-stream.ts +148 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/request.ts +82 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/response.ts +65 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/url-search-params.ts +40 -0
- package/dist/runtime/build/vendor/node_modules/seroval-plugins/web/url.ts +37 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/dist/server.cjs +824 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/dist/server.js +770 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/dist/solid.cjs +1808 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/dist/solid.js +1753 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/jsx-runtime.d.ts +1 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/package.json +243 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/store/dist/server.cjs +133 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/store/dist/server.js +121 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/store/dist/store.cjs +463 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/store/dist/store.js +454 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/store/package.json +46 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/store/types/index.d.ts +12 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/store/types/modifiers.d.ts +6 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/store/types/mutable.d.ts +5 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/store/types/server.d.ts +17 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/store/types/store.d.ts +108 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/index.d.ts +23 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/jsx.d.ts +4253 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/reactive/array.d.ts +44 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/reactive/observable.d.ts +36 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/reactive/scheduler.d.ts +10 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/reactive/signal.d.ts +581 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/render/Suspense.d.ts +26 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/render/component.d.ts +111 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/render/flow.d.ts +118 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/render/hydration.d.ts +24 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/render/index.d.ts +4 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/server/index.d.ts +3 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/server/reactive.d.ts +98 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/types/server/rendering.d.ts +160 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/dist/server.cjs +900 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/dist/server.js +786 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/dist/web.cjs +884 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/dist/web.js +772 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/package.json +46 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/storage/dist/storage.cjs +12 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/storage/dist/storage.js +10 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/storage/package.json +15 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/storage/types/index.d.ts +2 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/types/client.d.ts +93 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/types/core.d.ts +2 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/types/index.d.ts +50 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/types/jsx.d.ts +1 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/types/server-mock.d.ts +65 -0
- package/dist/runtime/build/vendor/node_modules/solid-js/web/types/server.d.ts +187 -0
- package/dist/runtime/build/worker.mjs +293415 -0
- package/dist/runtime/catalog/sdk-natives.json +655 -0
- package/dist/runtime/cli/iota-ext.mjs +1028 -0
- package/dist/runtime/client-host/entry.d.ts +10 -0
- package/dist/runtime/client-host/entry.js +124 -0
- package/dist/runtime/client-host/hooks.d.ts +43 -0
- package/dist/runtime/client-host/hooks.js +94 -0
- package/dist/runtime/client-host/index.d.ts +9 -0
- package/dist/runtime/client-host/index.js +9 -0
- package/dist/runtime/client-host/islands.d.ts +44 -0
- package/dist/runtime/client-host/islands.js +165 -0
- package/dist/runtime/client-host/kit.d.ts +10 -0
- package/dist/runtime/client-host/kit.js +37 -0
- package/dist/runtime/client-host/page.d.ts +53 -0
- package/dist/runtime/client-host/page.js +217 -0
- package/dist/runtime/client-host/params.d.ts +8 -0
- package/dist/runtime/client-host/params.js +36 -0
- package/dist/runtime/client-host/protocol.d.ts +78 -0
- package/dist/runtime/client-host/protocol.js +26 -0
- package/dist/runtime/client-host/shared.d.ts +12 -0
- package/dist/runtime/client-host/shared.js +49 -0
- package/dist/runtime/client-host/shell.d.ts +88 -0
- package/dist/runtime/client-host/shell.js +195 -0
- package/dist/runtime/client-host/slots.d.ts +54 -0
- package/dist/runtime/client-host/slots.js +90 -0
- package/dist/runtime/client-host/styles.d.ts +7 -0
- package/dist/runtime/client-host/styles.js +61 -0
- package/dist/runtime/client-host/transport.d.ts +45 -0
- package/dist/runtime/client-host/transport.js +115 -0
- package/dist/runtime/client.d.ts +226 -0
- package/dist/runtime/client.js +121 -0
- package/dist/runtime/contracts.d.ts +204 -0
- package/dist/runtime/contracts.js +195 -0
- package/dist/runtime/docs/authoring.md +1609 -0
- package/dist/runtime/docs/example/docs/en/admin/limits.md +10 -0
- package/dist/runtime/docs/example/docs/en/getting-started.md +13 -0
- package/dist/runtime/docs/example/docs/en/points.md +9 -0
- package/dist/runtime/docs/example/docs/ru/getting-started.md +12 -0
- package/dist/runtime/docs/example/package.json +27 -0
- package/dist/runtime/docs/example/src/ClientScreen.tsx +10 -0
- package/dist/runtime/docs/example/src/RedemptionScreen.tsx +7 -0
- package/dist/runtime/docs/example/src/RewardsScreen.module.css +13 -0
- package/dist/runtime/docs/example/src/RewardsScreen.tsx +51 -0
- package/dist/runtime/docs/example/src/client.tsx +40 -0
- package/dist/runtime/docs/example/src/contracts.ts +132 -0
- package/dist/runtime/docs/example/src/css-modules.d.ts +5 -0
- package/dist/runtime/docs/example/src/server.test.ts +156 -0
- package/dist/runtime/docs/example/src/server.ts +188 -0
- package/dist/runtime/docs/example/tsconfig.json +16 -0
- package/dist/runtime/entity.d.ts +237 -0
- package/dist/runtime/entity.js +201 -0
- package/dist/runtime/fakes.d.ts +80 -0
- package/dist/runtime/fakes.js +88 -0
- package/dist/runtime/fixtures.d.ts +34 -0
- package/dist/runtime/fixtures.js +60 -0
- package/dist/runtime/help.d.ts +22 -0
- package/dist/runtime/help.js +51 -0
- package/dist/runtime/host/context.mjs +392 -0
- package/dist/runtime/host/errors.mjs +64 -0
- package/dist/runtime/host/loader.mjs +28 -0
- package/dist/runtime/host/protocol.mjs +4 -0
- package/dist/runtime/host/register.mjs +8 -0
- package/dist/runtime/host/sdk/assert.mjs +153 -0
- package/dist/runtime/host/sdk/client-host/hooks.mjs +86 -0
- package/dist/runtime/host/sdk/client-host/protocol.mjs +30 -0
- package/dist/runtime/host/sdk/client-host/slots.mjs +82 -0
- package/dist/runtime/host/sdk/client-host/styles.mjs +45 -0
- package/dist/runtime/host/sdk/client-host/transport.mjs +102 -0
- package/dist/runtime/host/sdk/client.mjs +115 -0
- package/dist/runtime/host/sdk/contracts.mjs +185 -0
- package/dist/runtime/host/sdk/entity.mjs +183 -0
- package/dist/runtime/host/sdk/fakes.mjs +88 -0
- package/dist/runtime/host/sdk/fixtures.mjs +56 -0
- package/dist/runtime/host/sdk/help.mjs +37 -0
- package/dist/runtime/host/sdk/index.mjs +83 -0
- package/dist/runtime/host/sdk/kit.mjs +11 -0
- package/dist/runtime/host/sdk/manifest.mjs +276 -0
- package/dist/runtime/host/sdk/model.mjs +4 -0
- package/dist/runtime/host/sdk/resource.mjs +34 -0
- package/dist/runtime/host/sdk/schema.mjs +75 -0
- package/dist/runtime/host/sdk/server.mjs +43 -0
- package/dist/runtime/host/sdk/testhost.mjs +992 -0
- package/dist/runtime/host/sdk/testing.mjs +21 -0
- package/dist/runtime/host/sdk/wire.mjs +207 -0
- package/dist/runtime/host/worker.mjs +252 -0
- package/dist/runtime/index.d.ts +10 -0
- package/dist/runtime/index.js +5 -0
- package/dist/runtime/kit.d.ts +5 -0
- package/dist/runtime/kit.js +14 -0
- package/dist/runtime/manifest.d.ts +17 -0
- package/dist/runtime/manifest.js +323 -0
- package/dist/runtime/model.d.ts +224 -0
- package/dist/runtime/model.js +3 -0
- package/dist/runtime/resource.d.ts +31 -0
- package/dist/runtime/resource.js +35 -0
- package/dist/runtime/schema.d.ts +97 -0
- package/dist/runtime/schema.js +73 -0
- package/dist/runtime/server.d.ts +445 -0
- package/dist/runtime/server.js +41 -0
- package/dist/runtime/testhost.d.ts +216 -0
- package/dist/runtime/testhost.js +1146 -0
- package/dist/runtime/testing.d.ts +10 -0
- package/dist/runtime/testing.js +7 -0
- package/dist/runtime/wire.d.ts +26 -0
- package/dist/runtime/wire.js +236 -0
- package/dist/sdk-identity.cjs +3 -3
- package/dist/sdk-identity.js +3 -3
- package/dist/sdk-identity.json +2 -2
- package/dist/solid-ui/embedded-css.d.ts +2 -0
- package/dist/solid-ui/embedded-css.js +1 -0
- package/dist/solid-ui/embedded.css +2 -0
- package/dist/testing/components.d.ts +73 -0
- package/dist/testing/components.js +96 -0
- package/dist/testing/htmx.d.ts +44 -0
- package/dist/testing/htmx.js +284 -0
- package/dist/testing/index.d.ts +4 -41
- package/dist/testing/index.js +3 -206
- package/dist/testing/scenarios.d.ts +83 -0
- package/dist/testing/scenarios.js +74 -0
- package/dist/testing/wait.d.ts +7 -0
- package/dist/testing/wait.js +19 -0
- package/package.json +33 -2
- package/dist/lens/TablePanel-C09tzJOL.js +0 -980
- package/dist/lens/index-DcVtZneD.js +0 -18473
- package/dist/lens/runtime/recovery.d.ts +0 -26
- package/dist/lens/runtime/recovery.d.ts.map +0 -1
|
@@ -0,0 +1,1028 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli/commands.ts
|
|
4
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, mkdtempSync, readFileSync as readFileSync4, readdirSync as readdirSync2, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { dirname as dirname4, join as join4, relative as relative2, resolve as resolve3 } from "node:path";
|
|
7
|
+
|
|
8
|
+
// src/cli/args.ts
|
|
9
|
+
var UsageError = class extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "UsageError";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
function parseArgs(argv, spec) {
|
|
16
|
+
const values = /* @__PURE__ */ new Map();
|
|
17
|
+
const lists = /* @__PURE__ */ new Map();
|
|
18
|
+
const flags = /* @__PURE__ */ new Set();
|
|
19
|
+
const positionals = [];
|
|
20
|
+
const takesValue = /* @__PURE__ */ new Set([...spec.values ?? [], ...spec.lists ?? []]);
|
|
21
|
+
const isBoolean = new Set(spec.booleans ?? []);
|
|
22
|
+
for (let i = 0; i < argv.length; i++) {
|
|
23
|
+
const arg = argv[i] ?? "";
|
|
24
|
+
if (arg === "--") {
|
|
25
|
+
positionals.push(...argv.slice(i + 1));
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
if (!arg.startsWith("--")) {
|
|
29
|
+
positionals.push(arg);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const eq = arg.indexOf("=");
|
|
33
|
+
const name = arg.slice(2, eq === -1 ? void 0 : eq);
|
|
34
|
+
if (isBoolean.has(name)) {
|
|
35
|
+
if (eq !== -1) throw new UsageError(`--${name} does not take a value`);
|
|
36
|
+
flags.add(name);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (!takesValue.has(name)) throw new UsageError(`unknown option --${name}`);
|
|
40
|
+
let value = eq === -1 ? void 0 : arg.slice(eq + 1);
|
|
41
|
+
if (value === void 0) {
|
|
42
|
+
value = argv[++i];
|
|
43
|
+
if (value === void 0 || value.startsWith("--")) throw new UsageError(`--${name} needs a value`);
|
|
44
|
+
}
|
|
45
|
+
if (spec.lists?.includes(name) === true) lists.set(name, [...lists.get(name) ?? [], value]);
|
|
46
|
+
else values.set(name, value);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
positionals,
|
|
50
|
+
value: (name) => values.get(name),
|
|
51
|
+
list: (name) => lists.get(name) ?? [],
|
|
52
|
+
flag: (name) => flags.has(name)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/cli/kitfs.ts
|
|
57
|
+
import { createHash } from "node:crypto";
|
|
58
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
59
|
+
import { dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
60
|
+
var SCOPE = "@iota-kit";
|
|
61
|
+
var KIT_DIR = ".iota/kit";
|
|
62
|
+
var KIT_PATHS_KEY = `${SCOPE}/*`;
|
|
63
|
+
var KIT_PATHS_VALUE = `./${KIT_DIR}/*`;
|
|
64
|
+
var sha256 = (data) => createHash("sha256").update(data).digest("hex");
|
|
65
|
+
var kitRoot = (dir) => join(dir, KIT_DIR);
|
|
66
|
+
var recordFile = (dir) => join(kitRoot(dir), "kit.json");
|
|
67
|
+
var legacyScope = (dir) => join(dir, "node_modules", SCOPE);
|
|
68
|
+
var legacyRecord = (dir) => join(dir, "node_modules", ".iota-kit.json");
|
|
69
|
+
function moduleDir(dir, location, name) {
|
|
70
|
+
return join(location === "legacy" ? legacyScope(dir) : kitRoot(dir), name.slice(SCOPE.length + 1));
|
|
71
|
+
}
|
|
72
|
+
function readTree(root, prefix = "") {
|
|
73
|
+
const out = {};
|
|
74
|
+
for (const entry of readdirSync(join(root, prefix), { withFileTypes: true })) {
|
|
75
|
+
const rel = prefix === "" ? entry.name : `${prefix}/${entry.name}`;
|
|
76
|
+
if (entry.isDirectory()) Object.assign(out, readTree(root, rel));
|
|
77
|
+
else if (entry.isFile()) out[rel] = readFileSync(join(root, rel), "utf8");
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
function moduleNames(root) {
|
|
82
|
+
if (!existsSync(root)) return [];
|
|
83
|
+
return readdirSync(root).sort().filter((name) => {
|
|
84
|
+
const module = join(root, name);
|
|
85
|
+
return statSync(module).isDirectory() && existsSync(join(module, "index.js"));
|
|
86
|
+
}).map((name) => `${SCOPE}/${name}`);
|
|
87
|
+
}
|
|
88
|
+
function locate(dir) {
|
|
89
|
+
if (moduleNames(kitRoot(dir)).length > 0 || existsSync(recordFile(dir))) return "kit";
|
|
90
|
+
if (moduleNames(legacyScope(dir)).length > 0) return "legacy";
|
|
91
|
+
return "none";
|
|
92
|
+
}
|
|
93
|
+
function parseRecord(file) {
|
|
94
|
+
try {
|
|
95
|
+
return JSON.parse(readFileSync(file, "utf8"));
|
|
96
|
+
} catch {
|
|
97
|
+
return void 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function readRecord(dir) {
|
|
101
|
+
const location = locate(dir);
|
|
102
|
+
if (location === "none") return void 0;
|
|
103
|
+
return parseRecord(location === "legacy" ? legacyRecord(dir) : recordFile(dir));
|
|
104
|
+
}
|
|
105
|
+
function loadKit(dir) {
|
|
106
|
+
const location = locate(dir);
|
|
107
|
+
const modules = {};
|
|
108
|
+
if (location !== "none") {
|
|
109
|
+
for (const name of moduleNames(location === "legacy" ? legacyScope(dir) : kitRoot(dir))) modules[name] = readTree(moduleDir(dir, location, name));
|
|
110
|
+
}
|
|
111
|
+
const names = Object.keys(modules);
|
|
112
|
+
const report = inspectKit(dir);
|
|
113
|
+
const intact = !report.modules.some((m) => m.state === "modified" || m.state === "unrecorded");
|
|
114
|
+
const hash = (intact ? report.record?.hash : void 0) ?? sha256(JSON.stringify(names.map((n) => [n, modules[n]])));
|
|
115
|
+
return { hash, modules, installed: names.length > 0, location };
|
|
116
|
+
}
|
|
117
|
+
function inspectKit(dir) {
|
|
118
|
+
const location = locate(dir);
|
|
119
|
+
if (location === "none") return { location, record: void 0, modules: [], ok: false };
|
|
120
|
+
const record = readRecord(dir);
|
|
121
|
+
const onDisk = moduleNames(location === "legacy" ? legacyScope(dir) : kitRoot(dir));
|
|
122
|
+
const names = [.../* @__PURE__ */ new Set([...record?.modules ?? [], ...onDisk])].sort();
|
|
123
|
+
const modules = names.map((name) => {
|
|
124
|
+
const root = moduleDir(dir, location, name);
|
|
125
|
+
const problems = [];
|
|
126
|
+
if (record === void 0 || !record.modules.includes(name)) {
|
|
127
|
+
return { name, state: "unrecorded", problems: [`not part of the recorded snapshot${record === void 0 ? " (kit.json is missing or unreadable)" : ""}`] };
|
|
128
|
+
}
|
|
129
|
+
if (!existsSync(join(root, "index.js"))) {
|
|
130
|
+
return { name, state: "missing", problems: [`${join(KIT_DIR, name.slice(SCOPE.length + 1), "index.js")} is missing`] };
|
|
131
|
+
}
|
|
132
|
+
let state = "ok";
|
|
133
|
+
const expected = record.files?.[name];
|
|
134
|
+
if (expected === void 0) {
|
|
135
|
+
if (!existsSync(join(root, "index.d.ts"))) {
|
|
136
|
+
problems.push("index.d.ts is missing");
|
|
137
|
+
state = "missing";
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
for (const [path, digest] of Object.entries(expected).sort(([a], [b]) => a < b ? -1 : 1)) {
|
|
141
|
+
const file = join(root, path);
|
|
142
|
+
if (!existsSync(file)) {
|
|
143
|
+
problems.push(`${path} is missing`);
|
|
144
|
+
state = "missing";
|
|
145
|
+
} else if (sha256(readFileSync(file)) !== digest) {
|
|
146
|
+
problems.push(`${path} differs from the recorded snapshot`);
|
|
147
|
+
if (state === "ok") state = "modified";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return { name, state, problems };
|
|
152
|
+
});
|
|
153
|
+
return { location, record, modules, ok: modules.length > 0 && modules.every((m) => m.state === "ok") };
|
|
154
|
+
}
|
|
155
|
+
var InvalidKitError = class extends Error {
|
|
156
|
+
constructor(message) {
|
|
157
|
+
super(message);
|
|
158
|
+
this.name = "InvalidKitError";
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
var NAMESPACE_PATTERN = /^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)*$/;
|
|
162
|
+
function kitNamespace(name) {
|
|
163
|
+
const namespace = name.startsWith(`${SCOPE}/`) ? name.slice(SCOPE.length + 1) : "";
|
|
164
|
+
if (!NAMESPACE_PATTERN.test(namespace)) throw new InvalidKitError(`kit module name ${JSON.stringify(name)} is not ${SCOPE}/<namespace>`);
|
|
165
|
+
return namespace;
|
|
166
|
+
}
|
|
167
|
+
function checkKitPath(module, root, path) {
|
|
168
|
+
const bad = (why) => {
|
|
169
|
+
throw new InvalidKitError(`kit module ${module} has an unsafe file path ${JSON.stringify(path)}: ${why}`);
|
|
170
|
+
};
|
|
171
|
+
if (path === "" || isAbsolute(path) || path.startsWith("/") || /^[A-Za-z]:/.test(path)) bad("it is empty or absolute");
|
|
172
|
+
if (/[\\\u0000-\u001f]/.test(path)) bad("it has a backslash or a control character");
|
|
173
|
+
for (const segment of path.split("/")) {
|
|
174
|
+
if (segment === "" || segment === "." || segment === "..") bad('it has an empty, "." or ".." segment');
|
|
175
|
+
}
|
|
176
|
+
const target = resolve(root, path);
|
|
177
|
+
if (!target.startsWith(root + sep)) bad("it resolves outside the module directory");
|
|
178
|
+
}
|
|
179
|
+
function checkKit(modules) {
|
|
180
|
+
const seen = /* @__PURE__ */ new Set();
|
|
181
|
+
for (const [name, content] of Object.entries(modules)) {
|
|
182
|
+
const namespace = kitNamespace(name);
|
|
183
|
+
if (seen.has(namespace)) throw new InvalidKitError(`kit module ${name} appears twice`);
|
|
184
|
+
seen.add(namespace);
|
|
185
|
+
const root = resolve("/kit-root", namespace);
|
|
186
|
+
for (const path of Object.keys(content)) checkKitPath(name, root, path);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function installKit(dir, hash, modules, source) {
|
|
190
|
+
checkKit(modules);
|
|
191
|
+
const live = kitRoot(dir);
|
|
192
|
+
const nonce = `${process.pid}-${createHash("sha256").update(String(Math.random())).digest("hex").slice(0, 8)}`;
|
|
193
|
+
const staging = `${live}.staging-${nonce}`;
|
|
194
|
+
const previous = `${live}.previous-${nonce}`;
|
|
195
|
+
mkdirSync(dirname(live), { recursive: true });
|
|
196
|
+
rmSync(staging, { recursive: true, force: true });
|
|
197
|
+
const files = {};
|
|
198
|
+
try {
|
|
199
|
+
mkdirSync(staging, { recursive: true });
|
|
200
|
+
for (const [name, content] of Object.entries(modules)) {
|
|
201
|
+
const root = join(staging, kitNamespace(name));
|
|
202
|
+
files[name] = {};
|
|
203
|
+
for (const [path, data] of Object.entries(content)) {
|
|
204
|
+
const target = join(root, path);
|
|
205
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
206
|
+
writeFileSync(target, data);
|
|
207
|
+
files[name][path] = sha256(data);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const record = { hash, source, modules: Object.keys(modules).sort(), files };
|
|
211
|
+
writeFileSync(join(staging, "kit.json"), JSON.stringify(record, null, 2) + "\n");
|
|
212
|
+
const hadKit = existsSync(live);
|
|
213
|
+
if (hadKit) renameSync(live, previous);
|
|
214
|
+
try {
|
|
215
|
+
renameSync(staging, live);
|
|
216
|
+
} catch (err) {
|
|
217
|
+
if (hadKit) renameSync(previous, live);
|
|
218
|
+
throw err;
|
|
219
|
+
}
|
|
220
|
+
rmSync(previous, { recursive: true, force: true });
|
|
221
|
+
rmSync(legacyScope(dir), { recursive: true, force: true });
|
|
222
|
+
rmSync(legacyRecord(dir), { force: true });
|
|
223
|
+
return record;
|
|
224
|
+
} finally {
|
|
225
|
+
rmSync(staging, { recursive: true, force: true });
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function mapped(text) {
|
|
229
|
+
return text.includes(KIT_PATHS_KEY) && text.includes(KIT_PATHS_VALUE);
|
|
230
|
+
}
|
|
231
|
+
function editorPaths(dir) {
|
|
232
|
+
const file = join(dir, "tsconfig.json");
|
|
233
|
+
if (!existsSync(file)) return "absent";
|
|
234
|
+
return mapped(readFileSync(file, "utf8")) ? "present" : "manual";
|
|
235
|
+
}
|
|
236
|
+
function ensureEditorPaths(dir) {
|
|
237
|
+
const state = editorPaths(dir);
|
|
238
|
+
if (state !== "manual") return state;
|
|
239
|
+
const file = join(dir, "tsconfig.json");
|
|
240
|
+
try {
|
|
241
|
+
const doc = JSON.parse(readFileSync(file, "utf8"));
|
|
242
|
+
if (typeof doc !== "object" || doc === null || Array.isArray(doc)) return "manual";
|
|
243
|
+
doc.compilerOptions = { ...doc.compilerOptions ?? {}, paths: { ...doc.compilerOptions?.paths ?? {}, [KIT_PATHS_KEY]: [KIT_PATHS_VALUE] } };
|
|
244
|
+
writeFileSync(file, JSON.stringify(doc, null, 2) + "\n");
|
|
245
|
+
return "added";
|
|
246
|
+
} catch {
|
|
247
|
+
return "manual";
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// src/cli/report.ts
|
|
252
|
+
function style(enabled) {
|
|
253
|
+
const wrap = (open, close) => (text) => enabled ? `\x1B[${open}m${text}\x1B[${close}m` : text;
|
|
254
|
+
return { red: wrap(31, 39), green: wrap(32, 39), yellow: wrap(33, 39), dim: wrap(2, 22), bold: wrap(1, 22) };
|
|
255
|
+
}
|
|
256
|
+
var indent = (text, by) => text.split("\n").map((l) => l === "" ? l : by + l).join("\n");
|
|
257
|
+
function formatDiagnostic(d, s) {
|
|
258
|
+
const where = d.line === void 0 ? d.file : `${d.file}:${d.line}:${d.column ?? 1}`;
|
|
259
|
+
const [first = "", ...rest] = d.message.split("\n");
|
|
260
|
+
const tag = d.severity === "warning" ? `${s.yellow("warning:")} ` : "";
|
|
261
|
+
const head = `${s.bold(where)} ${s.dim(d.code)} ${tag}${first}`;
|
|
262
|
+
return rest.length === 0 ? head : `${head}
|
|
263
|
+
${indent(rest.join("\n"), " ")}`;
|
|
264
|
+
}
|
|
265
|
+
function formatDiagnostics(list, s) {
|
|
266
|
+
return list.map((d) => formatDiagnostic(d, s)).join("\n");
|
|
267
|
+
}
|
|
268
|
+
function formatCase(c, s) {
|
|
269
|
+
if (c.passed) return ` ${s.green("\u2713")} ${c.name} ${s.dim(`(${c.durationMs}ms)`)}`;
|
|
270
|
+
const lines = [` ${s.red("\u2717")} ${c.name} ${s.dim(`(${c.durationMs}ms)`)}`];
|
|
271
|
+
if (c.message !== void 0 && c.message !== "") lines.push(indent(c.message, " "));
|
|
272
|
+
if (c.location !== void 0) lines.push(` ${s.dim("at")} ${c.location.file}:${c.location.line}:${c.location.column}`);
|
|
273
|
+
const frames = (c.frames ?? []).filter((f) => !f.includes(`${c.location?.file ?? "\0"}:${c.location?.line ?? 0}:${c.location?.column ?? 0}`));
|
|
274
|
+
for (const f of frames.slice(0, 4)) lines.push(` ${s.dim(`at ${f}`)}`);
|
|
275
|
+
return lines.join("\n");
|
|
276
|
+
}
|
|
277
|
+
function formatTests(cases, s) {
|
|
278
|
+
const out = [];
|
|
279
|
+
let file;
|
|
280
|
+
for (const c of cases) {
|
|
281
|
+
if (c.file !== file) {
|
|
282
|
+
file = c.file;
|
|
283
|
+
out.push(s.bold(c.file));
|
|
284
|
+
}
|
|
285
|
+
out.push(formatCase(c, s));
|
|
286
|
+
}
|
|
287
|
+
return out.join("\n");
|
|
288
|
+
}
|
|
289
|
+
var plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
290
|
+
|
|
291
|
+
// src/cli/runtime.ts
|
|
292
|
+
import { spawn } from "node:child_process";
|
|
293
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
294
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
295
|
+
import { fileURLToPath } from "node:url";
|
|
296
|
+
var EnvironmentError = class extends Error {
|
|
297
|
+
constructor(message) {
|
|
298
|
+
super(message);
|
|
299
|
+
this.name = "EnvironmentError";
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
function locateDistribution(moduleURL) {
|
|
303
|
+
const root = dirname2(dirname2(fileURLToPath(moduleURL)));
|
|
304
|
+
let version = "0.0.0";
|
|
305
|
+
let sdkDir = dirname2(root);
|
|
306
|
+
for (let dir = root, i = 0; i < 4; dir = dirname2(dir), i++) {
|
|
307
|
+
const file = join2(dir, "package.json");
|
|
308
|
+
if (!existsSync2(file)) continue;
|
|
309
|
+
const pkg = JSON.parse(readFileSync2(file, "utf8"));
|
|
310
|
+
if (pkg.name === "@iota-uz/sdk" && pkg.version !== void 0) {
|
|
311
|
+
version = pkg.version;
|
|
312
|
+
sdkDir = dir;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return { root, worker: join2(root, "build", "worker.mjs"), sdkCatalog: join2(root, "catalog", "sdk-natives.json"), sdkVersion: version, sdkDir };
|
|
317
|
+
}
|
|
318
|
+
function runWorker(dist, request, env) {
|
|
319
|
+
if (!existsSync2(dist.worker)) throw new EnvironmentError(`build worker not found at ${dist.worker}; reinstall @iota-uz/sdk`);
|
|
320
|
+
return new Promise((resolve4, reject) => {
|
|
321
|
+
const child = spawn(process.execPath, ["--no-warnings", dist.worker], { env, stdio: ["pipe", "pipe", "pipe"] });
|
|
322
|
+
let stdout = "";
|
|
323
|
+
let stderr = "";
|
|
324
|
+
child.stdout.on("data", (b) => stdout += b.toString("utf8"));
|
|
325
|
+
child.stderr.on("data", (b) => stderr += b.toString("utf8"));
|
|
326
|
+
child.on("error", (err) => reject(new EnvironmentError(`cannot start node: ${err.message}`)));
|
|
327
|
+
child.on("close", (code2) => {
|
|
328
|
+
const line = stdout.trim().split("\n").pop() ?? "";
|
|
329
|
+
try {
|
|
330
|
+
resolve4(JSON.parse(line));
|
|
331
|
+
} catch {
|
|
332
|
+
const text = (stderr || stdout).trim();
|
|
333
|
+
const hint = /Cannot find (?:module|package) 'esbuild'/.test(text) ? "\nesbuild is a peer dependency of @iota-uz/sdk: add it to your devDependencies (npm install --save-dev esbuild@^0.25.0)." : "";
|
|
334
|
+
reject(new EnvironmentError(`the build worker exited with ${String(code2)}:
|
|
335
|
+
${text.slice(0, 2e3)}${hint}`));
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
child.stdin.end(JSON.stringify(request));
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// src/cli/sdkspec.ts
|
|
343
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
344
|
+
import { dirname as dirname3, isAbsolute as isAbsolute2, join as join3, relative, resolve as resolve2, sep as sep2 } from "node:path";
|
|
345
|
+
var SDK = "@iota-uz/sdk";
|
|
346
|
+
var DEP_FIELDS = ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
|
|
347
|
+
var PATH_PROTOCOLS = ["file:", "link:", "portal:"];
|
|
348
|
+
function installingProject(sdkDir) {
|
|
349
|
+
const marker = `${sep2}node_modules${sep2}@iota-uz${sep2}sdk`;
|
|
350
|
+
const at = sdkDir.lastIndexOf(marker);
|
|
351
|
+
return at > 0 ? sdkDir.slice(0, at) : void 0;
|
|
352
|
+
}
|
|
353
|
+
function declaredSpec(projectDir) {
|
|
354
|
+
const file = join3(projectDir, "package.json");
|
|
355
|
+
if (!existsSync3(file)) return void 0;
|
|
356
|
+
try {
|
|
357
|
+
const pkg = JSON.parse(readFileSync3(file, "utf8"));
|
|
358
|
+
for (const field2 of DEP_FIELDS) {
|
|
359
|
+
const spec = pkg[field2]?.[SDK];
|
|
360
|
+
if (typeof spec === "string" && spec.trim() !== "") return spec.trim();
|
|
361
|
+
}
|
|
362
|
+
} catch {
|
|
363
|
+
}
|
|
364
|
+
return void 0;
|
|
365
|
+
}
|
|
366
|
+
function findDeclaration(sdkDir, cwd) {
|
|
367
|
+
const candidates = [];
|
|
368
|
+
const installed = installingProject(sdkDir);
|
|
369
|
+
if (installed !== void 0) candidates.push(installed);
|
|
370
|
+
for (let dir = resolve2(cwd); ; dir = dirname3(dir)) {
|
|
371
|
+
candidates.push(dir);
|
|
372
|
+
if (dirname3(dir) === dir) break;
|
|
373
|
+
}
|
|
374
|
+
for (const projectDir of candidates) {
|
|
375
|
+
const spec = declaredSpec(projectDir);
|
|
376
|
+
if (spec !== void 0) return { projectDir, spec };
|
|
377
|
+
}
|
|
378
|
+
return void 0;
|
|
379
|
+
}
|
|
380
|
+
function pathSpec(spec) {
|
|
381
|
+
for (const protocol of PATH_PROTOCOLS) {
|
|
382
|
+
if (spec.startsWith(protocol)) return { protocol, path: spec.slice(protocol.length) };
|
|
383
|
+
}
|
|
384
|
+
if (/^\.{1,2}[\\/]/.test(spec)) return { protocol: "file:", path: spec };
|
|
385
|
+
return void 0;
|
|
386
|
+
}
|
|
387
|
+
var posix = (p) => p.split(sep2).join("/");
|
|
388
|
+
function resolveSdkSpec(o) {
|
|
389
|
+
const exact = o.sdkVersion === "0.0.0" ? "*" : o.sdkVersion;
|
|
390
|
+
const found = findDeclaration(o.sdkDir, o.cwd);
|
|
391
|
+
if (found === void 0) return exact;
|
|
392
|
+
const spec = found.spec;
|
|
393
|
+
const asPath = pathSpec(spec);
|
|
394
|
+
if (asPath !== void 0) {
|
|
395
|
+
if (asPath.path.startsWith("~") || isAbsolute2(asPath.path)) return spec;
|
|
396
|
+
const target = resolve2(found.projectDir, asPath.path);
|
|
397
|
+
const rel = posix(relative(o.newDir, target)) || ".";
|
|
398
|
+
return `${asPath.protocol}${rel.startsWith(".") ? rel : `./${rel}`}`;
|
|
399
|
+
}
|
|
400
|
+
if (/^(git(\+[a-z]+)?|github|gitlab|bitbucket|https?):/.test(spec) || /^[\w.-]+\/[\w.-]+(#.*)?$/.test(spec)) return spec;
|
|
401
|
+
return exact;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// src/cli/scaffold.ts
|
|
405
|
+
var NAMESPACE = /^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)*$/;
|
|
406
|
+
function validateNamespace(namespace) {
|
|
407
|
+
if (!NAMESPACE.test(namespace)) return `"${namespace}" is not a namespace: use dotted lowercase words such as "acme.loyalty"`;
|
|
408
|
+
if (!namespace.includes(".")) return `"${namespace}" has one segment: use "<owner>.<module>" such as "acme.loyalty" (the first segment must not collide with a platform namespace such as core or crm)`;
|
|
409
|
+
return void 0;
|
|
410
|
+
}
|
|
411
|
+
function defaultPackageName(namespace) {
|
|
412
|
+
const [owner = "ext", ...rest] = namespace.split(".");
|
|
413
|
+
return `@${owner}/${rest.join("-")}`;
|
|
414
|
+
}
|
|
415
|
+
var q = JSON.stringify;
|
|
416
|
+
function scaffold(o) {
|
|
417
|
+
const files = {};
|
|
418
|
+
const pkg = {
|
|
419
|
+
name: o.name,
|
|
420
|
+
version: "0.1.0",
|
|
421
|
+
private: true,
|
|
422
|
+
type: "module",
|
|
423
|
+
scripts: { check: "iota-ext check", build: "iota-ext build", test: "iota-ext test" },
|
|
424
|
+
iota: {
|
|
425
|
+
namespace: o.namespace,
|
|
426
|
+
contracts: "./src/contracts.ts",
|
|
427
|
+
server: "./src/server.ts",
|
|
428
|
+
...o.client ? { client: "./src/client.tsx" } : {}
|
|
429
|
+
},
|
|
430
|
+
// The spec the SDK was installed with (a tarball, a link, a git ref) or its exact registry version: the extension runtime
|
|
431
|
+
// ships from the version of the CLI that wrote this file, and earlier public builds have no dist/runtime.
|
|
432
|
+
dependencies: { "@iota-uz/sdk": o.sdkSpec },
|
|
433
|
+
// esbuild is an optional peer of @iota-uz/sdk (the public package carries no dependencies); the CLI's build worker needs it.
|
|
434
|
+
devDependencies: { "@types/node": "^22.0.0", esbuild: "^0.25.0", ...o.client ? { "solid-js": "^1.9.0" } : {}, typescript: "~5.7.2" }
|
|
435
|
+
};
|
|
436
|
+
files["package.json"] = JSON.stringify(pkg, null, 2) + "\n";
|
|
437
|
+
files["tsconfig.json"] = JSON.stringify(
|
|
438
|
+
{
|
|
439
|
+
compilerOptions: {
|
|
440
|
+
target: "ES2022",
|
|
441
|
+
module: "ESNext",
|
|
442
|
+
moduleResolution: "Bundler",
|
|
443
|
+
strict: true,
|
|
444
|
+
noEmit: true,
|
|
445
|
+
skipLibCheck: true,
|
|
446
|
+
lib: ["ES2022", "DOM", "DOM.Iterable"],
|
|
447
|
+
types: ["node"],
|
|
448
|
+
// The generated kit lives in .iota/kit, not in node_modules (npm install deletes what it did not install).
|
|
449
|
+
paths: { "@iota-kit/*": ["./.iota/kit/*"] },
|
|
450
|
+
...o.client ? { jsx: "preserve", jsxImportSource: "solid-js" } : {}
|
|
451
|
+
},
|
|
452
|
+
include: ["src"]
|
|
453
|
+
},
|
|
454
|
+
null,
|
|
455
|
+
2
|
|
456
|
+
) + "\n";
|
|
457
|
+
files[".gitignore"] = "node_modules\n.iota/build\n";
|
|
458
|
+
files["src/contracts.ts"] = `// Pure contracts: every resource this package declares. No handlers, no Node, no Solid.
|
|
459
|
+
import { command, entity, field, query, t } from "@iota-uz/sdk/runtime"
|
|
460
|
+
|
|
461
|
+
export const Note = entity(${q(`${o.namespace}.note`)}, {
|
|
462
|
+
title: field.text({ maxLength: 120 }),
|
|
463
|
+
body: field.text().optional(),
|
|
464
|
+
})
|
|
465
|
+
|
|
466
|
+
export const AddNote = command(${q(`${o.namespace}.addNote`)}, {
|
|
467
|
+
atomic: true,
|
|
468
|
+
input: t.object({ title: t.string(), body: t.string().optional() }),
|
|
469
|
+
output: t.object({ note: t.ref(Note) }),
|
|
470
|
+
})
|
|
471
|
+
|
|
472
|
+
export const ListNotes = query(${q(`${o.namespace}.listNotes`)}, {
|
|
473
|
+
input: t.object({}),
|
|
474
|
+
output: t.array(t.object({ title: t.string(), body: t.string().nullable() })),
|
|
475
|
+
})
|
|
476
|
+
`;
|
|
477
|
+
files["src/server.ts"] = `// Implementations: each export binds a handler to a contract by typed reference.
|
|
478
|
+
import { implement } from "@iota-uz/sdk/runtime/server"
|
|
479
|
+
import * as c from "./contracts"
|
|
480
|
+
|
|
481
|
+
export const addNote = implement(c.AddNote, async (tx, input) => {
|
|
482
|
+
const row = await tx.insert(c.Note, { title: input.title, body: input.body })
|
|
483
|
+
return { note: row.ref }
|
|
484
|
+
})
|
|
485
|
+
|
|
486
|
+
export const listNotes = implement(c.ListNotes, async (q) => {
|
|
487
|
+
const rows = await q.find(c.Note, { orderBy: [{ field: "createdAt", desc: true }], limit: 50 })
|
|
488
|
+
return rows.map((row) => ({ title: row.title, body: row.body }))
|
|
489
|
+
})
|
|
490
|
+
`;
|
|
491
|
+
files["src/server.test.ts"] = `import { assert, createTestHost, test } from "@iota-uz/sdk/runtime/testing"
|
|
492
|
+
import * as s from "./server"
|
|
493
|
+
|
|
494
|
+
test("a stored note is listed back", async () => {
|
|
495
|
+
const host = createTestHost({ implementations: [s.addNote, s.listNotes] })
|
|
496
|
+
const added = await host.transaction((tx) => s.addNote.handler(tx, { title: "First" }))
|
|
497
|
+
assert.equal(added.note.entity, ${q(`${o.namespace}.note`)})
|
|
498
|
+
const notes = await s.listNotes.handler(host.query(), {})
|
|
499
|
+
assert.deepEqual(notes, [{ title: "First", body: null }])
|
|
500
|
+
})
|
|
501
|
+
`;
|
|
502
|
+
if (o.client) {
|
|
503
|
+
files["src/client.tsx"] = `// Browser graph: pages, navigation, slots. Solid components; import contracts, never the server entry.
|
|
504
|
+
import { lazy } from "solid-js"
|
|
505
|
+
import { navigation, page } from "@iota-uz/sdk/runtime/client"
|
|
506
|
+
|
|
507
|
+
export const notes = page(${q(`${o.namespace}.notes`)}, {
|
|
508
|
+
path: ${q(`/${o.namespace.replace(/\./g, "-")}/notes`)},
|
|
509
|
+
nav: { label: { en: "Notes" }, group: ${q(o.namespace)}, icon: "note" },
|
|
510
|
+
component: lazy(() => import("./NotesScreen")),
|
|
511
|
+
})
|
|
512
|
+
|
|
513
|
+
export const nav = navigation({
|
|
514
|
+
groups: [{ id: ${q(o.namespace)}, label: { en: "Notes" } }],
|
|
515
|
+
})
|
|
516
|
+
`;
|
|
517
|
+
files["src/NotesScreen.tsx"] = `import { For, Show } from "solid-js"
|
|
518
|
+
import { Button, Card } from "@iota-uz/sdk/solid-ui"
|
|
519
|
+
import { useCommand, useQuery, type PageProps } from "@iota-uz/sdk/runtime/client"
|
|
520
|
+
import * as c from "./contracts"
|
|
521
|
+
import styles from "./NotesScreen.module.css"
|
|
522
|
+
|
|
523
|
+
// Styling without a line of CSS written inline: the SDK's Solid UI kit (the host's own instance and theme), Tailwind
|
|
524
|
+
// utility classes (compiled with the SDK design tokens into this version's stylesheet) and a scoped CSS module.
|
|
525
|
+
export default function NotesScreen(_props: PageProps) {
|
|
526
|
+
const notes = useQuery(c.ListNotes, {})
|
|
527
|
+
const add = useCommand(c.AddNote)
|
|
528
|
+
return (
|
|
529
|
+
<section class="flex flex-col gap-4 p-6">
|
|
530
|
+
<h1 class="text-xl font-semibold">Notes</h1>
|
|
531
|
+
<Card>
|
|
532
|
+
<Button
|
|
533
|
+
variant="primary"
|
|
534
|
+
loading={add.pending()}
|
|
535
|
+
onClick={() => void add.run({ title: "New note" }).then(() => notes.refetch())}
|
|
536
|
+
>
|
|
537
|
+
Add a note
|
|
538
|
+
</Button>
|
|
539
|
+
</Card>
|
|
540
|
+
<Show when={notes.data()}>
|
|
541
|
+
{(rows) => (
|
|
542
|
+
<ul class={styles.list}>
|
|
543
|
+
<For each={rows()}>{(note) => <li class={styles.item}>{note.title}</li>}</For>
|
|
544
|
+
</ul>
|
|
545
|
+
)}
|
|
546
|
+
</Show>
|
|
547
|
+
</section>
|
|
548
|
+
)
|
|
549
|
+
}
|
|
550
|
+
`;
|
|
551
|
+
files["src/css-modules.d.ts"] = `// The type of a scoped CSS module: \`styles.list\` is the unique class name the build gives \`.list\`.
|
|
552
|
+
// (Plain \`.css\` imports are refused by the build; see docs/authoring.md, "Styling".)
|
|
553
|
+
declare module "*.module.css" {
|
|
554
|
+
const classes: Readonly<Record<string, string>>
|
|
555
|
+
export default classes
|
|
556
|
+
}
|
|
557
|
+
`;
|
|
558
|
+
files["src/NotesScreen.module.css"] = `/* Scoped: the class names below are made unique to this package, so they cannot leak into the host or other packages. */
|
|
559
|
+
.list {
|
|
560
|
+
display: grid;
|
|
561
|
+
gap: 0.5rem;
|
|
562
|
+
list-style: none;
|
|
563
|
+
margin: 0;
|
|
564
|
+
padding: 0;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.item {
|
|
568
|
+
border-bottom: 1px solid currentcolor;
|
|
569
|
+
padding-bottom: 0.5rem;
|
|
570
|
+
}
|
|
571
|
+
`;
|
|
572
|
+
}
|
|
573
|
+
return files;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// src/cli/tar.ts
|
|
577
|
+
import { gunzipSync } from "node:zlib";
|
|
578
|
+
var decoder = new TextDecoder();
|
|
579
|
+
function field(block, start, length) {
|
|
580
|
+
const slice = block.subarray(start, start + length);
|
|
581
|
+
const end = slice.indexOf(0);
|
|
582
|
+
return decoder.decode(end === -1 ? slice : slice.subarray(0, end));
|
|
583
|
+
}
|
|
584
|
+
function paxPath(data) {
|
|
585
|
+
const text = decoder.decode(data);
|
|
586
|
+
let rest = text;
|
|
587
|
+
while (rest.length > 0) {
|
|
588
|
+
const space = rest.indexOf(" ");
|
|
589
|
+
const length = Number(rest.slice(0, space));
|
|
590
|
+
if (!Number.isInteger(length) || length <= 0) return void 0;
|
|
591
|
+
const record = rest.slice(space + 1, length - 1);
|
|
592
|
+
if (record.startsWith("path=")) return record.slice("path=".length);
|
|
593
|
+
rest = rest.slice(length);
|
|
594
|
+
}
|
|
595
|
+
return void 0;
|
|
596
|
+
}
|
|
597
|
+
function untar(gz) {
|
|
598
|
+
const tar = gunzipSync(gz);
|
|
599
|
+
const out = [];
|
|
600
|
+
let offset = 0;
|
|
601
|
+
let pending;
|
|
602
|
+
while (offset + 512 <= tar.length) {
|
|
603
|
+
const header = tar.subarray(offset, offset + 512);
|
|
604
|
+
if (header.every((b) => b === 0)) break;
|
|
605
|
+
const size = parseInt(field(header, 124, 12).trim() || "0", 8);
|
|
606
|
+
const type = field(header, 156, 1);
|
|
607
|
+
const prefix = field(header, 345, 155);
|
|
608
|
+
let name = prefix === "" ? field(header, 0, 100) : `${prefix}/${field(header, 0, 100)}`;
|
|
609
|
+
const body = tar.subarray(offset + 512, offset + 512 + size);
|
|
610
|
+
offset += 512 + Math.ceil(size / 512) * 512;
|
|
611
|
+
if (type === "x") {
|
|
612
|
+
pending = paxPath(body);
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
if (type === "g") continue;
|
|
616
|
+
if (pending !== void 0) {
|
|
617
|
+
name = pending;
|
|
618
|
+
pending = void 0;
|
|
619
|
+
}
|
|
620
|
+
if (type !== "0" && type !== "") continue;
|
|
621
|
+
const parts = name.split("/").filter((p) => p !== "" && p !== ".");
|
|
622
|
+
if (parts.includes("..") || name.startsWith("/")) throw new Error(`archive entry "${name}" escapes the package root`);
|
|
623
|
+
const path = parts.slice(1).join("/");
|
|
624
|
+
if (path !== "") out.push({ path, data: Uint8Array.from(body) });
|
|
625
|
+
}
|
|
626
|
+
return out;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// src/cli/commands.ts
|
|
630
|
+
var hasErrors = (list) => list.some((d) => d.severity === "error");
|
|
631
|
+
var json = (io, value) => io.out(JSON.stringify(value, null, 2));
|
|
632
|
+
function packageDir(ctx, dir) {
|
|
633
|
+
const abs = resolve3(ctx.io.cwd, dir ?? ".");
|
|
634
|
+
if (!existsSync4(join4(abs, "package.json"))) throw new UsageError(`no package.json in ${abs}: run iota-ext from a package directory, or pass --dir`);
|
|
635
|
+
return abs;
|
|
636
|
+
}
|
|
637
|
+
var KIT_COMMANDS = "`iota-ext kit generate` (the SDK natives core and crm, offline), `iota-ext kit generate --catalog <file>` or `iota-ext kit pull --server <url>`";
|
|
638
|
+
function kitDamage(report) {
|
|
639
|
+
const broken = report.modules.filter((m) => m.state !== "ok");
|
|
640
|
+
if (broken.length === 0) return void 0;
|
|
641
|
+
const detail = broken.map((m) => `${m.name} (${m.problems.join("; ")})`).join(", ");
|
|
642
|
+
return `the kit does not match its record: ${detail}. Restore it with ${KIT_COMMANDS}; \`iota-ext kit status\` lists the details.`;
|
|
643
|
+
}
|
|
644
|
+
function kitHint(dir, diagnostics) {
|
|
645
|
+
if (!diagnostics.some((d) => /@iota-kit\//.test(d.message) || d.code === "graph.unknownKit")) return void 0;
|
|
646
|
+
const kit2 = loadKit(dir);
|
|
647
|
+
const damage = kitDamage(inspectKit(dir));
|
|
648
|
+
if (damage !== void 0) return damage;
|
|
649
|
+
if (kit2.installed) {
|
|
650
|
+
return `kit modules installed (${KIT_DIR}): ${Object.keys(kit2.modules).join(", ")}. A module missing here comes from another package or an application: use \`iota-ext kit pull --server <url>\` or \`iota-ext kit generate --catalog <file>\`.`;
|
|
651
|
+
}
|
|
652
|
+
return `no developer kit is installed: run ${KIT_COMMANDS}. The kit lives in ${KIT_DIR} (package managers never touch it).`;
|
|
653
|
+
}
|
|
654
|
+
function legacyNote(ctx, dir) {
|
|
655
|
+
if (loadKit(dir).location === "legacy") {
|
|
656
|
+
ctx.io.err(`${ctx.s.dim("note:")} the kit is installed under node_modules/@iota-kit, which \`npm install\` deletes. Run \`iota-ext kit generate\` (or \`kit pull\`) once to move it to ${KIT_DIR}.`);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
function printDiagnostics(ctx, dir, diagnostics) {
|
|
660
|
+
if (diagnostics.length > 0) ctx.io.err(formatDiagnostics(diagnostics, ctx.s));
|
|
661
|
+
const hint = kitHint(dir, diagnostics);
|
|
662
|
+
if (hint !== void 0) ctx.io.err(`${ctx.s.dim("hint:")} ${hint}`);
|
|
663
|
+
}
|
|
664
|
+
async function runPackageOp(ctx, op, dir, outDir) {
|
|
665
|
+
legacyNote(ctx, dir);
|
|
666
|
+
const kit2 = loadKit(dir);
|
|
667
|
+
return runWorker(ctx.dist, { op, dir, outDir, kit: { hash: kit2.hash, modules: kit2.modules } }, ctx.io.env);
|
|
668
|
+
}
|
|
669
|
+
async function withScratch(body) {
|
|
670
|
+
const scratch = mkdtempSync(join4(tmpdir(), "iota-ext-"));
|
|
671
|
+
try {
|
|
672
|
+
return await body(scratch);
|
|
673
|
+
} finally {
|
|
674
|
+
rmSync2(scratch, { recursive: true, force: true });
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
async function check(ctx, argv) {
|
|
678
|
+
const args = parseArgs(argv, { values: ["dir"], booleans: ["json"] });
|
|
679
|
+
const dir = packageDir(ctx, args.value("dir"));
|
|
680
|
+
const res = await withScratch((scratch) => runPackageOp(ctx, "check", dir, scratch));
|
|
681
|
+
const ok = !hasErrors(res.diagnostics);
|
|
682
|
+
if (args.flag("json")) {
|
|
683
|
+
json(ctx.io, { ok, diagnostics: res.diagnostics, manifest: res.manifest });
|
|
684
|
+
return ok ? 0 : 1;
|
|
685
|
+
}
|
|
686
|
+
printDiagnostics(ctx, dir, res.diagnostics);
|
|
687
|
+
if (!ok) {
|
|
688
|
+
ctx.io.err(ctx.s.red(`check failed: ${plural(res.diagnostics.filter((d) => d.severity === "error").length, "error")}`));
|
|
689
|
+
return 1;
|
|
690
|
+
}
|
|
691
|
+
ctx.io.out(`${ctx.s.green("check passed")}: ${res.manifest?.namespace ?? ""} declares ${plural(res.manifest?.resources.length ?? 0, "resource")}`);
|
|
692
|
+
return 0;
|
|
693
|
+
}
|
|
694
|
+
async function build(ctx, argv) {
|
|
695
|
+
const args = parseArgs(argv, { values: ["dir", "out"], booleans: ["json"] });
|
|
696
|
+
const dir = packageDir(ctx, args.value("dir"));
|
|
697
|
+
const out = resolve3(ctx.io.cwd, args.value("out") ?? join4(dir, ".iota", "build"));
|
|
698
|
+
const rel = relative2(out, dir);
|
|
699
|
+
if (rel === "" || !rel.startsWith("..") && !rel.startsWith("/")) throw new UsageError(`--out ${out} contains the package; choose a separate directory`);
|
|
700
|
+
rmSync2(join4(out, "artifacts"), { recursive: true, force: true });
|
|
701
|
+
mkdirSync2(out, { recursive: true });
|
|
702
|
+
const res = await runPackageOp(ctx, "build", dir, out);
|
|
703
|
+
const ok = !hasErrors(res.diagnostics) && res.manifest !== void 0;
|
|
704
|
+
if (ok) writeFileSync2(join4(out, "manifest.json"), JSON.stringify(res.manifest, null, 2) + "\n");
|
|
705
|
+
if (args.flag("json")) {
|
|
706
|
+
json(ctx.io, { ok, out, diagnostics: res.diagnostics, artifacts: res.artifacts, manifest: res.manifest });
|
|
707
|
+
return ok ? 0 : 1;
|
|
708
|
+
}
|
|
709
|
+
printDiagnostics(ctx, dir, res.diagnostics);
|
|
710
|
+
if (!ok) {
|
|
711
|
+
ctx.io.err(ctx.s.red(`build failed: ${plural(res.diagnostics.filter((d) => d.severity === "error").length, "error")}`));
|
|
712
|
+
return 1;
|
|
713
|
+
}
|
|
714
|
+
ctx.io.out(`${ctx.s.green("build passed")}: ${res.manifest?.namespace ?? ""} (${plural(res.manifest?.resources.length ?? 0, "resource")})`);
|
|
715
|
+
for (const a of res.artifacts) ctx.io.out(` ${join4(relative2(ctx.io.cwd, out) || ".", "artifacts", a)}`);
|
|
716
|
+
ctx.io.out(` ${join4(relative2(ctx.io.cwd, out) || ".", "manifest.json")}`);
|
|
717
|
+
return 0;
|
|
718
|
+
}
|
|
719
|
+
async function test(ctx, argv) {
|
|
720
|
+
const args = parseArgs(argv, { values: ["dir"], booleans: ["json"] });
|
|
721
|
+
const dir = packageDir(ctx, args.value("dir"));
|
|
722
|
+
legacyNote(ctx, dir);
|
|
723
|
+
const kit2 = loadKit(dir);
|
|
724
|
+
const res = await withScratch(
|
|
725
|
+
(scratch) => runWorker(ctx.dist, { op: "test", dir, outDir: scratch, kit: { hash: kit2.hash, modules: kit2.modules }, typecheck: true, filter: args.positionals }, ctx.io.env)
|
|
726
|
+
);
|
|
727
|
+
const failed = res.cases.filter((c) => !c.passed).length;
|
|
728
|
+
const ok = !hasErrors(res.diagnostics) && failed === 0 && res.cases.length > 0;
|
|
729
|
+
if (args.flag("json")) {
|
|
730
|
+
json(ctx.io, { ok, diagnostics: res.diagnostics, cases: res.cases, passed: res.cases.length - failed, failed });
|
|
731
|
+
return ok ? 0 : 1;
|
|
732
|
+
}
|
|
733
|
+
if (hasErrors(res.diagnostics)) {
|
|
734
|
+
printDiagnostics(ctx, dir, res.diagnostics);
|
|
735
|
+
ctx.io.err(ctx.s.red("tests were not run: the package does not compile"));
|
|
736
|
+
return 1;
|
|
737
|
+
}
|
|
738
|
+
if (res.cases.length === 0) {
|
|
739
|
+
ctx.io.err(`no tests found: add *.test.ts files that register cases with test() from "@iota-uz/sdk/runtime/testing"${args.positionals.length > 0 ? ` and match ${args.positionals.join(", ")}` : ""}`);
|
|
740
|
+
return 1;
|
|
741
|
+
}
|
|
742
|
+
ctx.io.out(formatTests(res.cases, ctx.s));
|
|
743
|
+
const summary = `${plural(res.cases.length, "test")}: ${res.cases.length - failed} passed${failed > 0 ? `, ${failed} failed` : ""}`;
|
|
744
|
+
ctx.io.out(failed > 0 ? ctx.s.red(summary) : ctx.s.green(summary));
|
|
745
|
+
return ok ? 0 : 1;
|
|
746
|
+
}
|
|
747
|
+
function readCatalog(ctx, spec) {
|
|
748
|
+
const file = spec === "sdk" ? ctx.dist.sdkCatalog : resolve3(ctx.io.cwd, spec);
|
|
749
|
+
let doc;
|
|
750
|
+
try {
|
|
751
|
+
doc = JSON.parse(readFileSync4(file, "utf8"));
|
|
752
|
+
} catch (err) {
|
|
753
|
+
throw new EnvironmentError(`cannot read catalog snapshot ${file}: ${err instanceof Error ? err.message : String(err)}`);
|
|
754
|
+
}
|
|
755
|
+
if (doc.schema !== "iota.catalog/1" || !Array.isArray(doc.sources)) {
|
|
756
|
+
throw new EnvironmentError(`${file} is not a catalog snapshot (schema "iota.catalog/1"); export one with GET /_ext/manage/catalog/natives or the application's catalog command`);
|
|
757
|
+
}
|
|
758
|
+
return {
|
|
759
|
+
label: spec,
|
|
760
|
+
sources: doc.sources.map((s) => ({
|
|
761
|
+
namespace: s.namespace,
|
|
762
|
+
resources: s.resources ?? [],
|
|
763
|
+
...s.lists === void 0 ? {} : { lists: s.lists },
|
|
764
|
+
...s.contractsModule === void 0 ? {} : { contractsModule: s.contractsModule }
|
|
765
|
+
}))
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
function pathsSnippet() {
|
|
769
|
+
return `"compilerOptions": { "paths": { "${KIT_PATHS_KEY}": ["${KIT_PATHS_VALUE}"] } }`;
|
|
770
|
+
}
|
|
771
|
+
function reportEditor(ctx, editor) {
|
|
772
|
+
if (editor === "added") ctx.io.out(`updated tsconfig.json: ${pathsSnippet()} (the editor resolves ${KIT_PATHS_KEY} there)`);
|
|
773
|
+
else if (editor === "manual") ctx.io.err(`${ctx.s.dim("note:")} add ${pathsSnippet()} to tsconfig.json so the editor resolves ${KIT_PATHS_KEY} (iota-ext itself does not need it)`);
|
|
774
|
+
}
|
|
775
|
+
async function kitGenerate(ctx, argv) {
|
|
776
|
+
const args = parseArgs(argv, { values: ["dir"], lists: ["catalog"], booleans: ["json"] });
|
|
777
|
+
const dir = packageDir(ctx, args.value("dir"));
|
|
778
|
+
const specs = args.list("catalog").length > 0 ? args.list("catalog") : ["sdk"];
|
|
779
|
+
const owner = /* @__PURE__ */ new Map();
|
|
780
|
+
const sources = [];
|
|
781
|
+
for (const spec of specs) {
|
|
782
|
+
const cat = readCatalog(ctx, spec);
|
|
783
|
+
for (const s of cat.sources) {
|
|
784
|
+
const prev = owner.get(s.namespace);
|
|
785
|
+
if (prev !== void 0) {
|
|
786
|
+
throw new UsageError(`namespace "${s.namespace}" is in both ${prev} and ${cat.label}: an application snapshot already contains the SDK natives, so pass only that file`);
|
|
787
|
+
}
|
|
788
|
+
owner.set(s.namespace, cat.label);
|
|
789
|
+
sources.push(s);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
const res = await runWorker(ctx.dist, { op: "kit", sources }, ctx.io.env);
|
|
793
|
+
if (hasErrors(res.diagnostics)) {
|
|
794
|
+
if (args.flag("json")) json(ctx.io, { ok: false, diagnostics: res.diagnostics });
|
|
795
|
+
else ctx.io.err(formatDiagnostics(res.diagnostics, ctx.s));
|
|
796
|
+
return 1;
|
|
797
|
+
}
|
|
798
|
+
const record = installKit(dir, res.hash, res.modules, { kind: "catalog", files: [...specs] });
|
|
799
|
+
const editor = ensureEditorPaths(dir);
|
|
800
|
+
if (args.flag("json")) json(ctx.io, { ok: true, hash: record.hash, modules: record.modules, dir: KIT_DIR, editor });
|
|
801
|
+
else {
|
|
802
|
+
ctx.io.out(`${ctx.s.green("kit generated")}: ${record.modules.join(", ")} (snapshot ${record.hash.slice(0, 12)}, in ${KIT_DIR})`);
|
|
803
|
+
reportEditor(ctx, editor);
|
|
804
|
+
}
|
|
805
|
+
return 0;
|
|
806
|
+
}
|
|
807
|
+
function managementBase(server) {
|
|
808
|
+
const trimmed = server.replace(/\/+$/, "");
|
|
809
|
+
return trimmed.endsWith("/_ext/manage") ? trimmed : `${trimmed}/_ext/manage`;
|
|
810
|
+
}
|
|
811
|
+
async function kitPull(ctx, argv) {
|
|
812
|
+
const args = parseArgs(argv, { values: ["dir", "server", "token-env", "cookie-env"], booleans: ["json"] });
|
|
813
|
+
const dir = packageDir(ctx, args.value("dir"));
|
|
814
|
+
const server = args.value("server");
|
|
815
|
+
if (server === void 0) throw new UsageError("kit pull needs --server <url> (the application that runs the extension runtime)");
|
|
816
|
+
const headers = { Accept: "application/json" };
|
|
817
|
+
const tokenEnv = args.value("token-env");
|
|
818
|
+
if (tokenEnv !== void 0) {
|
|
819
|
+
const token = ctx.io.env[tokenEnv];
|
|
820
|
+
if (token === void 0 || token === "") throw new UsageError(`environment variable ${tokenEnv} is empty: export the API token there (it is never taken from the command line)`);
|
|
821
|
+
headers.Authorization = `Bearer ${token}`;
|
|
822
|
+
}
|
|
823
|
+
const cookieEnv = args.value("cookie-env");
|
|
824
|
+
if (cookieEnv !== void 0) {
|
|
825
|
+
const cookie = ctx.io.env[cookieEnv];
|
|
826
|
+
if (cookie === void 0 || cookie === "") throw new UsageError(`environment variable ${cookieEnv} is empty: export the session cookie header there`);
|
|
827
|
+
headers.Cookie = cookie;
|
|
828
|
+
}
|
|
829
|
+
const base = managementBase(server);
|
|
830
|
+
const get = async (url) => {
|
|
831
|
+
let res;
|
|
832
|
+
try {
|
|
833
|
+
res = await fetch(url, { headers });
|
|
834
|
+
} catch (err) {
|
|
835
|
+
throw new EnvironmentError(`cannot reach ${url}: ${err instanceof Error ? err.message : String(err)}`);
|
|
836
|
+
}
|
|
837
|
+
if (!res.ok) {
|
|
838
|
+
let detail = "";
|
|
839
|
+
try {
|
|
840
|
+
const body = await res.json();
|
|
841
|
+
detail = body.error === void 0 ? "" : `: ${body.error.code ?? ""} ${body.error.message ?? ""}`.trimEnd();
|
|
842
|
+
} catch {
|
|
843
|
+
detail = "";
|
|
844
|
+
}
|
|
845
|
+
throw new EnvironmentError(`${url} answered ${res.status}${detail}${res.status === 401 || res.status === 403 ? " (pass --token-env <VAR> with an API token, or --cookie-env <VAR>; the user needs the extensions read permission)" : ""}`);
|
|
846
|
+
}
|
|
847
|
+
return res;
|
|
848
|
+
};
|
|
849
|
+
const index = await (await get(`${base}/kit`)).json();
|
|
850
|
+
const modules = {};
|
|
851
|
+
let record;
|
|
852
|
+
try {
|
|
853
|
+
if (typeof index.hash !== "string" || !Array.isArray(index.modules)) throw new InvalidKitError("the kit index has no hash or module list");
|
|
854
|
+
const namespaces = index.modules.map((name) => kitNamespace(name));
|
|
855
|
+
for (const [i, name] of index.modules.entries()) {
|
|
856
|
+
const archive = new Uint8Array(await (await get(`${base}/kit/modules/${namespaces[i]}.tgz?hash=${encodeURIComponent(index.hash)}`)).arrayBuffer());
|
|
857
|
+
modules[name] = Object.fromEntries(untar(archive).map((e) => [e.path, e.data]));
|
|
858
|
+
}
|
|
859
|
+
record = installKit(dir, index.hash, modules, { kind: "server", url: server });
|
|
860
|
+
} catch (err) {
|
|
861
|
+
if (err instanceof InvalidKitError) throw new EnvironmentError(`${server} sent a kit that cannot be installed (the installed kit is unchanged): ${err.message}`);
|
|
862
|
+
throw err;
|
|
863
|
+
}
|
|
864
|
+
const editor = ensureEditorPaths(dir);
|
|
865
|
+
if (args.flag("json")) json(ctx.io, { ok: true, hash: record.hash, modules: record.modules, dir: KIT_DIR, editor });
|
|
866
|
+
else {
|
|
867
|
+
ctx.io.out(`${ctx.s.green("kit pulled")}: ${record.modules.join(", ")} (snapshot ${record.hash.slice(0, 12)}, in ${KIT_DIR})`);
|
|
868
|
+
reportEditor(ctx, editor);
|
|
869
|
+
}
|
|
870
|
+
return 0;
|
|
871
|
+
}
|
|
872
|
+
function kitStatus(ctx, argv) {
|
|
873
|
+
const args = parseArgs(argv, { values: ["dir"], booleans: ["json"] });
|
|
874
|
+
const dir = packageDir(ctx, args.value("dir"));
|
|
875
|
+
const report = inspectKit(dir);
|
|
876
|
+
const editor = editorPaths(dir);
|
|
877
|
+
const record = report.record;
|
|
878
|
+
const damaged = report.location !== "none" && !report.ok;
|
|
879
|
+
if (args.flag("json")) {
|
|
880
|
+
json(ctx.io, {
|
|
881
|
+
ok: !damaged,
|
|
882
|
+
installed: report.location !== "none",
|
|
883
|
+
dir: KIT_DIR,
|
|
884
|
+
location: report.location,
|
|
885
|
+
hash: record?.hash ?? null,
|
|
886
|
+
source: record?.source ?? null,
|
|
887
|
+
modules: report.modules,
|
|
888
|
+
editor
|
|
889
|
+
});
|
|
890
|
+
return damaged ? 1 : 0;
|
|
891
|
+
}
|
|
892
|
+
if (report.location === "none") {
|
|
893
|
+
ctx.io.out(`no developer kit installed: run ${KIT_COMMANDS}`);
|
|
894
|
+
return 0;
|
|
895
|
+
}
|
|
896
|
+
ctx.io.out(`snapshot ${record?.hash ?? "unknown"} (${report.location === "legacy" ? "node_modules/@iota-kit" : KIT_DIR})`);
|
|
897
|
+
for (const m of report.modules) ctx.io.out(` ${m.state === "ok" ? ctx.s.green("ok") : ctx.s.red(m.state)} ${m.name}${m.problems.length > 0 ? `: ${m.problems.join("; ")}` : ""}`);
|
|
898
|
+
if (report.location === "legacy") ctx.io.out(`the kit is under node_modules, where \`npm install\` deletes it: run \`iota-ext kit generate\` (or \`kit pull\`) to move it to ${KIT_DIR}`);
|
|
899
|
+
else if (damaged) ctx.io.out(`the kit is damaged: restore it with ${KIT_COMMANDS}`);
|
|
900
|
+
if (editor === "manual") ctx.io.out(`tsconfig.json has no ${KIT_PATHS_KEY} path, so the editor cannot resolve the kit: add ${pathsSnippet()}`);
|
|
901
|
+
return damaged ? 1 : 0;
|
|
902
|
+
}
|
|
903
|
+
async function kit(ctx, argv) {
|
|
904
|
+
const [sub, ...rest] = argv;
|
|
905
|
+
if (sub === "generate") return kitGenerate(ctx, rest);
|
|
906
|
+
if (sub === "pull") return kitPull(ctx, rest);
|
|
907
|
+
if (sub === "status") return kitStatus(ctx, rest);
|
|
908
|
+
throw new UsageError("usage: iota-ext kit <generate|pull|status>");
|
|
909
|
+
}
|
|
910
|
+
async function init(ctx, argv) {
|
|
911
|
+
const args = parseArgs(argv, { values: ["namespace", "name"], booleans: ["no-client", "no-kit", "force"] });
|
|
912
|
+
const target = args.positionals[0];
|
|
913
|
+
if (target === void 0) throw new UsageError("usage: iota-ext init <dir> --namespace <owner.module> [--name <npm name>] [--no-client] [--no-kit]");
|
|
914
|
+
const namespace = args.value("namespace");
|
|
915
|
+
if (namespace === void 0) throw new UsageError("init needs --namespace <owner.module>, for example --namespace acme.loyalty");
|
|
916
|
+
const invalid = validateNamespace(namespace);
|
|
917
|
+
if (invalid !== void 0) throw new UsageError(invalid);
|
|
918
|
+
const dir = resolve3(ctx.io.cwd, target);
|
|
919
|
+
if (existsSync4(dir) && readdirSync2(dir).length > 0 && !args.flag("force")) throw new UsageError(`${dir} is not empty (use --force to write the scaffold anyway)`);
|
|
920
|
+
const files = scaffold({ namespace, name: args.value("name") ?? defaultPackageName(namespace), sdkSpec: resolveSdkSpec({ sdkDir: ctx.dist.sdkDir, sdkVersion: ctx.dist.sdkVersion, cwd: ctx.io.cwd, newDir: dir }), client: !args.flag("no-client") });
|
|
921
|
+
for (const [path, text] of Object.entries(files)) {
|
|
922
|
+
const file = join4(dir, path);
|
|
923
|
+
mkdirSync2(dirname4(file), { recursive: true });
|
|
924
|
+
writeFileSync2(file, text);
|
|
925
|
+
}
|
|
926
|
+
ctx.io.out(`created ${plural(Object.keys(files).length, "file")} in ${relative2(ctx.io.cwd, dir) || "."}`);
|
|
927
|
+
if (!args.flag("no-kit")) {
|
|
928
|
+
const code2 = await kitGenerate(ctx, ["--dir", dir]);
|
|
929
|
+
if (code2 !== 0) return code2;
|
|
930
|
+
}
|
|
931
|
+
const here = relative2(ctx.io.cwd, dir);
|
|
932
|
+
ctx.io.out(
|
|
933
|
+
[
|
|
934
|
+
"",
|
|
935
|
+
"next:",
|
|
936
|
+
...here === "" ? [] : [` cd ${here}`],
|
|
937
|
+
" npm install # editor support (typescript, @types/node, solid-js) and the lockfile publishing needs; the kit in .iota/kit is untouched by it",
|
|
938
|
+
" npx iota-ext check",
|
|
939
|
+
" npx iota-ext test"
|
|
940
|
+
].join("\n")
|
|
941
|
+
);
|
|
942
|
+
return 0;
|
|
943
|
+
}
|
|
944
|
+
var HELP = `iota-ext \u2014 author tooling for extension packages
|
|
945
|
+
|
|
946
|
+
Usage: iota-ext <command> [options]
|
|
947
|
+
|
|
948
|
+
init <dir> --namespace <owner.module> [--name <npm>] [--no-client] [--no-kit] [--force]
|
|
949
|
+
scaffold a package (contracts, server, client, a passing test) and its offline kit
|
|
950
|
+
kit generate [--catalog <file|sdk>]...
|
|
951
|
+
render @iota-kit/* into .iota/kit from catalog snapshots, offline (default: the SDK natives core, crm)
|
|
952
|
+
kit pull --server <url> [--token-env VAR] [--cookie-env VAR]
|
|
953
|
+
download the live developer kit into .iota/kit from the application's /_ext/manage API
|
|
954
|
+
kit status verify the installed kit (modules, files, hashes, tsconfig paths); exit 1 when it is damaged
|
|
955
|
+
check typecheck, validate the graphs and the manifest (writes nothing)
|
|
956
|
+
build [--out <dir>] check, then write artifacts and manifest.json (default .iota/build)
|
|
957
|
+
test [filter...] typecheck, then run *.test.ts with the synthetic test host
|
|
958
|
+
|
|
959
|
+
Options for every command except init: --dir <package dir> (default: the current directory), --json (machine output).
|
|
960
|
+
Diagnostics print as "file:line:col code message".
|
|
961
|
+
Exit codes: 0 ok, 1 package errors or failing tests, 2 usage, 3 environment (network, worker, files).
|
|
962
|
+
`;
|
|
963
|
+
async function run(argv, io, moduleURL) {
|
|
964
|
+
const [command, ...rest] = argv;
|
|
965
|
+
const dist = locateDistribution(moduleURL);
|
|
966
|
+
const ctx = { io, dist, s: style(io.color) };
|
|
967
|
+
try {
|
|
968
|
+
switch (command) {
|
|
969
|
+
case void 0:
|
|
970
|
+
case "help":
|
|
971
|
+
case "--help":
|
|
972
|
+
case "-h":
|
|
973
|
+
io.out(HELP);
|
|
974
|
+
return command === void 0 ? 2 : 0;
|
|
975
|
+
case "--version":
|
|
976
|
+
case "version":
|
|
977
|
+
io.out(dist.sdkVersion);
|
|
978
|
+
return 0;
|
|
979
|
+
case "init":
|
|
980
|
+
return await init(ctx, rest);
|
|
981
|
+
case "kit":
|
|
982
|
+
return await kit(ctx, rest);
|
|
983
|
+
case "check":
|
|
984
|
+
return await check(ctx, rest);
|
|
985
|
+
case "build":
|
|
986
|
+
return await build(ctx, rest);
|
|
987
|
+
case "test":
|
|
988
|
+
return await test(ctx, rest);
|
|
989
|
+
default:
|
|
990
|
+
throw new UsageError(`unknown command "${command}"`);
|
|
991
|
+
}
|
|
992
|
+
} catch (err) {
|
|
993
|
+
if (err instanceof UsageError) {
|
|
994
|
+
io.err(`iota-ext: ${err.message}
|
|
995
|
+
run "iota-ext help" for usage`);
|
|
996
|
+
return 2;
|
|
997
|
+
}
|
|
998
|
+
if (err instanceof EnvironmentError) {
|
|
999
|
+
io.err(`iota-ext: ${err.message}`);
|
|
1000
|
+
return 3;
|
|
1001
|
+
}
|
|
1002
|
+
throw err;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// src/cli/main.ts
|
|
1007
|
+
for (const stream of [process.stdout, process.stderr]) stream.on("error", (err) => {
|
|
1008
|
+
if (err.code !== "EPIPE") throw err;
|
|
1009
|
+
});
|
|
1010
|
+
var color = process.stdout.isTTY === true && process.env.NO_COLOR === void 0;
|
|
1011
|
+
var code = await run(
|
|
1012
|
+
process.argv.slice(2),
|
|
1013
|
+
{
|
|
1014
|
+
cwd: process.cwd(),
|
|
1015
|
+
env: process.env,
|
|
1016
|
+
color,
|
|
1017
|
+
out: (text) => void process.stdout.write(`${text}
|
|
1018
|
+
`),
|
|
1019
|
+
err: (text) => void process.stderr.write(`${text}
|
|
1020
|
+
`)
|
|
1021
|
+
},
|
|
1022
|
+
import.meta.url
|
|
1023
|
+
).catch((err) => {
|
|
1024
|
+
process.stderr.write(`iota-ext: unexpected failure: ${err instanceof Error ? err.stack ?? err.message : String(err)}
|
|
1025
|
+
`);
|
|
1026
|
+
return 3;
|
|
1027
|
+
});
|
|
1028
|
+
process.exitCode = code;
|