@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,65 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
nom,
|
|
8
|
+
} from '@voxgig/apidef'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
|
|
12
|
+
const { target, ctx$: { model } } = props
|
|
13
|
+
const info = (model.main && model.main.kit && model.main.kit.info) || {}
|
|
14
|
+
const tagline = info.tagline || ''
|
|
15
|
+
|
|
16
|
+
Content(`# ${model.Name} ${target.title} SDK
|
|
17
|
+
|
|
18
|
+
${tagline}
|
|
19
|
+
|
|
20
|
+
The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Dart conventions.
|
|
21
|
+
|
|
22
|
+
`)
|
|
23
|
+
|
|
24
|
+
// Emphasise the entity-oriented design: the SDK surfaces the API as
|
|
25
|
+
// capitalised, semantic Entities with a small, uniform verb set rather
|
|
26
|
+
// than raw URL paths and query strings. The example entity name is
|
|
27
|
+
// derived from the model, never hardcoded.
|
|
28
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
29
|
+
const exampleEntity = Object.values(entity || {})
|
|
30
|
+
.find((e: any) => e.active !== false) as any
|
|
31
|
+
const example = exampleEntity
|
|
32
|
+
? `for example \`client.${nom(exampleEntity, 'Name')}()\` — each`
|
|
33
|
+
: 'each'
|
|
34
|
+
|
|
35
|
+
// Model-driven op list — only the operations the active entities actually
|
|
36
|
+
// expose (a read-only entity has just list+load); never claim
|
|
37
|
+
// create/update/remove exist when no entity has them.
|
|
38
|
+
const CANON_OPS = ['list', 'load', 'create', 'update', 'remove']
|
|
39
|
+
const opSet = new Set<string>()
|
|
40
|
+
Object.values(entity || {}).forEach((e: any) => {
|
|
41
|
+
if (!e || e.active === false) return
|
|
42
|
+
Object.keys(e.op || {}).forEach((o: string) => {
|
|
43
|
+
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
const opNames = CANON_OPS.filter((o) => opSet.has(o))
|
|
47
|
+
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
48
|
+
const opList = (opNames.length ? opNames : ['list', 'load'])
|
|
49
|
+
.map((o) => '`' + o + '`').join(', ')
|
|
50
|
+
|
|
51
|
+
Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
|
|
52
|
+
carrying a small, uniform set of operations (${opList}) instead of raw URL
|
|
53
|
+
paths and query strings. You work with named resources and verbs, which
|
|
54
|
+
keeps the cognitive load low.
|
|
55
|
+
|
|
56
|
+
> Other languages, the CLI, and MCP server live alongside this one — see
|
|
57
|
+
> the [top-level README](../README.md).
|
|
58
|
+
|
|
59
|
+
`)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
ReadmeIntro
|
|
65
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, each, Content, isAuthActive } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
} from '@voxgig/apidef'
|
|
8
|
+
|
|
9
|
+
import { dartPackageName } from './Package_dart'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const ReadmeModel = cmp(function ReadmeModel(props: any) {
|
|
13
|
+
const { target, ctx$: { model } } = props
|
|
14
|
+
|
|
15
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
16
|
+
const entityList = each(entity).filter((e: any) => e.active !== false)
|
|
17
|
+
const pkg = dartPackageName(model)
|
|
18
|
+
|
|
19
|
+
// Model-driven op rows for the shared entity interface: emit a row only for
|
|
20
|
+
// operations at least one active entity actually exposes.
|
|
21
|
+
const opUnion = new Set<string>()
|
|
22
|
+
entityList.forEach((e: any) => Object.keys(e.op || {})
|
|
23
|
+
.forEach((o: string) => { if (e.op[o] && e.op[o].active !== false) opUnion.add(o) }))
|
|
24
|
+
const opRowDefs: Record<string, string> = {
|
|
25
|
+
load: '| `load` | `(reqmatch, [ctrl]) -> Future<dynamic>` | Load a single entity by match criteria. Throws on error. |',
|
|
26
|
+
list: '| `list` | `(reqmatch, [ctrl]) -> Future<List>` | List entities matching the criteria (a list of entity instances). Throws on error. |',
|
|
27
|
+
create: '| `create` | `(reqdata, [ctrl]) -> Future<dynamic>` | Create a new entity. Throws on error. |',
|
|
28
|
+
update: '| `update` | `(reqdata, [ctrl]) -> Future<dynamic>` | Update an existing entity. Throws on error. |',
|
|
29
|
+
remove: '| `remove` | `(reqmatch, [ctrl]) -> Future<dynamic>` | Remove an entity. Throws on error. |',
|
|
30
|
+
}
|
|
31
|
+
const opRows = ['load', 'list', 'create', 'update', 'remove']
|
|
32
|
+
.filter((o) => opUnion.has(o)).map((o) => opRowDefs[o]).join('\n')
|
|
33
|
+
|
|
34
|
+
const apikeyOptionRow = isAuthActive(model)
|
|
35
|
+
? '| `apikey` | `String` | API key for authentication. |\n'
|
|
36
|
+
: ''
|
|
37
|
+
|
|
38
|
+
Content(`### ${model.const.Name}SDK
|
|
39
|
+
|
|
40
|
+
\`\`\`dart
|
|
41
|
+
import 'package:${pkg}/${model.const.Name}SDK.dart';
|
|
42
|
+
|
|
43
|
+
final client = ${model.const.Name}SDK(options);
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
Creates a new SDK client.
|
|
47
|
+
|
|
48
|
+
| Option | Type | Description |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
${apikeyOptionRow}| \`base\` | \`String\` | Base URL of the API server. |
|
|
51
|
+
| \`prefix\` | \`String\` | URL path prefix prepended to all requests. |
|
|
52
|
+
| \`suffix\` | \`String\` | URL path suffix appended to all requests. |
|
|
53
|
+
| \`feature\` | \`Map\` | Feature activation flags. |
|
|
54
|
+
| \`extend\` | \`List\` | Additional Feature instances to load. |
|
|
55
|
+
| \`system\` | \`Map\` | System overrides (e.g. custom \`fetch\` function). |
|
|
56
|
+
|
|
57
|
+
### test
|
|
58
|
+
|
|
59
|
+
\`\`\`dart
|
|
60
|
+
final client = ${model.const.Name}SDK.test(testopts, sdkopts);
|
|
61
|
+
\`\`\`
|
|
62
|
+
|
|
63
|
+
Creates a test-mode client with mock transport. Both arguments may be \`null\`.
|
|
64
|
+
|
|
65
|
+
### ${model.const.Name}SDK methods
|
|
66
|
+
|
|
67
|
+
| Method | Signature | Description |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| \`options\` | \`() -> Map\` | Deep copy of current SDK options. |
|
|
70
|
+
| \`utility\` | \`() -> Utility\` | The SDK utility object. |
|
|
71
|
+
| \`prepare\` | \`([fetchargs]) -> Future\` | Build an HTTP request definition without sending. Returns an error value on failure. |
|
|
72
|
+
| \`direct\` | \`([fetchargs]) -> Future<Map>\` | Build and send an HTTP request. Returns a result map (branch on \`ok\`); never throws. |
|
|
73
|
+
`)
|
|
74
|
+
|
|
75
|
+
each(entityList, (ent: any) => {
|
|
76
|
+
const article = /^[aeiou]/i.test(ent.Name) ? 'an' : 'a'
|
|
77
|
+
Content(`| \`${ent.Name}\` | \`([entopts]) -> ${ent.Name}Entity\` | Create ${article} ${ent.Name} entity instance. |
|
|
78
|
+
`)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
Content(`
|
|
82
|
+
### Entity interface
|
|
83
|
+
|
|
84
|
+
All entities share the same interface.
|
|
85
|
+
|
|
86
|
+
| Method | Signature | Description |
|
|
87
|
+
| --- | --- | --- |
|
|
88
|
+
${opRows}
|
|
89
|
+
| \`data\` | \`([d]) -> Map\` | Get (or, with an argument, set) entity data. |
|
|
90
|
+
| \`match\` | \`([m]) -> Map\` | Get (or, with an argument, set) entity match criteria. |
|
|
91
|
+
| \`make\` | \`() -> Entity\` | Create a new instance with the same options. |
|
|
92
|
+
| \`entopts\` | \`() -> Map\` | Return the entity options. |
|
|
93
|
+
| \`Name\` | \`String\` | The entity name (a public field). |
|
|
94
|
+
|
|
95
|
+
### Result shape
|
|
96
|
+
|
|
97
|
+
Entity operations return the ENTITY (call data() for the record) (a \`Map\` for single-entity
|
|
98
|
+
ops, a \`List\` of entity instances for \`list\`) and throw on error. Wrap calls
|
|
99
|
+
in \`try\`/\`catch\` to handle failures.
|
|
100
|
+
|
|
101
|
+
The \`direct()\` escape hatch never throws — it returns a result \`Map\` you
|
|
102
|
+
branch on via \`result['ok']\`:
|
|
103
|
+
|
|
104
|
+
| Key | Type | Description |
|
|
105
|
+
| --- | --- | --- |
|
|
106
|
+
| \`ok\` | \`bool\` | \`true\` if the HTTP status is 2xx. |
|
|
107
|
+
| \`status\` | \`int\` | HTTP status code. |
|
|
108
|
+
| \`headers\` | \`Map\` | Response headers. |
|
|
109
|
+
| \`data\` | \`dynamic\` | Parsed JSON response body. |
|
|
110
|
+
|
|
111
|
+
On error, \`ok\` is \`false\` and \`err\` contains the error value.
|
|
112
|
+
|
|
113
|
+
`)
|
|
114
|
+
|
|
115
|
+
// Entities summary
|
|
116
|
+
Content(`### Entities
|
|
117
|
+
|
|
118
|
+
`)
|
|
119
|
+
each(entityList, (ent: any) => {
|
|
120
|
+
const fields = ent.fields || []
|
|
121
|
+
const opnames = Object.keys(ent.op || {})
|
|
122
|
+
const ops = ent.op || {}
|
|
123
|
+
const points = each(ops).map((op: any) =>
|
|
124
|
+
op.points ? each(op.points) : []
|
|
125
|
+
).flat()
|
|
126
|
+
const path = points.length > 0 ? (points[0] as any).orig || '' : ''
|
|
127
|
+
|
|
128
|
+
Content(`#### ${ent.Name}
|
|
129
|
+
|
|
130
|
+
| Field | Description |
|
|
131
|
+
| --- | --- |
|
|
132
|
+
`)
|
|
133
|
+
each(fields, (field: any) => {
|
|
134
|
+
Content(`| \`${field.name}\` | ${field.short || ''} |
|
|
135
|
+
`)
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
Content(`
|
|
139
|
+
Operations: ${opnames.map((n: string) => n.charAt(0).toUpperCase() + n.slice(1)).join(', ')}.
|
|
140
|
+
|
|
141
|
+
API path: \`${path}\`
|
|
142
|
+
|
|
143
|
+
`)
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
export {
|
|
150
|
+
ReadmeModel
|
|
151
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, each, Content, envName, isAuthActive } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const ReadmeOptions = cmp(function ReadmeOptions(props: any) {
|
|
6
|
+
const { target } = props
|
|
7
|
+
const { model } = props.ctx$
|
|
8
|
+
|
|
9
|
+
const publishedOptions = each(target.options).filter((option: any) =>
|
|
10
|
+
option.publish && ('apikey' !== option.name || isAuthActive(model)))
|
|
11
|
+
if (0 === publishedOptions.length) {
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const authActive = isAuthActive(model)
|
|
16
|
+
const importIO = authActive ? `import 'dart:io';\n` : ''
|
|
17
|
+
|
|
18
|
+
Content(`
|
|
19
|
+
|
|
20
|
+
## Options
|
|
21
|
+
|
|
22
|
+
Pass options when creating a client instance:
|
|
23
|
+
|
|
24
|
+
`)
|
|
25
|
+
|
|
26
|
+
Content(`\`\`\`dart
|
|
27
|
+
${importIO}
|
|
28
|
+
final client = ${model.Name}SDK({
|
|
29
|
+
`)
|
|
30
|
+
|
|
31
|
+
publishedOptions.map((option: any) => {
|
|
32
|
+
if ('apikey' === option.name) {
|
|
33
|
+
Content(` 'apikey': Platform.environment['${envName(model)}_APIKEY'],
|
|
34
|
+
`)
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
Content(` // '${option.name}': ${option.kind === 'string' ? "'...'" : '...'},
|
|
38
|
+
`)
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
Content(`});
|
|
43
|
+
\`\`\`
|
|
44
|
+
|
|
45
|
+
`)
|
|
46
|
+
|
|
47
|
+
Content(`| Option | Type | Description |
|
|
48
|
+
| --- | --- | --- |
|
|
49
|
+
`)
|
|
50
|
+
|
|
51
|
+
publishedOptions.map((option: any) => {
|
|
52
|
+
Content(`| \`${option.name}\` | \`${option.kind}\` | ${option.short} |
|
|
53
|
+
`)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
Content(`
|
|
57
|
+
`)
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
ReadmeOptions
|
|
63
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, 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 `list()` on a NESTED entity needs its parent path params. The
|
|
14
|
+
// quickstart used to emit `client.Moon().list()` for an entity at
|
|
15
|
+
// `/planet/{planet_id}/moon`, which 404s against a live server from a
|
|
16
|
+
// half-built URL — indistinguishable from "no such record". The model
|
|
17
|
+
// already marks those params `reqd: true`; matchArg renders exactly them.
|
|
18
|
+
function listMatchArg(ent: any): string {
|
|
19
|
+
const idF = entityIdField(ent)
|
|
20
|
+
return matchArg('ts', ent, 'list', idF, idLiteral(ent, 'list', idF))
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
|
|
25
|
+
const { target, ctx$: { model } } = props
|
|
26
|
+
|
|
27
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
28
|
+
const pkg = dartPackageName(model)
|
|
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
|
+
const importIO = authActive ? `import 'dart:io';\n` : ''
|
|
45
|
+
const ctor = authActive
|
|
46
|
+
? `${model.const.Name}SDK({\n 'apikey': Platform.environment['${envName(model)}_APIKEY'],\n})`
|
|
47
|
+
: `${model.const.Name}SDK()`
|
|
48
|
+
|
|
49
|
+
Content(`### 1. Create a client
|
|
50
|
+
|
|
51
|
+
\`\`\`dart
|
|
52
|
+
${importIO}import 'package:${pkg}/${model.const.Name}SDK.dart';
|
|
53
|
+
|
|
54
|
+
final client = ${ctor};
|
|
55
|
+
\`\`\`
|
|
56
|
+
|
|
57
|
+
`)
|
|
58
|
+
|
|
59
|
+
if (exampleEntity) {
|
|
60
|
+
const eName = nom(exampleEntity, 'Name')
|
|
61
|
+
const article = /^[aeiou]/i.test(eName) ? 'an' : 'a'
|
|
62
|
+
const eVar = exampleVarName(eName.toLowerCase(), 'dart')
|
|
63
|
+
const opnames = entityOps(exampleEntity)
|
|
64
|
+
// Model-driven id keys: `idF` is the entity's id-like MATCH field name, or
|
|
65
|
+
// null when it has none. `dataIdF` is the id on the RETURNED record's data
|
|
66
|
+
// type — an entity can key its match on an id it does not carry as data.
|
|
67
|
+
const idF = entityIdField(exampleEntity)
|
|
68
|
+
const dataIdF = entityDataIdField(exampleEntity)
|
|
69
|
+
|
|
70
|
+
// A type-correct, executable Dart literal for a param.
|
|
71
|
+
const dartLit = (type: any, placeholder: string = 'example'): string => {
|
|
72
|
+
const k = canonScalarKey(type)
|
|
73
|
+
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
74
|
+
if ('BOOLEAN' === k) return 'true'
|
|
75
|
+
if ('ARRAY' === k) return '<dynamic>[]'
|
|
76
|
+
if ('OBJECT' === k) return '<String, dynamic>{}'
|
|
77
|
+
return `'${placeholder}'`
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (opnames.includes('list')) {
|
|
81
|
+
Content(`### 2. List ${eName.toLowerCase()} records
|
|
82
|
+
|
|
83
|
+
\`list()\` returns a \`List\` of entity instances and throws on error — iterate
|
|
84
|
+
it and read each record's data via \`.data()\`.
|
|
85
|
+
|
|
86
|
+
\`\`\`dart
|
|
87
|
+
try {
|
|
88
|
+
final ${eVar}s = await client.${eName}().list(${listMatchArg(exampleEntity)});
|
|
89
|
+
for (final item in ${eVar}s) {
|
|
90
|
+
print(item.data());
|
|
91
|
+
}
|
|
92
|
+
} catch (err) {
|
|
93
|
+
print('list failed: $err');
|
|
94
|
+
}
|
|
95
|
+
\`\`\`
|
|
96
|
+
|
|
97
|
+
`)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (nestedEntity) {
|
|
101
|
+
const neName = nom(nestedEntity, 'Name')
|
|
102
|
+
const neArticle = /^[aeiou]/i.test(neName) ? 'an' : 'a'
|
|
103
|
+
const neVar = exampleVarName(neName.toLowerCase(), 'dart')
|
|
104
|
+
|
|
105
|
+
// Model-driven match: every REQUIRED load-match key. Parent keys (e.g.
|
|
106
|
+
// page_id) first, the entity's own id last.
|
|
107
|
+
const neIdF = entityIdField(nestedEntity)
|
|
108
|
+
const neRequired = opRequestShape(nestedEntity, 'load').items
|
|
109
|
+
.filter((it: any) => !it.optional)
|
|
110
|
+
.sort((a: any, b: any) =>
|
|
111
|
+
(a.name === neIdF ? 1 : 0) - (b.name === neIdF ? 1 : 0))
|
|
112
|
+
const parentItem = neRequired.find((it: any) => it.name !== neIdF) as any
|
|
113
|
+
const parentParam = parentItem && parentItem.name
|
|
114
|
+
const parentName = parentParam ? parentParam.replace(/_id$/, '') : 'its parent'
|
|
115
|
+
const neMatch = neRequired.map((it: any) =>
|
|
116
|
+
`'${it.name}': ${dartLit(it.type,
|
|
117
|
+
it.name === neIdF ? 'example_id' : 'example_' + it.name)}`)
|
|
118
|
+
|
|
119
|
+
Content(`### 3. Load ${neArticle} ${neName.toLowerCase()}
|
|
120
|
+
|
|
121
|
+
${neName} is nested under ${parentName}, so provide the \`${parentParam}\`.
|
|
122
|
+
\`load()\` returns the ENTITY — call data() for the record — and throws on error.
|
|
123
|
+
|
|
124
|
+
\`\`\`dart
|
|
125
|
+
try {
|
|
126
|
+
final ${neVar} = await client.${neName}().load({${neMatch.join(', ')}});
|
|
127
|
+
print(${neVar});
|
|
128
|
+
} catch (err) {
|
|
129
|
+
print('load failed: $err');
|
|
130
|
+
}
|
|
131
|
+
\`\`\`
|
|
132
|
+
|
|
133
|
+
`)
|
|
134
|
+
}
|
|
135
|
+
else if (opnames.includes('load')) {
|
|
136
|
+
// Every REQUIRED load-match key (id first, then parent path params).
|
|
137
|
+
const loadRequired = opRequestShape(exampleEntity, 'load').items
|
|
138
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
139
|
+
.sort((a: any, b: any) =>
|
|
140
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
141
|
+
const loadArg = 0 < loadRequired.length
|
|
142
|
+
? `{${loadRequired.map((it: any) =>
|
|
143
|
+
`'${it.name}': ${dartLit(it.type,
|
|
144
|
+
it.name === idF ? 'example_id' : 'example_' + it.name)}`).join(', ')}}`
|
|
145
|
+
: ''
|
|
146
|
+
|
|
147
|
+
Content(`### 3. Load ${article} ${eName.toLowerCase()}
|
|
148
|
+
|
|
149
|
+
\`load()\` returns the ENTITY — call data() for the record — and throws on error.
|
|
150
|
+
|
|
151
|
+
\`\`\`dart
|
|
152
|
+
try {
|
|
153
|
+
final ${eVar} = await client.${eName}().load(${loadArg});
|
|
154
|
+
print(${eVar});
|
|
155
|
+
} catch (err) {
|
|
156
|
+
print('load failed: $err');
|
|
157
|
+
}
|
|
158
|
+
\`\`\`
|
|
159
|
+
|
|
160
|
+
`)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Model-driven example fields for create/update bodies.
|
|
164
|
+
const examplePairs = (opname: string): string[] => {
|
|
165
|
+
const items = opRequestShape(exampleEntity, opname).items
|
|
166
|
+
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
167
|
+
('create' === opname && !it.optional))
|
|
168
|
+
const required = items.filter((it: any) => !it.optional)
|
|
169
|
+
const optional = items.filter((it: any) => it.optional)
|
|
170
|
+
const chosen = 'create' === opname
|
|
171
|
+
? (required.length ? required : items.slice(0, 2))
|
|
172
|
+
: required.concat(optional).slice(0, Math.max(2, required.length))
|
|
173
|
+
return chosen.map((it: any) => `'${it.name}': ${dartLit(it.type, 'example_' + it.name)}`)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const idParamType = (opname: string): any => {
|
|
177
|
+
const it = opRequestShape(exampleEntity, opname).items.find((x: any) => x.name === idF)
|
|
178
|
+
return it && it.type
|
|
179
|
+
}
|
|
180
|
+
const idValueFor = (opname: string): string => (null != dataIdF && opnames.includes('create'))
|
|
181
|
+
? `created.data()['${dataIdF}']`
|
|
182
|
+
: dartLit(idParamType(opname), 'example_id')
|
|
183
|
+
|
|
184
|
+
if (opnames.includes('create') || opnames.includes('update') || opnames.includes('remove')) {
|
|
185
|
+
Content(`### 4. Create, update, and remove
|
|
186
|
+
|
|
187
|
+
\`\`\`dart
|
|
188
|
+
`)
|
|
189
|
+
if (opnames.includes('create')) {
|
|
190
|
+
Content(`// Create — returns the ENTITY (call data() for the record)
|
|
191
|
+
final created = await client.${eName}().create({${examplePairs('create').join(', ')}});
|
|
192
|
+
|
|
193
|
+
`)
|
|
194
|
+
}
|
|
195
|
+
if (opnames.includes('update')) {
|
|
196
|
+
const updatePairs = (idF ? [`'${idF}': ${idValueFor('update')}`] : []).concat(examplePairs('update'))
|
|
197
|
+
const fromCreated = null != dataIdF && opnames.includes('create')
|
|
198
|
+
Content(`// Update${fromCreated ? " — the created record's id is a plain map key" : ''}
|
|
199
|
+
await client.${eName}().update({${updatePairs.join(', ')}});
|
|
200
|
+
|
|
201
|
+
`)
|
|
202
|
+
}
|
|
203
|
+
if (opnames.includes('remove')) {
|
|
204
|
+
const removePairs = opRequestShape(exampleEntity, 'remove').items
|
|
205
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
206
|
+
.sort((a: any, b: any) =>
|
|
207
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
208
|
+
.map((it: any) => it.name === idF
|
|
209
|
+
? `'${it.name}': ${idValueFor('remove')}`
|
|
210
|
+
: `'${it.name}': ${dartLit(it.type, 'example_' + it.name)}`)
|
|
211
|
+
Content(`// Remove
|
|
212
|
+
await client.${eName}().remove(${removePairs.length ? `{${removePairs.join(', ')}}` : ''});
|
|
213
|
+
`)
|
|
214
|
+
}
|
|
215
|
+
Content(`\`\`\`
|
|
216
|
+
|
|
217
|
+
`)
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
export {
|
|
224
|
+
ReadmeQuick
|
|
225
|
+
}
|