@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,449 @@
|
|
|
1
|
+
-- Struct corpus runner — drives the shared JSON test spec's `struct` subtree
|
|
2
|
+
-- against the vendored voxgig struct port. Vendored/adapted from the struct
|
|
3
|
+
-- haskell corpus runner; exposes `runStructCorpus` returning (pass, fail).
|
|
4
|
+
|
|
5
|
+
{-# LANGUAGE LambdaCase #-}
|
|
6
|
+
|
|
7
|
+
module StructCorpus (runStructCorpus) where
|
|
8
|
+
|
|
9
|
+
import Control.Exception (SomeException, throwIO, try)
|
|
10
|
+
import Control.Monad (forM_, when)
|
|
11
|
+
import Data.Char (toLower)
|
|
12
|
+
import Data.IORef
|
|
13
|
+
import Data.List (intercalate, isPrefixOf)
|
|
14
|
+
|
|
15
|
+
import VoxgigStruct
|
|
16
|
+
import qualified Vregex
|
|
17
|
+
import SdkJson (jsonRead)
|
|
18
|
+
|
|
19
|
+
nullmark, undefmark, existsmark :: String
|
|
20
|
+
nullmark = "__NULL__"
|
|
21
|
+
undefmark = "__UNDEF__"
|
|
22
|
+
existsmark = "__EXISTS__"
|
|
23
|
+
|
|
24
|
+
-- ---------------- fixJSON / equality ----------------
|
|
25
|
+
|
|
26
|
+
fixJson :: Value -> Bool -> IO Value
|
|
27
|
+
fixJson v flagNull = case v of
|
|
28
|
+
VNoval -> return (if flagNull then VStr nullmark else v)
|
|
29
|
+
VNull -> return (if flagNull then VStr nullmark else v)
|
|
30
|
+
VMap m -> do
|
|
31
|
+
es <- readIORef m
|
|
32
|
+
o <- emptyMap
|
|
33
|
+
forM_ es $ \(k, x) -> do fx <- fixJson x flagNull; _ <- setprop o (VStr k) fx; return ()
|
|
34
|
+
return o
|
|
35
|
+
VList r -> do its <- readIORef r; xs <- mapM (\x -> fixJson x flagNull) its; mkList xs
|
|
36
|
+
_ -> return v
|
|
37
|
+
|
|
38
|
+
eqv :: Value -> Value -> IO Bool
|
|
39
|
+
eqv a b = case (a, b) of
|
|
40
|
+
(VNoval, VNoval) -> return True
|
|
41
|
+
(VNoval, VNull) -> return True
|
|
42
|
+
(VNull, VNoval) -> return True
|
|
43
|
+
(VNull, VNull) -> return True
|
|
44
|
+
(VBool x, VBool y) -> return (x == y)
|
|
45
|
+
(VNum x, VNum y) -> return (x == y)
|
|
46
|
+
(VStr x, VStr y) -> return (x == y)
|
|
47
|
+
(VList x, VList y) -> do
|
|
48
|
+
xs <- readIORef x; ys <- readIORef y
|
|
49
|
+
if length xs /= length ys then return False else allM (zipWith eqv xs ys)
|
|
50
|
+
(VMap x, VMap y) -> do
|
|
51
|
+
xs <- readIORef x; ys <- readIORef y
|
|
52
|
+
if length xs /= length ys then return False
|
|
53
|
+
else allM [case lookup k ys of Just w -> eqv v w; Nothing -> return False | (k, v) <- xs]
|
|
54
|
+
_ -> return (sameRef a b)
|
|
55
|
+
where
|
|
56
|
+
allM = andM
|
|
57
|
+
sameRef (VList p) (VList q) = p == q
|
|
58
|
+
sameRef (VMap p) (VMap q) = p == q
|
|
59
|
+
sameRef VNoval VNoval = True
|
|
60
|
+
sameRef _ _ = False
|
|
61
|
+
|
|
62
|
+
-- ---------------- match support ----------------
|
|
63
|
+
|
|
64
|
+
containsLower :: String -> String -> Bool
|
|
65
|
+
containsLower hay needle =
|
|
66
|
+
let h = map toLower hay; nd = map toLower needle
|
|
67
|
+
in null nd || go h
|
|
68
|
+
where
|
|
69
|
+
go [] = False
|
|
70
|
+
go s@(_:rest) = (map toLower needle `isPrefixOf` map toLower s) || go rest
|
|
71
|
+
|
|
72
|
+
matchval :: Value -> Value -> IO Bool
|
|
73
|
+
matchval check0 base = do
|
|
74
|
+
let check = if vStrEq check0 undefmark || vStrEq check0 nullmark then VNoval else check0
|
|
75
|
+
e <- eqv check base
|
|
76
|
+
if e then return True
|
|
77
|
+
else case check of
|
|
78
|
+
VStr cs -> do
|
|
79
|
+
basestr <- stringify base
|
|
80
|
+
if length cs >= 2 && head cs == '/' && last cs == '/'
|
|
81
|
+
then return (Vregex.testStr (take (length cs - 2) (drop 1 cs)) basestr)
|
|
82
|
+
else do cstr <- stringify check; return (containsLower basestr cstr)
|
|
83
|
+
VFunc _ -> return True
|
|
84
|
+
_ -> return False
|
|
85
|
+
|
|
86
|
+
doMatch :: Value -> Value -> IO ()
|
|
87
|
+
doMatch check base0 = do
|
|
88
|
+
base <- clone base0
|
|
89
|
+
_ <- walk (Just (\_ v _ path -> do
|
|
90
|
+
when (not (isnode v)) $ do
|
|
91
|
+
baseval <- getpath INone base path
|
|
92
|
+
e <- eqv baseval v
|
|
93
|
+
if e then return ()
|
|
94
|
+
else if vStrEq v undefmark && isNullish baseval then return ()
|
|
95
|
+
else if vStrEq v existsmark && not (isNullish baseval) then return ()
|
|
96
|
+
else do
|
|
97
|
+
mv <- matchval v baseval
|
|
98
|
+
if not mv then do
|
|
99
|
+
pelems <- listItems path
|
|
100
|
+
pstrs <- mapM jsString pelems
|
|
101
|
+
sv <- stringify v
|
|
102
|
+
sb <- stringify baseval
|
|
103
|
+
ioError (userError ("MATCH: " ++ intercalate "." pstrs ++ ": [" ++ sv ++ "] <=> [" ++ sb ++ "]"))
|
|
104
|
+
else return ()
|
|
105
|
+
return v)) Nothing VNoval check
|
|
106
|
+
return ()
|
|
107
|
+
|
|
108
|
+
-- ---------------- result tracking ----------------
|
|
109
|
+
|
|
110
|
+
data Counters = Counters { npass :: IORef Int, nfail :: IORef Int, failures :: IORef [String] }
|
|
111
|
+
|
|
112
|
+
record :: Counters -> String -> String -> Bool -> String -> IO ()
|
|
113
|
+
record c group name ok msg =
|
|
114
|
+
if ok then modifyIORef' (npass c) (+ 1)
|
|
115
|
+
else do modifyIORef' (nfail c) (+ 1); modifyIORef' (failures c) (++ ["FAIL " ++ group ++ " " ++ name ++ " - " ++ msg])
|
|
116
|
+
|
|
117
|
+
errMsg :: SomeException -> String
|
|
118
|
+
errMsg e = case lines (show e) of (l:_) -> stripUser l; [] -> show e
|
|
119
|
+
where stripUser s = case dropWhile (/= ':') s of _ -> s
|
|
120
|
+
|
|
121
|
+
-- ---------------- per-entry runner ----------------
|
|
122
|
+
|
|
123
|
+
omapV :: [(String, Value)] -> IO Value
|
|
124
|
+
omapV = mkMap
|
|
125
|
+
|
|
126
|
+
entryGet :: Value -> String -> IO Value
|
|
127
|
+
entryGet e k = getpropRaw e k
|
|
128
|
+
|
|
129
|
+
entryHas :: Value -> String -> IO Bool
|
|
130
|
+
entryHas e k = case e of { VMap m -> do { es <- readIORef m; return (any ((== k) . fst) es) }; _ -> return False }
|
|
131
|
+
|
|
132
|
+
resolveArgs :: Value -> IO [Value]
|
|
133
|
+
resolveArgs entry = do
|
|
134
|
+
hc <- entryHas entry "ctx"
|
|
135
|
+
if hc then do c <- entryGet entry "ctx"; return [c]
|
|
136
|
+
else do
|
|
137
|
+
ha <- entryHas entry "args"
|
|
138
|
+
if ha then do a <- entryGet entry "args"; if islist a then listItems a else return []
|
|
139
|
+
else do
|
|
140
|
+
hi <- entryHas entry "in"
|
|
141
|
+
if hi then do v <- entryGet entry "in"; c <- clone v; return [c]
|
|
142
|
+
else return [VNoval]
|
|
143
|
+
|
|
144
|
+
checkResult :: Value -> [Value] -> Value -> IO ()
|
|
145
|
+
checkResult entry args res = do
|
|
146
|
+
hm <- entryHas entry "match"
|
|
147
|
+
matched <- if hm then do
|
|
148
|
+
mv <- entryGet entry "match"
|
|
149
|
+
ein <- entryGet entry "in"; eres <- entryGet entry "res"; ectx <- entryGet entry "ctx"
|
|
150
|
+
al <- mkList args
|
|
151
|
+
o <- omapV [("in", ein), ("args", al), ("out", eres), ("ctx", ectx)]
|
|
152
|
+
doMatch mv o
|
|
153
|
+
return True
|
|
154
|
+
else return False
|
|
155
|
+
out <- entryGet entry "out"
|
|
156
|
+
e <- eqv out res
|
|
157
|
+
if e then return ()
|
|
158
|
+
else if matched && (vStrEq out nullmark || isNullish out) then return ()
|
|
159
|
+
else do so <- stringify out; sr <- stringify res; ioError (userError ("Expected: " ++ so ++ ", got: " ++ sr))
|
|
160
|
+
|
|
161
|
+
handleError :: Value -> SomeException -> IO ()
|
|
162
|
+
handleError entry err = do
|
|
163
|
+
let msg = exMsg err
|
|
164
|
+
he <- entryHas entry "err"
|
|
165
|
+
if he then do
|
|
166
|
+
entryErr <- entryGet entry "err"
|
|
167
|
+
em <- matchval entryErr (VStr msg)
|
|
168
|
+
if vIsTrue entryErr || em then do
|
|
169
|
+
hm <- entryHas entry "match"
|
|
170
|
+
when hm $ do
|
|
171
|
+
mv <- entryGet entry "match"
|
|
172
|
+
ein <- entryGet entry "in"; eres <- entryGet entry "res"; ectx <- entryGet entry "ctx"
|
|
173
|
+
o <- omapV [("in", ein), ("out", eres), ("ctx", ectx), ("err", VStr msg)]
|
|
174
|
+
doMatch mv o
|
|
175
|
+
else do se <- stringify entryErr; ioError (userError ("ERROR MATCH: [" ++ se ++ "] <=> [" ++ msg ++ "]"))
|
|
176
|
+
else throwIO err
|
|
177
|
+
|
|
178
|
+
exMsg :: SomeException -> String
|
|
179
|
+
exMsg e =
|
|
180
|
+
let s = show e
|
|
181
|
+
in case stripPrefix "user error (" s of
|
|
182
|
+
Just rest -> reverse (drop 1 (reverse rest)) -- drop trailing ')'
|
|
183
|
+
Nothing -> s
|
|
184
|
+
where stripPrefix p str = if p `isPrefixOf` str then Just (drop (length p) str) else Nothing
|
|
185
|
+
|
|
186
|
+
runSet :: Counters -> String -> Value -> ([Value] -> IO Value) -> Bool -> IO ()
|
|
187
|
+
runSet c group node subject flagNull = do
|
|
188
|
+
fixed <- fixJson node flagNull
|
|
189
|
+
testset <- getprop fixed (VStr "set") >>= \ts -> if islist ts then listItems ts else return []
|
|
190
|
+
forM_ testset $ \entry -> do
|
|
191
|
+
nm <- entryGet entry "name" >>= jsString
|
|
192
|
+
result <- try (runOne entry) :: IO (Either SomeException ())
|
|
193
|
+
case result of
|
|
194
|
+
Right () -> record c group nm True ""
|
|
195
|
+
Left e -> do
|
|
196
|
+
r2 <- try (handleError entry e) :: IO (Either SomeException ())
|
|
197
|
+
case r2 of
|
|
198
|
+
Right () -> record c group nm True ""
|
|
199
|
+
Left e2 -> record c group nm False (exMsg e2)
|
|
200
|
+
where
|
|
201
|
+
runOne entry = do
|
|
202
|
+
ho <- entryHas entry "out"
|
|
203
|
+
when (not ho && flagNull) $ do _ <- setprop entry (VStr "out") (VStr nullmark); return ()
|
|
204
|
+
args <- resolveArgs entry
|
|
205
|
+
r <- subject args
|
|
206
|
+
res <- fixJson r flagNull
|
|
207
|
+
_ <- setprop entry (VStr "res") res
|
|
208
|
+
checkResult entry args res
|
|
209
|
+
|
|
210
|
+
runSingle :: Counters -> String -> Value -> (Value -> IO Value) -> IO ()
|
|
211
|
+
runSingle c group node actualFn = do
|
|
212
|
+
result <- try go :: IO (Either SomeException ())
|
|
213
|
+
case result of
|
|
214
|
+
Right () -> return ()
|
|
215
|
+
Left e -> record c group "single" False (exMsg e)
|
|
216
|
+
where
|
|
217
|
+
go = do
|
|
218
|
+
expected <- entryGet node "out"
|
|
219
|
+
inv <- entryGet node "in"
|
|
220
|
+
actual <- actualFn inv
|
|
221
|
+
e <- eqv expected actual
|
|
222
|
+
if e then record c group "single" True ""
|
|
223
|
+
else do se <- stringify expected; sa <- stringify actual; record c group "single" False ("Expected: " ++ se ++ ", got: " ++ sa)
|
|
224
|
+
|
|
225
|
+
-- ---------------- arg helpers ----------------
|
|
226
|
+
|
|
227
|
+
arg1 :: (Value -> IO Value) -> [Value] -> IO Value
|
|
228
|
+
arg1 f = \args -> f (case args of (x:_) -> x; [] -> VNoval)
|
|
229
|
+
|
|
230
|
+
vget :: Value -> String -> IO Value
|
|
231
|
+
vget vin k = case vin of { VMap m -> do { es <- readIORef m; return (maybe VNoval id (lookup k es)) }; _ -> return VNoval }
|
|
232
|
+
|
|
233
|
+
vhas :: Value -> String -> IO Bool
|
|
234
|
+
vhas vin k = case vin of { VMap m -> do { es <- readIORef m; return (any ((== k) . fst) es) }; _ -> return False }
|
|
235
|
+
|
|
236
|
+
-- ---------------- main ----------------
|
|
237
|
+
|
|
238
|
+
runStructCorpus :: Value -> IO (Int, Int)
|
|
239
|
+
runStructCorpus alltests = do
|
|
240
|
+
spec <- entryGet alltests "struct"
|
|
241
|
+
c <- Counters <$> newIORef 0 <*> newIORef 0 <*> newIORef []
|
|
242
|
+
runAll c spec
|
|
243
|
+
fs <- readIORef (failures c)
|
|
244
|
+
forM_ fs putStrLn
|
|
245
|
+
p <- readIORef (npass c)
|
|
246
|
+
f <- readIORef (nfail c)
|
|
247
|
+
return (p, f)
|
|
248
|
+
|
|
249
|
+
-- ---------------- test groups ----------------
|
|
250
|
+
|
|
251
|
+
nullModifier :: Value -> Value -> Value -> Inj -> IO ()
|
|
252
|
+
nullModifier v key parent _inj =
|
|
253
|
+
if vStrEq v nullmark then setprop parent key VNull >> return ()
|
|
254
|
+
else case v of
|
|
255
|
+
VStr s -> do _ <- setprop parent key (VStr (replaceAll s nullmark "null")); return ()
|
|
256
|
+
_ -> return ()
|
|
257
|
+
|
|
258
|
+
runAll :: Counters -> Value -> IO ()
|
|
259
|
+
runAll c spec = do
|
|
260
|
+
let g k = getpropRaw spec k
|
|
261
|
+
minor <- g "minor"; walks <- g "walk"; merges <- g "merge"
|
|
262
|
+
getpaths <- g "getpath"; injects <- g "inject"; transforms <- g "transform"
|
|
263
|
+
validates <- g "validate"; selects <- g "select"; sentinels <- g "sentinels"
|
|
264
|
+
let mg k = getpropRaw minor k
|
|
265
|
+
rs group nd subj fl = do n <- nd; runSet c group n subj fl
|
|
266
|
+
rsT group nd subj = rs group nd subj True
|
|
267
|
+
rsF group nd subj = rs group nd subj False
|
|
268
|
+
|
|
269
|
+
rsT "minor.isnode" (mg "isnode") (arg1 (\v -> return (VBool (isnode v))))
|
|
270
|
+
rsT "minor.ismap" (mg "ismap") (arg1 (\v -> return (VBool (ismap v))))
|
|
271
|
+
rsT "minor.islist" (mg "islist") (arg1 (\v -> return (VBool (islist v))))
|
|
272
|
+
rsF "minor.iskey" (mg "iskey") (arg1 (\v -> return (VBool (iskey v))))
|
|
273
|
+
rsF "minor.strkey" (mg "strkey") (arg1 (\v -> return (VStr (strkey v))))
|
|
274
|
+
rsF "minor.isempty" (mg "isempty") (arg1 (\v -> VBool <$> isempty v))
|
|
275
|
+
rsT "minor.isfunc" (mg "isfunc") (arg1 (\v -> return (VBool (isfunc v))))
|
|
276
|
+
rsF "minor.clone" (mg "clone") (arg1 clone)
|
|
277
|
+
rsT "minor.escre" (mg "escre") (arg1 escre)
|
|
278
|
+
rsT "minor.escurl" (mg "escurl") (arg1 escurl)
|
|
279
|
+
rsF "minor.stringify" (mg "stringify") (arg1 (\vin -> do
|
|
280
|
+
h <- vhas vin "val"
|
|
281
|
+
if h then do val <- vget vin "val"; mx <- vget vin "max"; VStr <$> stringifyMax val mx
|
|
282
|
+
else VStr <$> stringify VNoval))
|
|
283
|
+
rsF "minor.jsonify" (mg "jsonify") (arg1 (\vin -> do val <- vget vin "val"; fl <- vget vin "flags"; VStr <$> jsonify val fl))
|
|
284
|
+
rsF "minor.getelem" (mg "getelem") (arg1 (\vin -> do
|
|
285
|
+
alt <- vget vin "alt"; val <- vget vin "val"; key <- vget vin "key"
|
|
286
|
+
if isNullish alt then getelem val key else getelemAlt alt val key))
|
|
287
|
+
rsT "minor.delprop" (mg "delprop") (arg1 (\vin -> do p <- vget vin "parent"; k <- vget vin "key"; delprop p k))
|
|
288
|
+
rsF "minor.size" (mg "size") (arg1 (\v -> vint <$> size v))
|
|
289
|
+
rsF "minor.slice" (mg "slice") (arg1 (\vin -> do val <- vget vin "val"; st <- vget vin "start"; en <- vget vin "end"; slice val st en))
|
|
290
|
+
rsF "minor.pad" (mg "pad") (arg1 (\vin -> do val <- vget vin "val"; pd <- vget vin "pad"; ch <- vget vin "char"; VStr <$> pad val pd ch))
|
|
291
|
+
rsF "minor.pathify" (mg "pathify") (arg1 (\vin -> do
|
|
292
|
+
h <- vhas vin "path"; frm <- vget vin "from"
|
|
293
|
+
if h then do pth <- vget vin "path"; VStr <$> pathifyFull pth frm VNoval False
|
|
294
|
+
else VStr <$> pathifyFull VNoval frm VNoval True))
|
|
295
|
+
rsT "minor.items" (mg "items") (arg1 items)
|
|
296
|
+
rsF "minor.getprop" (mg "getprop") (arg1 (\vin -> do
|
|
297
|
+
alt <- vget vin "alt"; val <- vget vin "val"; key <- vget vin "key"
|
|
298
|
+
if isNullish alt then getprop val key else getpropAlt alt val key))
|
|
299
|
+
rsT "minor.setprop" (mg "setprop") (arg1 (\vin -> do p <- vget vin "parent"; k <- vget vin "key"; val <- vget vin "val"; setprop p k val))
|
|
300
|
+
rsF "minor.haskey" (mg "haskey") (arg1 (\vin -> do s <- vget vin "src"; k <- vget vin "key"; VBool <$> haskey s k))
|
|
301
|
+
rsT "minor.keysof" (mg "keysof") (arg1 (\v -> do ks <- keysof v; mkList (map VStr ks)))
|
|
302
|
+
rsF "minor.join" (mg "join") (arg1 (\vin -> do val <- vget vin "val"; sep <- vget vin "sep"; url <- vget vin "url"; VStr <$> join val sep (vIsTrue url)))
|
|
303
|
+
rsF "minor.typify" (mg "typify") (arg1 (\v -> return (vint (typify v))))
|
|
304
|
+
rsF "minor.setpath" (mg "setpath") (arg1 (\vin -> do st <- vget vin "store"; pth <- vget vin "path"; val <- vget vin "val"; setpath st pth val))
|
|
305
|
+
rsT "minor.filter" (mg "filter") (arg1 (\vin -> do
|
|
306
|
+
val <- vget vin "val"; ch <- vget vin "check"
|
|
307
|
+
let check = case ch of
|
|
308
|
+
VStr "gt3" -> \(_, x) -> case x of VNum n -> n > 3; _ -> False
|
|
309
|
+
VStr "lt3" -> \(_, x) -> case x of VNum n -> n < 3; _ -> False
|
|
310
|
+
_ -> \_ -> False
|
|
311
|
+
VoxgigStruct.filter val check))
|
|
312
|
+
rsT "minor.typename" (mg "typename") (arg1 (\v -> return (VStr (typename (case v of VNum n -> truncate n; _ -> 0)))))
|
|
313
|
+
rsT "minor.flatten" (mg "flatten") (arg1 (\vin -> do
|
|
314
|
+
val <- vget vin "val"; d <- vget vin "depth"
|
|
315
|
+
flatten (case d of VNum n -> truncate n; _ -> 1) val))
|
|
316
|
+
|
|
317
|
+
runWalkLog c "walk.log" =<< getpropRaw walks "log"
|
|
318
|
+
do nd <- getpropRaw walks "basic"
|
|
319
|
+
rs "walk.basic" (return nd) (arg1 (\vin -> walk Nothing (Just (\_ v _ path ->
|
|
320
|
+
case v of { VStr s -> do { pelems <- listItems path; pstrs <- mapM jsString pelems; return (VStr (s ++ "~" ++ intercalate "." pstrs)) }; _ -> return v })) VNoval vin)) True
|
|
321
|
+
do nd <- getpropRaw walks "copy"; rs "walk.copy" (return nd) (arg1 (walkCopySubject)) True
|
|
322
|
+
do nd <- getpropRaw walks "depth"; rs "walk.depth" (return nd) (arg1 (walkDepthSubject)) False
|
|
323
|
+
|
|
324
|
+
do nd <- getpropRaw merges "basic"; runSingle c "merge.basic" nd (\in_ -> clone in_ >>= merge)
|
|
325
|
+
rsT "merge.cases" (getpropRaw merges "cases") (arg1 merge)
|
|
326
|
+
rsT "merge.array" (getpropRaw merges "array") (arg1 merge)
|
|
327
|
+
rsT "merge.integrity" (getpropRaw merges "integrity") (arg1 merge)
|
|
328
|
+
rsT "merge.depth" (getpropRaw merges "depth") (arg1 (\vin -> do val <- vget vin "val"; d <- vget vin "depth"; mergeD val d))
|
|
329
|
+
|
|
330
|
+
rsT "getpath.basic" (getpropRaw getpaths "basic") (arg1 (\vin -> do st <- vget vin "store"; pth <- vget vin "path"; getpath INone st pth))
|
|
331
|
+
rsT "getpath.relative" (getpropRaw getpaths "relative") (arg1 (\vin -> do
|
|
332
|
+
st <- vget vin "store"; pth <- vget vin "path"; dpv <- vget vin "dpath"; dpar <- vget vin "dparent"
|
|
333
|
+
dpath <- case dpv of VStr s -> mkList (map VStr (splitOn '.' s)); _ -> return VNoval
|
|
334
|
+
let d = (defaultInjDef VNoval) { dDparent = dpar, dDpath = dpath }
|
|
335
|
+
getpath (IDef d) st pth))
|
|
336
|
+
rsT "getpath.special" (getpropRaw getpaths "special") (arg1 (\vin -> do
|
|
337
|
+
st <- vget vin "store"; pth <- vget vin "path"; injm <- vget vin "inj"
|
|
338
|
+
bs <- getprop injm (VStr "base"); mt <- getprop injm (VStr "meta"); dpar <- getprop injm (VStr "dparent"); dpt <- getprop injm (VStr "dpath"); ky <- getprop injm (VStr "key")
|
|
339
|
+
let d = (defaultInjDef VNoval) { dBase = bs, dMeta = mt, dDparent = dpar, dDpath = dpt, dKey = ky }
|
|
340
|
+
getpath (if isNullish injm then INone else IDef d) st pth))
|
|
341
|
+
rsT "getpath.handler" (getpropRaw getpaths "handler") (arg1 (\vin -> do
|
|
342
|
+
stv <- vget vin "store"; pth <- vget vin "path"
|
|
343
|
+
store <- omapV [("$TOP", stv), ("$FOO", VFunc (\_ _ _ _ -> return (VStr "foo")))]
|
|
344
|
+
let d = (defaultInjDef VNoval) { dHandler = Just (\_inj v _ref _store -> case v of VFunc f -> f dummyInj VNoval "" VNoval; _ -> return v) }
|
|
345
|
+
getpath (IDef d) store pth))
|
|
346
|
+
|
|
347
|
+
do nd <- getpropRaw injects "basic"; runSingle c "inject.basic" nd (\in_ -> do val <- getpropRaw in_ "val" >>= clone; st <- getpropRaw in_ "store" >>= clone; inject INone val st)
|
|
348
|
+
rsT "inject.string" (getpropRaw injects "string") (arg1 (\vin -> do val <- vget vin "val"; st <- vget vin "store"; cur <- vget vin "current"; let d = (defaultInjDef VNoval) { dModify = Just nullModifier, dExtra = cur } in inject (IDef d) val st))
|
|
349
|
+
rsT "inject.deep" (getpropRaw injects "deep") (arg1 (\vin -> do val <- vget vin "val"; st <- vget vin "store"; inject INone val st))
|
|
350
|
+
|
|
351
|
+
do nd <- getpropRaw transforms "basic"; runSingle c "transform.basic" nd (\in_ -> do dat <- getpropRaw in_ "data"; sp <- getpropRaw in_ "spec"; transform INone dat sp)
|
|
352
|
+
forM_ ["paths", "cmds", "each", "pack", "ref"] $ \gn ->
|
|
353
|
+
rsT ("transform." ++ gn) (getpropRaw transforms gn) (arg1 (\vin -> do dat <- vget vin "data"; sp <- vget vin "spec"; transform INone dat sp))
|
|
354
|
+
rsT "transform.modify" (getpropRaw transforms "modify") (arg1 (\vin -> do
|
|
355
|
+
dat <- vget vin "data"; sp <- vget vin "spec"; st <- vget vin "store"
|
|
356
|
+
let modf = \v key parent _inj -> case v of VStr s | not (isNullish key) && not (isNullish parent) -> setprop parent key (VStr ("@" ++ s)) >> return (); _ -> return ()
|
|
357
|
+
d = (defaultInjDef VNoval) { dModify = Just modf, dExtra = st }
|
|
358
|
+
transform (IDef d) dat sp))
|
|
359
|
+
rsF "transform.format" (getpropRaw transforms "format") (arg1 (\vin -> do dat <- vget vin "data"; sp <- vget vin "spec"; transform INone dat sp))
|
|
360
|
+
rsT "transform.apply" (getpropRaw transforms "apply") (arg1 (\vin -> do dat <- vget vin "data"; sp <- vget vin "spec"; transform INone dat sp))
|
|
361
|
+
|
|
362
|
+
rsF "validate.basic" (getpropRaw validates "basic") (arg1 (\vin -> do dat <- vget vin "data"; sp <- vget vin "spec"; validate INone dat sp))
|
|
363
|
+
forM_ ["child", "one", "exact"] $ \gn ->
|
|
364
|
+
rsT ("validate." ++ gn) (getpropRaw validates gn) (arg1 (\vin -> do dat <- vget vin "data"; sp <- vget vin "spec"; validate INone dat sp))
|
|
365
|
+
rsF "validate.invalid" (getpropRaw validates "invalid") (arg1 (\vin -> do dat <- vget vin "data"; sp <- vget vin "spec"; validate INone dat sp))
|
|
366
|
+
rsT "validate.special" (getpropRaw validates "special") (arg1 (\vin -> do
|
|
367
|
+
dat <- vget vin "data"; sp <- vget vin "spec"; injm <- vget vin "inj"
|
|
368
|
+
mt <- getprop injm (VStr "meta")
|
|
369
|
+
let d = (defaultInjDef VNoval) { dMeta = mt }
|
|
370
|
+
validate (if isNullish injm then INone else IDef d) dat sp))
|
|
371
|
+
|
|
372
|
+
forM_ ["basic", "operators", "edge", "alts"] $ \gn ->
|
|
373
|
+
rsT ("select." ++ gn) (getpropRaw selects gn) (arg1 (\vin -> do obj <- vget vin "obj"; qry <- vget vin "query"; select obj qry))
|
|
374
|
+
|
|
375
|
+
rsF "sentinels.getprop_unify" (getpropRaw sentinels "getprop_unify") (arg1 (\vin -> do alt <- vget vin "alt"; val <- vget vin "val"; key <- vget vin "key"; getpropAlt alt val key))
|
|
376
|
+
rsF "sentinels.getelem_absent" (getpropRaw sentinels "getelem_absent") (arg1 (\vin -> do alt <- vget vin "alt"; val <- vget vin "val"; key <- vget vin "key"; getelemAlt alt val key))
|
|
377
|
+
rsF "sentinels.haskey_unify" (getpropRaw sentinels "haskey_unify") (arg1 (\vin -> do val <- vget vin "val"; key <- vget vin "key"; VBool <$> haskey val key))
|
|
378
|
+
rsF "sentinels.isempty_unify" (getpropRaw sentinels "isempty_unify") (arg1 (\v -> VBool <$> isempty v))
|
|
379
|
+
rsF "sentinels.isnode_unify" (getpropRaw sentinels "isnode_unify") (arg1 (\v -> return (VBool (isnode v))))
|
|
380
|
+
rsF "sentinels.stringify_null" (getpropRaw sentinels "stringify_null") (arg1 (\vin -> VStr <$> stringify vin))
|
|
381
|
+
|
|
382
|
+
runWalkLog :: Counters -> String -> Value -> IO ()
|
|
383
|
+
runWalkLog c group node = do
|
|
384
|
+
result <- try go :: IO (Either SomeException ())
|
|
385
|
+
case result of
|
|
386
|
+
Right () -> return ()
|
|
387
|
+
Left e -> record c group "log" False (exMsg e)
|
|
388
|
+
where
|
|
389
|
+
go = do
|
|
390
|
+
testData <- clone node
|
|
391
|
+
logRef <- emptyList
|
|
392
|
+
let walklog _ v _ _ = return v
|
|
393
|
+
walklogA key v parent path = do
|
|
394
|
+
ks <- if isNullish key then stringify VNoval else stringify key
|
|
395
|
+
vs <- stringify v
|
|
396
|
+
ps <- if isNullish parent then stringify VNoval else stringify parent
|
|
397
|
+
ts <- pathify path
|
|
398
|
+
sz <- size logRef
|
|
399
|
+
_ <- setprop logRef (VNum (fromIntegral sz)) (VStr ("k=" ++ ks ++ ", v=" ++ vs ++ ", p=" ++ ps ++ ", t=" ++ ts))
|
|
400
|
+
return v
|
|
401
|
+
din <- getpropRaw testData "in"
|
|
402
|
+
_ <- walk Nothing (Just walklogA) VNoval din
|
|
403
|
+
dout <- getpropRaw testData "out"
|
|
404
|
+
expected <- getprop dout (VStr "after")
|
|
405
|
+
e <- eqv expected logRef
|
|
406
|
+
if e then record c group "log" True ""
|
|
407
|
+
else do se <- stringify expected; sl <- stringify logRef; record c group "log" False ("Expected: " ++ se ++ ", got: " ++ sl)
|
|
408
|
+
|
|
409
|
+
walkCopySubject :: Value -> IO Value
|
|
410
|
+
walkCopySubject vin = do
|
|
411
|
+
curRef <- newIORef =<< mkList [VNoval]
|
|
412
|
+
let walkcopy key v _parent path =
|
|
413
|
+
if isNullish key then do
|
|
414
|
+
inner <- if ismap v then emptyMap else if islist v then emptyList else return v
|
|
415
|
+
nl <- mkList [inner]
|
|
416
|
+
writeIORef curRef nl
|
|
417
|
+
return v
|
|
418
|
+
else do
|
|
419
|
+
i <- size path
|
|
420
|
+
nv <- if isnode v then do
|
|
421
|
+
cur <- readIORef curRef
|
|
422
|
+
let grow = do its <- listItems cur; when (length its <= i) (do _ <- setprop cur (VNum (fromIntegral (length its))) VNoval; grow)
|
|
423
|
+
grow
|
|
424
|
+
nn <- if ismap v then emptyMap else emptyList
|
|
425
|
+
_ <- setprop cur (VNum (fromIntegral i)) nn
|
|
426
|
+
return nn
|
|
427
|
+
else return v
|
|
428
|
+
cur <- readIORef curRef
|
|
429
|
+
tgt <- getelem cur (VNum (fromIntegral (i - 1)))
|
|
430
|
+
_ <- setprop tgt key nv
|
|
431
|
+
return v
|
|
432
|
+
_ <- walk (Just walkcopy) Nothing VNoval vin
|
|
433
|
+
cur <- readIORef curRef
|
|
434
|
+
getelem cur (VNum 0)
|
|
435
|
+
|
|
436
|
+
walkDepthSubject :: Value -> IO Value
|
|
437
|
+
walkDepthSubject vin = do
|
|
438
|
+
topRef <- newIORef VNoval
|
|
439
|
+
currRef <- newIORef VNoval
|
|
440
|
+
let copy key v _parent _path = do
|
|
441
|
+
if isNullish key || isnode v then do
|
|
442
|
+
child <- if islist v then emptyList else emptyMap
|
|
443
|
+
if isNullish key then do writeIORef topRef child; writeIORef currRef child
|
|
444
|
+
else do cur <- readIORef currRef; _ <- setprop cur key child; writeIORef currRef child
|
|
445
|
+
else do cur <- readIORef currRef; _ <- setprop cur key v; return ()
|
|
446
|
+
return v
|
|
447
|
+
src <- vget vin "src"; md <- vget vin "maxdepth"
|
|
448
|
+
_ <- walk (Just copy) Nothing md src
|
|
449
|
+
readIORef topRef
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
-- Custom utility overrides: caller-supplied callables in options.utility land
|
|
2
|
+
-- on utility.custom during option resolution.
|
|
3
|
+
|
|
4
|
+
module TCustomUtility (tests) where
|
|
5
|
+
|
|
6
|
+
import Control.Monad (forM_, foldM)
|
|
7
|
+
import Data.IORef (readIORef)
|
|
8
|
+
|
|
9
|
+
import VoxgigStruct (Value (..), emptyMap, isfunc)
|
|
10
|
+
import SdkTypes
|
|
11
|
+
import SdkHelpers
|
|
12
|
+
import qualified SdkClient as C
|
|
13
|
+
import Testutil
|
|
14
|
+
|
|
15
|
+
utils :: [(String, String)]
|
|
16
|
+
utils =
|
|
17
|
+
[ ("auth", "AUTH"), ("body", "BODY"), ("contextify", "CONTEXTIFY")
|
|
18
|
+
, ("done", "DONE"), ("error", "ERROR"), ("findparam", "FINDPARAM")
|
|
19
|
+
, ("fullurl", "FULLURL"), ("headers", "HEADERS"), ("method", "METHOD")
|
|
20
|
+
, ("operator", "OPERATOR"), ("params", "PARAMS"), ("query", "QUERY")
|
|
21
|
+
, ("reqform", "REQFORM"), ("request", "REQUEST"), ("resbasic", "RESBASIC")
|
|
22
|
+
, ("resbody", "RESBODY"), ("resform", "RESFORM"), ("resheaders", "RESHEADERS")
|
|
23
|
+
, ("response", "RESPONSE"), ("result", "RESULT"), ("spec", "SPEC") ]
|
|
24
|
+
|
|
25
|
+
tests :: Counters -> IO ()
|
|
26
|
+
tests c = do
|
|
27
|
+
runTest c "customUtility.basic" $ do
|
|
28
|
+
utilOpts <- emptyMap
|
|
29
|
+
forM_ utils $ \(k, tag) ->
|
|
30
|
+
setp utilOpts k (VFunc (\_ _ _ _ -> jo [("util", VStr tag)]))
|
|
31
|
+
opts <- jo [("apikey", VStr "APIKEY01"), ("utility", utilOpts)]
|
|
32
|
+
sdk <- C.testSdk VNoval opts
|
|
33
|
+
let u = clUtility sdk
|
|
34
|
+
custom <- readIORef (uCustom u)
|
|
35
|
+
foldM (\ok (k, tag) -> do
|
|
36
|
+
f <- getp custom k
|
|
37
|
+
if not (isfunc f) then pure False
|
|
38
|
+
else do out <- callVfn f VNoval; uv <- getp out "util"; pure (ok && vstring uv == tag)) True utils
|