@voxgig/sdkgen-langpack 0.0.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/.sdk/model/target/dart.aon +63 -0
- package/.sdk/model/target/haskell.aon +72 -0
- package/.sdk/model/target/lean.aon +91 -0
- package/.sdk/src/cmp/dart/Config_dart.ts +248 -0
- package/.sdk/src/cmp/dart/EntityBase_dart.ts +34 -0
- package/.sdk/src/cmp/dart/EntityOperation_dart.ts +43 -0
- package/.sdk/src/cmp/dart/EntityTypes_dart.ts +207 -0
- package/.sdk/src/cmp/dart/Entity_dart.ts +87 -0
- package/.sdk/src/cmp/dart/Gitignore_dart.ts +34 -0
- package/.sdk/src/cmp/dart/MainEntity_dart.ts +33 -0
- package/.sdk/src/cmp/dart/Main_dart.ts +178 -0
- package/.sdk/src/cmp/dart/Package_dart.ts +82 -0
- package/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +177 -0
- package/.sdk/src/cmp/dart/ReadmeExamplesTest_dart.ts +238 -0
- package/.sdk/src/cmp/dart/ReadmeExplanation_dart.ts +53 -0
- package/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +152 -0
- package/.sdk/src/cmp/dart/ReadmeInstall_dart.ts +59 -0
- package/.sdk/src/cmp/dart/ReadmeIntro_dart.ts +65 -0
- package/.sdk/src/cmp/dart/ReadmeModel_dart.ts +151 -0
- package/.sdk/src/cmp/dart/ReadmeOptions_dart.ts +63 -0
- package/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +225 -0
- package/.sdk/src/cmp/dart/ReadmeRef_dart.ts +397 -0
- package/.sdk/src/cmp/dart/ReadmeTopHowto_dart.ts +24 -0
- package/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +106 -0
- package/.sdk/src/cmp/dart/ReadmeTopTest_dart.ts +78 -0
- package/.sdk/src/cmp/dart/SdkError_dart.ts +42 -0
- package/.sdk/src/cmp/dart/TestDirect_dart.ts +516 -0
- package/.sdk/src/cmp/dart/TestEntity_dart.ts +628 -0
- package/.sdk/src/cmp/dart/Test_dart.ts +138 -0
- package/.sdk/src/cmp/dart/fragment/Config.data.fragment.dart +98 -0
- package/.sdk/src/cmp/dart/fragment/Config.fragment.dart +70 -0
- package/.sdk/src/cmp/dart/fragment/Direct.test.fragment.dart +25 -0
- package/.sdk/src/cmp/dart/fragment/Entity.fragment.dart +29 -0
- package/.sdk/src/cmp/dart/fragment/Entity.test.fragment.dart +28 -0
- package/.sdk/src/cmp/dart/fragment/EntityBase.fragment.dart +302 -0
- package/.sdk/src/cmp/dart/fragment/EntityCreateOp.fragment.dart +98 -0
- package/.sdk/src/cmp/dart/fragment/EntityListOp.fragment.dart +90 -0
- package/.sdk/src/cmp/dart/fragment/EntityLoadOp.fragment.dart +102 -0
- package/.sdk/src/cmp/dart/fragment/EntityRemoveOp.fragment.dart +108 -0
- package/.sdk/src/cmp/dart/fragment/EntityUpdateOp.fragment.dart +102 -0
- package/.sdk/src/cmp/dart/fragment/Main.fragment.dart +339 -0
- package/.sdk/src/cmp/dart/fragment/SdkError.fragment.dart +26 -0
- package/.sdk/src/cmp/dart/tsconfig.json +15 -0
- package/.sdk/src/cmp/dart/utility_dart.ts +155 -0
- package/.sdk/src/cmp/haskell/Config_haskell.ts +98 -0
- package/.sdk/src/cmp/haskell/Entity_haskell.ts +13 -0
- package/.sdk/src/cmp/haskell/Gitignore_haskell.ts +27 -0
- package/.sdk/src/cmp/haskell/Main_haskell.ts +123 -0
- package/.sdk/src/cmp/haskell/Package_haskell.ts +60 -0
- package/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +186 -0
- package/.sdk/src/cmp/haskell/ReadmeExamplesTest_haskell.ts +135 -0
- package/.sdk/src/cmp/haskell/ReadmeExplanation_haskell.ts +48 -0
- package/.sdk/src/cmp/haskell/ReadmeHowto_haskell.ts +168 -0
- package/.sdk/src/cmp/haskell/ReadmeInstall_haskell.ts +51 -0
- package/.sdk/src/cmp/haskell/ReadmeIntro_haskell.ts +67 -0
- package/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +162 -0
- package/.sdk/src/cmp/haskell/ReadmeOptions_haskell.ts +74 -0
- package/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +241 -0
- package/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +408 -0
- package/.sdk/src/cmp/haskell/ReadmeTopHowto_haskell.ts +31 -0
- package/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +104 -0
- package/.sdk/src/cmp/haskell/ReadmeTopTest_haskell.ts +80 -0
- package/.sdk/src/cmp/haskell/Test_haskell.ts +297 -0
- package/.sdk/src/cmp/haskell/tsconfig.json +15 -0
- package/.sdk/src/cmp/haskell/utility_haskell.ts +166 -0
- package/.sdk/src/cmp/lean/Config_lean.ts +93 -0
- package/.sdk/src/cmp/lean/Entity_lean.ts +9 -0
- package/.sdk/src/cmp/lean/Gitignore_lean.ts +18 -0
- package/.sdk/src/cmp/lean/Main_lean.ts +120 -0
- package/.sdk/src/cmp/lean/Package_lean.ts +93 -0
- package/.sdk/src/cmp/lean/ReadmeEntity_lean.ts +29 -0
- package/.sdk/src/cmp/lean/ReadmeExplanation_lean.ts +19 -0
- package/.sdk/src/cmp/lean/ReadmeHowto_lean.ts +25 -0
- package/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +39 -0
- package/.sdk/src/cmp/lean/ReadmeIntro_lean.ts +25 -0
- package/.sdk/src/cmp/lean/ReadmeModel_lean.ts +24 -0
- package/.sdk/src/cmp/lean/ReadmeOptions_lean.ts +22 -0
- package/.sdk/src/cmp/lean/ReadmeQuick_lean.ts +50 -0
- package/.sdk/src/cmp/lean/ReadmeRef_lean.ts +40 -0
- package/.sdk/src/cmp/lean/ReadmeTopHowto_lean.ts +16 -0
- package/.sdk/src/cmp/lean/ReadmeTopQuick_lean.ts +23 -0
- package/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +19 -0
- package/.sdk/src/cmp/lean/Test_lean.ts +261 -0
- package/.sdk/src/cmp/lean/utility_lean.ts +129 -0
- package/.sdk/tm/dart/LICENSE +22 -0
- package/.sdk/tm/dart/Makefile +50 -0
- package/.sdk/tm/dart/lib/Context.dart +150 -0
- package/.sdk/tm/dart/lib/Control.dart +15 -0
- package/.sdk/tm/dart/lib/Operation.dart +31 -0
- package/.sdk/tm/dart/lib/Point.dart +51 -0
- package/.sdk/tm/dart/lib/Response.dart +32 -0
- package/.sdk/tm/dart/lib/Result.dart +39 -0
- package/.sdk/tm/dart/lib/Spec.dart +49 -0
- package/.sdk/tm/dart/lib/feature/audit/AuditFeature.dart +103 -0
- package/.sdk/tm/dart/lib/feature/base/BaseFeature.dart +76 -0
- package/.sdk/tm/dart/lib/feature/cache/CacheFeature.dart +152 -0
- package/.sdk/tm/dart/lib/feature/clienttrack/ClienttrackFeature.dart +104 -0
- package/.sdk/tm/dart/lib/feature/cost/CostFeature.dart +446 -0
- package/.sdk/tm/dart/lib/feature/debug/DebugFeature.dart +153 -0
- package/.sdk/tm/dart/lib/feature/idempotency/IdempotencyFeature.dart +92 -0
- package/.sdk/tm/dart/lib/feature/log/LogFeature.dart +85 -0
- package/.sdk/tm/dart/lib/feature/metrics/MetricsFeature.dart +103 -0
- package/.sdk/tm/dart/lib/feature/netsim/NetsimFeature.dart +186 -0
- package/.sdk/tm/dart/lib/feature/paging/PagingFeature.dart +240 -0
- package/.sdk/tm/dart/lib/feature/proxy/ProxyFeature.dart +118 -0
- package/.sdk/tm/dart/lib/feature/ratelimit/RatelimitFeature.dart +103 -0
- package/.sdk/tm/dart/lib/feature/rbac/RbacFeature.dart +121 -0
- package/.sdk/tm/dart/lib/feature/retry/RetryFeature.dart +155 -0
- package/.sdk/tm/dart/lib/feature/secrets/SecretsFeature.dart +649 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/capability.dart +105 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/catalog.dart +46 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/config.dart +297 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/depend.dart +198 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/env.dart +144 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/export.dart +58 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/graph.dart +160 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/host.dart +1067 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/order.dart +172 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/plugin.dart +23 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/point.dart +117 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/ref.dart +105 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/resolve.dart +58 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/types.dart +201 -0
- package/.sdk/tm/dart/lib/feature/secrets/plugin/version.dart +116 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/aws.dart +285 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/azuresecrets.dart +178 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/boru.dart +145 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/crypto.dart +194 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/doppler.dart +101 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/gcpsecrets.dart +143 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/hashicorp.dart +190 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/httpjson.dart +363 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/infisical.dart +149 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/onepassword.dart +146 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/secretspec.dart +116 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/sigv4.dart +237 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/addr.dart +138 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/json.dart +276 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/provider.dart +31 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/providers.dart +243 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/sekreto.dart +730 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/spec.dart +200 -0
- package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/support.dart +217 -0
- package/.sdk/tm/dart/lib/feature/streaming/StreamingFeature.dart +97 -0
- package/.sdk/tm/dart/lib/feature/telemetry/TelemetryFeature.dart +136 -0
- package/.sdk/tm/dart/lib/feature/test/TestFeature.dart +328 -0
- package/.sdk/tm/dart/lib/feature/timeout/TimeoutFeature.dart +104 -0
- package/.sdk/tm/dart/lib/utility/CleanUtility.dart +12 -0
- package/.sdk/tm/dart/lib/utility/DoneUtility.dart +18 -0
- package/.sdk/tm/dart/lib/utility/ErrUtility.dart +46 -0
- package/.sdk/tm/dart/lib/utility/FeatureAddUtility.dart +35 -0
- package/.sdk/tm/dart/lib/utility/FeatureHookUtility.dart +20 -0
- package/.sdk/tm/dart/lib/utility/FeatureInitUtility.dart +9 -0
- package/.sdk/tm/dart/lib/utility/FetcherUtility.dart +104 -0
- package/.sdk/tm/dart/lib/utility/GraphqlUtility.dart +162 -0
- package/.sdk/tm/dart/lib/utility/MakeContextUtility.dart +6 -0
- package/.sdk/tm/dart/lib/utility/MakeErrorUtility.dart +71 -0
- package/.sdk/tm/dart/lib/utility/MakeFetchDefUtility.dart +42 -0
- package/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +233 -0
- package/.sdk/tm/dart/lib/utility/MakePointUtility.dart +130 -0
- package/.sdk/tm/dart/lib/utility/MakeRequestUtility.dart +66 -0
- package/.sdk/tm/dart/lib/utility/MakeResponseUtility.dart +59 -0
- package/.sdk/tm/dart/lib/utility/MakeResultUtility.dart +49 -0
- package/.sdk/tm/dart/lib/utility/MakeSpecUtility.dart +77 -0
- package/.sdk/tm/dart/lib/utility/MakeUrlUtility.dart +51 -0
- package/.sdk/tm/dart/lib/utility/ParamUtility.dart +56 -0
- package/.sdk/tm/dart/lib/utility/PrepareAuthUtility.dart +46 -0
- package/.sdk/tm/dart/lib/utility/PrepareBodyUtility.dart +19 -0
- package/.sdk/tm/dart/lib/utility/PrepareHeadersUtility.dart +11 -0
- package/.sdk/tm/dart/lib/utility/PrepareMethodUtility.dart +30 -0
- package/.sdk/tm/dart/lib/utility/PrepareParamsUtility.dart +23 -0
- package/.sdk/tm/dart/lib/utility/PreparePathUtility.dart +9 -0
- package/.sdk/tm/dart/lib/utility/PrepareQueryUtility.dart +18 -0
- package/.sdk/tm/dart/lib/utility/ResultBasicUtility.dart +29 -0
- package/.sdk/tm/dart/lib/utility/ResultBodyUtility.dart +15 -0
- package/.sdk/tm/dart/lib/utility/ResultHeadersUtility.dart +18 -0
- package/.sdk/tm/dart/lib/utility/StructUtility.dart +127 -0
- package/.sdk/tm/dart/lib/utility/TransformRequestUtility.dart +28 -0
- package/.sdk/tm/dart/lib/utility/TransformResponseUtility.dart +44 -0
- package/.sdk/tm/dart/lib/utility/Utility.dart +239 -0
- package/.sdk/tm/dart/lib/utility/voxgig_struct.dart +2462 -0
- package/.sdk/tm/dart/src/feature/README.md +3 -0
- package/.sdk/tm/dart/src/feature/audit/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/base/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/cache/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/clienttrack/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/cost/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/debug/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/idempotency/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/log/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/metrics/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/netsim/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/paging/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/proxy/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/ratelimit/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/rbac/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/retry/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/secrets/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/streaming/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/telemetry/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/test/.gitkeep +0 -0
- package/.sdk/tm/dart/src/feature/timeout/.gitkeep +0 -0
- package/.sdk/tm/dart/test/custom_test.dart +65 -0
- package/.sdk/tm/dart/test/exists_test.dart +12 -0
- package/.sdk/tm/dart/test/feature/harness.dart +347 -0
- package/.sdk/tm/dart/test/feature/secrets/secrets_test.dart +1107 -0
- package/.sdk/tm/dart/test/feature_test.dart +1193 -0
- package/.sdk/tm/dart/test/harness.dart +153 -0
- package/.sdk/tm/dart/test/netsim_test.dart +48 -0
- package/.sdk/tm/dart/test/omni.dart +520 -0
- package/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
- package/.sdk/tm/dart/test/pipeline_test.dart +608 -0
- package/.sdk/tm/dart/test/primary_test.dart +476 -0
- package/.sdk/tm/dart/test/sdk-test-control.json +19 -0
- package/.sdk/tm/dart/test/struct_test.dart +468 -0
- package/.sdk/tm/dart/test/utility.dart +198 -0
- package/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
- package/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
- package/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
- package/.sdk/tm/haskell/LICENSE +21 -0
- package/.sdk/tm/haskell/Makefile +22 -0
- package/.sdk/tm/haskell/VERSION +1 -0
- package/.sdk/tm/haskell/src/SdkFeatures.hs +1440 -0
- package/.sdk/tm/haskell/src/SdkHelpers.hs +337 -0
- package/.sdk/tm/haskell/src/SdkJson.hs +111 -0
- package/.sdk/tm/haskell/src/SdkRuntime.hs +1279 -0
- package/.sdk/tm/haskell/src/SdkTypes.hs +195 -0
- package/.sdk/tm/haskell/src/VoxgigStruct.hs +2299 -0
- package/.sdk/tm/haskell/src/Vregex.hs +237 -0
- package/.sdk/tm/haskell/src/feature/README.md +5 -0
- package/.sdk/tm/haskell/src/feature/audit/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/base/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/cache/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/clienttrack/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/debug/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/idempotency/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/log/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/metrics/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/netsim/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/paging/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/proxy/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/ratelimit/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/rbac/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/retry/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/streaming/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/telemetry/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/test/.gitkeep +0 -0
- package/.sdk/tm/haskell/src/feature/timeout/.gitkeep +0 -0
- package/.sdk/tm/haskell/test/Harness.hs +281 -0
- package/.sdk/tm/haskell/test/OmniResolver.hs +252 -0
- package/.sdk/tm/haskell/test/Runner.hs +49 -0
- package/.sdk/tm/haskell/test/StructCorpus.hs +449 -0
- package/.sdk/tm/haskell/test/TCustomUtility.hs +38 -0
- package/.sdk/tm/haskell/test/TFeature.hs +794 -0
- package/.sdk/tm/haskell/test/TNetsim.hs +50 -0
- package/.sdk/tm/haskell/test/TPipeline.hs +334 -0
- package/.sdk/tm/haskell/test/TPrimaryCorpus.hs +263 -0
- package/.sdk/tm/haskell/test/TPrimaryUtility.hs +386 -0
- package/.sdk/tm/haskell/test/Testutil.hs +59 -0
- package/.sdk/tm/haskell/test/vendor/omni/Omni.hs +1147 -0
- package/.sdk/tm/lean/LICENSE +21 -0
- package/.sdk/tm/lean/Makefile +32 -0
- package/.sdk/tm/lean/VERSION +1 -0
- package/.sdk/tm/lean/src/SdkFeature.lean +171 -0
- package/.sdk/tm/lean/src/SdkFeatures.lean +787 -0
- package/.sdk/tm/lean/src/SdkJson.lean +134 -0
- package/.sdk/tm/lean/src/SdkRuntime.lean +374 -0
- package/.sdk/tm/lean/src/SdkUtility.lean +809 -0
- package/.sdk/tm/lean/src/VoxgigStruct.lean +2880 -0
- package/.sdk/tm/lean/src/Vregex.lean +412 -0
- package/.sdk/tm/lean/src/feature/README.md +5 -0
- package/.sdk/tm/lean/src/feature/audit/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/base/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/cache/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/clienttrack/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/cost/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/debug/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/idempotency/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/log/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/metrics/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/netsim/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/paging/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/proxy/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/ratelimit/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/rbac/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/retry/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/streaming/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/telemetry/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/test/.gitkeep +0 -0
- package/.sdk/tm/lean/src/feature/timeout/.gitkeep +0 -0
- package/.sdk/tm/lean/test/OmniResolver.lean +358 -0
- package/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
- package/.sdk/tm/lean/test/StructCorpus.lean +368 -0
- package/.sdk/tm/lean/test/TFeature.lean +281 -0
- package/.sdk/tm/lean/test/TPrimaryUtility.lean +227 -0
- package/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
- package/LICENSE +21 -0
- package/README.md +104 -0
- package/package.json +78 -0
- package/sdkgen-package.json +22 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/- JSON reader: String -> struct `Value`.
|
|
2
|
+
The runtime parses HTTP response bodies into the vendored voxgig-struct
|
|
3
|
+
`Value` model (VoxgigStruct.lean), so specs/options/payloads/results are all
|
|
4
|
+
the same reference-stable node type — exactly as the Python/Go SDKs pass
|
|
5
|
+
`map[string]any` around. Serialisation back to a String is `stringify`
|
|
6
|
+
(VoxgigStruct). -/
|
|
7
|
+
|
|
8
|
+
import VoxgigStruct
|
|
9
|
+
|
|
10
|
+
open VoxgigStruct
|
|
11
|
+
|
|
12
|
+
namespace SdkJson
|
|
13
|
+
|
|
14
|
+
structure JState where
|
|
15
|
+
src : Array Char
|
|
16
|
+
pos : Nat
|
|
17
|
+
|
|
18
|
+
partial def jPeek (s : JState) : Option Char := s.src[s.pos]?
|
|
19
|
+
|
|
20
|
+
partial def jSkipWs (s : JState) : JState := Id.run do
|
|
21
|
+
let mut p := s.pos
|
|
22
|
+
while p < s.src.size &&
|
|
23
|
+
(s.src[p]! == ' ' || s.src[p]! == '\t' || s.src[p]! == '\n' || s.src[p]! == '\r') do
|
|
24
|
+
p := p + 1
|
|
25
|
+
return { s with pos := p }
|
|
26
|
+
|
|
27
|
+
partial def jStr (s0 : JState) : SIO (String × JState) := do
|
|
28
|
+
let src := s0.src
|
|
29
|
+
let mut p := s0.pos + 1
|
|
30
|
+
let mut b := ""
|
|
31
|
+
repeat do
|
|
32
|
+
if p >= src.size then break
|
|
33
|
+
let c := src[p]!
|
|
34
|
+
p := p + 1
|
|
35
|
+
if c == '"' then break
|
|
36
|
+
if c == '\\' then
|
|
37
|
+
let e := src[p]!
|
|
38
|
+
p := p + 1
|
|
39
|
+
match e with
|
|
40
|
+
| '"' => b := b.push '"'
|
|
41
|
+
| '\\' => b := b.push '\\'
|
|
42
|
+
| '/' => b := b.push '/'
|
|
43
|
+
| 'n' => b := b.push '\n'
|
|
44
|
+
| 't' => b := b.push '\t'
|
|
45
|
+
| 'r' => b := b.push '\r'
|
|
46
|
+
| 'b' => b := b.push '\x08'
|
|
47
|
+
| 'f' => b := b.push '\x0c'
|
|
48
|
+
| 'u' => do
|
|
49
|
+
let mut code : Nat := 0
|
|
50
|
+
for _ in [0:4] do
|
|
51
|
+
let h := src[p]!
|
|
52
|
+
p := p + 1
|
|
53
|
+
let d :=
|
|
54
|
+
if h >= '0' && h <= '9' then h.toNat - '0'.toNat
|
|
55
|
+
else if h >= 'a' && h <= 'f' then 10 + h.toNat - 'a'.toNat
|
|
56
|
+
else if h >= 'A' && h <= 'F' then 10 + h.toNat - 'A'.toNat
|
|
57
|
+
else 0
|
|
58
|
+
code := code * 16 + d
|
|
59
|
+
b := b.push (Char.ofNat code)
|
|
60
|
+
| c => b := b.push c
|
|
61
|
+
else
|
|
62
|
+
b := b.push c
|
|
63
|
+
return (b, { s0 with pos := p })
|
|
64
|
+
|
|
65
|
+
mutual
|
|
66
|
+
|
|
67
|
+
partial def jVal (s0 : JState) : SIO (Value × JState) := do
|
|
68
|
+
let s := jSkipWs s0
|
|
69
|
+
match jPeek s with
|
|
70
|
+
| some '{' => jObj s
|
|
71
|
+
| some '[' => jArr s
|
|
72
|
+
| some '"' => do
|
|
73
|
+
let (str, s') ← jStr s
|
|
74
|
+
pure (.str str, s')
|
|
75
|
+
| some 't' => pure (.bool true, { s with pos := s.pos + 4 })
|
|
76
|
+
| some 'f' => pure (.bool false, { s with pos := s.pos + 5 })
|
|
77
|
+
| some 'n' => pure (.null, { s with pos := s.pos + 4 })
|
|
78
|
+
| _ => jNum s
|
|
79
|
+
|
|
80
|
+
partial def jObj (s0 : JState) : SIO (Value × JState) := do
|
|
81
|
+
let s := jSkipWs { s0 with pos := s0.pos + 1 }
|
|
82
|
+
if jPeek s == some '}' then
|
|
83
|
+
pure (← emptyMap, { s with pos := s.pos + 1 })
|
|
84
|
+
else do
|
|
85
|
+
let m ← emptyMap
|
|
86
|
+
let sRef ← IO.mkRef s
|
|
87
|
+
repeat do
|
|
88
|
+
let s1 := jSkipWs (← sRef.get)
|
|
89
|
+
let (k, s2) ← jStr s1
|
|
90
|
+
let s3 := jSkipWs s2
|
|
91
|
+
let s4 := { s3 with pos := s3.pos + 1 } -- ':'
|
|
92
|
+
let (v, s5) ← jVal s4
|
|
93
|
+
let _ ← setprop m (.str k) v
|
|
94
|
+
let s6 := jSkipWs s5
|
|
95
|
+
let c := (jPeek s6).getD '}'
|
|
96
|
+
sRef.set { s6 with pos := s6.pos + 1 }
|
|
97
|
+
if c != ',' then break
|
|
98
|
+
pure (m, ← sRef.get)
|
|
99
|
+
|
|
100
|
+
partial def jArr (s0 : JState) : SIO (Value × JState) := do
|
|
101
|
+
let s := jSkipWs { s0 with pos := s0.pos + 1 }
|
|
102
|
+
if jPeek s == some ']' then
|
|
103
|
+
pure (← emptyList, { s with pos := s.pos + 1 })
|
|
104
|
+
else do
|
|
105
|
+
let sRef ← IO.mkRef s
|
|
106
|
+
let accRef ← IO.mkRef (#[] : Array Value)
|
|
107
|
+
repeat do
|
|
108
|
+
let (v, s1) ← jVal (← sRef.get)
|
|
109
|
+
accRef.modify (·.push v)
|
|
110
|
+
let s2 := jSkipWs s1
|
|
111
|
+
let c := (jPeek s2).getD ']'
|
|
112
|
+
sRef.set { s2 with pos := s2.pos + 1 }
|
|
113
|
+
if c != ',' then break
|
|
114
|
+
pure (← newList (← accRef.get), ← sRef.get)
|
|
115
|
+
|
|
116
|
+
partial def jNum (s0 : JState) : SIO (Value × JState) := do
|
|
117
|
+
let src := s0.src
|
|
118
|
+
let mut p := s0.pos
|
|
119
|
+
let start := p
|
|
120
|
+
while p < src.size &&
|
|
121
|
+
(let c := src[p]!
|
|
122
|
+
(c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.' || c == 'e' || c == 'E') do
|
|
123
|
+
p := p + 1
|
|
124
|
+
let tok := String.ofList (src.extract start p).toList
|
|
125
|
+
pure (.num ((parseFloatJS tok).getD 0.0), { s0 with pos := p })
|
|
126
|
+
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
/-- Parse a JSON string into a struct `Value` (empty/blank input -> noval). -/
|
|
130
|
+
def jsonRead (s : String) : SIO Value := do
|
|
131
|
+
if s.all (fun c => c == ' ' || c == '\n' || c == '\t' || c == '\r') then pure .noval
|
|
132
|
+
else pure (← jVal { src := s.toList.toArray, pos := 0 }).1
|
|
133
|
+
|
|
134
|
+
end SdkJson
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/- ProjectName SDK runtime: the generic, config-driven operation pipeline.
|
|
2
|
+
|
|
3
|
+
Following the Haskell target's model, entities are NOT generated per-entity;
|
|
4
|
+
the whole SDK is driven by the API model (a struct `Value` parsed from the
|
|
5
|
+
embedded config). A client holds `options` + `config`; an operation looks up
|
|
6
|
+
`config.entity.<name>.op.<op>.points`, selects the matching endpoint, builds
|
|
7
|
+
the URL/method/body, calls the `curl` transport, parses the JSON response,
|
|
8
|
+
and applies the response transform.
|
|
9
|
+
|
|
10
|
+
The struct `Value` is the single data model throughout (like map[string]any
|
|
11
|
+
in the Go/Python SDKs); everything runs in struct's `SIO` monad. -/
|
|
12
|
+
|
|
13
|
+
import VoxgigStruct
|
|
14
|
+
import SdkJson
|
|
15
|
+
import SdkUtility
|
|
16
|
+
import SdkFeature
|
|
17
|
+
import SdkFeatures
|
|
18
|
+
|
|
19
|
+
open VoxgigStruct
|
|
20
|
+
|
|
21
|
+
namespace SdkRuntime
|
|
22
|
+
|
|
23
|
+
/-- Pure string view of a scalar Value. -/
|
|
24
|
+
def asStr : Value → String
|
|
25
|
+
| .str s => s
|
|
26
|
+
| _ => ""
|
|
27
|
+
|
|
28
|
+
def isNv : Value → Bool
|
|
29
|
+
| .noval => true
|
|
30
|
+
| .null => true
|
|
31
|
+
| _ => false
|
|
32
|
+
|
|
33
|
+
/-- Get a map field by string key (noval if absent). -/
|
|
34
|
+
def gp (v : Value) (k : String) : SIO Value := getprop v (.str k) .noval
|
|
35
|
+
|
|
36
|
+
def gpS (v : Value) (k : String) : SIO String := do pure (asStr (← gp v k))
|
|
37
|
+
|
|
38
|
+
-- ---------------------------------------------------------------------------
|
|
39
|
+
-- Transport: shell out to curl. Returns (status, body).
|
|
40
|
+
-- ---------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
def curlFetch (method url : String) (body : Option String) : IO (Nat × String) := do
|
|
43
|
+
let base := #["-s", "-w", "\n%{http_code}", "--max-time", "20", "-X", method]
|
|
44
|
+
let hdr := if body.isSome then #["-H", "Content-Type: application/json"] else #[]
|
|
45
|
+
let dat := match body with | some b => #["-d", b] | none => #[]
|
|
46
|
+
let out ← IO.Process.output { cmd := "curl", args := base ++ hdr ++ dat ++ #[url] }
|
|
47
|
+
if out.exitCode != 0 then
|
|
48
|
+
throw (IO.userError s!"curl failed ({out.exitCode}): {out.stderr}")
|
|
49
|
+
let lines := out.stdout.splitOn "\n"
|
|
50
|
+
let status := (lines.getLastD "0").toNat!
|
|
51
|
+
let bodyStr := String.intercalate "\n" lines.dropLast
|
|
52
|
+
return (status, bodyStr)
|
|
53
|
+
|
|
54
|
+
-- ---------------------------------------------------------------------------
|
|
55
|
+
-- Point selection (mirrors SdkRuntime.hs prepareOperation): all select.exist
|
|
56
|
+
-- keys must be present in match/data, and select.$action must equal the
|
|
57
|
+
-- caller's $action (both absent = the plain point).
|
|
58
|
+
-- ---------------------------------------------------------------------------
|
|
59
|
+
|
|
60
|
+
def existOk (point matchV dataV : Value) : SIO Bool := do
|
|
61
|
+
let sel ← gp point "select"
|
|
62
|
+
match (← gp sel "exist") with
|
|
63
|
+
| .list id => do
|
|
64
|
+
let mut ok := true
|
|
65
|
+
for ek in (← listItems id) do
|
|
66
|
+
let k := asStr ek
|
|
67
|
+
if isNv (← gp matchV k) && isNv (← gp dataV k) then ok := false
|
|
68
|
+
pure ok
|
|
69
|
+
| _ => pure true
|
|
70
|
+
|
|
71
|
+
def actionOk (point matchV : Value) : SIO Bool := do
|
|
72
|
+
let sel ← gp point "select"
|
|
73
|
+
pure ((← gp sel "$action") == (← gp matchV "$action"))
|
|
74
|
+
|
|
75
|
+
def selectPoint (points matchV dataV : Value) : SIO Value := do
|
|
76
|
+
match points with
|
|
77
|
+
| .list id => do
|
|
78
|
+
let pts ← listItems id
|
|
79
|
+
if pts.size == 1 then pure pts[0]!
|
|
80
|
+
else do
|
|
81
|
+
for pt in pts do
|
|
82
|
+
if (← existOk pt matchV dataV) && (← actionOk pt matchV) then return pt
|
|
83
|
+
pure .noval
|
|
84
|
+
| _ => pure .noval
|
|
85
|
+
|
|
86
|
+
-- ---------------------------------------------------------------------------
|
|
87
|
+
-- Request building + response transform.
|
|
88
|
+
-- ---------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
/-- Substitute a `{name}` path segment from match (falling back to data). -/
|
|
91
|
+
def resolvePart (seg : String) (matchV dataV : Value) : SIO String := do
|
|
92
|
+
if seg.startsWith "{" && seg.endsWith "}" then
|
|
93
|
+
let key := (seg.replace "{" "").replace "}" ""
|
|
94
|
+
let mv ← gp matchV key
|
|
95
|
+
let v ← if isNv mv then gp dataV key else pure mv
|
|
96
|
+
pure (asStr v)
|
|
97
|
+
else pure seg
|
|
98
|
+
|
|
99
|
+
def buildUrl (base : String) (point matchV dataV : Value) : SIO String := do
|
|
100
|
+
match (← gp point "parts") with
|
|
101
|
+
| .list id => do
|
|
102
|
+
let mut segs : Array String := #[]
|
|
103
|
+
for p in (← listItems id) do
|
|
104
|
+
segs := segs.push (← resolvePart (asStr p) matchV dataV)
|
|
105
|
+
pure (base ++ "/" ++ String.intercalate "/" segs.toList)
|
|
106
|
+
| _ => pure base
|
|
107
|
+
|
|
108
|
+
/-- Strip surrounding backticks from a transform expression. -/
|
|
109
|
+
def unquote (s : String) : String := s.replace "`" ""
|
|
110
|
+
|
|
111
|
+
/-- Apply transform.res: `body`, `body.entity`, etc. -/
|
|
112
|
+
def resTransform (point body : Value) : SIO Value := do
|
|
113
|
+
let tr ← gp point "transform"
|
|
114
|
+
let e := unquote (← gpS tr "res")
|
|
115
|
+
let segs := e.splitOn "."
|
|
116
|
+
let mut cur := body
|
|
117
|
+
for s in segs.drop 1 do
|
|
118
|
+
cur ← gp cur s
|
|
119
|
+
pure cur
|
|
120
|
+
|
|
121
|
+
-- ---------------------------------------------------------------------------
|
|
122
|
+
-- Test mode: an in-memory mock transport.
|
|
123
|
+
--
|
|
124
|
+
-- The `test` feature of the other targets seeds an entity store and answers
|
|
125
|
+
-- operations from it, so entity behaviour is verifiable with no server. The
|
|
126
|
+
-- store is `client.store.<entity>` : a map of id -> entity.
|
|
127
|
+
-- ---------------------------------------------------------------------------
|
|
128
|
+
|
|
129
|
+
/-- Every field of `matchV` must equal the entity's field. -/
|
|
130
|
+
def entMatches (ent matchV : Value) : SIO Bool := do
|
|
131
|
+
match matchV with
|
|
132
|
+
| .map i => do
|
|
133
|
+
let mut ok := true
|
|
134
|
+
for k in (← keysof (.map i)) do
|
|
135
|
+
let want ← gp (.map i) k
|
|
136
|
+
if !(isNv want) then
|
|
137
|
+
if !((← gp ent k) == want) then ok := false
|
|
138
|
+
pure ok
|
|
139
|
+
| _ => pure true
|
|
140
|
+
|
|
141
|
+
/-- Deterministic id for created entities (no clock/RNG in Lean). -/
|
|
142
|
+
def nextTestId (store : Value) : SIO String := do
|
|
143
|
+
let n ← gp store "__seq__"
|
|
144
|
+
let i := (match n with | .num f => f | _ => 0.0) + 1.0
|
|
145
|
+
let _ ← setprop store (.str "__seq__") (.num i)
|
|
146
|
+
pure ("t" ++ numToString i)
|
|
147
|
+
|
|
148
|
+
def mockOp (client : Value) (entityName opName : String)
|
|
149
|
+
(matchV dataV : Value) : SIO Value := do
|
|
150
|
+
let store ← gp client "store"
|
|
151
|
+
let entmap ← (match (← gp store entityName) with
|
|
152
|
+
| .map i => pure (Value.map i)
|
|
153
|
+
| _ => do let m ← emptyMap; let _ ← setprop store (.str entityName) m; pure m)
|
|
154
|
+
let idOf (v : Value) : SIO String := do pure (asStr (← gp v "id"))
|
|
155
|
+
match opName with
|
|
156
|
+
| "list" => do
|
|
157
|
+
let mut out : Array Value := #[]
|
|
158
|
+
for k in (← keysof entmap) do
|
|
159
|
+
let e ← gp entmap k
|
|
160
|
+
if (← entMatches e matchV) then out := out.push e
|
|
161
|
+
newList out
|
|
162
|
+
| "load" => do
|
|
163
|
+
let wid ← idOf matchV
|
|
164
|
+
pure ((← gp entmap wid))
|
|
165
|
+
| "remove" => do
|
|
166
|
+
let wid ← idOf matchV
|
|
167
|
+
let _ ← delprop entmap (.str wid)
|
|
168
|
+
emptyMap
|
|
169
|
+
| "create" => do
|
|
170
|
+
let ent ← clone dataV
|
|
171
|
+
let given ← idOf dataV
|
|
172
|
+
let eid ← if given != "" then pure given else nextTestId store
|
|
173
|
+
let _ ← setprop ent (.str "id") (.str eid)
|
|
174
|
+
let _ ← setprop entmap (.str eid) ent
|
|
175
|
+
pure ent
|
|
176
|
+
| "update" => do
|
|
177
|
+
let wid0 ← idOf dataV
|
|
178
|
+
let wid ← if wid0 != "" then pure wid0 else idOf matchV
|
|
179
|
+
let cur ← gp entmap wid
|
|
180
|
+
match cur with
|
|
181
|
+
| .map _ => do
|
|
182
|
+
for k in (← keysof dataV) do
|
|
183
|
+
let _ ← setprop cur (.str k) (← gp dataV k)
|
|
184
|
+
pure cur
|
|
185
|
+
| _ => emptyMap
|
|
186
|
+
| _ => emptyMap
|
|
187
|
+
|
|
188
|
+
-- ---------------------------------------------------------------------------
|
|
189
|
+
-- Feature wiring
|
|
190
|
+
--
|
|
191
|
+
-- The client carries: `featureopts` (name -> options), `features` (registry
|
|
192
|
+
-- indices, in add order) and `fetcher` (the head of the transport chain). Each
|
|
193
|
+
-- active feature's `init` wraps the current fetcher, so the LAST feature added
|
|
194
|
+
-- is outermost; the base of the chain is the mock (test mode) or curl (live).
|
|
195
|
+
-- ---------------------------------------------------------------------------
|
|
196
|
+
|
|
197
|
+
/-- The base transport: curl for a live client. -/
|
|
198
|
+
def liveFetcher : SdkFeature.Fetcher := fun _ctx url fetchdef => do
|
|
199
|
+
let method := asStr (← gp fetchdef "method")
|
|
200
|
+
let bodyV ← gp fetchdef "body"
|
|
201
|
+
let bodyStr ← if isNv bodyV then pure none else (do pure (some (← jsonify bodyV)))
|
|
202
|
+
let (st, respBody) ← curlFetch (if method == "" then "GET" else method) url bodyStr
|
|
203
|
+
let json ← SdkJson.jsonRead respBody
|
|
204
|
+
let resp ← newMap #[("status", .num st.toFloat), ("statusText", .str "OK"),
|
|
205
|
+
("body", json), ("headers", ← emptyMap)]
|
|
206
|
+
pure (resp, none)
|
|
207
|
+
|
|
208
|
+
/-- THE MOCK HAS TO AGREE WITH THE MODEL. A point carrying
|
|
209
|
+
`transform.res: `body.item`` describes an API that answers {"item": {...}}
|
|
210
|
+
and the response transform unwraps that key on the way back. Returning the
|
|
211
|
+
bare payload means the transform unwraps a property that is not there and
|
|
212
|
+
the caller gets nothing. Mirrors the go/ts/lua/php mocks. -/
|
|
213
|
+
def mockEnvelope (ctx : Value) (data : Value) : SIO Value := do
|
|
214
|
+
if isNv data then pure data else do
|
|
215
|
+
let tm ← gp (← gp ctx "point") "transform"
|
|
216
|
+
let spec := asStr (← gp tm "res")
|
|
217
|
+
-- Exactly `body.<key>`; a deeper path is not an envelope this mock can
|
|
218
|
+
-- synthesise, so it is left alone rather than guessed at.
|
|
219
|
+
if spec.startsWith "`body." && spec.endsWith "`" && spec.length > 7 then
|
|
220
|
+
let inner := ((spec.drop 6).dropRight 1).toString
|
|
221
|
+
if inner.isEmpty || inner.contains '.' then pure data
|
|
222
|
+
else newMap #[(inner, data)]
|
|
223
|
+
else pure data
|
|
224
|
+
|
|
225
|
+
/-- The base transport in test mode: answer from the seeded store. -/
|
|
226
|
+
def testFetcher : SdkFeature.Fetcher := fun ctx _url _fetchdef => do
|
|
227
|
+
let client ← gp ctx "client"
|
|
228
|
+
let entityName ← gpS (← gp ctx "op") "entity"
|
|
229
|
+
let opName ← gpS (← gp ctx "op") "name"
|
|
230
|
+
let matchV ← gp ctx "reqmatch"
|
|
231
|
+
let dataV ← gp ctx "reqdata"
|
|
232
|
+
let out ← mockOp client entityName opName matchV dataV
|
|
233
|
+
let payload ← mockEnvelope ctx out
|
|
234
|
+
let resp ← newMap #[("status", .num 200.0), ("statusText", .str "OK"),
|
|
235
|
+
("body", payload), ("headers", ← emptyMap)]
|
|
236
|
+
pure (resp, none)
|
|
237
|
+
|
|
238
|
+
/-- Merge config.feature and options.feature into the client's feature options. -/
|
|
239
|
+
def resolveFeatureOpts (client : Value) : SIO Value := do
|
|
240
|
+
let config ← gp client "config"
|
|
241
|
+
let options ← gp client "options"
|
|
242
|
+
let cf ← (match (← gp config "feature") with | .map i => pure (Value.map i) | _ => emptyMap)
|
|
243
|
+
let of0 ← (match (← gp options "feature") with | .map i => pure (Value.map i) | _ => emptyMap)
|
|
244
|
+
let merged ← merge (← newList #[cf, of0])
|
|
245
|
+
let fo ← (match merged with | .map i => pure (Value.map i) | _ => emptyMap)
|
|
246
|
+
SdkUtility.sp client "featureopts" fo
|
|
247
|
+
pure fo
|
|
248
|
+
|
|
249
|
+
/-- Construct and initialise every configured feature for this client. -/
|
|
250
|
+
def initFeatures (client : Value) : SIO Unit := do
|
|
251
|
+
let fo ← resolveFeatureOpts client
|
|
252
|
+
let baseF := if (← gpS client "mode") == "test" then testFetcher else liveFetcher
|
|
253
|
+
SdkFeature.setFetcher client baseF
|
|
254
|
+
let ctx ← newMap #[("client", client)]
|
|
255
|
+
let mut ids : Array Value := #[]
|
|
256
|
+
for name in SdkFeatures.featureNames do
|
|
257
|
+
let opts ← gp fo name
|
|
258
|
+
if (← SdkFeature.optActive opts) then do
|
|
259
|
+
let f ← SdkFeatures.makeFeature name
|
|
260
|
+
let id ← SdkFeature.registerFeature f
|
|
261
|
+
ids := ids.push (.num id.toFloat)
|
|
262
|
+
f.init ctx opts
|
|
263
|
+
SdkUtility.sp client "features" (← newList ids)
|
|
264
|
+
|
|
265
|
+
-- ---------------------------------------------------------------------------
|
|
266
|
+
-- The generic operation, with feature hooks at every pipeline stage.
|
|
267
|
+
-- ---------------------------------------------------------------------------
|
|
268
|
+
|
|
269
|
+
def runOp (client : Value) (entityName opName : String)
|
|
270
|
+
(matchV dataV _callopts : Value) : SIO Value := do
|
|
271
|
+
let options ← gp client "options"
|
|
272
|
+
let config ← gp client "config"
|
|
273
|
+
let op ← newMap #[("name", .str opName), ("entity", .str entityName),
|
|
274
|
+
("input", .str (SdkUtility.opInputOf opName))]
|
|
275
|
+
let out ← emptyMap
|
|
276
|
+
let ctx ← newMap #[("client", client), ("options", options), ("config", config),
|
|
277
|
+
("opname", .str opName), ("op", op), ("out", out),
|
|
278
|
+
("reqmatch", matchV), ("reqdata", dataV),
|
|
279
|
+
("match", matchV), ("data", dataV)]
|
|
280
|
+
let _ ← SdkUtility.makeResult ctx
|
|
281
|
+
|
|
282
|
+
-- PrePoint: a feature may short-circuit here (rbac denies by setting out.point).
|
|
283
|
+
SdkFeature.dispatch client "PrePoint" ctx
|
|
284
|
+
let denied ← gp out "point"
|
|
285
|
+
if (← SdkUtility.isErrV denied) then
|
|
286
|
+
throw (IO.userError (← gpS denied "message"))
|
|
287
|
+
|
|
288
|
+
let ent ← gp (← gp config "entity") entityName
|
|
289
|
+
let opcfg ← gp (← gp ent "op") opName
|
|
290
|
+
let point ← selectPoint (← gp opcfg "points") matchV dataV
|
|
291
|
+
if isNv point then
|
|
292
|
+
throw (IO.userError s!"Operation \"{opName}\" has no matching endpoint for {entityName}.")
|
|
293
|
+
SdkUtility.sp ctx "point" point
|
|
294
|
+
|
|
295
|
+
-- PreSpec: build the request description.
|
|
296
|
+
let userBase ← gpS options "base"
|
|
297
|
+
let base ← if userBase != "" then pure userBase
|
|
298
|
+
else gpS (← gp config "options") "base"
|
|
299
|
+
let url ← buildUrl base point matchV dataV
|
|
300
|
+
let method ← gpS point "method"
|
|
301
|
+
let headers ← SdkUtility.prepareHeaders ctx
|
|
302
|
+
let spec ← newMap #[("base", .str base), ("method", .str method),
|
|
303
|
+
("headers", headers), ("step", .str "start")]
|
|
304
|
+
SdkUtility.sp ctx "spec" spec
|
|
305
|
+
SdkUtility.sp spec "query" (← emptyMap)
|
|
306
|
+
SdkFeature.dispatch client "PreSpec" ctx
|
|
307
|
+
|
|
308
|
+
let hasBody := method == "POST" || method == "PUT" || method == "PATCH"
|
|
309
|
+
if hasBody then SdkUtility.sp spec "body" dataV
|
|
310
|
+
|
|
311
|
+
-- PreRequest: last chance to alter headers/transport (idempotency, clienttrack).
|
|
312
|
+
SdkFeature.dispatch client "PreRequest" ctx
|
|
313
|
+
|
|
314
|
+
let fetchdef ← SdkUtility.makeFetchDef ctx
|
|
315
|
+
let fetch ← SdkFeature.getFetcher client
|
|
316
|
+
let (resp, ferr) ← fetch ctx url fetchdef
|
|
317
|
+
match ferr with
|
|
318
|
+
| some e => throw (IO.userError (← gpS e "message"))
|
|
319
|
+
| none => pure ()
|
|
320
|
+
SdkUtility.sp ctx "response" resp
|
|
321
|
+
|
|
322
|
+
-- PreResponse / PreResult: fold the response into the result.
|
|
323
|
+
SdkFeature.dispatch client "PreResponse" ctx
|
|
324
|
+
let body ← gp resp "body"
|
|
325
|
+
let resdata ← resTransform point body
|
|
326
|
+
let result ← gp ctx "result"
|
|
327
|
+
SdkUtility.sp result "body" body
|
|
328
|
+
SdkUtility.sp result "resdata" resdata
|
|
329
|
+
SdkUtility.sp result "status" (← gp resp "status")
|
|
330
|
+
SdkUtility.sp result "ok" (.bool true)
|
|
331
|
+
SdkFeature.dispatch client "PreResult" ctx
|
|
332
|
+
|
|
333
|
+
-- PreDone: metrics/telemetry/audit close out here.
|
|
334
|
+
SdkFeature.dispatch client "PreDone" ctx
|
|
335
|
+
pure resdata
|
|
336
|
+
|
|
337
|
+
-- Entity operation wrappers.
|
|
338
|
+
def opList (c : Value) (e : String) (m co : Value) : SIO Value := do runOp c e "list" m (← emptyMap) co
|
|
339
|
+
def opLoad (c : Value) (e : String) (m co : Value) : SIO Value := do runOp c e "load" m (← emptyMap) co
|
|
340
|
+
def opCreate (c : Value) (e : String) (d co : Value) : SIO Value := do runOp c e "create" (← emptyMap) d co
|
|
341
|
+
def opUpdate (c : Value) (e : String) (m d co : Value) : SIO Value := do runOp c e "update" m d co
|
|
342
|
+
def opRemove (c : Value) (e : String) (m co : Value) : SIO Value := do runOp c e "remove" m (← emptyMap) co
|
|
343
|
+
|
|
344
|
+
/-- Build a client Value from options + config JSON strings. -/
|
|
345
|
+
def mkClient (optionsJson configJson : String) : SIO Value := do
|
|
346
|
+
let options ← SdkJson.jsonRead optionsJson
|
|
347
|
+
let config ← SdkJson.jsonRead configJson
|
|
348
|
+
let c ← newMap #[("options", options), ("config", config), ("mode", .str "live")]
|
|
349
|
+
initFeatures c
|
|
350
|
+
pure c
|
|
351
|
+
|
|
352
|
+
/-- Build a client from an options `Value` (the generated `newSdk` entry). -/
|
|
353
|
+
def mkClientV (options : Value) (configJson : String) : SIO Value := do
|
|
354
|
+
let opts ← (match options with | .map _ => pure options | _ => emptyMap)
|
|
355
|
+
let config ← SdkJson.jsonRead configJson
|
|
356
|
+
let c ← newMap #[("options", opts), ("config", config), ("mode", .str "live")]
|
|
357
|
+
initFeatures c
|
|
358
|
+
pure c
|
|
359
|
+
|
|
360
|
+
/-- A test-mode client: operations are answered from an in-memory store seeded
|
|
361
|
+
with the entity test data, so entity behaviour is verifiable offline. -/
|
|
362
|
+
def mkTestClientV (options : Value) (configJson : String) (seed : Value) : SIO Value := do
|
|
363
|
+
let opts ← (match options with | .map _ => pure options | _ => emptyMap)
|
|
364
|
+
let config ← SdkJson.jsonRead configJson
|
|
365
|
+
let existing ← gp seed "existing"
|
|
366
|
+
let store ← (match existing with
|
|
367
|
+
| .map _ => clone existing
|
|
368
|
+
| _ => emptyMap)
|
|
369
|
+
let c ← newMap #[("options", opts), ("config", config), ("mode", .str "test"),
|
|
370
|
+
("store", store)]
|
|
371
|
+
initFeatures c
|
|
372
|
+
pure c
|
|
373
|
+
|
|
374
|
+
end SdkRuntime
|