@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,608 @@
|
|
|
1
|
+
// Direct unit tests for the operation-pipeline utilities. The generated
|
|
2
|
+
// entity tests exercise the happy path; these drive the error and edge
|
|
3
|
+
// branches (missing spec/response/result, 4xx handling, transport
|
|
4
|
+
// failures, feature ordering, auth header shaping) that a normal
|
|
5
|
+
// success-path op never reaches. All utilities are reached through
|
|
6
|
+
// `stdutil`, so this suite is API-agnostic. Port of ts test/pipeline.test.ts.
|
|
7
|
+
|
|
8
|
+
import 'harness.dart';
|
|
9
|
+
|
|
10
|
+
import '../lib/ProjectNameSDK.dart';
|
|
11
|
+
import '../lib/ProjectNameError.dart';
|
|
12
|
+
import '../lib/Operation.dart';
|
|
13
|
+
import '../lib/Response.dart';
|
|
14
|
+
import '../lib/Result.dart';
|
|
15
|
+
import '../lib/Spec.dart';
|
|
16
|
+
import '../lib/feature/base/BaseFeature.dart';
|
|
17
|
+
import '../lib/utility/ErrUtility.dart';
|
|
18
|
+
import '../lib/utility/Utility.dart';
|
|
19
|
+
|
|
20
|
+
// Transport-shaped response with a re-readable body + lowercased headers.
|
|
21
|
+
Map<String, dynamic> resp(int status, [dynamic data, Map<String, dynamic>? headers]) {
|
|
22
|
+
final h = <String, dynamic>{};
|
|
23
|
+
(headers ?? {}).forEach((k, v) => h[k.toLowerCase()] = v);
|
|
24
|
+
return {
|
|
25
|
+
'status': status,
|
|
26
|
+
'statusText': status < 400 ? 'OK' : 'ERR',
|
|
27
|
+
'body': 'body',
|
|
28
|
+
'json': () => data,
|
|
29
|
+
'headers': h,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
dynamic base([Map<String, dynamic>? over]) {
|
|
34
|
+
final ctx = stdutil.makeContext({});
|
|
35
|
+
ctx.utility = stdutil;
|
|
36
|
+
ctx.ctrl = {};
|
|
37
|
+
ctx.op = Operation({'name': 'load', 'entity': 'x'});
|
|
38
|
+
over?.forEach((k, v) {
|
|
39
|
+
switch (k) {
|
|
40
|
+
case 'op':
|
|
41
|
+
ctx.op = v is Operation || null == v ? v : Operation(v);
|
|
42
|
+
break;
|
|
43
|
+
case 'options':
|
|
44
|
+
ctx.options = v;
|
|
45
|
+
break;
|
|
46
|
+
case 'spec':
|
|
47
|
+
ctx.spec = v is Map ? Spec(v) : v;
|
|
48
|
+
break;
|
|
49
|
+
case 'response':
|
|
50
|
+
ctx.response = v is Map ? Response(v) : v;
|
|
51
|
+
break;
|
|
52
|
+
case 'result':
|
|
53
|
+
ctx.result = v is Map ? Result(v) : v;
|
|
54
|
+
break;
|
|
55
|
+
case 'out':
|
|
56
|
+
ctx.out = Map<String, dynamic>.from(v);
|
|
57
|
+
break;
|
|
58
|
+
case 'ctrl':
|
|
59
|
+
ctx.ctrl = v is Map ? Map<String, dynamic>.from(v) : v;
|
|
60
|
+
break;
|
|
61
|
+
case 'utility':
|
|
62
|
+
ctx.utility = v;
|
|
63
|
+
break;
|
|
64
|
+
case 'entity':
|
|
65
|
+
ctx.entity = v;
|
|
66
|
+
break;
|
|
67
|
+
case 'client':
|
|
68
|
+
ctx.client = v;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return ctx;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// A utility whose fetcher (or other member) is overridden (makeRequest tests).
|
|
76
|
+
Utility utilWith(dynamic fetcher) {
|
|
77
|
+
final u = Utility();
|
|
78
|
+
u.fetcher = fetcher;
|
|
79
|
+
return u;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Entity fake for the list-wrapping test.
|
|
83
|
+
class _FakeEnt {
|
|
84
|
+
final List made;
|
|
85
|
+
_FakeEnt(this.made);
|
|
86
|
+
String get name => 'x';
|
|
87
|
+
dynamic make() => _FakeEnt(made);
|
|
88
|
+
dynamic data(dynamic d) {
|
|
89
|
+
made.add(d);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Client fake exposing only options() (prepareAuth tests).
|
|
94
|
+
class _OptClient {
|
|
95
|
+
final dynamic opts;
|
|
96
|
+
_OptClient(this.opts);
|
|
97
|
+
dynamic options() => opts;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Client fake exposing only features (featureAdd tests).
|
|
101
|
+
class _FeatClient {
|
|
102
|
+
List features = [];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
BaseFeature _feat(String name, [Map<String, dynamic>? opts]) {
|
|
106
|
+
final f = BaseFeature();
|
|
107
|
+
f.name = name;
|
|
108
|
+
if (null != opts) {
|
|
109
|
+
f.options = opts;
|
|
110
|
+
}
|
|
111
|
+
return f;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const allow = {
|
|
115
|
+
'op': 'load,list,create,update,remove',
|
|
116
|
+
'method': 'GET,PUT,POST,PATCH,DELETE'
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
void tests() {
|
|
120
|
+
describe('pipeline:makePoint + makeSpec', () {
|
|
121
|
+
test('makePoint rejects a disallowed operation', (t) {
|
|
122
|
+
final ctx = base({
|
|
123
|
+
'op': {'name': 'nope', 'points': []},
|
|
124
|
+
'options': {
|
|
125
|
+
'allow': {'op': 'load'}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
equal('point_op_allow', errcode(stdutil.makePoint(ctx)));
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test('makePoint rejects an operation with no endpoints', (t) {
|
|
132
|
+
final ctx = base({
|
|
133
|
+
'op': {'name': 'load', 'points': []},
|
|
134
|
+
'options': {'allow': allow}
|
|
135
|
+
});
|
|
136
|
+
equal('point_no_points', errcode(stdutil.makePoint(ctx)));
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test('makePoint returns the single point', (t) {
|
|
140
|
+
final ctx = base({
|
|
141
|
+
'op': {
|
|
142
|
+
'name': 'load',
|
|
143
|
+
'points': [
|
|
144
|
+
{
|
|
145
|
+
'method': 'GET',
|
|
146
|
+
'parts': ['a']
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
'options': {'allow': allow}
|
|
151
|
+
});
|
|
152
|
+
final r = stdutil.makePoint(ctx);
|
|
153
|
+
equal(true, identical(r, ctx.op.points[0]));
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test('makePoint short-circuits a feature-supplied point', (t) {
|
|
157
|
+
final preset = {'method': 'GET'};
|
|
158
|
+
final ctx = base({
|
|
159
|
+
'out': {'point': preset}
|
|
160
|
+
});
|
|
161
|
+
equal(true, identical(preset, stdutil.makePoint(ctx)));
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test('makeSpec short-circuits a feature-supplied spec', (t) {
|
|
165
|
+
final preset = {'method': 'GET'};
|
|
166
|
+
final ctx = base({
|
|
167
|
+
'out': {'spec': preset}
|
|
168
|
+
});
|
|
169
|
+
equal(true, identical(preset, stdutil.makeSpec(ctx)));
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
describe('pipeline:makeResponse', () {
|
|
174
|
+
test('guards missing spec / response / result', (t) async {
|
|
175
|
+
equal(
|
|
176
|
+
'response_no_spec',
|
|
177
|
+
errcode(await stdutil.makeResponse(
|
|
178
|
+
base({'spec': null, 'response': {}, 'result': {}}))));
|
|
179
|
+
equal(
|
|
180
|
+
'response_no_response',
|
|
181
|
+
errcode(await stdutil.makeResponse(
|
|
182
|
+
base({'spec': {}, 'response': null, 'result': {}}))));
|
|
183
|
+
equal(
|
|
184
|
+
'response_no_result',
|
|
185
|
+
errcode(await stdutil.makeResponse(
|
|
186
|
+
base({'spec': {}, 'response': {}, 'result': null}))));
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
test('a 4xx response sets result.err and copies headers', (t) async {
|
|
190
|
+
final ctx = base({
|
|
191
|
+
'spec': {'step': 's'},
|
|
192
|
+
'response': resp(404, null, {'x-a': '1'}),
|
|
193
|
+
'result': {'ok': false}
|
|
194
|
+
});
|
|
195
|
+
await stdutil.makeResponse(ctx);
|
|
196
|
+
ok(null != ctx.result.err);
|
|
197
|
+
equal(404, ctx.result.status);
|
|
198
|
+
equal('1', ctx.result.headers['x-a']);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
test('a 2xx response parses the body and marks ok', (t) async {
|
|
202
|
+
final ctx = base({
|
|
203
|
+
'spec': {'step': 's'},
|
|
204
|
+
'response': resp(200, {'v': 1}),
|
|
205
|
+
'result': {'ok': false}
|
|
206
|
+
});
|
|
207
|
+
await stdutil.makeResponse(ctx);
|
|
208
|
+
equal(true, ctx.result.ok);
|
|
209
|
+
deepEqual(ctx.result.body, {'v': 1});
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
test('records to ctrl.explain when explain is on', (t) async {
|
|
213
|
+
final ctx = base({
|
|
214
|
+
'ctrl': {'explain': {}},
|
|
215
|
+
'spec': {'step': 's'},
|
|
216
|
+
'response': resp(200, {'v': 2}),
|
|
217
|
+
'result': {'ok': false}
|
|
218
|
+
});
|
|
219
|
+
await stdutil.makeResponse(ctx);
|
|
220
|
+
ok(null != ctx.ctrl['explain']['result']);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
test('a body-parse exception is captured on result.err', (t) async {
|
|
224
|
+
final throwing = resp(200, null);
|
|
225
|
+
throwing['json'] = () => throw StateError('bad json');
|
|
226
|
+
final ctx = base({
|
|
227
|
+
'spec': {'step': 's'},
|
|
228
|
+
'response': throwing,
|
|
229
|
+
'result': {'ok': false}
|
|
230
|
+
});
|
|
231
|
+
await stdutil.makeResponse(ctx);
|
|
232
|
+
ok(null != ctx.result.err);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
test('short-circuits when a feature already supplied the response',
|
|
236
|
+
(t) async {
|
|
237
|
+
final preset = resp(299);
|
|
238
|
+
final ctx = base({
|
|
239
|
+
'out': {'response': preset},
|
|
240
|
+
'spec': {},
|
|
241
|
+
'response': {},
|
|
242
|
+
'result': {}
|
|
243
|
+
});
|
|
244
|
+
equal(true, identical(preset, await stdutil.makeResponse(ctx)));
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
describe('pipeline:makeResult', () {
|
|
249
|
+
test('guards missing spec / result', (t) {
|
|
250
|
+
equal('result_no_spec',
|
|
251
|
+
errcode(stdutil.makeResult(base({'spec': null, 'result': {}}))));
|
|
252
|
+
equal('result_no_result',
|
|
253
|
+
errcode(stdutil.makeResult(base({'spec': {}, 'result': null}))));
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
test('list op wraps resdata into entity instances', (t) {
|
|
257
|
+
final made = [];
|
|
258
|
+
final ctx = base({
|
|
259
|
+
'op': {'name': 'list', 'entity': 'x'},
|
|
260
|
+
'entity': _FakeEnt(made),
|
|
261
|
+
'spec': {'step': 's'},
|
|
262
|
+
'result': {
|
|
263
|
+
'resdata': [
|
|
264
|
+
{'a': 1},
|
|
265
|
+
{'a': 2}
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
final r = stdutil.makeResult(ctx);
|
|
270
|
+
equal(2, r.resdata.length);
|
|
271
|
+
equal(2, made.length);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
test('an empty list yields an empty resdata array', (t) {
|
|
275
|
+
final ctx = base({
|
|
276
|
+
'op': {'name': 'list', 'entity': 'x'},
|
|
277
|
+
'entity': _FakeEnt([]),
|
|
278
|
+
'spec': {'step': 's'},
|
|
279
|
+
'result': {'resdata': []},
|
|
280
|
+
});
|
|
281
|
+
final r = stdutil.makeResult(ctx);
|
|
282
|
+
deepEqual(r.resdata, []);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
test('short-circuits on a preset result', (t) {
|
|
286
|
+
final preset = {'ok': true};
|
|
287
|
+
equal(
|
|
288
|
+
true,
|
|
289
|
+
identical(
|
|
290
|
+
preset,
|
|
291
|
+
stdutil.makeResult(base({
|
|
292
|
+
'out': {'result': preset},
|
|
293
|
+
'spec': {},
|
|
294
|
+
'result': {}
|
|
295
|
+
}))));
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
describe('pipeline:makeRequest', () {
|
|
300
|
+
test('guards a missing spec', (t) async {
|
|
301
|
+
equal('request_no_spec',
|
|
302
|
+
errcode(await stdutil.makeRequest(base({'spec': null}))));
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
test('a null transport result becomes a response error', (t) async {
|
|
306
|
+
final ctx = base({
|
|
307
|
+
'utility': utilWith((c, u, f) async => null),
|
|
308
|
+
'spec': {'step': 's', 'method': 'GET', 'headers': {}}
|
|
309
|
+
});
|
|
310
|
+
final r = await stdutil.makeRequest(ctx);
|
|
311
|
+
ok(null != r.err);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
test('an Error transport result is carried on the response', (t) async {
|
|
315
|
+
final boom = ProjectNameError('boom', 'boom', null);
|
|
316
|
+
final ctx = base({
|
|
317
|
+
'utility': utilWith((c, u, f) async => boom),
|
|
318
|
+
'spec': {'step': 's', 'method': 'GET', 'headers': {}}
|
|
319
|
+
});
|
|
320
|
+
final r = await stdutil.makeRequest(ctx);
|
|
321
|
+
equal(true, identical(boom, r.err));
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
test('a normal transport response is wrapped', (t) async {
|
|
325
|
+
final ctx = base({
|
|
326
|
+
'utility': utilWith((c, u, f) async => resp(200, {'a': 1})),
|
|
327
|
+
'spec': {'step': 's', 'method': 'GET', 'headers': {}}
|
|
328
|
+
});
|
|
329
|
+
final r = await stdutil.makeRequest(ctx);
|
|
330
|
+
equal(200, r.status);
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
test('records the fetchdef to ctrl.explain', (t) async {
|
|
334
|
+
final ctx = base({
|
|
335
|
+
'ctrl': {'explain': {}},
|
|
336
|
+
'utility': utilWith((c, u, f) async => resp(200, {})),
|
|
337
|
+
'spec': {'step': 's', 'method': 'GET', 'headers': {}},
|
|
338
|
+
});
|
|
339
|
+
await stdutil.makeRequest(ctx);
|
|
340
|
+
ok(null != ctx.ctrl['explain']['fetchdef']);
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
test('a fetchdef error surfaces as a response error', (t) async {
|
|
344
|
+
final u = Utility();
|
|
345
|
+
u.makeFetchDef = (dynamic c) => ProjectNameError('fetchdef_boom', 'boom', null);
|
|
346
|
+
final ctx = base({
|
|
347
|
+
'utility': u,
|
|
348
|
+
'spec': {'step': 's', 'method': 'GET', 'headers': {}}
|
|
349
|
+
});
|
|
350
|
+
final r = await stdutil.makeRequest(ctx);
|
|
351
|
+
ok(null != r.err);
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
test('short-circuits a feature-supplied request', (t) async {
|
|
355
|
+
final preset = resp(201);
|
|
356
|
+
equal(
|
|
357
|
+
true,
|
|
358
|
+
identical(
|
|
359
|
+
preset,
|
|
360
|
+
await stdutil.makeRequest(base({
|
|
361
|
+
'out': {'request': preset},
|
|
362
|
+
'spec': {}
|
|
363
|
+
}))));
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
describe('pipeline:makeFetchDef', () {
|
|
368
|
+
test('guards a missing spec', (t) {
|
|
369
|
+
equal('fetchdef_no_spec',
|
|
370
|
+
errcode(stdutil.makeFetchDef(base({'spec': null}))));
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
test('serialises an object body to JSON and inits a missing result', (t) {
|
|
374
|
+
final ctx = base({
|
|
375
|
+
'result': null,
|
|
376
|
+
'spec': {
|
|
377
|
+
'step': 's',
|
|
378
|
+
'method': 'POST',
|
|
379
|
+
'headers': {},
|
|
380
|
+
'base': 'http://h',
|
|
381
|
+
'prefix': '',
|
|
382
|
+
'suffix': '',
|
|
383
|
+
'parts': ['a'],
|
|
384
|
+
'path': 'a',
|
|
385
|
+
'body': {'x': 1}
|
|
386
|
+
},
|
|
387
|
+
});
|
|
388
|
+
final fd = stdutil.makeFetchDef(ctx);
|
|
389
|
+
ok(fd['body'] is String);
|
|
390
|
+
ok(fd['url'].toString().contains('http://h'));
|
|
391
|
+
ok(null != ctx.result); // result was lazily created
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
describe('pipeline:makeError + done', () {
|
|
396
|
+
test('done returns resdata on success', (t) {
|
|
397
|
+
equal(
|
|
398
|
+
42,
|
|
399
|
+
stdutil.done(base({
|
|
400
|
+
'result': {'ok': true, 'resdata': 42}
|
|
401
|
+
})));
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
test('done throws the error when not ok', (t) {
|
|
405
|
+
var threw = false;
|
|
406
|
+
try {
|
|
407
|
+
stdutil.done(base({
|
|
408
|
+
'result': {'ok': false}
|
|
409
|
+
}));
|
|
410
|
+
} catch (_e) {
|
|
411
|
+
threw = true;
|
|
412
|
+
}
|
|
413
|
+
equal(true, threw);
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
test('done cleans ctrl.explain on success', (t) {
|
|
417
|
+
final ctx = base({
|
|
418
|
+
'ctrl': {
|
|
419
|
+
'explain': {
|
|
420
|
+
'result': {'err': 'x'}
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
'result': {'ok': true, 'resdata': 7}
|
|
424
|
+
});
|
|
425
|
+
equal(7, stdutil.done(ctx));
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
test('makeError returns resdata instead of throwing when ctrl.throw is false',
|
|
429
|
+
(t) {
|
|
430
|
+
final ctx = base({
|
|
431
|
+
'ctrl': {'throw': false},
|
|
432
|
+
'result': {'ok': false, 'resdata': 'fallback'}
|
|
433
|
+
});
|
|
434
|
+
equal('fallback', stdutil.makeError(ctx));
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
test('makeError records to ctrl.explain', (t) {
|
|
438
|
+
final ctx = base({
|
|
439
|
+
'ctrl': {'throw': false, 'explain': {}},
|
|
440
|
+
'result': {'ok': false}
|
|
441
|
+
});
|
|
442
|
+
stdutil.makeError(ctx);
|
|
443
|
+
ok(null != ctx.ctrl['explain']['err']);
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
describe('pipeline:featureAdd ordering', () {
|
|
448
|
+
_FeatClient client() =>
|
|
449
|
+
_FeatClient()..features = [_feat('a'), _feat('b')];
|
|
450
|
+
|
|
451
|
+
String names(_FeatClient c) =>
|
|
452
|
+
c.features.map((f) => (f as dynamic).name).join(',');
|
|
453
|
+
|
|
454
|
+
test('appends by default', (t) {
|
|
455
|
+
final c = client();
|
|
456
|
+
stdutil.featureAdd(base({'client': c}), _feat('z'));
|
|
457
|
+
equal('a,b,z', names(c));
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
test('__before__ inserts ahead of the named feature', (t) {
|
|
461
|
+
final c = client();
|
|
462
|
+
stdutil.featureAdd(
|
|
463
|
+
base({'client': c}), _feat('z', {'__before__': 'b'}));
|
|
464
|
+
equal('a,z,b', names(c));
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
test('__after__ inserts behind the named feature', (t) {
|
|
468
|
+
final c = client();
|
|
469
|
+
stdutil.featureAdd(base({'client': c}), _feat('z', {'__after__': 'a'}));
|
|
470
|
+
equal('a,z,b', names(c));
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
test('__replace__ swaps the named feature', (t) {
|
|
474
|
+
final c = client();
|
|
475
|
+
stdutil.featureAdd(
|
|
476
|
+
base({'client': c}), _feat('z', {'__replace__': 'a'}));
|
|
477
|
+
equal('z,b', names(c));
|
|
478
|
+
});
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
describe('pipeline:feature order', () {
|
|
482
|
+
dynamic resolve(dynamic feature) {
|
|
483
|
+
final ctx = stdutil.makeContext({
|
|
484
|
+
'utility': stdutil,
|
|
485
|
+
'options': {'feature': feature},
|
|
486
|
+
'config': {'options': {}},
|
|
487
|
+
});
|
|
488
|
+
return stdutil.makeOptions(ctx);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
test('map form is ordered test-first (test is the base transport)', (t) {
|
|
492
|
+
final o = resolve({
|
|
493
|
+
'metrics': {'active': true},
|
|
494
|
+
'test': {'active': true}
|
|
495
|
+
});
|
|
496
|
+
equal('test,metrics',
|
|
497
|
+
(o['__derived__']['featureorder'] as List).join(','));
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
test('array form preserves the explicit developer-specified order', (t) {
|
|
501
|
+
final o = resolve([
|
|
502
|
+
{'name': 'metrics', 'active': true},
|
|
503
|
+
{'name': 'test', 'active': true}
|
|
504
|
+
]);
|
|
505
|
+
equal('metrics,test',
|
|
506
|
+
(o['__derived__']['featureorder'] as List).join(','));
|
|
507
|
+
// the List is normalized to a map for merge/init, opts preserved
|
|
508
|
+
equal(true, o['feature']['metrics']['active']);
|
|
509
|
+
equal(true, o['feature']['test']['active']);
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
test('map form with no test orders names deterministically', (t) {
|
|
513
|
+
final o = resolve({
|
|
514
|
+
'retry': {'active': true},
|
|
515
|
+
'cache': {'active': true}
|
|
516
|
+
});
|
|
517
|
+
equal('cache,retry',
|
|
518
|
+
(o['__derived__']['featureorder'] as List).join(','));
|
|
519
|
+
});
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
describe('pipeline:prepareAuth', () {
|
|
523
|
+
// Fake client so the exact options.auth / apikey shape is controlled.
|
|
524
|
+
dynamic authCtx(dynamic options, dynamic headers) {
|
|
525
|
+
return base({
|
|
526
|
+
'client': _OptClient(options),
|
|
527
|
+
'spec': null == headers ? null : {'headers': headers}
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
test('guards a missing spec', (t) {
|
|
532
|
+
equal(
|
|
533
|
+
'auth_no_spec',
|
|
534
|
+
errcode(stdutil.prepareAuth(authCtx({
|
|
535
|
+
'auth': {'prefix': ''},
|
|
536
|
+
'apikey': 'K'
|
|
537
|
+
}, null))));
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
test('an apikey with a prefix is space-joined', (t) {
|
|
541
|
+
final ctx = authCtx({
|
|
542
|
+
'apikey': 'K',
|
|
543
|
+
'auth': {'prefix': 'Bearer'}
|
|
544
|
+
}, {});
|
|
545
|
+
stdutil.prepareAuth(ctx);
|
|
546
|
+
equal('Bearer K', ctx.spec.headers['authorization']);
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
test('a raw apikey (empty prefix) goes in as-is', (t) {
|
|
550
|
+
final ctx = authCtx({
|
|
551
|
+
'apikey': 'K',
|
|
552
|
+
'auth': {'prefix': ''}
|
|
553
|
+
}, {});
|
|
554
|
+
stdutil.prepareAuth(ctx);
|
|
555
|
+
equal('K', ctx.spec.headers['authorization']);
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
test('an empty apikey drops the header', (t) {
|
|
559
|
+
final ctx = authCtx({
|
|
560
|
+
'apikey': '',
|
|
561
|
+
'auth': {'prefix': 'Bearer'}
|
|
562
|
+
}, {
|
|
563
|
+
'authorization': 'stale'
|
|
564
|
+
});
|
|
565
|
+
stdutil.prepareAuth(ctx);
|
|
566
|
+
equal(null, ctx.spec.headers['authorization']);
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
test('a public API (no auth block) drops the header', (t) {
|
|
570
|
+
final ctx = authCtx({'apikey': 'K'}, {'authorization': 'stale'});
|
|
571
|
+
stdutil.prepareAuth(ctx);
|
|
572
|
+
equal(null, ctx.spec.headers['authorization']);
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
test('a missing apikey option drops the header', (t) {
|
|
576
|
+
final ctx = authCtx({
|
|
577
|
+
'auth': {'prefix': 'Bearer'}
|
|
578
|
+
}, {
|
|
579
|
+
'authorization': 'stale'
|
|
580
|
+
});
|
|
581
|
+
stdutil.prepareAuth(ctx);
|
|
582
|
+
equal(null, ctx.spec.headers['authorization']);
|
|
583
|
+
});
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
describe('pipeline:result helpers', () {
|
|
587
|
+
test('resultHeaders with a plain map copies entries', (t) {
|
|
588
|
+
final ctx = base({
|
|
589
|
+
'response': {'headers': {}},
|
|
590
|
+
'result': {}
|
|
591
|
+
});
|
|
592
|
+
stdutil.resultHeaders(ctx);
|
|
593
|
+
deepEqual(ctx.result.headers, {});
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
test('resultBody skips parsing when the body is absent', (t) async {
|
|
597
|
+
final ctx = base({
|
|
598
|
+
'response': {
|
|
599
|
+
'json': () => {'a': 1},
|
|
600
|
+
'body': null
|
|
601
|
+
},
|
|
602
|
+
'result': {}
|
|
603
|
+
});
|
|
604
|
+
await stdutil.resultBody(ctx);
|
|
605
|
+
equal(null, ctx.result.body);
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
}
|