@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,339 @@
|
|
|
1
|
+
|
|
2
|
+
// ignore_for_file: non_constant_identifier_names
|
|
3
|
+
|
|
4
|
+
import 'dart:async';
|
|
5
|
+
|
|
6
|
+
import 'Config.dart';
|
|
7
|
+
import 'Spec.dart';
|
|
8
|
+
// ProjectNameEntityBase / ProjectNameError / BaseFeature are re-exported below;
|
|
9
|
+
// a Dart `export` needs no matching `import`, so importing them here too is an
|
|
10
|
+
// unused_import. Keep only the imports actually referenced in this file.
|
|
11
|
+
import 'utility/ErrUtility.dart';
|
|
12
|
+
// PREFIXED, and deliberately not re-exported. The runtime helper class is
|
|
13
|
+
// named `Utility`, and so is the generated data class for an entity named
|
|
14
|
+
// `utility` (ProjectNameTypes.dart) — exporting both from this library makes
|
|
15
|
+
// the name ambiguous and NO dart SDK for such an API compiles:
|
|
16
|
+
//
|
|
17
|
+
// Error: 'Utility' is exported from both 'lib/ProjectNameTypes.dart'
|
|
18
|
+
// and 'lib/utility/Utility.dart'
|
|
19
|
+
//
|
|
20
|
+
// The entity type is the user-facing name, so it keeps the plain one; the
|
|
21
|
+
// runtime helper is internal plumbing and is reached through the prefix. Any
|
|
22
|
+
// entity name can collide with an internal class, so the prefix — not a
|
|
23
|
+
// rename — is what makes this safe for every API.
|
|
24
|
+
import 'utility/Utility.dart' as sdkutil;
|
|
25
|
+
|
|
26
|
+
export 'Config.dart' show Config, config;
|
|
27
|
+
export 'ProjectNameEntityBase.dart' show ProjectNameEntityBase;
|
|
28
|
+
export 'ProjectNameError.dart' show ProjectNameError;
|
|
29
|
+
export 'feature/base/BaseFeature.dart' show BaseFeature;
|
|
30
|
+
|
|
31
|
+
final sdkutil.Utility stdutil = sdkutil.Utility();
|
|
32
|
+
|
|
33
|
+
class ProjectNameSDK {
|
|
34
|
+
String mode = 'live';
|
|
35
|
+
dynamic _options;
|
|
36
|
+
final sdkutil.Utility _utility = sdkutil.Utility();
|
|
37
|
+
List<dynamic> features = [];
|
|
38
|
+
dynamic rootctx;
|
|
39
|
+
|
|
40
|
+
// Feature activity tracking store (retry attempts, cache hits, spans, ...).
|
|
41
|
+
final Map<String, dynamic> track = {};
|
|
42
|
+
|
|
43
|
+
ProjectNameSDK([dynamic options]) {
|
|
44
|
+
rootctx = _utility.makeContext({
|
|
45
|
+
'client': this,
|
|
46
|
+
'utility': _utility,
|
|
47
|
+
'config': config.toMap(),
|
|
48
|
+
'options': options,
|
|
49
|
+
'shared': {},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
_options = _utility.makeOptions(rootctx);
|
|
53
|
+
|
|
54
|
+
final struct = _utility.struct;
|
|
55
|
+
|
|
56
|
+
if (true == struct.getpath(_options, 'feature.test.active')) {
|
|
57
|
+
mode = 'test';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
rootctx.options = _options;
|
|
61
|
+
|
|
62
|
+
features = [];
|
|
63
|
+
|
|
64
|
+
final featureAdd = _utility.featureAdd;
|
|
65
|
+
final featureInit = _utility.featureInit;
|
|
66
|
+
|
|
67
|
+
// Add features in the resolved order (makeOptions puts an explicit List
|
|
68
|
+
// order first, else defaults to test-first). Ordering matters: the
|
|
69
|
+
// `test` feature installs the base mock transport and the transport
|
|
70
|
+
// features (retry/cache/netsim/proxy/ratelimit) wrap whatever is current,
|
|
71
|
+
// so `test` must be added before them to sit at the base of the chain.
|
|
72
|
+
final List extendList =
|
|
73
|
+
_options['extend'] is List ? _options['extend'] : [];
|
|
74
|
+
|
|
75
|
+
final featureorder =
|
|
76
|
+
struct.getpath(_options, '__derived__.featureorder') ?? [];
|
|
77
|
+
for (final fname in featureorder) {
|
|
78
|
+
final fopts = _options['feature'][fname];
|
|
79
|
+
if (fopts is Map && true == fopts['active']) {
|
|
80
|
+
// An active name with no generated class is legal when an
|
|
81
|
+
// extend-supplied instance carries that name (station's adopt
|
|
82
|
+
// path): the instance is added below, positioned by its own
|
|
83
|
+
// __after__ entry, so skip it here rather than fail construction.
|
|
84
|
+
if (!config.hasFeature(fname.toString()) &&
|
|
85
|
+
extendList.any((f) => fname.toString() == f.name.toString())) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
featureAdd(rootctx, config.makeFeature(fname.toString()));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
for (final f in extendList) {
|
|
93
|
+
featureAdd(rootctx, f);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
for (final f in features) {
|
|
97
|
+
featureInit(rootctx, f);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
final featureHook = _utility.featureHook;
|
|
101
|
+
featureHook(rootctx, 'PostConstruct');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
dynamic options() {
|
|
105
|
+
return _utility.struct.clone(_options);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
sdkutil.Utility utility() {
|
|
109
|
+
return _utility;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// #SecretsAccessor
|
|
113
|
+
Future<dynamic> prepare([dynamic fetchargs]) async {
|
|
114
|
+
final utility = _utility;
|
|
115
|
+
|
|
116
|
+
final makeContext = utility.makeContext;
|
|
117
|
+
final makeFetchDef = utility.makeFetchDef;
|
|
118
|
+
final prepareHeaders = utility.prepareHeaders;
|
|
119
|
+
final prepareAuth = utility.prepareAuth;
|
|
120
|
+
|
|
121
|
+
fetchargs = fetchargs ?? {};
|
|
122
|
+
|
|
123
|
+
final ctx = makeContext({
|
|
124
|
+
'opname': 'prepare',
|
|
125
|
+
'ctrl': fetchargs['ctrl'] ?? {},
|
|
126
|
+
}, rootctx);
|
|
127
|
+
|
|
128
|
+
final options = _options;
|
|
129
|
+
|
|
130
|
+
// Build spec directly from SDK options + user-provided fetch args.
|
|
131
|
+
final spec = Spec({
|
|
132
|
+
'base': options['base'],
|
|
133
|
+
'prefix': options['prefix'],
|
|
134
|
+
'suffix': options['suffix'],
|
|
135
|
+
'path': fetchargs['path'] ?? '',
|
|
136
|
+
'method': fetchargs['method'] ?? 'GET',
|
|
137
|
+
'params': fetchargs['params'] ?? {},
|
|
138
|
+
'query': fetchargs['query'] ?? {},
|
|
139
|
+
'body': fetchargs['body'],
|
|
140
|
+
'step': 'start',
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
ctx.spec = spec;
|
|
144
|
+
|
|
145
|
+
spec.headers = prepareHeaders(ctx);
|
|
146
|
+
|
|
147
|
+
// Merge user-provided headers over SDK defaults.
|
|
148
|
+
if (fetchargs['headers'] is Map) {
|
|
149
|
+
(fetchargs['headers'] as Map).forEach((key, val) {
|
|
150
|
+
spec.headers[key] = val;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Apply SDK auth (apikey, auth prefix, etc.)
|
|
155
|
+
final authResult = prepareAuth(ctx);
|
|
156
|
+
if (iserr(authResult)) {
|
|
157
|
+
return authResult;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return makeFetchDef(ctx);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Raw endpoint access is operator-controllable, like every entity op.
|
|
164
|
+
// Blocking it means denying BOTH the 'direct' and 'graphql' tokens, since
|
|
165
|
+
// either one reaches the same endpoint.
|
|
166
|
+
Future<dynamic> direct([dynamic fetchargs]) async {
|
|
167
|
+
if (!_opAllowed('direct')) {
|
|
168
|
+
return _opDenied('direct');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return _rawRequest(fetchargs);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Is this raw-access op permitted by the SDK's allow.op option?
|
|
175
|
+
bool _opAllowed(String op) {
|
|
176
|
+
final allow = _utility.struct.getpath(_options, 'allow.op');
|
|
177
|
+
return allow is String && allow.contains(op);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
dynamic _opDenied(String op) {
|
|
181
|
+
final allow = _utility.struct.getpath(_options, 'allow.op');
|
|
182
|
+
return {
|
|
183
|
+
'ok': false,
|
|
184
|
+
'err': Exception('ProjectNameSDK: $op: operation not allowed by'
|
|
185
|
+
' SDK option allow.op value: "${allow ?? ''}"'),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Ungated request path shared by direct and graphql, each of which checks
|
|
190
|
+
// its own allow.op token first. Private, rather than a flag on fetchargs:
|
|
191
|
+
// a caller-supplied marker would let anyone opt straight back out of the
|
|
192
|
+
// gate by passing it.
|
|
193
|
+
Future<dynamic> _rawRequest([dynamic fetchargs]) async {
|
|
194
|
+
final utility = _utility;
|
|
195
|
+
final fetcher = utility.fetcher;
|
|
196
|
+
final makeContext = utility.makeContext;
|
|
197
|
+
|
|
198
|
+
final fetchdef = await prepare(fetchargs);
|
|
199
|
+
if (iserr(fetchdef)) {
|
|
200
|
+
return fetchdef;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
final ctx = makeContext({
|
|
204
|
+
'opname': 'direct',
|
|
205
|
+
'ctrl': (fetchargs ?? {})['ctrl'] ?? {},
|
|
206
|
+
}, rootctx);
|
|
207
|
+
|
|
208
|
+
try {
|
|
209
|
+
final dynamic fetched =
|
|
210
|
+
await Future.value(fetcher(ctx, fetchdef['url'], fetchdef));
|
|
211
|
+
|
|
212
|
+
if (null == fetched) {
|
|
213
|
+
return {
|
|
214
|
+
'ok': false,
|
|
215
|
+
'err': ctx.error('direct_no_response', 'response: undefined')
|
|
216
|
+
};
|
|
217
|
+
} else if (iserr(fetched)) {
|
|
218
|
+
return {'ok': false, 'err': fetched};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
final status = fetched['status'];
|
|
222
|
+
|
|
223
|
+
// No body responses (204 No Content, 304 Not Modified) and explicit
|
|
224
|
+
// zero content-length must skip JSON parsing.
|
|
225
|
+
final headers = fetched['headers'];
|
|
226
|
+
final contentLength =
|
|
227
|
+
headers is Map ? headers['content-length'] : null;
|
|
228
|
+
final noBody = 204 == status ||
|
|
229
|
+
304 == status ||
|
|
230
|
+
'0' == (null == contentLength ? null : contentLength.toString());
|
|
231
|
+
|
|
232
|
+
dynamic json;
|
|
233
|
+
if (!noBody) {
|
|
234
|
+
try {
|
|
235
|
+
final jsonFn = fetched['json'];
|
|
236
|
+
json = jsonFn is Function
|
|
237
|
+
? await Future.value(jsonFn())
|
|
238
|
+
: fetched['json'];
|
|
239
|
+
} catch (_parseErr) {
|
|
240
|
+
// Body wasn't valid JSON — surface the raw response rather than
|
|
241
|
+
// throwing. data stays null; callers can inspect status/headers.
|
|
242
|
+
json = null;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return {
|
|
247
|
+
'ok': status is num && status >= 200 && status < 300,
|
|
248
|
+
'status': status,
|
|
249
|
+
'headers': fetched['headers'],
|
|
250
|
+
'data': json,
|
|
251
|
+
};
|
|
252
|
+
} catch (err) {
|
|
253
|
+
return {'ok': false, 'err': err};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Raw GraphQL access: the pressure valve that makes the generated
|
|
258
|
+
// surface's deliberate omissions (per-call selection sets, typed filter
|
|
259
|
+
// builders, batching, subscriptions) livable — the whole schema stays
|
|
260
|
+
// reachable.
|
|
261
|
+
//
|
|
262
|
+
// Thin wrapper over the same prepare/fetch path direct uses, with the one
|
|
263
|
+
// thing raw direct cannot do for GraphQL: a GraphQL failure rides HTTP 200
|
|
264
|
+
// as a top-level `errors` array, so status alone would report a failed
|
|
265
|
+
// query as ok.
|
|
266
|
+
//
|
|
267
|
+
// NOTE: like direct, this bypasses the feature pipeline — no retry,
|
|
268
|
+
// ratelimit or paging features apply.
|
|
269
|
+
Future<dynamic> graphql(String query,
|
|
270
|
+
[dynamic variables, dynamic ctrl]) async {
|
|
271
|
+
if (!_opAllowed('graphql')) {
|
|
272
|
+
return _opDenied('graphql');
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
final dynamic res = await _rawRequest({
|
|
276
|
+
'method': 'POST',
|
|
277
|
+
'headers': {'content-type': 'application/json'},
|
|
278
|
+
'body': {'query': query, 'variables': variables ?? {}},
|
|
279
|
+
'ctrl': ctrl ?? {},
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
if (res is! Map) {
|
|
283
|
+
return res;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Errors are read BEFORE any status check: a GraphQL parse or validation
|
|
287
|
+
// failure comes back as HTTP 400 carrying the standard { errors: [...] }
|
|
288
|
+
// body, and the raw path represents a non-2xx as ok:false with no err —
|
|
289
|
+
// so returning early on status would discard the server's own
|
|
290
|
+
// diagnostics, which are the only useful part of that response.
|
|
291
|
+
final errors = _utility.struct.getpath(res, 'data.errors');
|
|
292
|
+
|
|
293
|
+
if (errors is List && 0 < errors.length) {
|
|
294
|
+
final first = errors[0];
|
|
295
|
+
final msg = (first is Map ? first['message'] : null);
|
|
296
|
+
res['ok'] = false;
|
|
297
|
+
res['err'] = Exception('ProjectNameSDK: graphql: '
|
|
298
|
+
'${msg is String && msg.isNotEmpty ? msg : 'graphql error'}');
|
|
299
|
+
res['graphql'] = errors;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return res;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// <[SLOT]>
|
|
306
|
+
|
|
307
|
+
static ProjectNameSDK test([dynamic testoptsarg, dynamic sdkoptsarg]) {
|
|
308
|
+
final struct = stdutil.struct;
|
|
309
|
+
final setpath = struct.setpath;
|
|
310
|
+
final getdef = struct.getdef;
|
|
311
|
+
final clone = struct.clone;
|
|
312
|
+
final setprop = struct.setprop;
|
|
313
|
+
|
|
314
|
+
final sdkopts = getdef(clone(sdkoptsarg), {});
|
|
315
|
+
final testopts = getdef(clone(testoptsarg), {});
|
|
316
|
+
setprop(testopts, 'active', true);
|
|
317
|
+
setpath(sdkopts, 'feature.test', testopts);
|
|
318
|
+
|
|
319
|
+
final testsdk = ProjectNameSDK(sdkopts);
|
|
320
|
+
testsdk.mode = 'test';
|
|
321
|
+
|
|
322
|
+
return testsdk;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
ProjectNameSDK tester([dynamic testopts, dynamic sdkopts]) {
|
|
326
|
+
return ProjectNameSDK.test(testopts, sdkopts);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
Map<String, dynamic> toJSON() {
|
|
330
|
+
return {'name': 'ProjectName'};
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
@override
|
|
334
|
+
String toString() {
|
|
335
|
+
return 'ProjectName ' + _utility.struct.jsonify(toJSON());
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
typedef SDK = ProjectNameSDK;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class ProjectNameError extends Error {
|
|
2
|
+
final bool isProjectNameError = true;
|
|
3
|
+
|
|
4
|
+
final String sdk = 'ProjectName';
|
|
5
|
+
|
|
6
|
+
String code;
|
|
7
|
+
String message;
|
|
8
|
+
dynamic ctx;
|
|
9
|
+
|
|
10
|
+
// Populated by makeError with the (cleaned) result and spec.
|
|
11
|
+
dynamic result;
|
|
12
|
+
dynamic spec;
|
|
13
|
+
|
|
14
|
+
// HTTP status of the response that caused this error, or -1 when the
|
|
15
|
+
// request never got one. PROMOTED to the top level: it used to be
|
|
16
|
+
// reachable only at `err.result['status']`, so every consumer coupled
|
|
17
|
+
// itself to the internal shape of `result`.
|
|
18
|
+
int status = -1;
|
|
19
|
+
|
|
20
|
+
bool get notFound => 404 == status;
|
|
21
|
+
|
|
22
|
+
ProjectNameError(this.code, this.message, [this.ctx]);
|
|
23
|
+
|
|
24
|
+
@override
|
|
25
|
+
String toString() => 'ProjectNameError: ' + code + ': ' + message;
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"esModuleInterop": true,
|
|
4
|
+
"module": "nodenext",
|
|
5
|
+
"noEmitOnError": true,
|
|
6
|
+
"outDir":"../dist",
|
|
7
|
+
"rootDir":".",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"target": "es2022",
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationDir": "../dist"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
|
|
2
|
+
import * as Path from 'node:path'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
clone,
|
|
7
|
+
walk,
|
|
8
|
+
} from '@voxgig/struct'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// Escape a string for a single-quoted Dart string literal. `$` must be
|
|
12
|
+
// escaped or Dart interpolates it (model values like '`$COPY`' would break).
|
|
13
|
+
function dartString(s: string): string {
|
|
14
|
+
return "'" + String(s)
|
|
15
|
+
.replace(/\\/g, '\\\\')
|
|
16
|
+
.replace(/'/g, "\\'")
|
|
17
|
+
.replace(/\$/g, '\\$')
|
|
18
|
+
.replace(/\n/g, '\\n')
|
|
19
|
+
.replace(/\r/g, '\\r')
|
|
20
|
+
.replace(/\t/g, '\\t') + "'"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// Render a JSON-like value as a deep-dynamic Dart literal. Every map is
|
|
25
|
+
// emitted as `<String, dynamic>{...}` and every list as `<dynamic>[...]` so
|
|
26
|
+
// the runtime struct utilities can freely mutate/extend the structures
|
|
27
|
+
// (inferred literal types would be too narrow and throw at runtime).
|
|
28
|
+
function dartValue(obj: any, indent: number = 0): string {
|
|
29
|
+
const pad = ' '.repeat(indent)
|
|
30
|
+
const cpad = ' '.repeat(indent + 1)
|
|
31
|
+
|
|
32
|
+
if (null == obj) {
|
|
33
|
+
return 'null'
|
|
34
|
+
}
|
|
35
|
+
if ('string' === typeof obj) {
|
|
36
|
+
return dartString(obj)
|
|
37
|
+
}
|
|
38
|
+
if ('number' === typeof obj) {
|
|
39
|
+
return isFinite(obj) ? String(obj) : 'null'
|
|
40
|
+
}
|
|
41
|
+
if ('boolean' === typeof obj) {
|
|
42
|
+
return obj ? 'true' : 'false'
|
|
43
|
+
}
|
|
44
|
+
if (Array.isArray(obj)) {
|
|
45
|
+
if (0 === obj.length) {
|
|
46
|
+
return '<dynamic>[]'
|
|
47
|
+
}
|
|
48
|
+
return '<dynamic>[\n' +
|
|
49
|
+
obj.map(v => cpad + dartValue(v, indent + 1) + ',').join('\n') +
|
|
50
|
+
'\n' + pad + ']'
|
|
51
|
+
}
|
|
52
|
+
if ('object' === typeof obj) {
|
|
53
|
+
const keys = Object.keys(obj)
|
|
54
|
+
if (0 === keys.length) {
|
|
55
|
+
return '<String, dynamic>{}'
|
|
56
|
+
}
|
|
57
|
+
return '<String, dynamic>{\n' +
|
|
58
|
+
keys.map(k => cpad + dartString(k) + ': ' + dartValue(obj[k], indent + 1) + ',')
|
|
59
|
+
.join('\n') +
|
|
60
|
+
'\n' + pad + '}'
|
|
61
|
+
}
|
|
62
|
+
return 'null'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
function projectPath(suffix?: string): string {
|
|
67
|
+
return Path.normalize(Path.join(__dirname, '../../..', suffix ?? ''))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// Emission-time normalisation of a model subtree (L0).
|
|
72
|
+
//
|
|
73
|
+
// Always drops jostraca's iteration metadata (`$`-suffixed keys: index$,
|
|
74
|
+
// key$, val$). With `dropDefaults`, also drops keys whose value IS the
|
|
75
|
+
// default the runtime already assumes when the key is absent, which is pure
|
|
76
|
+
// payload — see CONFIG_DEFAULT.
|
|
77
|
+
//
|
|
78
|
+
// Rebuilds the tree rather than mutating during a walk. The previous
|
|
79
|
+
// implementation walked a clone calling `delete p[k]`, but walk() assigns its
|
|
80
|
+
// callback's result back over the child (`setprop(out, ckey, walk(...))`), so
|
|
81
|
+
// the delete was undone on the way out and the helper silently did nothing.
|
|
82
|
+
// Returning `undefined` from the callback does not fix it either: setprop
|
|
83
|
+
// stores undefined rather than removing the key, which then emits as a null.
|
|
84
|
+
//
|
|
85
|
+
// `dropDefaults` is opt-in and must be passed ONLY for the entity subtree.
|
|
86
|
+
// `active` means something different in feature config, where absent reads as
|
|
87
|
+
// INACTIVE (see feature_init) — dropping `active: true` there would silently
|
|
88
|
+
// disable the feature.
|
|
89
|
+
// jostraca's iteration metadata, injected by each()/names() while it walks the
|
|
90
|
+
// model. Listed explicitly rather than matched by trailing-dollar suffix: a
|
|
91
|
+
// trailing dollar is not exclusive to jostraca -- Seneca uses entity$ as real
|
|
92
|
+
// data -- so a blanket suffix match can silently drop a legitimate API field.
|
|
93
|
+
const MODEL_META = ['index$', 'key$', 'val$']
|
|
94
|
+
|
|
95
|
+
// Keys whose value IS the default the runtime already assumes when the key is
|
|
96
|
+
// absent, so emitting them is pure payload.
|
|
97
|
+
const CONFIG_DEFAULT: Record<string, any> = {
|
|
98
|
+
active: true,
|
|
99
|
+
req: false,
|
|
100
|
+
reqd: false,
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Subtrees carrying user payload rather than schema. An active:true inside an
|
|
104
|
+
// OpenAPI example is DATA, not a default, so default-pruning stops at these
|
|
105
|
+
// keys and everything below them is passed through untouched.
|
|
106
|
+
const PAYLOAD_KEYS = ['default', 'example', 'examples']
|
|
107
|
+
|
|
108
|
+
function clean(o: any, dropDefaults?: boolean): any {
|
|
109
|
+
const prune = (node: any, defaults: boolean): any => {
|
|
110
|
+
if (Array.isArray(node)) {
|
|
111
|
+
return node.map((n: any) => prune(n, defaults))
|
|
112
|
+
}
|
|
113
|
+
if (null != node && 'object' === typeof node) {
|
|
114
|
+
const out: any = {}
|
|
115
|
+
for (const k of Object.keys(node)) {
|
|
116
|
+
if (MODEL_META.includes(k)) {
|
|
117
|
+
continue
|
|
118
|
+
}
|
|
119
|
+
if (defaults && k in CONFIG_DEFAULT && CONFIG_DEFAULT[k] === node[k]) {
|
|
120
|
+
continue
|
|
121
|
+
}
|
|
122
|
+
out[k] = prune(node[k], defaults && !PAYLOAD_KEYS.includes(k))
|
|
123
|
+
}
|
|
124
|
+
return out
|
|
125
|
+
}
|
|
126
|
+
return node
|
|
127
|
+
}
|
|
128
|
+
return prune(o, true === dropDefaults)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
// The JSON as a Dart string literal.
|
|
134
|
+
//
|
|
135
|
+
// Dart's ordinary string literals INTERPOLATE: `$name` and `${...}` are
|
|
136
|
+
// substitution, and the model is full of `$` - `$STRING`, `$NUMBER`,
|
|
137
|
+
// `$action`. A raw string (`r'...'`) would avoid that but cannot contain its
|
|
138
|
+
// own quote character and has no escape for it, and the JSON contains both
|
|
139
|
+
// quote characters in quantity.
|
|
140
|
+
//
|
|
141
|
+
// So: JSON.stringify's escaping, which already handles `"` and `\` and emits
|
|
142
|
+
// no raw control characters, plus `$` -> `\$`. That last step is unambiguous
|
|
143
|
+
// precisely because JSON.stringify has already escaped every backslash, so a
|
|
144
|
+
// `\$` here can only have come from this rule.
|
|
145
|
+
function dartStringLiteral(json: string): string {
|
|
146
|
+
return JSON.stringify(json).replace(/\$/g, '\\$')
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export {
|
|
150
|
+
dartStringLiteral,
|
|
151
|
+
clean,
|
|
152
|
+
dartString,
|
|
153
|
+
dartValue,
|
|
154
|
+
projectPath,
|
|
155
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Content,
|
|
3
|
+
File,
|
|
4
|
+
cmp,
|
|
5
|
+
configDefinition,
|
|
6
|
+
configReprSetting,
|
|
7
|
+
isConfigData,
|
|
8
|
+
} from '@voxgig/sdkgen'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
Model,
|
|
13
|
+
} from '@voxgig/apidef'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
formatHsValue,
|
|
18
|
+
hsString,
|
|
19
|
+
} from './utility_haskell'
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
// The full set of feature constructors in SdkFeatures (name -> <name>Feature).
|
|
23
|
+
const FEATURE_NAMES = [
|
|
24
|
+
'log', 'test', 'retry', 'timeout', 'ratelimit', 'cache', 'idempotency',
|
|
25
|
+
'paging', 'streaming', 'proxy', 'telemetry', 'metrics', 'debug', 'audit',
|
|
26
|
+
'clienttrack', 'rbac', 'netsim',
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
// SdkConfig.hs: makeConfig builds the embedded API model as a struct Value;
|
|
31
|
+
// makeFeature(name) is the N-feature-safe factory the client uses to
|
|
32
|
+
// instantiate features named in the options.
|
|
33
|
+
const Config = cmp(async function Config(props: any) {
|
|
34
|
+
const ctx$ = props.ctx$
|
|
35
|
+
const target = props.target
|
|
36
|
+
|
|
37
|
+
const model: Model = ctx$.model
|
|
38
|
+
|
|
39
|
+
// The same config as an OBJECT, built by the shared helper so this target's
|
|
40
|
+
// literal and the data that replaces it above the threshold are the same
|
|
41
|
+
// config by construction. The JSON is what the threshold is measured on -
|
|
42
|
+
// emitted source size varies by language, the model does not.
|
|
43
|
+
const { def: configDef, json: configJson } = configDefinition(model)
|
|
44
|
+
const asData = isConfigData(configJson, configReprSetting(model))
|
|
45
|
+
|
|
46
|
+
// ABOVE THE THRESHOLD: emit the model as DATA.
|
|
47
|
+
//
|
|
48
|
+
// The literal representation is one enormous CV expression. GHC type-checks
|
|
49
|
+
// and desugars every constructor application in it, and buildCV then walks
|
|
50
|
+
// the whole tree allocating an IORef per node. A string constant is one
|
|
51
|
+
// token, and jsonRead builds the same Value from it directly.
|
|
52
|
+
//
|
|
53
|
+
// Both branches return a FRESH Value per call - buildCV allocates new
|
|
54
|
+
// IORefs, jsonRead re-parses - so a caller that mutates one config cannot
|
|
55
|
+
// reach another's, exactly as before.
|
|
56
|
+
const configBody = asData
|
|
57
|
+
? `-- THE API MODEL, EMBEDDED AS DATA (sdkgen rung L1).
|
|
58
|
+
--
|
|
59
|
+
-- Emitted only above a size threshold, or when \`main.kit.config.repr\` pins
|
|
60
|
+
-- it: for a small model the CV literal is smaller and far easier to read when
|
|
61
|
+
-- debugging.
|
|
62
|
+
configData :: String
|
|
63
|
+
configData = ${hsString(configJson)}
|
|
64
|
+
|
|
65
|
+
makeConfig :: IO Value
|
|
66
|
+
makeConfig = jsonRead configData`
|
|
67
|
+
: `makeConfig :: IO Value
|
|
68
|
+
makeConfig = buildCV ${formatHsValue(configDef)}`
|
|
69
|
+
|
|
70
|
+
File({ name: 'SdkConfig.' + target.ext }, () => {
|
|
71
|
+
|
|
72
|
+
Content(`-- Generated API configuration (make_config) and the feature factory.
|
|
73
|
+
|
|
74
|
+
module SdkConfig (makeConfig, makeFeature) where
|
|
75
|
+
|
|
76
|
+
import VoxgigStruct (Value)
|
|
77
|
+
import ${asData ? 'SdkJson (jsonRead)' : 'SdkHelpers (CV (..), buildCV)'}
|
|
78
|
+
import SdkTypes (Feature)
|
|
79
|
+
import qualified SdkFeatures as F
|
|
80
|
+
|
|
81
|
+
${configBody}
|
|
82
|
+
|
|
83
|
+
makeFeature :: String -> IO Feature
|
|
84
|
+
makeFeature name = case name of
|
|
85
|
+
`)
|
|
86
|
+
|
|
87
|
+
for (const fname of FEATURE_NAMES) {
|
|
88
|
+
Content(` "${fname}" -> F.${fname}Feature\n`)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
Content(` _ -> F.baseFeature\n`)
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
Config
|
|
98
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cmp } from '@voxgig/sdkgen'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// Entities are generic in the Haskell target: there is no per-entity
|
|
5
|
+
// generated module. Every entity is created by the config-driven
|
|
6
|
+
// F.makeEntity (see SdkClient), so this component emits nothing. It exists
|
|
7
|
+
// only so the neutral Entity component can resolve a language delegate.
|
|
8
|
+
const Entity = cmp(function Entity(_props: any) {})
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
Entity
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Content,
|
|
3
|
+
File,
|
|
4
|
+
cmp,
|
|
5
|
+
} from '@voxgig/sdkgen'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const Gitignore = cmp(async function Gitignore(_props: any) {
|
|
9
|
+
File({ name: '.gitignore' }, () => {
|
|
10
|
+
Content(`# Haskell build output
|
|
11
|
+
.hsbuild/
|
|
12
|
+
dist-newstyle/
|
|
13
|
+
*.hi
|
|
14
|
+
*.o
|
|
15
|
+
|
|
16
|
+
# IDE / OS
|
|
17
|
+
.idea/
|
|
18
|
+
.vscode/
|
|
19
|
+
.DS_Store
|
|
20
|
+
`)
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
Gitignore
|
|
27
|
+
}
|