@iota-uz/sdk 0.46.0 → 0.47.1
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,86 @@
|
|
|
1
|
+
import { createComponent, createContext, createEffect, createSignal, onCleanup, useContext } from "solid-js";
|
|
2
|
+
import { createClient } from "../client.mjs";
|
|
3
|
+
import { bindTransport } from "./transport.mjs";
|
|
4
|
+
const RuntimeTransportContext = createContext();
|
|
5
|
+
const RuntimeProvider = (props) => createComponent(RuntimeTransportContext.Provider, {
|
|
6
|
+
get value() {
|
|
7
|
+
return props.transport;
|
|
8
|
+
},
|
|
9
|
+
get children() {
|
|
10
|
+
return props.children;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
function useTransport() {
|
|
14
|
+
const transport = useContext(RuntimeTransportContext);
|
|
15
|
+
if (!transport) throw new Error("useQuery/useCommand must be used inside a page mounted by the iota runtime host");
|
|
16
|
+
return transport;
|
|
17
|
+
}
|
|
18
|
+
function isAbort(error) {
|
|
19
|
+
return error instanceof DOMException && error.name === "AbortError";
|
|
20
|
+
}
|
|
21
|
+
function useQuery(query, input) {
|
|
22
|
+
const transport = useTransport();
|
|
23
|
+
const [data, setData] = createSignal();
|
|
24
|
+
const [error, setError] = createSignal();
|
|
25
|
+
const [loading, setLoading] = createSignal(true);
|
|
26
|
+
const [tick, setTick] = createSignal(0);
|
|
27
|
+
let generation = 0;
|
|
28
|
+
let controller;
|
|
29
|
+
let disposed = false;
|
|
30
|
+
createEffect(() => {
|
|
31
|
+
tick();
|
|
32
|
+
const value = typeof input === "function" ? input() : input;
|
|
33
|
+
const mine = ++generation;
|
|
34
|
+
controller?.abort();
|
|
35
|
+
const current = controller = new AbortController();
|
|
36
|
+
setLoading(true);
|
|
37
|
+
setError(void 0);
|
|
38
|
+
void createClient(bindTransport(transport, current.signal)).query(query, value).then(
|
|
39
|
+
(result) => {
|
|
40
|
+
if (disposed || mine !== generation) return;
|
|
41
|
+
setData(() => result);
|
|
42
|
+
setLoading(false);
|
|
43
|
+
},
|
|
44
|
+
(cause) => {
|
|
45
|
+
if (disposed || mine !== generation || isAbort(cause)) return;
|
|
46
|
+
setError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
47
|
+
setLoading(false);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
onCleanup(() => {
|
|
52
|
+
disposed = true;
|
|
53
|
+
controller?.abort();
|
|
54
|
+
});
|
|
55
|
+
return { data, error, loading, refetch: () => setTick((n) => n + 1) };
|
|
56
|
+
}
|
|
57
|
+
function useCommand(command) {
|
|
58
|
+
const transport = useTransport();
|
|
59
|
+
const [inFlight, setInFlight] = createSignal(0);
|
|
60
|
+
const [error, setError] = createSignal();
|
|
61
|
+
let disposed = false;
|
|
62
|
+
let latest = 0;
|
|
63
|
+
onCleanup(() => {
|
|
64
|
+
disposed = true;
|
|
65
|
+
});
|
|
66
|
+
const api = createClient(bindTransport(transport));
|
|
67
|
+
async function run(input) {
|
|
68
|
+
const mine = ++latest;
|
|
69
|
+
setError(void 0);
|
|
70
|
+
setInFlight((n) => n + 1);
|
|
71
|
+
try {
|
|
72
|
+
return await api.command(command, input);
|
|
73
|
+
} catch (cause) {
|
|
74
|
+
if (!disposed && mine === latest) setError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
75
|
+
throw cause;
|
|
76
|
+
} finally {
|
|
77
|
+
if (!disposed) setInFlight((n) => n - 1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return { run, pending: () => inFlight() > 0, error, reset: () => setError(void 0) };
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
RuntimeProvider,
|
|
84
|
+
useCommand,
|
|
85
|
+
useQuery
|
|
86
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const PAGE_DATA_KIND = "iota.runtime.page";
|
|
2
|
+
const RUNTIME_CONTEXT_ELEMENT_ID = "iota-runtime-context";
|
|
3
|
+
const RUNTIME_CONTEXT_VERSION = "1.0.0";
|
|
4
|
+
const RPC_PATH = "/_ext/rpc";
|
|
5
|
+
function isPageData(value) {
|
|
6
|
+
if (!value || typeof value !== "object") return false;
|
|
7
|
+
const v = value;
|
|
8
|
+
return v.kind === PAGE_DATA_KIND && !!v.page && typeof v.page.module === "string" && typeof v.page.id === "string";
|
|
9
|
+
}
|
|
10
|
+
function major(version) {
|
|
11
|
+
return version.split(".", 1)[0] ?? "";
|
|
12
|
+
}
|
|
13
|
+
function readRuntimeContext(document, elementID = RUNTIME_CONTEXT_ELEMENT_ID) {
|
|
14
|
+
const element = document.getElementById(elementID);
|
|
15
|
+
if (!element?.textContent) return null;
|
|
16
|
+
const value = JSON.parse(element.textContent);
|
|
17
|
+
if (typeof value.version !== "string" || major(value.version) !== major(RUNTIME_CONTEXT_VERSION)) {
|
|
18
|
+
throw new Error(`runtime context ${String(value.version)} is incompatible with ${RUNTIME_CONTEXT_VERSION}`);
|
|
19
|
+
}
|
|
20
|
+
if (typeof value.rpc !== "string" || !value.navigation) throw new Error("runtime context is incomplete");
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
PAGE_DATA_KIND,
|
|
25
|
+
RPC_PATH,
|
|
26
|
+
RUNTIME_CONTEXT_ELEMENT_ID,
|
|
27
|
+
RUNTIME_CONTEXT_VERSION,
|
|
28
|
+
isPageData,
|
|
29
|
+
readRuntimeContext
|
|
30
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createComponent, createContext, createSignal, ErrorBoundary, For, onCleanup, useContext } from "solid-js";
|
|
2
|
+
import { ensureStyles } from "./styles.mjs";
|
|
3
|
+
const SlotContext = createContext();
|
|
4
|
+
const SlotsProvider = (props) => createComponent(SlotContext.Provider, {
|
|
5
|
+
get value() {
|
|
6
|
+
return props.source;
|
|
7
|
+
},
|
|
8
|
+
get children() {
|
|
9
|
+
return props.children;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
function Slot(props) {
|
|
13
|
+
const source = useContext(SlotContext);
|
|
14
|
+
if (!source) return void 0;
|
|
15
|
+
return createComponent(For, {
|
|
16
|
+
get each() {
|
|
17
|
+
return source.contributions(props.slot.slotId);
|
|
18
|
+
},
|
|
19
|
+
children: (contribution) => createComponent(ContributionView, { contribution, source, get props() {
|
|
20
|
+
return props.props;
|
|
21
|
+
} })
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function ContributionView(p) {
|
|
25
|
+
const [component, setComponent] = createSignal();
|
|
26
|
+
let disposed = false;
|
|
27
|
+
onCleanup(() => {
|
|
28
|
+
disposed = true;
|
|
29
|
+
});
|
|
30
|
+
void p.source.load(p.contribution).then((loaded) => {
|
|
31
|
+
if (!disposed && loaded) setComponent(() => loaded);
|
|
32
|
+
});
|
|
33
|
+
return createComponent(ErrorBoundary, {
|
|
34
|
+
fallback: (cause) => {
|
|
35
|
+
console.error(`Slot contribution ${p.contribution.id} failed`, cause);
|
|
36
|
+
return void 0;
|
|
37
|
+
},
|
|
38
|
+
get children() {
|
|
39
|
+
const Contribution = component();
|
|
40
|
+
return Contribution ? createComponent(Contribution, p.props) : void 0;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function resolveComponent(module, name) {
|
|
45
|
+
const value = name ? module[name] : module.default;
|
|
46
|
+
return value && typeof value.component === "function" ? value.component : void 0;
|
|
47
|
+
}
|
|
48
|
+
const EMPTY = [];
|
|
49
|
+
function createSlotSource(options) {
|
|
50
|
+
const importModule = options.importModule ?? ((url) => import(
|
|
51
|
+
/* @vite-ignore */
|
|
52
|
+
url
|
|
53
|
+
));
|
|
54
|
+
const log = options.console ?? console;
|
|
55
|
+
const modules = /* @__PURE__ */ new Map();
|
|
56
|
+
const doc = options.document ?? (typeof document === "undefined" ? void 0 : document);
|
|
57
|
+
return {
|
|
58
|
+
contributions: (slotId) => options.contributions[slotId] ?? EMPTY,
|
|
59
|
+
async load(contribution) {
|
|
60
|
+
let pending = modules.get(contribution.module);
|
|
61
|
+
if (!pending) {
|
|
62
|
+
pending = importModule(contribution.module);
|
|
63
|
+
modules.set(contribution.module, pending);
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const [module] = await Promise.all([pending, ensureStyles(doc, contribution.styles)]);
|
|
67
|
+
const component = resolveComponent(module, contribution.export);
|
|
68
|
+
if (!component) log.error(`Slot contribution ${contribution.id}: module ${contribution.module} has no component export "${contribution.export ?? "default"}"`);
|
|
69
|
+
return component;
|
|
70
|
+
} catch (cause) {
|
|
71
|
+
log.error(`Slot contribution ${contribution.id}: module ${contribution.module} could not be loaded`, cause);
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
Slot,
|
|
79
|
+
SlotsProvider,
|
|
80
|
+
createSlotSource,
|
|
81
|
+
resolveComponent
|
|
82
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const STYLE_ATTR = "data-iota-ext-css";
|
|
2
|
+
const STYLE_TIMEOUT_MS = 1e4;
|
|
3
|
+
function find(doc, href) {
|
|
4
|
+
const absolute = new URL(href, doc.baseURI).href;
|
|
5
|
+
return Array.from(doc.querySelectorAll('link[rel~="stylesheet"]')).find((link) => link.href === absolute);
|
|
6
|
+
}
|
|
7
|
+
const outcome = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
function settled(link, win) {
|
|
9
|
+
if (link.sheet !== null) return Promise.resolve(true);
|
|
10
|
+
const known = outcome.get(link);
|
|
11
|
+
if (known !== void 0) return Promise.resolve(known);
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
const finish = (ok) => {
|
|
14
|
+
win.clearTimeout(timer);
|
|
15
|
+
link.removeEventListener("load", onLoad);
|
|
16
|
+
link.removeEventListener("error", onError);
|
|
17
|
+
outcome.set(link, ok);
|
|
18
|
+
resolve(ok);
|
|
19
|
+
};
|
|
20
|
+
const onLoad = () => finish(true);
|
|
21
|
+
const onError = () => finish(false);
|
|
22
|
+
const timer = win.setTimeout(() => finish(false), STYLE_TIMEOUT_MS);
|
|
23
|
+
link.addEventListener("load", onLoad);
|
|
24
|
+
link.addEventListener("error", onError);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async function ensureStyles(doc, hrefs) {
|
|
28
|
+
const win = doc?.defaultView;
|
|
29
|
+
if (!doc || !win || !hrefs || hrefs.length === 0) return;
|
|
30
|
+
await Promise.all([...new Set(hrefs)].map(async (href) => {
|
|
31
|
+
let link = find(doc, href);
|
|
32
|
+
if (!link) {
|
|
33
|
+
link = doc.createElement("link");
|
|
34
|
+
link.rel = "stylesheet";
|
|
35
|
+
link.href = href;
|
|
36
|
+
link.setAttribute(STYLE_ATTR, "");
|
|
37
|
+
doc.head.append(link);
|
|
38
|
+
}
|
|
39
|
+
if (!await settled(link, win)) win.console.error(`Extension stylesheet ${href} could not be loaded; its components render without it`);
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
STYLE_ATTR,
|
|
44
|
+
ensureStyles
|
|
45
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { RemoteError } from "../client.mjs";
|
|
2
|
+
import { RPC_PATH } from "./protocol.mjs";
|
|
3
|
+
class TransportError extends Error {
|
|
4
|
+
kind = "transport";
|
|
5
|
+
status;
|
|
6
|
+
retriable;
|
|
7
|
+
// No parameter properties: the host build strips types only (scripts/build-host.mjs).
|
|
8
|
+
constructor(message, status, retriable, options) {
|
|
9
|
+
super(message, options);
|
|
10
|
+
this.name = "TransportError";
|
|
11
|
+
this.status = status;
|
|
12
|
+
this.retriable = retriable;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class UnauthenticatedError extends Error {
|
|
16
|
+
kind = "unauthenticated";
|
|
17
|
+
reauthUrl;
|
|
18
|
+
constructor(reauthUrl) {
|
|
19
|
+
super("Session expired");
|
|
20
|
+
this.name = "UnauthenticatedError";
|
|
21
|
+
this.reauthUrl = reauthUrl;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const TRANSIENT = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
25
|
+
function abortError(signal) {
|
|
26
|
+
return signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
27
|
+
}
|
|
28
|
+
function createRpcTransport(options = {}) {
|
|
29
|
+
const endpoint = options.endpoint ?? RPC_PATH;
|
|
30
|
+
const doFetch = options.fetch ?? ((...args) => fetch(...args));
|
|
31
|
+
const retries = Math.max(0, options.queryRetries ?? 1);
|
|
32
|
+
const delay = options.retryDelayMs ?? 200;
|
|
33
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
34
|
+
async function once(kind, resource, input, signal) {
|
|
35
|
+
const session = options.session?.snapshot();
|
|
36
|
+
let response;
|
|
37
|
+
try {
|
|
38
|
+
response = await doFetch(endpoint, {
|
|
39
|
+
method: "POST",
|
|
40
|
+
credentials: "same-origin",
|
|
41
|
+
...signal ? { signal } : {},
|
|
42
|
+
headers: {
|
|
43
|
+
"content-type": "application/json",
|
|
44
|
+
accept: "application/json",
|
|
45
|
+
...session?.csrf ? { "x-csrf-token": session.csrf } : {},
|
|
46
|
+
...session?.headers
|
|
47
|
+
},
|
|
48
|
+
body: JSON.stringify({ kind, resource, input })
|
|
49
|
+
});
|
|
50
|
+
} catch (cause) {
|
|
51
|
+
if (signal?.aborted) throw abortError(signal);
|
|
52
|
+
throw new TransportError(`Request to ${resource} failed`, void 0, true, { cause });
|
|
53
|
+
}
|
|
54
|
+
let body;
|
|
55
|
+
try {
|
|
56
|
+
body = await response.json();
|
|
57
|
+
} catch {
|
|
58
|
+
body = void 0;
|
|
59
|
+
}
|
|
60
|
+
if (body && body.ok === true) return body.value ?? null;
|
|
61
|
+
if (response.status === 401) throw new UnauthenticatedError(options.reauthUrl);
|
|
62
|
+
if (body?.error && typeof body.error.kind === "string") throw new RemoteError(body.error);
|
|
63
|
+
throw new TransportError(`Request to ${resource} failed with HTTP ${response.status}`, response.status, TRANSIENT.has(response.status));
|
|
64
|
+
}
|
|
65
|
+
async function invoke(kind, resource, input, call = {}) {
|
|
66
|
+
const query = kind === "query";
|
|
67
|
+
let refreshed = false;
|
|
68
|
+
for (let attempt = 0; ; attempt++) {
|
|
69
|
+
if (call.signal?.aborted) throw abortError(call.signal);
|
|
70
|
+
try {
|
|
71
|
+
return await once(kind, resource, input, call.signal);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (!query) throw error;
|
|
74
|
+
if (call.signal?.aborted) throw error;
|
|
75
|
+
if (error instanceof UnauthenticatedError && !refreshed && options.session) {
|
|
76
|
+
refreshed = true;
|
|
77
|
+
try {
|
|
78
|
+
await options.session.refresh(call.signal ?? new AbortController().signal);
|
|
79
|
+
} catch {
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (error instanceof TransportError && error.retriable && attempt < retries) {
|
|
85
|
+
await sleep(delay);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return { invoke };
|
|
93
|
+
}
|
|
94
|
+
function bindTransport(transport, signal) {
|
|
95
|
+
return { invoke: (kind, resource, input) => transport.invoke(kind, resource, input, signal ? { signal } : {}) };
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
TransportError,
|
|
99
|
+
UnauthenticatedError,
|
|
100
|
+
bindTransport,
|
|
101
|
+
createRpcTransport
|
|
102
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { contract, omitEmpty } from "./resource.mjs";
|
|
2
|
+
import { decode, encode, validate } from "./wire.mjs";
|
|
3
|
+
function page(target, spec) {
|
|
4
|
+
const isRoute = typeof target !== "string";
|
|
5
|
+
const replacement = isRoute && target.foreign;
|
|
6
|
+
const id = isRoute ? replacement ? "" : `${target.id}.page` : target;
|
|
7
|
+
const path = isRoute ? target.path : spec.path;
|
|
8
|
+
if (path === void 0) throw new Error(`page ${id}: path is required`);
|
|
9
|
+
const resource = omitEmpty({
|
|
10
|
+
id,
|
|
11
|
+
kind: "page",
|
|
12
|
+
path,
|
|
13
|
+
route: isRoute ? target.id : void 0,
|
|
14
|
+
nav: spec.nav,
|
|
15
|
+
permission: spec.permission?.id
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
...contract({ ...resource, id, kind: "page" }),
|
|
19
|
+
component: spec.component,
|
|
20
|
+
...replacement ? { implicitId: "export" } : {}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function navigation(spec) {
|
|
24
|
+
const id = spec.id ?? "";
|
|
25
|
+
const resource = omitEmpty({
|
|
26
|
+
id,
|
|
27
|
+
kind: "navigation",
|
|
28
|
+
groups: spec.groups && [...spec.groups],
|
|
29
|
+
patches: spec.patches && [...spec.patches],
|
|
30
|
+
workspaces: spec.workspaces && [...spec.workspaces],
|
|
31
|
+
palette: spec.palette && [...spec.palette]
|
|
32
|
+
});
|
|
33
|
+
return { ...contract({ ...resource, id, kind: "navigation" }), ...spec.id ? {} : { implicitId: "navigation" } };
|
|
34
|
+
}
|
|
35
|
+
function slot(target, component, opts = {}) {
|
|
36
|
+
const targetId = typeof target === "string" ? target : target.slotId;
|
|
37
|
+
const id = opts.id ?? "";
|
|
38
|
+
const resource = omitEmpty({ id, kind: "slot", target: targetId, order: opts.order, permission: opts.permission?.id });
|
|
39
|
+
return { ...contract({ ...resource, id, kind: "slot" }), component, ...opts.id ? {} : { implicitId: "export" } };
|
|
40
|
+
}
|
|
41
|
+
function cell(column, component, opts = {}) {
|
|
42
|
+
const id = opts.id ?? "";
|
|
43
|
+
const resource = omitEmpty({ id, kind: "cell", target: column.id });
|
|
44
|
+
return { ...contract({ ...resource, id, kind: "cell" }), component, ...opts.id ? {} : { implicitId: "export" } };
|
|
45
|
+
}
|
|
46
|
+
function shellRenderer(component, opts = {}) {
|
|
47
|
+
const id = opts.id ?? "";
|
|
48
|
+
return { ...contract({ id, kind: "shell" }), component, ...opts.id ? {} : { implicitId: "shell" } };
|
|
49
|
+
}
|
|
50
|
+
class RemoteError extends Error {
|
|
51
|
+
body;
|
|
52
|
+
constructor(body) {
|
|
53
|
+
super(body.message ?? body.code);
|
|
54
|
+
this.name = "RemoteError";
|
|
55
|
+
this.body = body;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
import { RuntimeProvider, useCommand, useQuery } from "./client-host/hooks.mjs";
|
|
59
|
+
import { helpDocHref, helpHref } from "./help.mjs";
|
|
60
|
+
import { Slot } from "./client-host/slots.mjs";
|
|
61
|
+
import { TransportError, UnauthenticatedError } from "./client-host/transport.mjs";
|
|
62
|
+
function isError(err, error) {
|
|
63
|
+
if (!(err instanceof RemoteError) || err.body.kind !== "domain" || err.body.code !== error.id) return false;
|
|
64
|
+
try {
|
|
65
|
+
validate(error.params, err.body.params);
|
|
66
|
+
return true;
|
|
67
|
+
} catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function issuesOf(err, issue) {
|
|
72
|
+
if (!(err instanceof RemoteError) || err.body.kind !== "validation") return [];
|
|
73
|
+
const out = [];
|
|
74
|
+
for (const i of err.body.issues ?? []) {
|
|
75
|
+
if (i.code !== issue.id) continue;
|
|
76
|
+
try {
|
|
77
|
+
validate(issue.params, i.params);
|
|
78
|
+
} catch {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
out.push({ code: issue.id, phase: i.phase, source: i.source, path: i.path, params: i.params });
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
function createClient(transport) {
|
|
86
|
+
async function query(q, input) {
|
|
87
|
+
const raw = await transport.invoke("query", q.id, encode(q.input, input));
|
|
88
|
+
return decode(q.output, raw);
|
|
89
|
+
}
|
|
90
|
+
async function command(c, input) {
|
|
91
|
+
const raw = await transport.invoke(c.atomic ? "atomic" : "command", c.id, encode(c.input, input));
|
|
92
|
+
const output = c.output;
|
|
93
|
+
return output === void 0 ? void 0 : decode(output, raw);
|
|
94
|
+
}
|
|
95
|
+
return { query, command };
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
RemoteError,
|
|
99
|
+
RuntimeProvider,
|
|
100
|
+
Slot,
|
|
101
|
+
TransportError,
|
|
102
|
+
UnauthenticatedError,
|
|
103
|
+
cell,
|
|
104
|
+
createClient,
|
|
105
|
+
helpDocHref,
|
|
106
|
+
helpHref,
|
|
107
|
+
isError,
|
|
108
|
+
issuesOf,
|
|
109
|
+
navigation,
|
|
110
|
+
page,
|
|
111
|
+
shellRenderer,
|
|
112
|
+
slot,
|
|
113
|
+
useCommand,
|
|
114
|
+
useQuery
|
|
115
|
+
};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { contract, omitEmpty } from "./resource.mjs";
|
|
2
|
+
import { encode } from "./wire.mjs";
|
|
3
|
+
function permission(id, spec) {
|
|
4
|
+
return { ...contract({ id, kind: "permission", label: spec.label }), label: spec.label };
|
|
5
|
+
}
|
|
6
|
+
const ISSUE = Symbol.for("iota.issue");
|
|
7
|
+
let makeError;
|
|
8
|
+
class ContractError extends Error {
|
|
9
|
+
kind;
|
|
10
|
+
code;
|
|
11
|
+
params;
|
|
12
|
+
issues;
|
|
13
|
+
constructor(kind, code, params, issues) {
|
|
14
|
+
super(`${code}${issues.length > 0 ? ` (${issues.map((i) => `${i.path.join(".")}: ${i.code}`).join(", ")})` : ""}`);
|
|
15
|
+
this.name = "ContractError";
|
|
16
|
+
this.kind = kind;
|
|
17
|
+
this.code = code;
|
|
18
|
+
this.params = params;
|
|
19
|
+
this.issues = issues;
|
|
20
|
+
}
|
|
21
|
+
static {
|
|
22
|
+
makeError = (kind, code, params, issues) => new ContractError(kind, code, params, issues);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function domainError(id, params) {
|
|
26
|
+
return {
|
|
27
|
+
...contract({ id, kind: "domainError", params: params.type }),
|
|
28
|
+
params,
|
|
29
|
+
of: (value) => makeError("domain", id, value, [])
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function issue(id, params) {
|
|
33
|
+
return {
|
|
34
|
+
...contract({ id, kind: "issue", params: params.type }),
|
|
35
|
+
params,
|
|
36
|
+
at: (path, value) => ({ [ISSUE]: true, code: id, path: [...path], params: value })
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function validation(...issues) {
|
|
40
|
+
for (const i of issues) {
|
|
41
|
+
if (i[ISSUE] !== true) throw new TypeError("validation(): issues must be created with Issue.at(path, params)");
|
|
42
|
+
}
|
|
43
|
+
return makeError("validation", "validation", null, issues);
|
|
44
|
+
}
|
|
45
|
+
function callable(id, kind, spec, atomic) {
|
|
46
|
+
return omitEmpty({
|
|
47
|
+
id,
|
|
48
|
+
kind,
|
|
49
|
+
label: spec.label,
|
|
50
|
+
description: spec.description,
|
|
51
|
+
atomic: atomic || void 0,
|
|
52
|
+
input: spec.input.type,
|
|
53
|
+
output: spec.output?.type,
|
|
54
|
+
errors: spec.errors?.map((e) => e.id),
|
|
55
|
+
permission: spec.permission?.id
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function query(id, spec) {
|
|
59
|
+
return { ...contract({ ...callable(id, "query", spec, false), id, kind: "query" }), input: spec.input, output: spec.output };
|
|
60
|
+
}
|
|
61
|
+
function command(id, spec) {
|
|
62
|
+
const atomic = spec.atomic === true;
|
|
63
|
+
return { ...contract({ ...callable(id, "command", spec, atomic), id, kind: "command" }), input: spec.input, output: spec.output, atomic };
|
|
64
|
+
}
|
|
65
|
+
function operation(id, spec) {
|
|
66
|
+
return { ...contract({ ...callable(id, "operation", spec, false), id, kind: "operation" }), input: spec.input, output: spec.output, atomic: true };
|
|
67
|
+
}
|
|
68
|
+
function event(id, spec) {
|
|
69
|
+
const resource = omitEmpty({ id, kind: "event", description: spec.description, subject: spec.subject?.id, payload: spec.payload.type });
|
|
70
|
+
return { ...contract(resource), subject: spec.subject, payload: spec.payload };
|
|
71
|
+
}
|
|
72
|
+
function notice(id, spec) {
|
|
73
|
+
const resource = omitEmpty({ id, kind: "notice", description: spec.description, subject: spec.subject?.id, payload: spec.payload.type });
|
|
74
|
+
return { ...contract(resource), subject: spec.subject, payload: spec.payload };
|
|
75
|
+
}
|
|
76
|
+
function workflow(id, spec) {
|
|
77
|
+
const signalTypes = Object.fromEntries(Object.entries(spec.signals ?? {}).map(([k, s]) => [k, s.type]));
|
|
78
|
+
const resource = omitEmpty({
|
|
79
|
+
id,
|
|
80
|
+
kind: "workflow",
|
|
81
|
+
description: spec.description,
|
|
82
|
+
input: spec.input.type,
|
|
83
|
+
output: spec.output?.type,
|
|
84
|
+
signals: Object.keys(signalTypes).length > 0 ? signalTypes : void 0
|
|
85
|
+
});
|
|
86
|
+
const signals = Object.fromEntries(
|
|
87
|
+
Object.entries(spec.signals ?? {}).map(([name, schema]) => [name, { workflow: id, name, schema }])
|
|
88
|
+
);
|
|
89
|
+
return { ...contract({ ...resource, id, kind: "workflow" }), input: spec.input, output: spec.output, signals };
|
|
90
|
+
}
|
|
91
|
+
const ROUTE_PARAM_KINDS = /* @__PURE__ */ new Set(["string", "uuid", "int", "int64"]);
|
|
92
|
+
const PARAM_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
93
|
+
function parsePath(where, path) {
|
|
94
|
+
if (!path.startsWith("/")) throw new Error(`${where}: path "${path}" must start with "/"`);
|
|
95
|
+
const names = /* @__PURE__ */ new Set();
|
|
96
|
+
return path.split("/").slice(1).map((segment) => {
|
|
97
|
+
if (!segment.includes(":")) return { literal: segment };
|
|
98
|
+
const name = segment.slice(1);
|
|
99
|
+
if (!segment.startsWith(":") || !PARAM_NAME.test(name)) throw new Error(`${where}: path segment "${segment}" must be a literal or exactly ":name"`);
|
|
100
|
+
if (names.has(name)) throw new Error(`${where}: path parameter ":${name}" appears twice`);
|
|
101
|
+
names.add(name);
|
|
102
|
+
return { literal: "", param: name };
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function checkRouteParams(id, path, params) {
|
|
106
|
+
const names = parsePath(`route ${id}`, path).flatMap((s) => s.param === void 0 ? [] : [s.param]);
|
|
107
|
+
const type = params.type;
|
|
108
|
+
if (type.kind !== "object" || type.optional || type.nullable) throw new Error(`route ${id}: params must be t.object({...})`);
|
|
109
|
+
const declared = new Map((type.properties ?? []).map((p) => [p.name, p.type]));
|
|
110
|
+
for (const name of names) {
|
|
111
|
+
const p = declared.get(name);
|
|
112
|
+
if (p === void 0) throw new Error(`route ${id}: path parameter ":${name}" has no schema in params`);
|
|
113
|
+
if (!ROUTE_PARAM_KINDS.has(p.kind)) throw new Error(`route ${id}: ":${name}" is ${p.kind}; path parameters are string, uuid, int or int64`);
|
|
114
|
+
if (p.optional || p.nullable) throw new Error(`route ${id}: ":${name}" must be required and non-null`);
|
|
115
|
+
}
|
|
116
|
+
for (const name of declared.keys()) {
|
|
117
|
+
if (!names.includes(name)) throw new Error(`route ${id}: params has "${name}", which is not a :segment of "${path}"`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function route(id, spec) {
|
|
121
|
+
checkRouteParams(id, spec.path, spec.params);
|
|
122
|
+
return { ...contract({ id, kind: "route", path: spec.path, params: spec.params.type }), path: spec.path, params: spec.params };
|
|
123
|
+
}
|
|
124
|
+
function href(r, params) {
|
|
125
|
+
const wire = encode(r.params, params);
|
|
126
|
+
const values = typeof wire === "object" && wire !== null && !Array.isArray(wire) ? wire : {};
|
|
127
|
+
return "/" + parsePath(`route ${r.id}`, r.path).map((segment) => {
|
|
128
|
+
if (segment.param === void 0) return segment.literal;
|
|
129
|
+
const value = String(values[segment.param]);
|
|
130
|
+
if (value === "" || value === "." || value === "..") throw new Error(`route ${r.id}: ":${segment.param}" cannot be "${value}"`);
|
|
131
|
+
return encodeURIComponent(value);
|
|
132
|
+
}).join("/");
|
|
133
|
+
}
|
|
134
|
+
function contactResolver(id, entity) {
|
|
135
|
+
return { ...contract({ id, kind: "contactResolver", subject: entity.id }), entity };
|
|
136
|
+
}
|
|
137
|
+
function deliveryPolicy(id, entity) {
|
|
138
|
+
return { ...contract({ id, kind: "deliveryPolicy", subject: entity.id }), entity };
|
|
139
|
+
}
|
|
140
|
+
function nativeList(id) {
|
|
141
|
+
return { listId: id };
|
|
142
|
+
}
|
|
143
|
+
function slotRef(id, _props) {
|
|
144
|
+
return { slotId: id };
|
|
145
|
+
}
|
|
146
|
+
function defineSlot(id, spec) {
|
|
147
|
+
const resource = omitEmpty({ id, kind: "slot", props: spec.props.type, permission: spec.permission?.id });
|
|
148
|
+
return { ...contract({ ...resource, id, kind: "slot" }), slotId: id };
|
|
149
|
+
}
|
|
150
|
+
function column(list, spec) {
|
|
151
|
+
const resource = omitEmpty({
|
|
152
|
+
id: spec.id,
|
|
153
|
+
kind: "column",
|
|
154
|
+
label: spec.label,
|
|
155
|
+
list: list.listId,
|
|
156
|
+
overlay: spec.field.owner,
|
|
157
|
+
field: spec.field.key,
|
|
158
|
+
filterable: spec.filterable,
|
|
159
|
+
sortable: spec.sortable,
|
|
160
|
+
exportable: spec.exportable
|
|
161
|
+
});
|
|
162
|
+
return { ...contract({ ...resource, id: spec.id, kind: "column" }), list: list.listId };
|
|
163
|
+
}
|
|
164
|
+
export {
|
|
165
|
+
ContractError,
|
|
166
|
+
ISSUE,
|
|
167
|
+
column,
|
|
168
|
+
command,
|
|
169
|
+
contactResolver,
|
|
170
|
+
defineSlot,
|
|
171
|
+
deliveryPolicy,
|
|
172
|
+
domainError,
|
|
173
|
+
event,
|
|
174
|
+
href,
|
|
175
|
+
issue,
|
|
176
|
+
nativeList,
|
|
177
|
+
notice,
|
|
178
|
+
operation,
|
|
179
|
+
permission,
|
|
180
|
+
query,
|
|
181
|
+
route,
|
|
182
|
+
slotRef,
|
|
183
|
+
validation,
|
|
184
|
+
workflow
|
|
185
|
+
};
|