@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,241 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityOps } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
nom,
|
|
8
|
+
} from '@voxgig/apidef'
|
|
9
|
+
|
|
10
|
+
import { hsVarName } from './utility_haskell'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// A type-correct Haskell `Value` literal for a param. List/object params fall
|
|
14
|
+
// back to VNoval (they cannot be built as a pure literal inside `jo`); scalars
|
|
15
|
+
// use the matching constructor.
|
|
16
|
+
function hsLit(type: any, placeholder: string = 'example'): string {
|
|
17
|
+
const k = canonKey(type)
|
|
18
|
+
if ('INTEGER' === k || 'NUMBER' === k) return 'VNum 1'
|
|
19
|
+
if ('BOOLEAN' === k) return 'VBool True'
|
|
20
|
+
if ('ARRAY' === k || 'OBJECT' === k) return 'VNoval'
|
|
21
|
+
return `VStr "${placeholder}"`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
|
|
26
|
+
const { target, ctx$: { model } } = props
|
|
27
|
+
|
|
28
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
29
|
+
|
|
30
|
+
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
31
|
+
|
|
32
|
+
// Find a nested entity if available: one with a parent chain
|
|
33
|
+
// (relations.ancestors), an active load op, and a required non-id load
|
|
34
|
+
// param to demonstrate (the parent key, e.g. page_id).
|
|
35
|
+
const nestedEntity = Object.values(entity).find((e: any) =>
|
|
36
|
+
e.active !== false &&
|
|
37
|
+
e.relations && e.relations.ancestors && 0 < e.relations.ancestors.length &&
|
|
38
|
+
entityOps(e).includes('load') &&
|
|
39
|
+
opRequestShape(e, 'load').items.some((it: any) =>
|
|
40
|
+
!it.optional && it.name !== entityIdField(e))
|
|
41
|
+
) as any
|
|
42
|
+
|
|
43
|
+
const authActive = isAuthActive(model)
|
|
44
|
+
|
|
45
|
+
Content(`### 1. Create a client
|
|
46
|
+
|
|
47
|
+
\`\`\`haskell
|
|
48
|
+
`)
|
|
49
|
+
if (authActive) {
|
|
50
|
+
Content(`import System.Environment (lookupEnv)
|
|
51
|
+
import qualified SdkClient as Sdk
|
|
52
|
+
import VoxgigStruct (Value (..), emptyMap)
|
|
53
|
+
import SdkHelpers (jo)
|
|
54
|
+
|
|
55
|
+
main :: IO ()
|
|
56
|
+
main = do
|
|
57
|
+
mkey <- lookupEnv "${envName(model)}_APIKEY"
|
|
58
|
+
opts <- jo [("apikey", maybe VNoval VStr mkey)]
|
|
59
|
+
sdk <- Sdk.newSdk opts
|
|
60
|
+
`)
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
Content(`import qualified SdkClient as Sdk
|
|
64
|
+
import VoxgigStruct (Value (..), emptyMap)
|
|
65
|
+
import SdkHelpers (jo)
|
|
66
|
+
|
|
67
|
+
main :: IO ()
|
|
68
|
+
main = do
|
|
69
|
+
sdk <- Sdk.newSdk0
|
|
70
|
+
`)
|
|
71
|
+
}
|
|
72
|
+
Content(`\`\`\`
|
|
73
|
+
|
|
74
|
+
Entity operations raise on error (via \`Control.Exception.throwIO\`) and
|
|
75
|
+
return the bare result \`Value\`. Wrap a call in \`Control.Exception.try\`
|
|
76
|
+
to recover from failures.
|
|
77
|
+
|
|
78
|
+
`)
|
|
79
|
+
|
|
80
|
+
if (exampleEntity) {
|
|
81
|
+
const eName = nom(exampleEntity, 'Name')
|
|
82
|
+
const article = /^[aeiou]/i.test(eName) ? 'an' : 'a'
|
|
83
|
+
const eFn = hsVarName(exampleEntity.name)
|
|
84
|
+
const opnames = entityOps(exampleEntity)
|
|
85
|
+
// Model-driven id key: `idF` is the entity's id-like MATCH field name, or
|
|
86
|
+
// null when it has none. `dataIdF` is the id on the RETURNED record's data
|
|
87
|
+
// type.
|
|
88
|
+
const idF = entityIdField(exampleEntity)
|
|
89
|
+
|
|
90
|
+
if (opnames.includes('list')) {
|
|
91
|
+
Content(`### 2. List ${eName.toLowerCase()} records
|
|
92
|
+
|
|
93
|
+
\`eList ent match ctrl\` resolves to one ENTITY per record and raises on
|
|
94
|
+
error. Read a record with \`eDataGet\`.
|
|
95
|
+
|
|
96
|
+
\`\`\`haskell
|
|
97
|
+
ent <- Sdk.${eFn} sdk VNoval
|
|
98
|
+
match <- emptyMap
|
|
99
|
+
ctrl <- emptyMap
|
|
100
|
+
${eFn}s <- Sdk.eList ent match ctrl
|
|
101
|
+
mapM_ (\\en -> print =<< Sdk.eDataGet en) ${eFn}s
|
|
102
|
+
\`\`\`
|
|
103
|
+
|
|
104
|
+
`)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (nestedEntity) {
|
|
108
|
+
const neName = nom(nestedEntity, 'Name')
|
|
109
|
+
const neArticle = /^[aeiou]/i.test(neName) ? 'an' : 'a'
|
|
110
|
+
const neFn = hsVarName(nestedEntity.name)
|
|
111
|
+
|
|
112
|
+
const neIdF = entityIdField(nestedEntity)
|
|
113
|
+
const neRequired = opRequestShape(nestedEntity, 'load').items
|
|
114
|
+
.filter((it: any) => !it.optional)
|
|
115
|
+
.sort((a: any, b: any) =>
|
|
116
|
+
(a.name === neIdF ? 1 : 0) - (b.name === neIdF ? 1 : 0))
|
|
117
|
+
const parentItem = neRequired.find((it: any) => it.name !== neIdF) as any
|
|
118
|
+
const parentParam = parentItem && parentItem.name
|
|
119
|
+
const parentName = parentParam ? parentParam.replace(/_id$/, '') : 'its parent'
|
|
120
|
+
const neMatch = neRequired.map((it: any) =>
|
|
121
|
+
`("${it.name}", ${hsLit(it.type,
|
|
122
|
+
it.name === neIdF ? 'example_id' : 'example_' + it.name)})`)
|
|
123
|
+
|
|
124
|
+
Content(`### 3. Load ${neArticle} ${neName.toLowerCase()}
|
|
125
|
+
|
|
126
|
+
${neName} is nested under ${parentName}, so provide the \`${parentParam}\`.
|
|
127
|
+
\`eLoad\` resolves to the ENTITY and raises on error; \`eDataGet\` gives the
|
|
128
|
+
record.
|
|
129
|
+
|
|
130
|
+
\`\`\`haskell
|
|
131
|
+
${neFn}Ent <- Sdk.${neFn} sdk VNoval
|
|
132
|
+
m <- jo [${neMatch.join(', ')}]
|
|
133
|
+
ctrl2 <- emptyMap
|
|
134
|
+
${neFn} <- Sdk.eLoad ${neFn}Ent m ctrl2
|
|
135
|
+
print =<< Sdk.eDataGet ${neFn}
|
|
136
|
+
\`\`\`
|
|
137
|
+
|
|
138
|
+
`)
|
|
139
|
+
}
|
|
140
|
+
else if (opnames.includes('load')) {
|
|
141
|
+
const loadRequired = opRequestShape(exampleEntity, 'load').items
|
|
142
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
143
|
+
.sort((a: any, b: any) =>
|
|
144
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
145
|
+
const loadArg = 0 < loadRequired.length
|
|
146
|
+
? `[${loadRequired.map((it: any) =>
|
|
147
|
+
`("${it.name}", ${hsLit(it.type,
|
|
148
|
+
it.name === idF ? 'example_id' : 'example_' + it.name)})`).join(', ')}]`
|
|
149
|
+
: '[]'
|
|
150
|
+
|
|
151
|
+
Content(`### 3. Load ${article} ${eName.toLowerCase()}
|
|
152
|
+
|
|
153
|
+
\`eLoad ent match ctrl\` resolves to the ENTITY and raises on error;
|
|
154
|
+
\`eDataGet\` gives the record.
|
|
155
|
+
|
|
156
|
+
\`\`\`haskell
|
|
157
|
+
ent2 <- Sdk.${eFn} sdk VNoval
|
|
158
|
+
m <- jo ${loadArg}
|
|
159
|
+
ctrl2 <- emptyMap
|
|
160
|
+
${eFn} <- Sdk.eLoad ent2 m ctrl2
|
|
161
|
+
print =<< Sdk.eDataGet ${eFn}
|
|
162
|
+
\`\`\`
|
|
163
|
+
|
|
164
|
+
`)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Model-driven example fields: derive the create/update body from the op
|
|
168
|
+
// shape so the docs reference REAL writable fields.
|
|
169
|
+
const examplePairs = (opname: string): string[] => {
|
|
170
|
+
const items = opRequestShape(exampleEntity, opname).items
|
|
171
|
+
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
172
|
+
('create' === opname && !it.optional))
|
|
173
|
+
const required = items.filter((it: any) => !it.optional)
|
|
174
|
+
const optional = items.filter((it: any) => it.optional)
|
|
175
|
+
const chosen = 'create' === opname
|
|
176
|
+
? (required.length ? required : items.slice(0, 2))
|
|
177
|
+
: required.concat(optional).slice(0, Math.max(2, required.length))
|
|
178
|
+
return chosen.map((it: any) => `("${it.name}", ${hsLit(it.type, 'example_' + it.name)})`)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const idParamType = (opname: string): any => {
|
|
182
|
+
const it = opRequestShape(exampleEntity, opname).items.find((x: any) => x.name === idF)
|
|
183
|
+
return it && it.type
|
|
184
|
+
}
|
|
185
|
+
const idValueFor = (opname: string): string =>
|
|
186
|
+
hsLit(idParamType(opname), 'example_id')
|
|
187
|
+
|
|
188
|
+
if (opnames.includes('create') || opnames.includes('update') || opnames.includes('remove')) {
|
|
189
|
+
Content(`### 4. Create, update, and remove
|
|
190
|
+
|
|
191
|
+
`)
|
|
192
|
+
if (opnames.includes('create')) {
|
|
193
|
+
Content(`\`\`\`haskell
|
|
194
|
+
createEnt <- Sdk.${eFn} sdk VNoval
|
|
195
|
+
d <- jo [${examplePairs('create').join(', ')}]
|
|
196
|
+
cctrl <- emptyMap
|
|
197
|
+
created <- Sdk.eCreate createEnt d cctrl
|
|
198
|
+
print =<< Sdk.eDataGet created
|
|
199
|
+
\`\`\`
|
|
200
|
+
|
|
201
|
+
`)
|
|
202
|
+
}
|
|
203
|
+
if (opnames.includes('update')) {
|
|
204
|
+
const updatePairs = (idF ? [`("${idF}", ${idValueFor('update')})`] : []).concat(examplePairs('update'))
|
|
205
|
+
Content(`\`\`\`haskell
|
|
206
|
+
updateEnt <- Sdk.${eFn} sdk VNoval
|
|
207
|
+
upd <- jo [${updatePairs.join(', ')}]
|
|
208
|
+
uctrl <- emptyMap
|
|
209
|
+
updated <- Sdk.eUpdate updateEnt upd uctrl
|
|
210
|
+
print =<< Sdk.eDataGet updated
|
|
211
|
+
\`\`\`
|
|
212
|
+
|
|
213
|
+
`)
|
|
214
|
+
}
|
|
215
|
+
if (opnames.includes('remove')) {
|
|
216
|
+
const removePairs = opRequestShape(exampleEntity, 'remove').items
|
|
217
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
218
|
+
.sort((a: any, b: any) =>
|
|
219
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
220
|
+
.map((it: any) => it.name === idF
|
|
221
|
+
? `("${it.name}", ${idValueFor('remove')})`
|
|
222
|
+
: `("${it.name}", ${hsLit(it.type, 'example_' + it.name)})`)
|
|
223
|
+
Content(`\`\`\`haskell
|
|
224
|
+
removeEnt <- Sdk.${eFn} sdk VNoval
|
|
225
|
+
rm <- jo [${removePairs.length ? removePairs.join(', ') : ''}]
|
|
226
|
+
rctrl <- emptyMap
|
|
227
|
+
-- Resolves to the entity, marked deleted; it keeps the data it held.
|
|
228
|
+
removed <- Sdk.eRemove removeEnt rm rctrl
|
|
229
|
+
print =<< readIORef (Sdk.eDeleted removed)
|
|
230
|
+
\`\`\`
|
|
231
|
+
|
|
232
|
+
`)
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
export {
|
|
240
|
+
ReadmeQuick
|
|
241
|
+
}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, each, Content, canonKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
} from '@voxgig/apidef'
|
|
8
|
+
|
|
9
|
+
import { hsVarName } from './utility_haskell'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
// A type-correct Haskell `Value` literal for a field's canonical type.
|
|
13
|
+
function hsLit(type: any, placeholder: string = 'example'): string {
|
|
14
|
+
const k = canonKey(type)
|
|
15
|
+
if ('INTEGER' === k || 'NUMBER' === k) return 'VNum 1'
|
|
16
|
+
if ('BOOLEAN' === k) return 'VBool True'
|
|
17
|
+
if ('ARRAY' === k || 'OBJECT' === k) return 'VNoval'
|
|
18
|
+
return `VStr "${placeholder}"`
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
// A readable Haskell type name for a field's canonical type.
|
|
23
|
+
function hsType(type: any): string {
|
|
24
|
+
const k = canonKey(type)
|
|
25
|
+
if ('STRING' === k) return 'String'
|
|
26
|
+
if ('INTEGER' === k) return 'Int'
|
|
27
|
+
if ('NUMBER' === k) return 'Double'
|
|
28
|
+
if ('BOOLEAN' === k) return 'Bool'
|
|
29
|
+
if ('ARRAY' === k) return '[Value]'
|
|
30
|
+
return 'Value'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const OP_SIGNATURES: Record<string, { sig: string, returns: string, desc: string }> = {
|
|
35
|
+
load: {
|
|
36
|
+
sig: 'eLoad ent match ctrl :: IO Entity',
|
|
37
|
+
returns: 'the entity',
|
|
38
|
+
desc: 'Load a single entity matching the given criteria. Resolves to the ENTITY (read the record with `eDataGet`) and raises on error.',
|
|
39
|
+
},
|
|
40
|
+
list: {
|
|
41
|
+
sig: 'eList ent match ctrl :: IO [Entity]',
|
|
42
|
+
returns: 'one entity per record',
|
|
43
|
+
desc: 'List entities matching the given criteria. The match is optional \u2014 pass an empty map to list all records. Resolves to one ENTITY per record and raises on error.',
|
|
44
|
+
},
|
|
45
|
+
create: {
|
|
46
|
+
sig: 'eCreate ent data ctrl :: IO Entity',
|
|
47
|
+
returns: 'the created entity',
|
|
48
|
+
desc: 'Create a new entity with the given data. Resolves to the ENTITY (read the record with `eDataGet`) and raises on error.',
|
|
49
|
+
},
|
|
50
|
+
update: {
|
|
51
|
+
sig: 'eUpdate ent data ctrl :: IO Entity',
|
|
52
|
+
returns: 'the updated entity',
|
|
53
|
+
desc: 'Update an existing entity. The data must include the entity `id`. Resolves to the ENTITY (read the record with `eDataGet`) and raises on error.',
|
|
54
|
+
},
|
|
55
|
+
remove: {
|
|
56
|
+
sig: 'eRemove ent match ctrl :: IO Entity',
|
|
57
|
+
returns: 'the removed entity',
|
|
58
|
+
desc: 'Remove the entity matching the given criteria. Resolves to the ENTITY, marked deleted (`eDeleted`); it keeps the data it held. Raises on error.',
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const ReadmeRef = cmp(function ReadmeRef(props: any) {
|
|
64
|
+
const { target } = props
|
|
65
|
+
const { model } = props.ctx$
|
|
66
|
+
|
|
67
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
68
|
+
const feature = getModelPath(model, `main.${KIT}.feature`)
|
|
69
|
+
|
|
70
|
+
const publishedEntities = each(entity).filter((e: any) => e.active !== false)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
File({ name: 'REFERENCE.md' }, () => {
|
|
74
|
+
|
|
75
|
+
Content(`# ${model.Name} ${target.title} SDK Reference
|
|
76
|
+
|
|
77
|
+
Complete API reference for the ${model.Name} ${target.title} SDK.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## Client
|
|
81
|
+
|
|
82
|
+
### Constructors
|
|
83
|
+
|
|
84
|
+
\`\`\`haskell
|
|
85
|
+
import qualified SdkClient as Sdk
|
|
86
|
+
import VoxgigStruct (Value (..))
|
|
87
|
+
import SdkHelpers (jo)
|
|
88
|
+
|
|
89
|
+
makeClient :: IO Sdk.Client
|
|
90
|
+
makeClient = do
|
|
91
|
+
opts <- jo [("base", VStr "https://api.example.com")]
|
|
92
|
+
Sdk.newSdk opts
|
|
93
|
+
\`\`\`
|
|
94
|
+
|
|
95
|
+
Construct a live SDK client.
|
|
96
|
+
|
|
97
|
+
**Functions:**
|
|
98
|
+
|
|
99
|
+
| Function | Signature | Description |
|
|
100
|
+
| --- | --- | --- |
|
|
101
|
+
| \`newSdk\` | \`Value -> IO Client\` | Construct a client from an options map. |
|
|
102
|
+
| \`newSdk0\` | \`IO Client\` | Construct a client with defaults. |
|
|
103
|
+
|
|
104
|
+
**Options (map keys):**
|
|
105
|
+
|
|
106
|
+
| Key | Type | Description |
|
|
107
|
+
| --- | --- | --- |
|
|
108
|
+
${isAuthActive(model) ? '| `apikey` | `String` | API key for authentication. |\n' : ''}| \`base\` | \`String\` | Base URL for API requests. |
|
|
109
|
+
| \`prefix\` | \`String\` | URL prefix appended after base. |
|
|
110
|
+
| \`suffix\` | \`String\` | URL suffix appended after path. |
|
|
111
|
+
| \`headers\` | \`Value\` | Custom headers for all requests. |
|
|
112
|
+
| \`feature\` | \`Value\` | Feature configuration. |
|
|
113
|
+
| \`system\` | \`Value\` | System overrides (e.g. custom fetch). |
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
### Test constructors
|
|
117
|
+
|
|
118
|
+
\`\`\`haskell
|
|
119
|
+
client <- Sdk.testSdk0
|
|
120
|
+
\`\`\`
|
|
121
|
+
|
|
122
|
+
\`testSdk :: Value -> Value -> IO Client\` constructs a test client with mock
|
|
123
|
+
features active (\`testSdk0 :: IO Client\` for the no-argument form). Pass
|
|
124
|
+
\`VNoval\` for defaults.
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Entity accessors
|
|
128
|
+
|
|
129
|
+
`)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
// Entity factory functions
|
|
133
|
+
publishedEntities.map((ent: any) => {
|
|
134
|
+
const eFn = hsVarName(ent.name)
|
|
135
|
+
Content(`#### \`${eFn} :: Client -> Value -> IO Entity\`
|
|
136
|
+
|
|
137
|
+
Construct a \`${ent.Name}\` entity bound to the client. Pass \`VNoval\` for no initial options.
|
|
138
|
+
|
|
139
|
+
`)
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
Content(`### HTTP escape hatches
|
|
144
|
+
|
|
145
|
+
#### \`direct :: Client -> Value -> IO Value\` (module \`SdkFeatures\`)
|
|
146
|
+
|
|
147
|
+
Make a direct HTTP request to any API endpoint. Returns a result \`Value\` with
|
|
148
|
+
\`ok\`, \`status\`, \`headers\`, and \`data\` (or \`err\` on failure). This escape
|
|
149
|
+
hatch never raises — branch on \`getp result "ok"\`.
|
|
150
|
+
|
|
151
|
+
**Argument (map keys):**
|
|
152
|
+
|
|
153
|
+
| Key | Type | Description |
|
|
154
|
+
| --- | --- | --- |
|
|
155
|
+
| \`path\` | \`String\` | URL path with optional \`{param}\` placeholders. |
|
|
156
|
+
| \`method\` | \`String\` | HTTP method (default: \`"GET"\`). |
|
|
157
|
+
| \`params\` | \`Value\` | Path parameter values. |
|
|
158
|
+
| \`query\` | \`Value\` | Query string parameters. |
|
|
159
|
+
| \`headers\` | \`Value\` | Request headers (merged with defaults). |
|
|
160
|
+
| \`body\` | \`Value\` | Request body (maps are JSON-serialized). |
|
|
161
|
+
|
|
162
|
+
#### \`prepare :: Client -> Value -> IO Value\` (module \`SdkFeatures\`)
|
|
163
|
+
|
|
164
|
+
Prepare a fetch definition without sending. Returns the \`fetchdef\` and raises on error.
|
|
165
|
+
|
|
166
|
+
`)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
// Entity reference sections
|
|
170
|
+
publishedEntities.map((ent: any) => {
|
|
171
|
+
const opnames = Object.keys(ent.op || {})
|
|
172
|
+
const fields = ent.fields || []
|
|
173
|
+
const idF = entityIdField(ent)
|
|
174
|
+
const eFn = hsVarName(ent.name)
|
|
175
|
+
|
|
176
|
+
Content(`
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## ${ent.Name}
|
|
180
|
+
|
|
181
|
+
`)
|
|
182
|
+
|
|
183
|
+
if (ent.short) {
|
|
184
|
+
Content(`${ent.short}
|
|
185
|
+
|
|
186
|
+
`)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
Content(`\`\`\`haskell
|
|
190
|
+
ent <- Sdk.${eFn} sdk VNoval
|
|
191
|
+
\`\`\`
|
|
192
|
+
|
|
193
|
+
`)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
// Field schema
|
|
197
|
+
if (fields.length > 0) {
|
|
198
|
+
Content(`### Fields
|
|
199
|
+
|
|
200
|
+
| Field | Type | Required | Description |
|
|
201
|
+
| --- | --- | --- | --- |
|
|
202
|
+
`)
|
|
203
|
+
each(fields, (field: any) => {
|
|
204
|
+
const req = field.req ? 'Yes' : 'No'
|
|
205
|
+
const desc = field.short || ''
|
|
206
|
+
Content(`| \`${field.name}\` | \`${hsType(field.type)}\` | ${req} | ${desc} |
|
|
207
|
+
`)
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
Content(`
|
|
211
|
+
`)
|
|
212
|
+
|
|
213
|
+
// Field operations breakdown
|
|
214
|
+
const hasFieldOps = fields.some((f: any) => f.op && Object.keys(f.op).length > 0)
|
|
215
|
+
if (hasFieldOps) {
|
|
216
|
+
const opcols = ['load', 'list', 'create', 'update', 'remove']
|
|
217
|
+
.filter((op: string) => opnames.includes(op) && ent.op[op]?.active !== false)
|
|
218
|
+
Content(`### Field Usage by Operation
|
|
219
|
+
|
|
220
|
+
| Field | ${opcols.join(' | ')} |
|
|
221
|
+
| --- | ${opcols.map(() => '---').join(' | ')} |
|
|
222
|
+
`)
|
|
223
|
+
each(fields, (field: any) => {
|
|
224
|
+
const fops = field.op || {}
|
|
225
|
+
const cols = opcols.map((op: string) => {
|
|
226
|
+
const fop = fops[op]
|
|
227
|
+
if (null == fop) return '-'
|
|
228
|
+
if (fop.active === false) return '-'
|
|
229
|
+
return 'Yes'
|
|
230
|
+
})
|
|
231
|
+
Content(`| \`${field.name}\` | ${cols.join(' | ')} |
|
|
232
|
+
`)
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
Content(`
|
|
236
|
+
`)
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
// Operation details
|
|
242
|
+
if (opnames.length > 0) {
|
|
243
|
+
Content(`### Operations
|
|
244
|
+
|
|
245
|
+
`)
|
|
246
|
+
|
|
247
|
+
opnames.map((opname: string) => {
|
|
248
|
+
const info = OP_SIGNATURES[opname]
|
|
249
|
+
if (!info) return
|
|
250
|
+
|
|
251
|
+
Content(`#### \`${info.sig}\`
|
|
252
|
+
|
|
253
|
+
${info.desc}
|
|
254
|
+
|
|
255
|
+
`)
|
|
256
|
+
|
|
257
|
+
if ('load' === opname || 'remove' === opname) {
|
|
258
|
+
const matchItems = opRequestShape(ent, opname).items
|
|
259
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
260
|
+
.sort((a: any, b: any) =>
|
|
261
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
262
|
+
const arg = 0 < matchItems.length
|
|
263
|
+
? `[${matchItems.map((it: any) =>
|
|
264
|
+
`("${it.name}", ${hsLit(it.type,
|
|
265
|
+
it.name === idF ? ent.name + '_id' : it.name)})`).join(', ')}]`
|
|
266
|
+
: '[]'
|
|
267
|
+
Content(`\`\`\`haskell
|
|
268
|
+
ent <- Sdk.${eFn} sdk VNoval
|
|
269
|
+
match <- jo ${arg}
|
|
270
|
+
ctrl <- emptyMap
|
|
271
|
+
result <- Sdk.e${opname.charAt(0).toUpperCase() + opname.slice(1)} ent match ctrl
|
|
272
|
+
\`\`\`
|
|
273
|
+
|
|
274
|
+
`)
|
|
275
|
+
}
|
|
276
|
+
else if ('list' === opname) {
|
|
277
|
+
Content(`\`\`\`haskell
|
|
278
|
+
ent <- Sdk.${eFn} sdk VNoval
|
|
279
|
+
match <- emptyMap
|
|
280
|
+
ctrl <- emptyMap
|
|
281
|
+
results <- Sdk.eList ent match ctrl -- one ENTITY per record
|
|
282
|
+
datas <- mapM Sdk.eDataGet results
|
|
283
|
+
\`\`\`
|
|
284
|
+
|
|
285
|
+
`)
|
|
286
|
+
}
|
|
287
|
+
else if ('create' === opname) {
|
|
288
|
+
const createItems = opRequestShape(ent, 'create').items
|
|
289
|
+
.filter((it: any) => !it.optional)
|
|
290
|
+
Content(`\`\`\`haskell
|
|
291
|
+
ent <- Sdk.${eFn} sdk VNoval
|
|
292
|
+
d <- jo
|
|
293
|
+
[`)
|
|
294
|
+
createItems.map((it: any, i: number) => {
|
|
295
|
+
const bracket = 0 === i ? ' ' : ', '
|
|
296
|
+
Content(`${bracket}("${it.name}", ${hsLit(it.type, 'example_' + it.name)}) -- ${hsType(it.type)}
|
|
297
|
+
`)
|
|
298
|
+
})
|
|
299
|
+
Content(`]
|
|
300
|
+
ctrl <- emptyMap
|
|
301
|
+
result <- Sdk.eCreate ent d ctrl -- the ENTITY
|
|
302
|
+
d2 <- Sdk.eDataGet result
|
|
303
|
+
\`\`\`
|
|
304
|
+
|
|
305
|
+
`)
|
|
306
|
+
}
|
|
307
|
+
else if ('update' === opname) {
|
|
308
|
+
const updateItems = opRequestShape(ent, 'update').items
|
|
309
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
310
|
+
.sort((a: any, b: any) =>
|
|
311
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
312
|
+
const updateLines = updateItems.map((it: any, i: number) => {
|
|
313
|
+
const bracket = 0 === i ? ' ' : ', '
|
|
314
|
+
return `${bracket}("${it.name}", ${hsLit(it.type,
|
|
315
|
+
it.name === idF ? ent.name + '_id' : it.name)})`
|
|
316
|
+
}).join('\n ')
|
|
317
|
+
Content(`\`\`\`haskell
|
|
318
|
+
ent <- Sdk.${eFn} sdk VNoval
|
|
319
|
+
d <- jo
|
|
320
|
+
[${updateLines}
|
|
321
|
+
] -- fields to update
|
|
322
|
+
ctrl <- emptyMap
|
|
323
|
+
result <- Sdk.eUpdate ent d ctrl -- the ENTITY
|
|
324
|
+
d2 <- Sdk.eDataGet result
|
|
325
|
+
\`\`\`
|
|
326
|
+
|
|
327
|
+
`)
|
|
328
|
+
}
|
|
329
|
+
})
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
// Common methods
|
|
334
|
+
Content(`### Common Fields
|
|
335
|
+
|
|
336
|
+
#### \`eDataGet :: IO Value\`
|
|
337
|
+
|
|
338
|
+
Get the entity data.
|
|
339
|
+
|
|
340
|
+
#### \`eDataSet :: Value -> IO ()\`
|
|
341
|
+
|
|
342
|
+
Set the entity data.
|
|
343
|
+
|
|
344
|
+
#### \`eStream :: String -> Value -> Value -> IO [Value]\`
|
|
345
|
+
|
|
346
|
+
Run an operation as a lazy stream of result items.
|
|
347
|
+
|
|
348
|
+
#### \`eMake :: IO Entity\`
|
|
349
|
+
|
|
350
|
+
Create a new \`${ent.Name}\` entity with the same options.
|
|
351
|
+
|
|
352
|
+
#### \`eName :: String\`
|
|
353
|
+
|
|
354
|
+
The entity name.
|
|
355
|
+
|
|
356
|
+
`)
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
// Features section
|
|
361
|
+
const activeFeatures = each(feature).filter((f: any) => f.active)
|
|
362
|
+
if (activeFeatures.length > 0) {
|
|
363
|
+
Content(`
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## Features
|
|
367
|
+
|
|
368
|
+
| Feature | Version | Description |
|
|
369
|
+
| --- | --- | --- |
|
|
370
|
+
`)
|
|
371
|
+
|
|
372
|
+
activeFeatures.map((f: any) => {
|
|
373
|
+
Content(`| \`${f.name}\` | ${f.version || '0.0.1'} | ${f.title || ''} |
|
|
374
|
+
`)
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
Content(`
|
|
378
|
+
|
|
379
|
+
Features are activated via the \`feature\` option:
|
|
380
|
+
|
|
381
|
+
`)
|
|
382
|
+
|
|
383
|
+
Content(`\`\`\`haskell
|
|
384
|
+
active <- jo [("active", VBool True)]
|
|
385
|
+
featureCfg <- jo
|
|
386
|
+
[`)
|
|
387
|
+
activeFeatures.map((f: any, i: number) => {
|
|
388
|
+
const bracket = 0 === i ? ' ' : ', '
|
|
389
|
+
Content(`${bracket}("${f.name}", active)
|
|
390
|
+
`)
|
|
391
|
+
})
|
|
392
|
+
Content(`]
|
|
393
|
+
opts <- jo [("feature", featureCfg)]
|
|
394
|
+
client <- Sdk.newSdk opts
|
|
395
|
+
\`\`\`
|
|
396
|
+
|
|
397
|
+
`)
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
})
|
|
401
|
+
})
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
export {
|
|
407
|
+
ReadmeRef
|
|
408
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const ReadmeTopHowto = cmp(function ReadmeTopHowto(props: any) {
|
|
6
|
+
const { target } = props
|
|
7
|
+
|
|
8
|
+
Content(`**Haskell:**
|
|
9
|
+
\`\`\`haskell
|
|
10
|
+
import qualified SdkClient as Sdk
|
|
11
|
+
import qualified SdkFeatures as F
|
|
12
|
+
import VoxgigStruct (Value (..))
|
|
13
|
+
import SdkHelpers (jo)
|
|
14
|
+
|
|
15
|
+
main :: IO ()
|
|
16
|
+
main = do
|
|
17
|
+
sdk <- Sdk.newSdk0
|
|
18
|
+
params <- jo [("id", VStr "example")]
|
|
19
|
+
args <- jo [("path", VStr "/api/resource/{id}"), ("method", VStr "GET"), ("params", params)]
|
|
20
|
+
result <- F.direct sdk args
|
|
21
|
+
print result
|
|
22
|
+
\`\`\`
|
|
23
|
+
|
|
24
|
+
`)
|
|
25
|
+
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
ReadmeTopHowto
|
|
31
|
+
}
|