@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,397 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
|
|
3
|
+
import { ReadmeRefFeatures } from '@voxgig/sdkgen'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
KIT,
|
|
7
|
+
getModelPath,
|
|
8
|
+
} from '@voxgig/apidef'
|
|
9
|
+
|
|
10
|
+
import { dartPackageName } from './Package_dart'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// Type names come from the shared canonToType 'dart' column (single source of truth).
|
|
14
|
+
|
|
15
|
+
// A type-correct Dart literal for a field's canonical type. Strings render
|
|
16
|
+
// the quoted placeholder (single-quoted, matching the generated Dart style).
|
|
17
|
+
function dartLit(type: any, placeholder: string = 'example'): string {
|
|
18
|
+
const k = canonScalarKey(type)
|
|
19
|
+
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
20
|
+
if ('BOOLEAN' === k) return 'true'
|
|
21
|
+
if ('ARRAY' === k) return '<dynamic>[]'
|
|
22
|
+
if ('OBJECT' === k) return '<String, dynamic>{}'
|
|
23
|
+
return `'${placeholder}'`
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// A `list()` on a NESTED entity needs its parent path params. The
|
|
28
|
+
// quickstart used to emit `client.Moon().list()` for an entity at
|
|
29
|
+
// `/planet/{planet_id}/moon`, which 404s against a live server from a
|
|
30
|
+
// half-built URL — indistinguishable from "no such record". The model
|
|
31
|
+
// already marks those params `reqd: true`; matchArg renders exactly them.
|
|
32
|
+
function listMatchArg(ent: any): string {
|
|
33
|
+
const idF = entityIdField(ent)
|
|
34
|
+
return matchArg('ts', ent, 'list', idF, idLiteral(ent, 'list', idF))
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const OP_SIGNATURES: Record<string, { sig: string, returns: string, desc: string }> = {
|
|
39
|
+
load: {
|
|
40
|
+
sig: 'load(reqmatch, [ctrl]) -> Future<dynamic>',
|
|
41
|
+
returns: 'the entity data',
|
|
42
|
+
desc: 'Load a single entity matching the given criteria. Returns the entity data and throws on error.',
|
|
43
|
+
},
|
|
44
|
+
list: {
|
|
45
|
+
sig: 'list([reqmatch, ctrl]) -> Future<List>',
|
|
46
|
+
returns: 'a list of entities',
|
|
47
|
+
desc: 'List entities matching the given criteria. The match is optional — call `list()` with no argument to list all records. Returns a list of entity instances and throws on error.',
|
|
48
|
+
},
|
|
49
|
+
create: {
|
|
50
|
+
sig: 'create(reqdata, [ctrl]) -> Future<dynamic>',
|
|
51
|
+
returns: 'the created entity data',
|
|
52
|
+
desc: 'Create a new entity with the given data. Returns the created entity data and throws on error.',
|
|
53
|
+
},
|
|
54
|
+
update: {
|
|
55
|
+
sig: 'update(reqdata, [ctrl]) -> Future<dynamic>',
|
|
56
|
+
returns: 'the updated entity data',
|
|
57
|
+
desc: 'Update an existing entity. The data must include the entity `id`. Returns the updated entity data and throws on error.',
|
|
58
|
+
},
|
|
59
|
+
remove: {
|
|
60
|
+
sig: 'remove(reqmatch, [ctrl]) -> Future<dynamic>',
|
|
61
|
+
returns: 'the removed entity data',
|
|
62
|
+
desc: 'Remove the entity matching the given criteria. Throws on error.',
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const ReadmeRef = cmp(function ReadmeRef(props: any) {
|
|
68
|
+
const { target } = props
|
|
69
|
+
const { model } = props.ctx$
|
|
70
|
+
|
|
71
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
72
|
+
const feature = getModelPath(model, `main.${KIT}.feature`)
|
|
73
|
+
const pkg = dartPackageName(model)
|
|
74
|
+
|
|
75
|
+
const publishedEntities = each(entity).filter((e: any) => e.active !== false)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
File({ name: 'REFERENCE.md' }, () => {
|
|
79
|
+
|
|
80
|
+
Content(`# ${model.Name} ${target.title} SDK Reference
|
|
81
|
+
|
|
82
|
+
Complete API reference for the ${model.Name} ${target.title} SDK.
|
|
83
|
+
|
|
84
|
+
## ${model.const.Name}SDK
|
|
85
|
+
|
|
86
|
+
### Constructor
|
|
87
|
+
|
|
88
|
+
`)
|
|
89
|
+
|
|
90
|
+
Content(`\`\`\`dart
|
|
91
|
+
import 'package:${pkg}/${model.const.Name}SDK.dart';
|
|
92
|
+
|
|
93
|
+
final client = ${model.const.Name}SDK(options);
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
Create a new SDK client instance.
|
|
97
|
+
|
|
98
|
+
**Parameters:**
|
|
99
|
+
|
|
100
|
+
| Name | Type | Description |
|
|
101
|
+
| --- | --- | --- |
|
|
102
|
+
| \`options\` | \`Map\` | SDK configuration options. |
|
|
103
|
+
${isAuthActive(model) ? '| `options[\'apikey\']` | `String` | API key for authentication. |\n' : ''}| \`options['base']\` | \`String\` | Base URL for API requests. |
|
|
104
|
+
| \`options['prefix']\` | \`String\` | URL prefix appended after base. |
|
|
105
|
+
| \`options['suffix']\` | \`String\` | URL suffix appended after path. |
|
|
106
|
+
| \`options['headers']\` | \`Map\` | Custom headers for all requests. |
|
|
107
|
+
| \`options['feature']\` | \`Map\` | Feature configuration. |
|
|
108
|
+
| \`options['system']\` | \`Map\` | System overrides (e.g. custom fetch). |
|
|
109
|
+
|
|
110
|
+
`)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
Content(`
|
|
114
|
+
### Static Methods
|
|
115
|
+
|
|
116
|
+
`)
|
|
117
|
+
|
|
118
|
+
Content(`#### \`${model.const.Name}SDK.test([testopts, sdkopts])\`
|
|
119
|
+
|
|
120
|
+
Create a test client with mock features active. Both arguments may be \`null\`.
|
|
121
|
+
|
|
122
|
+
\`\`\`dart
|
|
123
|
+
final client = ${model.const.Name}SDK.test();
|
|
124
|
+
\`\`\`
|
|
125
|
+
|
|
126
|
+
`)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
Content(`
|
|
130
|
+
### Instance Methods
|
|
131
|
+
|
|
132
|
+
`)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
// Entity factory methods
|
|
136
|
+
publishedEntities.map((ent: any) => {
|
|
137
|
+
Content(`#### \`${ent.Name}([entopts])\`
|
|
138
|
+
|
|
139
|
+
Create a new \`${ent.Name}Entity\` instance. Pass no argument for no initial data.
|
|
140
|
+
|
|
141
|
+
`)
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
Content(`#### \`options() -> Map\`
|
|
146
|
+
|
|
147
|
+
Return a deep copy of the current SDK options.
|
|
148
|
+
|
|
149
|
+
#### \`utility() -> Utility\`
|
|
150
|
+
|
|
151
|
+
Return the SDK utility object.
|
|
152
|
+
|
|
153
|
+
#### \`direct([fetchargs]) -> Future<Map>\`
|
|
154
|
+
|
|
155
|
+
Make a direct HTTP request to any API endpoint. Returns a result \`Map\` with \`ok\`, \`status\`, \`headers\`, and \`data\` (or \`err\` on failure). This escape hatch never throws — branch on \`result['ok']\`.
|
|
156
|
+
|
|
157
|
+
**Parameters:**
|
|
158
|
+
|
|
159
|
+
| Name | Type | Description |
|
|
160
|
+
| --- | --- | --- |
|
|
161
|
+
| \`fetchargs['path']\` | \`String\` | URL path with optional \`{param}\` placeholders. |
|
|
162
|
+
| \`fetchargs['method']\` | \`String\` | HTTP method (default: \`'GET'\`). |
|
|
163
|
+
| \`fetchargs['params']\` | \`Map\` | Path parameter values. |
|
|
164
|
+
| \`fetchargs['query']\` | \`Map\` | Query string parameters. |
|
|
165
|
+
| \`fetchargs['headers']\` | \`Map\` | Request headers (merged with defaults). |
|
|
166
|
+
| \`fetchargs['body']\` | \`dynamic\` | Request body (maps are JSON-serialized). |
|
|
167
|
+
|
|
168
|
+
**Returns:** \`Future<Map>\`
|
|
169
|
+
|
|
170
|
+
#### \`prepare([fetchargs]) -> Future\`
|
|
171
|
+
|
|
172
|
+
Prepare a fetch definition without sending. Returns the \`fetchdef\` (or an error value on failure).
|
|
173
|
+
|
|
174
|
+
`)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
// Entity reference sections
|
|
178
|
+
publishedEntities.map((ent: any) => {
|
|
179
|
+
const opnames = Object.keys(ent.op || {})
|
|
180
|
+
const fields = ent.fields || []
|
|
181
|
+
const idF = entityIdField(ent)
|
|
182
|
+
const eVar = exampleVarName(ent.name, 'dart')
|
|
183
|
+
|
|
184
|
+
Content(`
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## ${ent.Name}Entity
|
|
188
|
+
|
|
189
|
+
`)
|
|
190
|
+
|
|
191
|
+
if (ent.short) {
|
|
192
|
+
Content(`${ent.short}
|
|
193
|
+
|
|
194
|
+
`)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
Content(`\`\`\`dart
|
|
198
|
+
final ${eVar} = client.${ent.Name}();
|
|
199
|
+
\`\`\`
|
|
200
|
+
|
|
201
|
+
`)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
// Field schema
|
|
205
|
+
if (fields.length > 0) {
|
|
206
|
+
Content(`### Fields
|
|
207
|
+
|
|
208
|
+
| Field | Type | Required | Description |
|
|
209
|
+
| --- | --- | --- | --- |
|
|
210
|
+
`)
|
|
211
|
+
each(fields, (field: any) => {
|
|
212
|
+
const req = field.req ? 'Yes' : 'No'
|
|
213
|
+
const desc = field.short || ''
|
|
214
|
+
Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${req} | ${desc} |
|
|
215
|
+
`)
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
Content(`
|
|
219
|
+
`)
|
|
220
|
+
|
|
221
|
+
// Field operations breakdown
|
|
222
|
+
const hasFieldOps = fields.some((f: any) => f.op && Object.keys(f.op).length > 0)
|
|
223
|
+
if (hasFieldOps) {
|
|
224
|
+
const opcols = ['load', 'list', 'create', 'update', 'remove']
|
|
225
|
+
.filter((op: string) => opnames.includes(op) && ent.op[op]?.active !== false)
|
|
226
|
+
Content(`### Field Usage by Operation
|
|
227
|
+
|
|
228
|
+
| Field | ${opcols.join(' | ')} |
|
|
229
|
+
| --- | ${opcols.map(() => '---').join(' | ')} |
|
|
230
|
+
`)
|
|
231
|
+
each(fields, (field: any) => {
|
|
232
|
+
const fops = field.op || {}
|
|
233
|
+
const cols = opcols.map((op: string) => {
|
|
234
|
+
const fop = fops[op]
|
|
235
|
+
if (null == fop) return '-'
|
|
236
|
+
if (fop.active === false) return '-'
|
|
237
|
+
return 'Yes'
|
|
238
|
+
})
|
|
239
|
+
Content(`| \`${field.name}\` | ${cols.join(' | ')} |
|
|
240
|
+
`)
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
Content(`
|
|
244
|
+
`)
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
// Operation details
|
|
250
|
+
if (opnames.length > 0) {
|
|
251
|
+
Content(`### Operations
|
|
252
|
+
|
|
253
|
+
`)
|
|
254
|
+
|
|
255
|
+
opnames.map((opname: string) => {
|
|
256
|
+
const info = OP_SIGNATURES[opname]
|
|
257
|
+
if (!info) return
|
|
258
|
+
|
|
259
|
+
Content(`#### \`${info.sig}\`
|
|
260
|
+
|
|
261
|
+
${info.desc}
|
|
262
|
+
|
|
263
|
+
`)
|
|
264
|
+
|
|
265
|
+
if ('load' === opname || 'remove' === opname) {
|
|
266
|
+
const matchItems = opRequestShape(ent, opname).items
|
|
267
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
268
|
+
.sort((a: any, b: any) =>
|
|
269
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
270
|
+
const arg = 0 < matchItems.length
|
|
271
|
+
? `{${matchItems.map((it: any) =>
|
|
272
|
+
`'${it.name}': ${dartLit(it.type,
|
|
273
|
+
it.name === idF ? ent.name + '_id' : it.name)}`).join(', ')}}`
|
|
274
|
+
: ''
|
|
275
|
+
Content(`\`\`\`dart
|
|
276
|
+
final result = await client.${ent.Name}().${opname}(${arg});
|
|
277
|
+
\`\`\`
|
|
278
|
+
|
|
279
|
+
`)
|
|
280
|
+
}
|
|
281
|
+
else if ('list' === opname) {
|
|
282
|
+
Content(`\`\`\`dart
|
|
283
|
+
final results = await client.${ent.Name}().list(${listMatchArg(ent)});
|
|
284
|
+
for (final ${eVar} in results) {
|
|
285
|
+
print(${eVar}.data());
|
|
286
|
+
}
|
|
287
|
+
\`\`\`
|
|
288
|
+
|
|
289
|
+
`)
|
|
290
|
+
}
|
|
291
|
+
else if ('create' === opname) {
|
|
292
|
+
const createItems = opRequestShape(ent, 'create').items
|
|
293
|
+
.filter((it: any) => !it.optional)
|
|
294
|
+
Content(`\`\`\`dart
|
|
295
|
+
final result = await client.${ent.Name}().create({
|
|
296
|
+
`)
|
|
297
|
+
createItems.map((it: any) => {
|
|
298
|
+
Content(` '${it.name}': ${dartLit(it.type, 'example_' + it.name)}, // ${canonToType(it.type, target.name)}
|
|
299
|
+
`)
|
|
300
|
+
})
|
|
301
|
+
Content(`});
|
|
302
|
+
\`\`\`
|
|
303
|
+
|
|
304
|
+
`)
|
|
305
|
+
}
|
|
306
|
+
else if ('update' === opname) {
|
|
307
|
+
const updateItems = opRequestShape(ent, 'update').items
|
|
308
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
309
|
+
.sort((a: any, b: any) =>
|
|
310
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
311
|
+
const updateLines = updateItems.map((it: any) =>
|
|
312
|
+
` '${it.name}': ${dartLit(it.type,
|
|
313
|
+
it.name === idF ? ent.name + '_id' : it.name)},\n`).join('')
|
|
314
|
+
Content(`\`\`\`dart
|
|
315
|
+
final result = await client.${ent.Name}().update({
|
|
316
|
+
${updateLines} // Fields to update
|
|
317
|
+
});
|
|
318
|
+
\`\`\`
|
|
319
|
+
|
|
320
|
+
`)
|
|
321
|
+
}
|
|
322
|
+
})
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
// Common methods
|
|
327
|
+
Content(`### Common Methods
|
|
328
|
+
|
|
329
|
+
#### \`data([d]) -> Map\`
|
|
330
|
+
|
|
331
|
+
Get the entity data, or set it when passed an argument.
|
|
332
|
+
|
|
333
|
+
#### \`match([m]) -> Map\`
|
|
334
|
+
|
|
335
|
+
Get the entity match criteria, or set it when passed an argument.
|
|
336
|
+
|
|
337
|
+
#### \`make() -> Entity\`
|
|
338
|
+
|
|
339
|
+
Create a new \`${ent.Name}Entity\` instance with the same options.
|
|
340
|
+
|
|
341
|
+
#### \`entopts() -> Map\`
|
|
342
|
+
|
|
343
|
+
Return the entity options.
|
|
344
|
+
|
|
345
|
+
`)
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
// Features section
|
|
350
|
+
const activeFeatures = each(feature).filter((f: any) => f.active)
|
|
351
|
+
if (activeFeatures.length > 0) {
|
|
352
|
+
Content(`
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Features
|
|
356
|
+
|
|
357
|
+
| Feature | Version | Description |
|
|
358
|
+
| --- | --- | --- |
|
|
359
|
+
`)
|
|
360
|
+
|
|
361
|
+
activeFeatures.map((f: any) => {
|
|
362
|
+
Content(`| \`${f.name}\` | ${f.version || '0.0.1'} | ${f.title || ''} |
|
|
363
|
+
`)
|
|
364
|
+
})
|
|
365
|
+
|
|
366
|
+
Content(`
|
|
367
|
+
|
|
368
|
+
Features are activated via the \`feature\` option:
|
|
369
|
+
|
|
370
|
+
`)
|
|
371
|
+
|
|
372
|
+
Content(`\`\`\`dart
|
|
373
|
+
final client = ${model.const.Name}SDK({
|
|
374
|
+
'feature': {
|
|
375
|
+
`)
|
|
376
|
+
activeFeatures.map((f: any) => {
|
|
377
|
+
Content(` '${f.name}': {'active': true},
|
|
378
|
+
`)
|
|
379
|
+
})
|
|
380
|
+
Content(` },
|
|
381
|
+
});
|
|
382
|
+
\`\`\`
|
|
383
|
+
|
|
384
|
+
`)
|
|
385
|
+
// The shared feature reference: options, defaults, usage and the
|
|
386
|
+
// considerations. Model facts, identical in every target, so they are
|
|
387
|
+
// written once in cmp/ReadmeRefFeatures.ts rather than here.
|
|
388
|
+
ReadmeRefFeatures({ target })
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
})
|
|
392
|
+
})
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
export {
|
|
396
|
+
ReadmeRef
|
|
397
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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(`**Dart:**
|
|
9
|
+
\`\`\`dart
|
|
10
|
+
final result = await client.direct({
|
|
11
|
+
'path': '/api/resource/{id}',
|
|
12
|
+
'method': 'GET',
|
|
13
|
+
'params': {'id': 'example'},
|
|
14
|
+
});
|
|
15
|
+
\`\`\`
|
|
16
|
+
|
|
17
|
+
`)
|
|
18
|
+
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
ReadmeTopHowto
|
|
24
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
nom,
|
|
8
|
+
} from '@voxgig/apidef'
|
|
9
|
+
|
|
10
|
+
import { dartPackageName } from './Package_dart'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// A type-correct, executable Dart literal for a param: numeric/boolean/
|
|
14
|
+
// array/object params render a typed literal; strings render the quoted
|
|
15
|
+
// placeholder (single-quoted, matching the generated Dart style).
|
|
16
|
+
function dartLit(type: any, placeholder: string = 'example'): string {
|
|
17
|
+
const k = canonScalarKey(type)
|
|
18
|
+
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
19
|
+
if ('BOOLEAN' === k) return 'true'
|
|
20
|
+
if ('ARRAY' === k) return '<dynamic>[]'
|
|
21
|
+
if ('OBJECT' === k) return '<String, dynamic>{}'
|
|
22
|
+
return `'${placeholder}'`
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// A `list()` on a NESTED entity needs its parent path params. The
|
|
27
|
+
// quickstart used to emit `client.Moon().list()` for an entity at
|
|
28
|
+
// `/planet/{planet_id}/moon`, which 404s against a live server from a
|
|
29
|
+
// half-built URL — indistinguishable from "no such record". The model
|
|
30
|
+
// already marks those params `reqd: true`; matchArg renders exactly them.
|
|
31
|
+
function listMatchArg(ent: any): string {
|
|
32
|
+
const idF = entityIdField(ent)
|
|
33
|
+
return matchArg('ts', ent, 'list', idF, idLiteral(ent, 'list', idF))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
|
|
38
|
+
const { target, ctx$: { model } } = props
|
|
39
|
+
|
|
40
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
41
|
+
const pkg = dartPackageName(model)
|
|
42
|
+
|
|
43
|
+
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
44
|
+
|
|
45
|
+
const authActive = isAuthActive(model)
|
|
46
|
+
const importIO = authActive ? `import 'dart:io';\n` : ''
|
|
47
|
+
const ctor = authActive
|
|
48
|
+
? `${model.const.Name}SDK({\n 'apikey': Platform.environment['${envName(model)}_APIKEY'],\n })`
|
|
49
|
+
: `${model.const.Name}SDK()`
|
|
50
|
+
|
|
51
|
+
Content(`\`\`\`dart
|
|
52
|
+
${importIO}import 'package:${pkg}/${model.const.Name}SDK.dart';
|
|
53
|
+
|
|
54
|
+
Future<void> main() async {
|
|
55
|
+
final client = ${ctor};
|
|
56
|
+
|
|
57
|
+
`)
|
|
58
|
+
|
|
59
|
+
if (exampleEntity) {
|
|
60
|
+
const eName = nom(exampleEntity, 'Name')
|
|
61
|
+
const eVar = exampleVarName(eName.toLowerCase(), 'dart')
|
|
62
|
+
const opnames = Object.keys(exampleEntity.op || {})
|
|
63
|
+
// Model-driven id key: null when the entity has no id-like field, in which
|
|
64
|
+
// case the load example takes no match argument.
|
|
65
|
+
const idF = entityIdField(exampleEntity)
|
|
66
|
+
|
|
67
|
+
if (opnames.includes('list')) {
|
|
68
|
+
Content(` // List all ${eName.toLowerCase()}s (returns a list of entities, throws on error)
|
|
69
|
+
final ${eVar}s = await client.${eName}().list(${listMatchArg(exampleEntity)});
|
|
70
|
+
for (final item in ${eVar}s) {
|
|
71
|
+
print(item.data());
|
|
72
|
+
}
|
|
73
|
+
`)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (opnames.includes('load')) {
|
|
77
|
+
// Every REQUIRED load-match key (id first, then parent path params like
|
|
78
|
+
// page_id) — the same shape the runtime resolves path params from, so
|
|
79
|
+
// the example always works.
|
|
80
|
+
const loadItems = opRequestShape(exampleEntity, 'load').items
|
|
81
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
82
|
+
.sort((a: any, b: any) =>
|
|
83
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
84
|
+
const loadArg = 0 < loadItems.length
|
|
85
|
+
? `{${loadItems.map((it: any) =>
|
|
86
|
+
`'${it.name}': ${dartLit(it.type,
|
|
87
|
+
it.name === idF ? 'example_id' : 'example_' + it.name)}`).join(', ')}}`
|
|
88
|
+
: ''
|
|
89
|
+
Content(`
|
|
90
|
+
// Load a specific ${eName.toLowerCase()} (returns the record, throws on error)
|
|
91
|
+
final ${eVar} = await client.${eName}().load(${loadArg});
|
|
92
|
+
print(${eVar});
|
|
93
|
+
`)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
Content(`}
|
|
98
|
+
\`\`\`
|
|
99
|
+
`)
|
|
100
|
+
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
export {
|
|
105
|
+
ReadmeTopQuick
|
|
106
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
nom,
|
|
8
|
+
} from '@voxgig/apidef'
|
|
9
|
+
|
|
10
|
+
import { dartPackageName } from './Package_dart'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// A type-correct Dart literal for a field's canonical type.
|
|
14
|
+
function dartLit(type: any): string {
|
|
15
|
+
const k = canonScalarKey(type)
|
|
16
|
+
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
17
|
+
if ('BOOLEAN' === k) return 'true'
|
|
18
|
+
if ('ARRAY' === k) return '<dynamic>[]'
|
|
19
|
+
if ('OBJECT' === k) return '<String, dynamic>{}'
|
|
20
|
+
return "'example'"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
|
|
25
|
+
const { target, ctx$: { model } } = props
|
|
26
|
+
|
|
27
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
28
|
+
const pkg = dartPackageName(model)
|
|
29
|
+
|
|
30
|
+
// Pick an entity with a real op (prefer a read op) — never fabricate a
|
|
31
|
+
// `load` on an op-less entity.
|
|
32
|
+
const { entity: exampleEntity, primaryOp } = pickExampleEntity(entity)
|
|
33
|
+
|
|
34
|
+
Content(`\`\`\`dart
|
|
35
|
+
import 'package:${pkg}/${model.const.Name}SDK.dart';
|
|
36
|
+
|
|
37
|
+
Future<void> main() async {
|
|
38
|
+
final client = ${model.const.Name}SDK.test();
|
|
39
|
+
`)
|
|
40
|
+
|
|
41
|
+
if (exampleEntity && primaryOp) {
|
|
42
|
+
const eName = nom(exampleEntity, 'Name')
|
|
43
|
+
const idF = entityIdField(exampleEntity)
|
|
44
|
+
const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
|
|
45
|
+
let arg = ''
|
|
46
|
+
if (isMatchOp) {
|
|
47
|
+
// Every REQUIRED match key (id first).
|
|
48
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
49
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
50
|
+
.sort((a: any, b: any) =>
|
|
51
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
52
|
+
arg = 0 < items.length
|
|
53
|
+
? `{${items.map((it: any) =>
|
|
54
|
+
`'${it.name}': ${it.name === idF ? "'test01'" : dartLit(it.type)}`).join(', ')}}`
|
|
55
|
+
: ''
|
|
56
|
+
} else if ('create' === primaryOp || 'update' === primaryOp) {
|
|
57
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
58
|
+
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
59
|
+
const required = items.filter((it: any) => !it.optional)
|
|
60
|
+
const chosen = required.length ? required : items.slice(0, 3)
|
|
61
|
+
arg = `{${chosen.map((it: any) => `'${it.name}': ${dartLit(it.type)}`).join(', ')}}`
|
|
62
|
+
}
|
|
63
|
+
const eVar = exampleVarName(eName.toLowerCase(), 'dart') + ('list' === primaryOp ? 's' : '')
|
|
64
|
+
Content(` final ${eVar} = await client.${eName}().${primaryOp}(${arg});
|
|
65
|
+
print(${eVar});
|
|
66
|
+
`)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Content(`}
|
|
70
|
+
\`\`\`
|
|
71
|
+
`)
|
|
72
|
+
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
ReadmeTopTest
|
|
78
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
import * as Path from 'node:path'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
File,
|
|
7
|
+
Fragment,
|
|
8
|
+
cmp,
|
|
9
|
+
} from '@voxgig/sdkgen'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
Model,
|
|
14
|
+
} from '@voxgig/apidef'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const SdkError = cmp(async function SdkError(props: any) {
|
|
20
|
+
const ctx$ = props.ctx$
|
|
21
|
+
const target = props.target
|
|
22
|
+
|
|
23
|
+
const model: Model = ctx$.model
|
|
24
|
+
|
|
25
|
+
const ff = Path.normalize(__dirname + '/../../../src/cmp/dart/fragment/')
|
|
26
|
+
|
|
27
|
+
File({ name: model.const.Name + 'Error.' + target.ext }, () => {
|
|
28
|
+
|
|
29
|
+
Fragment({
|
|
30
|
+
from: ff + 'SdkError.fragment.dart',
|
|
31
|
+
|
|
32
|
+
replace: {
|
|
33
|
+
...ctx$.stdrep,
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
SdkError
|
|
42
|
+
}
|