@voxgig/sdkgen 4.51.0 → 4.52.0
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/bin/voxgig-sdkgen +1 -1
- package/dist/cmp/ReadmeExplanation.js +5 -2
- package/dist/cmp/ReadmeExplanation.js.map +1 -1
- package/dist/cmp/ReadmeFeatures.js +20 -6
- package/dist/cmp/ReadmeFeatures.js.map +1 -1
- package/dist/helpers/optspec.js +2 -2
- package/dist/helpers/optspec.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aontu +1 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/audit.aontu +1 -1
- package/project/.sdk/model/feature/cache.aontu +1 -1
- package/project/.sdk/model/feature/clienttrack.aontu +1 -1
- package/project/.sdk/model/feature/cost.aontu +1 -1
- package/project/.sdk/model/feature/debug.aontu +1 -1
- package/project/.sdk/model/feature/idempotency.aontu +1 -1
- package/project/.sdk/model/feature/log.aontu +1 -1
- package/project/.sdk/model/feature/metrics.aontu +3 -1
- package/project/.sdk/model/feature/netsim.aontu +1 -1
- package/project/.sdk/model/feature/paging.aontu +4 -1
- package/project/.sdk/model/feature/proxy.aontu +1 -1
- package/project/.sdk/model/feature/ratelimit.aontu +3 -3
- package/project/.sdk/model/feature/rbac.aontu +1 -1
- package/project/.sdk/model/feature/retry.aontu +1 -1
- package/project/.sdk/model/feature/secrets.aontu +1 -1
- package/project/.sdk/model/feature/streaming.aontu +1 -1
- package/project/.sdk/model/feature/telemetry.aontu +2 -2
- package/project/.sdk/model/feature/test.aontu +1 -1
- package/project/.sdk/model/feature/timeout.aontu +1 -1
- package/project/.sdk/model/feature/validate.aontu +1 -1
- package/project/.sdk/src/cmp/c/TestClean_c.ts +12 -11
- package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +17 -10
- package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -1
- package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +2 -1
- package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +30 -2
- package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +31 -12
- package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +2 -1
- package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +51 -15
- package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +17 -0
- package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +42 -2
- package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +42 -14
- package/project/.sdk/src/cmp/java/TestClean_java.ts +9 -4
- package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +21 -0
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +13 -8
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +26 -2
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityPatchOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +12 -5
- package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +9 -4
- package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +19 -0
- package/project/.sdk/src/cmp/lua/TestClean_lua.ts +2 -1
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +42 -5
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +44 -10
- package/project/.sdk/src/cmp/lua/utility_lua.ts +2 -1
- package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +2 -1
- package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +36 -21
- package/project/.sdk/src/cmp/perl/TestClean_perl.ts +1 -1
- package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +21 -0
- package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +31 -12
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +33 -4
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +13 -6
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +25 -2
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +26 -12
- package/project/.sdk/src/cmp/rb/TestClean_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +23 -2
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +27 -11
- package/project/.sdk/src/cmp/rust/TestClean_rust.ts +14 -17
- package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +22 -2
- package/project/.sdk/src/cmp/scala/TestClean_scala.ts +11 -11
- package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +14 -0
- package/project/.sdk/src/cmp/swift/TestClean_swift.ts +11 -11
- package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +9 -0
- package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +24 -10
- package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +13 -8
- package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +26 -2
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityPatchOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +12 -5
- package/project/.sdk/src/cmp/zig/TestClean_zig.ts +11 -11
- package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +17 -10
- package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +41 -6
- package/project/.sdk/tm/c/feature/metrics.c +7 -0
- package/project/.sdk/tm/c/feature/paging.c +231 -2
- package/project/.sdk/tm/c/feature/ratelimit.c +5 -9
- package/project/.sdk/tm/c/feature/retry.c +51 -4
- package/project/.sdk/tm/c/feature/streaming.c +2 -1
- package/project/.sdk/tm/c/feature/telemetry.c +19 -18
- package/project/.sdk/tm/c/feature/test.c +78 -54
- package/project/.sdk/tm/c/tests/feature_test.c +184 -0
- package/project/.sdk/tm/c/tests/primary_utility_test.c +2 -0
- package/project/.sdk/tm/c/utility/make_options.c +80 -9
- package/project/.sdk/tm/clojure/src/sdk/core.clj +31 -11
- package/project/.sdk/tm/clojure/src/sdk/features.clj +198 -70
- package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +70 -1
- package/project/.sdk/tm/cpp/core/types.hpp +137 -68
- package/project/.sdk/tm/cpp/feature/audit.hpp +6 -1
- package/project/.sdk/tm/cpp/feature/metrics.hpp +19 -0
- package/project/.sdk/tm/cpp/feature/paging.hpp +160 -2
- package/project/.sdk/tm/cpp/feature/ratelimit.hpp +18 -14
- package/project/.sdk/tm/cpp/feature/retry.hpp +46 -5
- package/project/.sdk/tm/cpp/feature/streaming.hpp +2 -1
- package/project/.sdk/tm/cpp/feature/telemetry.hpp +17 -10
- package/project/.sdk/tm/cpp/feature/test.hpp +63 -53
- package/project/.sdk/tm/cpp/test/feature_test.cpp +137 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +35 -5
- package/project/.sdk/tm/csharp/feature/AuditFeature.cs +8 -1
- package/project/.sdk/tm/csharp/feature/MetricsFeature.cs +23 -0
- package/project/.sdk/tm/csharp/feature/PagingFeature.cs +130 -3
- package/project/.sdk/tm/csharp/feature/RatelimitFeature.cs +26 -19
- package/project/.sdk/tm/csharp/feature/RetryFeature.cs +41 -7
- package/project/.sdk/tm/csharp/feature/StreamingFeature.cs +2 -1
- package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +11 -9
- package/project/.sdk/tm/csharp/feature/TestFeature.cs +55 -67
- package/project/.sdk/tm/csharp/test/FeatureTest.cs +162 -0
- package/project/.sdk/tm/csharp/utility/MakeOptions.cs +89 -12
- package/project/.sdk/tm/elixir/lib/projectname/feature/metrics.ex +13 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +110 -5
- package/project/.sdk/tm/elixir/lib/projectname/feature/ratelimit.ex +6 -12
- package/project/.sdk/tm/elixir/lib/projectname/feature/retry.ex +33 -9
- package/project/.sdk/tm/elixir/lib/projectname/feature/streaming.ex +2 -1
- package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +7 -7
- package/project/.sdk/tm/elixir/lib/projectname/feature/test.ex +52 -48
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +59 -35
- package/project/.sdk/tm/elixir/test/feature_test.exs +137 -0
- package/project/.sdk/tm/go/feature/audit_feature.go +1 -3
- package/project/.sdk/tm/go/feature/base_feature.go +11 -0
- package/project/.sdk/tm/go/feature/metrics_feature.go +14 -0
- package/project/.sdk/tm/go/feature/paging_feature.go +108 -2
- package/project/.sdk/tm/go/feature/ratelimit_feature.go +19 -17
- package/project/.sdk/tm/go/feature/retry_feature.go +81 -9
- package/project/.sdk/tm/go/feature/streaming_feature.go +2 -1
- package/project/.sdk/tm/go/feature/telemetry_feature.go +18 -11
- package/project/.sdk/tm/go/feature/test_feature.go +65 -55
- package/project/.sdk/tm/go/test/feature_corpus_test.go +209 -28
- package/project/.sdk/tm/go/test/feature_test.go +32 -0
- package/project/.sdk/tm/go/utility/make_options.go +111 -6
- package/project/.sdk/tm/java/core/SdkClient.java +43 -14
- package/project/.sdk/tm/java/feature/AuditFeature.java +5 -1
- package/project/.sdk/tm/java/feature/MetricsFeature.java +31 -0
- package/project/.sdk/tm/java/feature/PagingFeature.java +156 -2
- package/project/.sdk/tm/java/feature/RatelimitFeature.java +15 -13
- package/project/.sdk/tm/java/feature/RetryFeature.java +33 -6
- package/project/.sdk/tm/java/feature/StreamingFeature.java +2 -1
- package/project/.sdk/tm/java/feature/TelemetryFeature.java +17 -9
- package/project/.sdk/tm/java/feature/TestFeature.java +50 -63
- package/project/.sdk/tm/java/test/FeatureCorpusTest.java +170 -17
- package/project/.sdk/tm/java/utility/MakeOptions.java +128 -14
- package/project/.sdk/tm/js/src/feature/metrics/MetricsFeature.js +8 -3
- package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +99 -1
- package/project/.sdk/tm/js/src/feature/ratelimit/RatelimitFeature.js +5 -9
- package/project/.sdk/tm/js/src/feature/retry/RetryFeature.js +25 -3
- package/project/.sdk/tm/js/src/feature/streaming/StreamingFeature.js +2 -1
- package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +11 -6
- package/project/.sdk/tm/js/src/feature/test/TestFeature.js +38 -1
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +55 -6
- package/project/.sdk/tm/js/test/feature/Corpus.test.js +95 -25
- package/project/.sdk/tm/js/test/feature.test.js +14 -1
- package/project/.sdk/tm/kotlin/core/SdkClient.kt +23 -10
- package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +5 -1
- package/project/.sdk/tm/kotlin/feature/MetricsFeature.kt +22 -0
- package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +125 -2
- package/project/.sdk/tm/kotlin/feature/RatelimitFeature.kt +16 -13
- package/project/.sdk/tm/kotlin/feature/RetryFeature.kt +36 -14
- package/project/.sdk/tm/kotlin/feature/StreamingFeature.kt +4 -0
- package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +12 -10
- package/project/.sdk/tm/kotlin/feature/TestFeature.kt +45 -48
- package/project/.sdk/tm/kotlin/test/FeatureTest.kt +114 -0
- package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +83 -14
- package/project/.sdk/tm/lua/feature/debug_feature.lua +2 -3
- package/project/.sdk/tm/lua/feature/metrics_feature.lua +5 -0
- package/project/.sdk/tm/lua/feature/paging_feature.lua +143 -2
- package/project/.sdk/tm/lua/feature/ratelimit_feature.lua +5 -9
- package/project/.sdk/tm/lua/feature/retry_feature.lua +43 -5
- package/project/.sdk/tm/lua/feature/streaming_feature.lua +2 -1
- package/project/.sdk/tm/lua/feature/telemetry_feature.lua +18 -7
- package/project/.sdk/tm/lua/feature/test_feature.lua +60 -62
- package/project/.sdk/tm/lua/test/feature_test.lua +100 -3
- package/project/.sdk/tm/lua/utility/make_options.lua +55 -13
- package/project/.sdk/tm/ocaml/sdk_features.ml +286 -60
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +34 -11
- package/project/.sdk/tm/ocaml/test/t_feature.ml +72 -1
- package/project/.sdk/tm/perl/feature/debug_feature.pm +2 -2
- package/project/.sdk/tm/perl/feature/metrics_feature.pm +5 -0
- package/project/.sdk/tm/perl/feature/paging_feature.pm +139 -2
- package/project/.sdk/tm/perl/feature/ratelimit_feature.pm +5 -11
- package/project/.sdk/tm/perl/feature/retry_feature.pm +22 -4
- package/project/.sdk/tm/perl/feature/streaming_feature.pm +2 -0
- package/project/.sdk/tm/perl/feature/telemetry_feature.pm +17 -8
- package/project/.sdk/tm/perl/feature/test_feature.pm +45 -50
- package/project/.sdk/tm/perl/t/feature.t +2 -2
- package/project/.sdk/tm/perl/t/feature_corpus.t +126 -23
- package/project/.sdk/tm/perl/utility/make_options.pm +33 -10
- package/project/.sdk/tm/php/feature/MetricsFeature.php +8 -0
- package/project/.sdk/tm/php/feature/PagingFeature.php +128 -1
- package/project/.sdk/tm/php/feature/RatelimitFeature.php +5 -9
- package/project/.sdk/tm/php/feature/RetryFeature.php +27 -3
- package/project/.sdk/tm/php/feature/StreamingFeature.php +2 -1
- package/project/.sdk/tm/php/feature/TelemetryFeature.php +10 -7
- package/project/.sdk/tm/php/feature/TestFeature.php +55 -47
- package/project/.sdk/tm/php/test/FeatureCorpusTest.php +151 -16
- package/project/.sdk/tm/php/utility/MakeOptions.php +40 -13
- package/project/.sdk/tm/py/pkg/feature/metrics_feature.py +7 -0
- package/project/.sdk/tm/py/pkg/feature/paging_feature.py +86 -1
- package/project/.sdk/tm/py/pkg/feature/ratelimit_feature.py +13 -16
- package/project/.sdk/tm/py/pkg/feature/retry_feature.py +31 -6
- package/project/.sdk/tm/py/pkg/feature/streaming_feature.py +2 -1
- package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +10 -6
- package/project/.sdk/tm/py/pkg/feature/test_feature.py +56 -53
- package/project/.sdk/tm/py/pkg/utility/make_options.py +68 -20
- package/project/.sdk/tm/py/test/test_feature.py +11 -1
- package/project/.sdk/tm/py/test/test_feature_corpus.py +111 -16
- package/project/.sdk/tm/py-data/pkg/fetch.py +6 -3
- package/project/.sdk/tm/py-data/test/test_fetch.py +7 -4
- package/project/.sdk/tm/rb/feature/debug_feature.rb +2 -2
- package/project/.sdk/tm/rb/feature/metrics_feature.rb +8 -0
- package/project/.sdk/tm/rb/feature/paging_feature.rb +87 -1
- package/project/.sdk/tm/rb/feature/ratelimit_feature.rb +12 -16
- package/project/.sdk/tm/rb/feature/retry_feature.rb +19 -3
- package/project/.sdk/tm/rb/feature/streaming_feature.rb +2 -1
- package/project/.sdk/tm/rb/feature/telemetry_feature.rb +11 -6
- package/project/.sdk/tm/rb/feature/test_feature.rb +42 -49
- package/project/.sdk/tm/rb/test/feature_corpus_test.rb +108 -24
- package/project/.sdk/tm/rb/test/feature_test.rb +1 -1
- package/project/.sdk/tm/rb/utility/make_options.rb +32 -11
- package/project/.sdk/tm/rust/feature/audit.rs +2 -2
- package/project/.sdk/tm/rust/feature/metrics.rs +24 -1
- package/project/.sdk/tm/rust/feature/paging.rs +189 -3
- package/project/.sdk/tm/rust/feature/ratelimit.rs +5 -10
- package/project/.sdk/tm/rust/feature/retry.rs +59 -6
- package/project/.sdk/tm/rust/feature/streaming.rs +3 -2
- package/project/.sdk/tm/rust/feature/support.rs +4 -0
- package/project/.sdk/tm/rust/feature/telemetry.rs +22 -11
- package/project/.sdk/tm/rust/feature/test.rs +63 -57
- package/project/.sdk/tm/rust/tests/feature_test.rs +174 -0
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +1 -0
- package/project/.sdk/tm/rust/utility/make_options.rs +122 -27
- package/project/.sdk/tm/scala/core/SdkClient.scala +45 -11
- package/project/.sdk/tm/scala/feature/AuditFeature.scala +6 -1
- package/project/.sdk/tm/scala/feature/MetricsFeature.scala +31 -1
- package/project/.sdk/tm/scala/feature/PagingFeature.scala +122 -2
- package/project/.sdk/tm/scala/feature/RatelimitFeature.scala +14 -11
- package/project/.sdk/tm/scala/feature/RetryFeature.scala +29 -7
- package/project/.sdk/tm/scala/feature/StreamingFeature.scala +2 -1
- package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +12 -10
- package/project/.sdk/tm/scala/feature/TestFeature.scala +44 -44
- package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +41 -0
- package/project/.sdk/tm/scala/utility/Make.scala +96 -13
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +3 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/MetricsFeature.swift +20 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +102 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RatelimitFeature.swift +19 -13
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RetryFeature.swift +40 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/StreamingFeature.swift +2 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +11 -9
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +55 -49
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +51 -13
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +111 -0
- package/project/.sdk/tm/ts/src/feature/metrics/MetricsFeature.ts +5 -0
- package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +99 -1
- package/project/.sdk/tm/ts/src/feature/ratelimit/RatelimitFeature.ts +5 -9
- package/project/.sdk/tm/ts/src/feature/retry/RetryFeature.ts +25 -3
- package/project/.sdk/tm/ts/src/feature/streaming/StreamingFeature.ts +2 -1
- package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +11 -6
- package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +8 -7
- package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +57 -6
- package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +95 -25
- package/project/.sdk/tm/ts/test/feature.test.ts +14 -1
- package/project/.sdk/tm/zig/core/utility.zig +107 -8
- package/project/.sdk/tm/zig/feature/metrics.zig +19 -0
- package/project/.sdk/tm/zig/feature/paging.zig +172 -4
- package/project/.sdk/tm/zig/feature/ratelimit.zig +5 -11
- package/project/.sdk/tm/zig/feature/retry.zig +41 -3
- package/project/.sdk/tm/zig/feature/streaming.zig +2 -0
- package/project/.sdk/tm/zig/feature/telemetry.zig +15 -9
- package/project/.sdk/tm/zig/feature/test.zig +56 -40
- package/project/.sdk/tm/zig/test/feature_test.zig +109 -0
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +2 -0
- package/project/sdkgen-package.json +1 -1
- package/src/cmp/ReadmeExplanation.ts +5 -2
- package/src/cmp/ReadmeFeatures.ts +21 -6
- package/src/helpers/optspec.ts +2 -2
|
@@ -16,6 +16,8 @@ defmodule ProjectName.Feature.Paging do
|
|
|
16
16
|
|
|
17
17
|
@next_re ~r/<([^>]+)>\s*;\s*rel="?next"?/i
|
|
18
18
|
|
|
19
|
+
@origin_re ~r/^[a-z][a-z0-9+.-]*:\/\/[^\/?#]*/i
|
|
20
|
+
|
|
19
21
|
def new do
|
|
20
22
|
f = F.base("paging")
|
|
21
23
|
F.install(f, "init", fn ctx, opts -> init(f, ctx, opts) end)
|
|
@@ -66,6 +68,10 @@ defmodule ProjectName.Feature.Paging do
|
|
|
66
68
|
S.getprop(paging, "cursor") != nil ->
|
|
67
69
|
S.setprop(query, cursor_param, S.getprop(paging, "cursor"))
|
|
68
70
|
|
|
71
|
+
is_binary(S.getprop(paging, "next")) and
|
|
72
|
+
not foreign?(S.getprop(paging, "next"), S.getprop(spec, "base")) ->
|
|
73
|
+
follow(spec, S.getprop(paging, "next"))
|
|
74
|
+
|
|
69
75
|
S.getprop(query, page_param) == nil ->
|
|
70
76
|
# A record written back by pre_result holds the page just fetched
|
|
71
77
|
# as "page" and the one to fetch as "nextPage", so nextPage wins.
|
|
@@ -79,6 +85,7 @@ defmodule ProjectName.Feature.Paging do
|
|
|
79
85
|
end
|
|
80
86
|
|
|
81
87
|
limit = S.getprop(opts, "limit")
|
|
88
|
+
query = S.getprop(spec, "query")
|
|
82
89
|
|
|
83
90
|
if limit != nil and S.getprop(query, limit_param) == nil do
|
|
84
91
|
S.setprop(query, limit_param, limit)
|
|
@@ -177,13 +184,12 @@ defmodule ProjectName.Feature.Paging do
|
|
|
177
184
|
nil
|
|
178
185
|
end
|
|
179
186
|
|
|
187
|
+
mode = por(S.getprop(F.opts(f), "next"), "auto")
|
|
188
|
+
|
|
180
189
|
{next_val, cursor_val, has_more} =
|
|
181
190
|
if S.ismap(body) do
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
nil -> next_from_link
|
|
185
|
-
bnext -> por(next_from_link, bnext)
|
|
186
|
-
end
|
|
191
|
+
bnext = S.getprop(body, "next")
|
|
192
|
+
n = if link?(bnext, mode), do: por(next_from_link, bnext), else: next_from_link
|
|
187
193
|
|
|
188
194
|
# snake_case forms rank below the camelCase ones.
|
|
189
195
|
c =
|
|
@@ -191,6 +197,7 @@ defmodule ProjectName.Feature.Paging do
|
|
|
191
197
|
S.getprop(body, "nextCursor") != nil -> S.getprop(body, "nextCursor")
|
|
192
198
|
S.getprop(body, "cursor") != nil -> S.getprop(body, "cursor")
|
|
193
199
|
S.getprop(body, "next_cursor") != nil -> S.getprop(body, "next_cursor")
|
|
200
|
+
bnext != nil and not link?(bnext, mode) -> bnext
|
|
194
201
|
true -> nil
|
|
195
202
|
end
|
|
196
203
|
|
|
@@ -255,6 +262,20 @@ defmodule ProjectName.Feature.Paging do
|
|
|
255
262
|
next_page
|
|
256
263
|
end
|
|
257
264
|
|
|
265
|
+
# A link to another origin is recorded, never followed, and ends the walk.
|
|
266
|
+
spec = S.getprop(ctx, "spec")
|
|
267
|
+
base = if spec != nil, do: S.getprop(spec, "base"), else: S.getprop(S.getprop(ctx, "options"), "base")
|
|
268
|
+
|
|
269
|
+
next_val =
|
|
270
|
+
if is_binary(next_val) and spec != nil,
|
|
271
|
+
do: resolve(next_val, S.getprop(spec, "url")),
|
|
272
|
+
else: next_val
|
|
273
|
+
|
|
274
|
+
{next_val, foreign_val} =
|
|
275
|
+
if is_binary(next_val) and foreign?(next_val, base),
|
|
276
|
+
do: {nil, next_val},
|
|
277
|
+
else: {next_val, nil}
|
|
278
|
+
|
|
258
279
|
# Cursor presence only INFERS another page. When the server stated the
|
|
259
280
|
# answer outright — relay's `hasNextPage: false`, or a body `hasMore`
|
|
260
281
|
# — that wins: a final page normally carries both an end cursor and
|
|
@@ -267,6 +288,8 @@ defmodule ProjectName.Feature.Paging do
|
|
|
267
288
|
has_more or next_val != nil or cursor_val != nil or next_page != nil
|
|
268
289
|
end
|
|
269
290
|
|
|
291
|
+
has_more = if foreign_val != nil and cursor_val == nil and next_page == nil, do: false, else: has_more
|
|
292
|
+
|
|
270
293
|
paging =
|
|
271
294
|
S.jm([
|
|
272
295
|
"page", page,
|
|
@@ -274,6 +297,7 @@ defmodule ProjectName.Feature.Paging do
|
|
|
274
297
|
"nextPage", next_page,
|
|
275
298
|
"next", next_val,
|
|
276
299
|
"cursor", cursor_val,
|
|
300
|
+
"foreign", foreign_val,
|
|
277
301
|
"hasMore", has_more
|
|
278
302
|
])
|
|
279
303
|
|
|
@@ -317,6 +341,87 @@ defmodule ProjectName.Feature.Paging do
|
|
|
317
341
|
end
|
|
318
342
|
end
|
|
319
343
|
|
|
344
|
+
# Under the `next` option's default, a URL or an absolute path is a link and
|
|
345
|
+
# anything else a cursor; `cursor` and `url` pin the reading.
|
|
346
|
+
defp link?(next, "url") when is_binary(next), do: true
|
|
347
|
+
defp link?(next, "cursor") when is_binary(next), do: false
|
|
348
|
+
|
|
349
|
+
defp link?(next, _) when is_binary(next),
|
|
350
|
+
do: Regex.match?(@origin_re, next) or String.starts_with?(next, "/")
|
|
351
|
+
|
|
352
|
+
defp link?(_, _), do: false
|
|
353
|
+
|
|
354
|
+
defp foreign?(link, base) do
|
|
355
|
+
origin = String.downcase(origin_of(link))
|
|
356
|
+
origin != "" and origin != String.downcase(origin_of(base))
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
defp origin_of(text) when is_binary(text) do
|
|
360
|
+
case Regex.run(@origin_re, text) do
|
|
361
|
+
[origin] -> origin
|
|
362
|
+
_ -> ""
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
defp origin_of(_), do: ""
|
|
367
|
+
|
|
368
|
+
@holder "http://placeholder.invalid"
|
|
369
|
+
|
|
370
|
+
# RFC 3986 reference resolution against the URL of the request that
|
|
371
|
+
# returned the link. A link on that URL's origin comes back as its path and
|
|
372
|
+
# query; an absolute link is left as the server wrote it.
|
|
373
|
+
defp resolve(link, url) when is_binary(url) and url != "" do
|
|
374
|
+
if Regex.match?(~r/^[a-z][a-z0-9+.-]*:/i, link) do
|
|
375
|
+
link
|
|
376
|
+
else
|
|
377
|
+
from = if origin_of(url) == "", do: @holder <> if(String.starts_with?(url, "/"), do: "", else: "/") <> url, else: url
|
|
378
|
+
base = URI.parse(from)
|
|
379
|
+
out = %{URI.merge(base, link) | fragment: nil}
|
|
380
|
+
|
|
381
|
+
if {out.scheme, out.host, out.port} == {base.scheme, base.host, base.port},
|
|
382
|
+
do: (out.path || "/") <> if(out.query == nil, do: "", else: "?" <> out.query),
|
|
383
|
+
else: URI.to_string(out)
|
|
384
|
+
end
|
|
385
|
+
rescue
|
|
386
|
+
_ -> link
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
defp resolve(link, _), do: link
|
|
390
|
+
|
|
391
|
+
# The request goes to the link's path and query, on the SDK's own origin.
|
|
392
|
+
defp follow(spec, next) do
|
|
393
|
+
origin = origin_of(next)
|
|
394
|
+
link = next |> String.slice(String.length(origin)..-1//1) |> String.split("#", parts: 2) |> hd()
|
|
395
|
+
[path | rest] = String.split(link, "?", parts: 2)
|
|
396
|
+
rawquery = List.first(rest) || ""
|
|
397
|
+
|
|
398
|
+
query = S.jm([])
|
|
399
|
+
|
|
400
|
+
for pair <- String.split(rawquery, "&"), pair != "" do
|
|
401
|
+
[key | val] = String.split(pair, "=", parts: 2)
|
|
402
|
+
S.setprop(query, unescape(key), unescape(List.first(val) || ""))
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
old = S.getprop(spec, "query")
|
|
406
|
+
|
|
407
|
+
for {_, key} <- ProjectName.Helpers.entries(S.getprop(spec, "authquery")) do
|
|
408
|
+
S.setprop(query, key, S.getprop(old, key))
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
S.setprop(spec, "base", origin_of(S.getprop(spec, "base")))
|
|
412
|
+
S.setprop(spec, "prefix", "")
|
|
413
|
+
S.setprop(spec, "path", path)
|
|
414
|
+
S.setprop(spec, "suffix", "")
|
|
415
|
+
S.setprop(spec, "query", query)
|
|
416
|
+
nil
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
defp unescape(text) do
|
|
420
|
+
URI.decode_www_form(text)
|
|
421
|
+
rescue
|
|
422
|
+
ArgumentError -> text
|
|
423
|
+
end
|
|
424
|
+
|
|
320
425
|
defp is_list_op(f, ctx) do
|
|
321
426
|
ops = opt_list(S.getprop(F.opts(f), "ops"), ["list"])
|
|
322
427
|
op = S.getprop(ctx, "op")
|
|
@@ -44,24 +44,18 @@ defmodule ProjectName.Feature.Ratelimit do
|
|
|
44
44
|
rate = por(S.getprop(opts, "rate"), 5)
|
|
45
45
|
burst = case S.getprop(opts, "burst") do nil -> rate; v -> v end
|
|
46
46
|
|
|
47
|
-
# Refill
|
|
47
|
+
# Refill, then reserve this call's token before any wait: a negative
|
|
48
|
+
# count is the calls already queued, so overlapping calls pace in turn.
|
|
48
49
|
now = F.now(f)
|
|
49
50
|
elapsed = now - S.getprop(f, "last")
|
|
50
51
|
S.setprop(f, "last", now)
|
|
51
|
-
|
|
52
|
+
tokens = min(burst, S.getprop(f, "tokens") + elapsed / 1000 * rate) - 1
|
|
53
|
+
S.setprop(f, "tokens", tokens)
|
|
52
54
|
|
|
53
|
-
tokens
|
|
54
|
-
|
|
55
|
-
if tokens >= 1 do
|
|
56
|
-
S.setprop(f, "tokens", tokens - 1)
|
|
57
|
-
else
|
|
58
|
-
# Not enough tokens: wait for one to accrue, then consume it.
|
|
59
|
-
needed = 1 - tokens
|
|
60
|
-
wait_ms = ceil((needed / rate) * 1000)
|
|
55
|
+
if tokens < 0 do
|
|
56
|
+
wait_ms = ceil(-tokens / rate * 1000)
|
|
61
57
|
track(f, wait_ms)
|
|
62
58
|
F.sleep(f, wait_ms)
|
|
63
|
-
S.setprop(f, "last", F.now(f))
|
|
64
|
-
S.setprop(f, "tokens", 0)
|
|
65
59
|
end
|
|
66
60
|
|
|
67
61
|
nil
|
|
@@ -69,7 +69,12 @@ defmodule ProjectName.Feature.Retry do
|
|
|
69
69
|
if not is_number(status) or is_boolean(status) do
|
|
70
70
|
false
|
|
71
71
|
else
|
|
72
|
-
statuses =
|
|
72
|
+
statuses =
|
|
73
|
+
case S.getprop(opts, "statuses") do
|
|
74
|
+
nil -> S.jt(@statuses)
|
|
75
|
+
given -> given
|
|
76
|
+
end
|
|
77
|
+
|
|
73
78
|
Enum.member?(struct_list(statuses), trunc(status))
|
|
74
79
|
end
|
|
75
80
|
end
|
|
@@ -107,18 +112,37 @@ defmodule ProjectName.Feature.Retry do
|
|
|
107
112
|
else
|
|
108
113
|
val = F.header_get(headers, "retry-after")
|
|
109
114
|
|
|
110
|
-
|
|
111
|
-
val == nil -> nil
|
|
112
|
-
true ->
|
|
113
|
-
case Float.parse(to_string(val)) do
|
|
114
|
-
{n, _} -> n * 1000
|
|
115
|
-
:error -> nil
|
|
116
|
-
end
|
|
117
|
-
end
|
|
115
|
+
if val == nil, do: nil, else: retry_after_ms(to_string(val), System.system_time(:millisecond))
|
|
118
116
|
end
|
|
119
117
|
end
|
|
120
118
|
end
|
|
121
119
|
|
|
120
|
+
@months ~w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
|
|
121
|
+
|
|
122
|
+
@imf_fixdate ~r/\A(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) ([A-Z][a-z]{2}) (\d{4}) (\d{2}):(\d{2}):(\d{2}) GMT\z/
|
|
123
|
+
|
|
124
|
+
# RFC 9110 Retry-After: delay-seconds or an IMF-fixdate, else nil.
|
|
125
|
+
def retry_after_ms(value, now) do
|
|
126
|
+
s = String.replace(value, ~r/\A[ \t]+|[ \t]+\z/, "")
|
|
127
|
+
|
|
128
|
+
cond do
|
|
129
|
+
s =~ ~r/\A[0-9]+\z/ ->
|
|
130
|
+
String.to_integer(s) * 1000
|
|
131
|
+
|
|
132
|
+
true ->
|
|
133
|
+
with [_, day, mon, year, hour, minute, sec] <- Regex.run(@imf_fixdate, s),
|
|
134
|
+
mi when mi != nil <- Enum.find_index(@months, &(&1 == mon)),
|
|
135
|
+
[d, y, hh, mm, ss] = Enum.map([day, year, hour, minute, sec], &String.to_integer/1),
|
|
136
|
+
true <- d >= 1 and d <= 31 and hh <= 23 and mm <= 59 and ss <= 60,
|
|
137
|
+
{:ok, date} <- Date.new(y, mi + 1, d) do
|
|
138
|
+
at = (Date.diff(date, ~D[1970-01-01]) * 86_400 + hh * 3600 + mm * 60 + ss) * 1000
|
|
139
|
+
max(0, at - now)
|
|
140
|
+
else
|
|
141
|
+
_ -> nil
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
122
146
|
defp track(f, _ctx, attempt, res, err, raised, wait) do
|
|
123
147
|
client = S.getprop(f, "client")
|
|
124
148
|
track = F.track_node(client, "_retry", S.jm(["attempts", 0, "retries", S.jt([])]))
|
|
@@ -38,9 +38,10 @@ defmodule ProjectName.Feature.Streaming do
|
|
|
38
38
|
if not streamable?(f, ctx) do
|
|
39
39
|
nil
|
|
40
40
|
else
|
|
41
|
+
# A failed result keeps no stream, so the entity's stream raises its error.
|
|
41
42
|
result = S.getprop(ctx, "result")
|
|
42
43
|
|
|
43
|
-
if result == nil do
|
|
44
|
+
if result == nil or S.getprop(result, "err") != nil do
|
|
44
45
|
nil
|
|
45
46
|
else
|
|
46
47
|
S.setprop(result, "streaming", true)
|
|
@@ -25,7 +25,6 @@ defmodule ProjectName.Feature.Telemetry do
|
|
|
25
25
|
|
|
26
26
|
def init(f, ctx, options) do
|
|
27
27
|
F.init_common(f, ctx, options)
|
|
28
|
-
S.setprop(f, "seq", 0)
|
|
29
28
|
|
|
30
29
|
client = S.getprop(f, "client")
|
|
31
30
|
|
|
@@ -159,15 +158,16 @@ defmodule ProjectName.Feature.Telemetry do
|
|
|
159
158
|
if S.isfunc(idgen) do
|
|
160
159
|
idgen.(kind)
|
|
161
160
|
else
|
|
162
|
-
|
|
163
|
-
seq = S.getprop(f, "seq") + 1
|
|
164
|
-
S.setprop(f, "seq", seq)
|
|
165
|
-
n = seq |> Integer.to_string(16) |> String.downcase() |> String.pad_leading(4, "0")
|
|
166
|
-
prefix = if kind == "trace", do: "t", else: "s"
|
|
167
|
-
prefix <> String.pad_trailing(n, 16, "0")
|
|
161
|
+
random_hex(if kind == "trace", do: 16, else: 8)
|
|
168
162
|
end
|
|
169
163
|
end
|
|
170
164
|
|
|
165
|
+
# W3C trace context: lowercase hex from the platform's random source, never all zeros.
|
|
166
|
+
defp random_hex(nbytes) do
|
|
167
|
+
hex = :crypto.strong_rand_bytes(nbytes) |> Base.encode16(case: :lower)
|
|
168
|
+
if String.trim(hex, "0") == "", do: random_hex(nbytes), else: hex
|
|
169
|
+
end
|
|
170
|
+
|
|
171
171
|
# Python `v or default`: falsy = nil, false, "".
|
|
172
172
|
defp por(v, d) do
|
|
173
173
|
if v == nil or v == false or v == "", do: d, else: v
|
|
@@ -123,15 +123,9 @@ defmodule ProjectName.Feature.Test do
|
|
|
123
123
|
{out, nil}
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
-
defp
|
|
127
|
-
if
|
|
128
|
-
|
|
129
|
-
else
|
|
130
|
-
Enum.find_value([S.getprop(fctx, "match"), S.getprop(fctx, "data")], S.jm([]), fn src ->
|
|
131
|
-
v = if src != nil, do: S.getprop(src, "id"), else: nil
|
|
132
|
-
if v != nil and v != "__UNDEFINED__", do: S.jm(["id", v])
|
|
133
|
-
end)
|
|
134
|
-
end
|
|
126
|
+
defp held?(src, key) do
|
|
127
|
+
v = if src != nil, do: S.getprop(src, key), else: nil
|
|
128
|
+
v != nil and v != "__UNDEFINED__"
|
|
135
129
|
end
|
|
136
130
|
|
|
137
131
|
defp respond_op(f, entity, fctx) do
|
|
@@ -142,7 +136,7 @@ defmodule ProjectName.Feature.Test do
|
|
|
142
136
|
|
|
143
137
|
case opname do
|
|
144
138
|
"load" ->
|
|
145
|
-
args = build_args(f, fctx, op,
|
|
139
|
+
args = build_args(f, fctx, op, S.getprop(fctx, "reqmatch"))
|
|
146
140
|
found = S.select(entmap, args)
|
|
147
141
|
ent = S.getelem(found, 0)
|
|
148
142
|
|
|
@@ -169,28 +163,10 @@ defmodule ProjectName.Feature.Test do
|
|
|
169
163
|
|
|
170
164
|
opn when opn in ["update", "patch"] ->
|
|
171
165
|
reqdata = S.getprop(fctx, "reqdata")
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if S.getprop(reqdata, "id") != nil, do: S.setprop(um, "id", S.getprop(reqdata, "id"))
|
|
177
|
-
alias_map = S.getprop(op, "alias")
|
|
178
|
-
|
|
179
|
-
if alias_map != nil do
|
|
180
|
-
alias_id = S.getprop(alias_map, "id")
|
|
181
|
-
|
|
182
|
-
if alias_id != nil and S.getprop(reqdata, alias_id) != nil do
|
|
183
|
-
S.setprop(um, alias_id, S.getprop(reqdata, alias_id))
|
|
184
|
-
end
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
um
|
|
188
|
-
else
|
|
189
|
-
S.jm([])
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
update_match = if S.size(update_match) == 0, do: resolve_match(fctx, S.jm([])), else: update_match
|
|
193
|
-
args = build_args(f, fctx, op, update_match)
|
|
166
|
+
# `$body` travels on the wire alone; the record is the rest.
|
|
167
|
+
rec = if S.ismap(reqdata), do: S.clone(reqdata), else: S.jm([])
|
|
168
|
+
S.delprop(rec, "$body")
|
|
169
|
+
args = build_args(f, fctx, op, rec)
|
|
194
170
|
found = S.select(entmap, args)
|
|
195
171
|
ent = S.getelem(found, 0)
|
|
196
172
|
|
|
@@ -198,10 +174,7 @@ defmodule ProjectName.Feature.Test do
|
|
|
198
174
|
# update miss: 404, never another record
|
|
199
175
|
respond(fctx, 404, nil, S.jm(["statusText", "Not found"]))
|
|
200
176
|
else
|
|
201
|
-
# `$body` travels on the wire alone; the record is the rest.
|
|
202
177
|
if S.ismap(ent) and S.ismap(reqdata) do
|
|
203
|
-
rec = S.clone(reqdata)
|
|
204
|
-
S.delprop(rec, "$body")
|
|
205
178
|
S.merge(S.jt([ent, rec]))
|
|
206
179
|
end
|
|
207
180
|
|
|
@@ -210,7 +183,7 @@ defmodule ProjectName.Feature.Test do
|
|
|
210
183
|
end
|
|
211
184
|
|
|
212
185
|
"remove" ->
|
|
213
|
-
args = build_args(f, fctx, op,
|
|
186
|
+
args = build_args(f, fctx, op, S.getprop(fctx, "reqmatch"))
|
|
214
187
|
found = S.select(entmap, args)
|
|
215
188
|
ent = S.getelem(found, 0)
|
|
216
189
|
|
|
@@ -312,22 +285,53 @@ defmodule ProjectName.Feature.Test do
|
|
|
312
285
|
qand = S.jt([])
|
|
313
286
|
q = S.jm(["`$AND`", qand])
|
|
314
287
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
288
|
+
idfrom = S.getpath(config, "entity." <> entname <> ".id.from")
|
|
289
|
+
given = if args != nil, do: S.keysof(args), else: []
|
|
290
|
+
|
|
291
|
+
# With no id in the call, the entity's held id (or composite parts) stands in.
|
|
292
|
+
names =
|
|
293
|
+
if held?(args, "id") do
|
|
294
|
+
given
|
|
295
|
+
else
|
|
296
|
+
declared = S.getpath(config, "entity." <> entname <> ".id.parts")
|
|
297
|
+
|
|
298
|
+
parts =
|
|
299
|
+
cond do
|
|
300
|
+
S.islist(declared) -> Enum.map(0..(S.size(declared) - 1)//1, &to_string(S.getelem(declared, &1)))
|
|
301
|
+
opname == "list" -> []
|
|
302
|
+
true -> ["id"]
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
Enum.reduce(parts, given, fn pname, acc ->
|
|
306
|
+
if pname not in acc and (held?(S.getprop(ctx, "match"), pname) or held?(S.getprop(ctx, "data"), pname)),
|
|
307
|
+
do: acc ++ [pname],
|
|
308
|
+
else: acc
|
|
309
|
+
end)
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
Enum.each(names, fn key ->
|
|
313
|
+
is_id = key == "id"
|
|
314
|
+
is_reqd = not S.isempty(S.select(reqd_params, key)) or not S.isempty(S.select(reqd_query, key))
|
|
319
315
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
316
|
+
if is_id or is_reqd do
|
|
317
|
+
v = Utility.param(ctx, key)
|
|
318
|
+
ka = if S.getprop(op, "alias") != nil, do: S.getprop(S.getprop(op, "alias"), key), else: nil
|
|
323
319
|
|
|
324
|
-
|
|
325
|
-
|
|
320
|
+
qor = S.jt([S.jm([key, v])])
|
|
321
|
+
if is_binary(ka), do: Feature.list_push(qor, S.jm([ka, v]))
|
|
326
322
|
|
|
327
|
-
|
|
323
|
+
# An alternative, never a replacement: a seed keeping the parameter
|
|
324
|
+
# flat is still found.
|
|
325
|
+
kf = if idfrom != nil, do: S.getprop(idfrom, key), else: nil
|
|
326
|
+
|
|
327
|
+
if is_binary(kf) and kf != key do
|
|
328
|
+
nest = kf |> String.split(".") |> Enum.reverse() |> Enum.reduce(v, fn seg, acc -> S.jm([seg, acc]) end)
|
|
329
|
+
Feature.list_push(qor, nest)
|
|
328
330
|
end
|
|
329
|
-
|
|
330
|
-
|
|
331
|
+
|
|
332
|
+
Feature.list_push(qand, S.jm(["`$OR`", qor]))
|
|
333
|
+
end
|
|
334
|
+
end)
|
|
331
335
|
|
|
332
336
|
ctrl = S.getprop(ctx, "ctrl")
|
|
333
337
|
explain = if ctrl != nil, do: S.getprop(ctrl, "explain"), else: nil
|
|
@@ -758,6 +758,8 @@ defmodule ProjectName.Utility do
|
|
|
758
758
|
co = S.getprop(config, "options")
|
|
759
759
|
cfgopts = if S.ismap(co), do: co, else: S.jm([])
|
|
760
760
|
|
|
761
|
+
feature_defaults(opts0, S.getprop(config, "feature"))
|
|
762
|
+
|
|
761
763
|
# THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
762
764
|
#
|
|
763
765
|
# `ProjectName.Schema.optspec/0` is built from the model:
|
|
@@ -865,47 +867,41 @@ defmodule ProjectName.Utility do
|
|
|
865
867
|
end
|
|
866
868
|
end
|
|
867
869
|
|
|
868
|
-
# Resolve the feature add-order: an explicit list order (above) wins
|
|
869
|
-
#
|
|
870
|
-
#
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
fmap = if S.ismap(fmap), do: fmap, else: S.jm([])
|
|
876
|
-
names = S.keysof(fmap)
|
|
877
|
-
|
|
878
|
-
names =
|
|
879
|
-
if Enum.member?(names, "test") do
|
|
880
|
-
["test" | Enum.reject(names, &(&1 == "test"))]
|
|
881
|
-
else
|
|
882
|
-
names
|
|
883
|
-
end
|
|
870
|
+
# Resolve the feature add-order: an explicit list order (above) wins, and
|
|
871
|
+
# the names it leaves out follow it test-first, then sorted, so the outcome
|
|
872
|
+
# is deterministic and `test` is the base transport of a map.
|
|
873
|
+
given = explicit_order || []
|
|
874
|
+
fmap = S.getprop(opts, "feature")
|
|
875
|
+
fmap = if S.ismap(fmap), do: fmap, else: S.jm([])
|
|
876
|
+
names = Enum.reject(S.keysof(fmap), &(&1 in given))
|
|
884
877
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
if Enum.member?(names, "station") do
|
|
892
|
-
rest = Enum.reject(names, &(&1 == "station"))
|
|
893
|
-
|
|
894
|
-
at =
|
|
895
|
-
case Enum.find_index(rest, &(&1 == "test")) do
|
|
896
|
-
nil -> 0
|
|
897
|
-
ti -> ti + 1
|
|
898
|
-
end
|
|
878
|
+
names =
|
|
879
|
+
if Enum.member?(names, "test") do
|
|
880
|
+
["test" | Enum.reject(names, &(&1 == "test"))]
|
|
881
|
+
else
|
|
882
|
+
names
|
|
883
|
+
end
|
|
899
884
|
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
885
|
+
# Station special case, mirroring test's: its transport wrap must sit
|
|
886
|
+
# immediately outside the base transport, inside every other transport
|
|
887
|
+
# wrap, so map-form activation hoists it to just after test.
|
|
888
|
+
rest =
|
|
889
|
+
if Enum.member?(names, "station") do
|
|
890
|
+
others = Enum.reject(names, &(&1 == "station"))
|
|
891
|
+
|
|
892
|
+
at =
|
|
893
|
+
case Enum.find_index(others, &(&1 == "test")) do
|
|
894
|
+
nil -> 0
|
|
895
|
+
ti -> ti + 1
|
|
903
896
|
end
|
|
904
897
|
|
|
905
|
-
|
|
906
|
-
|
|
898
|
+
List.insert_at(others, at, "station")
|
|
899
|
+
else
|
|
900
|
+
names
|
|
907
901
|
end
|
|
908
902
|
|
|
903
|
+
feature_order = given ++ rest
|
|
904
|
+
|
|
909
905
|
derived = S.jm(["featureorder", S.jt(feature_order)])
|
|
910
906
|
S.setprop(opts, "__derived__", derived)
|
|
911
907
|
|
|
@@ -923,6 +919,34 @@ defmodule ProjectName.Utility do
|
|
|
923
919
|
# make every setting of that feature a secret. Entity blocks hold entity
|
|
924
920
|
# settings and seeded records, never a credential, so they are skipped, and
|
|
925
921
|
# so are rbac's rules, keyed by entity and operation names.
|
|
922
|
+
# The model's options for a feature sit beneath the caller's, key by key: a
|
|
923
|
+
# key the caller sets replaces the default whole, so a list is never merged.
|
|
924
|
+
defp feature_defaults(opts, cfgfeature) do
|
|
925
|
+
given = S.getprop(opts, "feature")
|
|
926
|
+
|
|
927
|
+
if S.ismap(cfgfeature) and (given == nil or S.ismap(given)) do
|
|
928
|
+
out = S.jm([])
|
|
929
|
+
if S.ismap(given), do: Enum.each(H.entries(given), fn {k, v} -> S.setprop(out, k, v) end)
|
|
930
|
+
|
|
931
|
+
Enum.each(S.keysof(cfgfeature), fn name ->
|
|
932
|
+
dflt = S.getprop(S.getprop(cfgfeature, name), "options")
|
|
933
|
+
fopts = S.getprop(out, name)
|
|
934
|
+
wanted = if fopts == nil, do: S.getprop(dflt, "active") == true, else: S.ismap(fopts)
|
|
935
|
+
|
|
936
|
+
if S.ismap(dflt) and wanted do
|
|
937
|
+
merged = S.clone(dflt)
|
|
938
|
+
|
|
939
|
+
if S.ismap(fopts),
|
|
940
|
+
do: Enum.each(H.entries(fopts), fn {k, v} -> S.setprop(merged, k, v) end)
|
|
941
|
+
|
|
942
|
+
S.setprop(out, name, merged)
|
|
943
|
+
end
|
|
944
|
+
end)
|
|
945
|
+
|
|
946
|
+
S.setprop(opts, "feature", out)
|
|
947
|
+
end
|
|
948
|
+
end
|
|
949
|
+
|
|
926
950
|
defp secret_scan(opts, names) do
|
|
927
951
|
out = S.jm([])
|
|
928
952
|
|