@voxgig/sdkgen 1.5.1 → 2.0.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.
Files changed (270) hide show
  1. package/dist/cmp/AgentGuideContent.js +5 -0
  2. package/dist/cmp/AgentGuideContent.js.map +1 -1
  3. package/dist/cmp/Feature.js +13 -0
  4. package/dist/cmp/Feature.js.map +1 -1
  5. package/dist/helpers/canonType.d.ts +3 -1
  6. package/dist/helpers/canonType.js +44 -1
  7. package/dist/helpers/canonType.js.map +1 -1
  8. package/dist/helpers/packageMeta.js +7 -0
  9. package/dist/helpers/packageMeta.js.map +1 -1
  10. package/dist/sdkgen.d.ts +3 -3
  11. package/dist/sdkgen.js +4 -1
  12. package/dist/sdkgen.js.map +1 -1
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/package.json +3 -3
  15. package/project/.sdk/model/feature/paging.aontu +7 -0
  16. package/project/.sdk/model/target/py-data.aontu +64 -0
  17. package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +89 -1
  18. package/project/.sdk/src/cmp/clojure/Main_clojure.ts +1 -0
  19. package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +97 -0
  20. package/project/.sdk/src/cmp/dart/fragment/Main.fragment.dart +78 -0
  21. package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +84 -0
  22. package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +87 -0
  23. package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +75 -0
  24. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +85 -0
  25. package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +4 -0
  26. package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +80 -0
  27. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +86 -0
  28. package/project/.sdk/src/cmp/py/Entity_py.ts +9 -2
  29. package/project/.sdk/src/cmp/py/MainEntity_py.ts +1 -1
  30. package/project/.sdk/src/cmp/py/Main_py.ts +34 -6
  31. package/project/.sdk/src/cmp/py/Package_py.ts +6 -9
  32. package/project/.sdk/src/cmp/py/TestDirect_py.ts +2 -2
  33. package/project/.sdk/src/cmp/py/TestEntity_py.ts +3 -3
  34. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +2 -2
  35. package/project/.sdk/src/cmp/py/fragment/EntityCreateOp.fragment.py +2 -2
  36. package/project/.sdk/src/cmp/py/fragment/EntityLoadOp.fragment.py +2 -2
  37. package/project/.sdk/src/cmp/py/fragment/EntityRemoveOp.fragment.py +2 -2
  38. package/project/.sdk/src/cmp/py/fragment/EntityUpdateOp.fragment.py +2 -2
  39. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +75 -8
  40. package/project/.sdk/src/cmp/py-data/Main_py-data.ts +987 -0
  41. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +71 -0
  42. package/project/.sdk/src/cmp/rust/fragment/Main.fragment.rs +95 -0
  43. package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +86 -0
  44. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +75 -0
  45. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +95 -0
  46. package/project/.sdk/tm/c/core/sdk.h +7 -0
  47. package/project/.sdk/tm/c/feature/paging.c +141 -2
  48. package/project/.sdk/tm/c/utility/graphql.c +178 -0
  49. package/project/.sdk/tm/c/utility/make_options.c +1 -1
  50. package/project/.sdk/tm/c/utility/make_response.c +6 -0
  51. package/project/.sdk/tm/c/utility/make_spec.c +23 -3
  52. package/project/.sdk/tm/clojure/src/sdk/client.clj +64 -1
  53. package/project/.sdk/tm/clojure/src/sdk/core.clj +126 -3
  54. package/project/.sdk/tm/clojure/src/sdk/features.clj +80 -14
  55. package/project/.sdk/tm/cpp/core/types.hpp +83 -0
  56. package/project/.sdk/tm/cpp/feature/paging.hpp +103 -1
  57. package/project/.sdk/tm/cpp/utility/pipeline.hpp +152 -3
  58. package/project/.sdk/tm/csharp/core/Utility.cs +4 -0
  59. package/project/.sdk/tm/csharp/feature/PagingFeature.cs +118 -1
  60. package/project/.sdk/tm/csharp/utility/Graphql.cs +190 -0
  61. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +1 -1
  62. package/project/.sdk/tm/csharp/utility/MakeResponse.cs +7 -0
  63. package/project/.sdk/tm/csharp/utility/MakeSpec.cs +21 -2
  64. package/project/.sdk/tm/csharp/utility/Register.cs +2 -0
  65. package/project/.sdk/tm/dart/lib/Point.dart +7 -0
  66. package/project/.sdk/tm/dart/lib/feature/paging/PagingFeature.dart +99 -4
  67. package/project/.sdk/tm/dart/lib/utility/GraphqlUtility.dart +162 -0
  68. package/project/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +1 -1
  69. package/project/.sdk/tm/dart/lib/utility/MakeResponseUtility.dart +5 -0
  70. package/project/.sdk/tm/dart/lib/utility/MakeSpecUtility.dart +18 -2
  71. package/project/.sdk/tm/dart/lib/utility/PrepareMethodUtility.dart +6 -1
  72. package/project/.sdk/tm/dart/lib/utility/Utility.dart +9 -0
  73. package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +136 -13
  74. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +187 -3
  75. package/project/.sdk/tm/go/core/utility_type.go +2 -0
  76. package/project/.sdk/tm/go/feature/paging_feature.go +87 -1
  77. package/project/.sdk/tm/go/utility/graphql.go +168 -0
  78. package/project/.sdk/tm/go/utility/make_options.go +1 -1
  79. package/project/.sdk/tm/go/utility/make_response.go +6 -0
  80. package/project/.sdk/tm/go/utility/make_spec.go +19 -2
  81. package/project/.sdk/tm/go/utility/register.go +2 -0
  82. package/project/.sdk/tm/haskell/src/SdkFeatures.hs +146 -7
  83. package/project/.sdk/tm/haskell/src/SdkRuntime.hs +153 -3
  84. package/project/.sdk/tm/java/core/SdkClient.java +93 -0
  85. package/project/.sdk/tm/java/core/Utility.java +4 -0
  86. package/project/.sdk/tm/java/feature/PagingFeature.java +100 -1
  87. package/project/.sdk/tm/java/utility/Graphql.java +191 -0
  88. package/project/.sdk/tm/java/utility/MakeOptions.java +1 -1
  89. package/project/.sdk/tm/java/utility/MakeResponse.java +6 -0
  90. package/project/.sdk/tm/java/utility/MakeSpec.java +17 -2
  91. package/project/.sdk/tm/java/utility/Register.java +2 -0
  92. package/project/.sdk/tm/js/src/Point.js +5 -0
  93. package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +82 -3
  94. package/project/.sdk/tm/js/src/feature/test/TestFeature.js +14 -2
  95. package/project/.sdk/tm/js/src/utility/GraphqlUtility.js +148 -0
  96. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +1 -1
  97. package/project/.sdk/tm/js/src/utility/MakeResponseUtility.js +7 -0
  98. package/project/.sdk/tm/js/src/utility/MakeSpecUtility.js +19 -2
  99. package/project/.sdk/tm/js/src/utility/Utility.js +4 -0
  100. package/project/.sdk/tm/kotlin/core/SdkClient.kt +84 -0
  101. package/project/.sdk/tm/kotlin/core/Utility.kt +2 -0
  102. package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +92 -1
  103. package/project/.sdk/tm/kotlin/utility/Graphql.kt +145 -0
  104. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +1 -1
  105. package/project/.sdk/tm/kotlin/utility/MakeReqRes.kt +6 -0
  106. package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +17 -2
  107. package/project/.sdk/tm/kotlin/utility/Register.kt +2 -0
  108. package/project/.sdk/tm/lean/src/SdkUtility.lean +134 -1
  109. package/project/.sdk/tm/lua/feature/paging_feature.lua +97 -2
  110. package/project/.sdk/tm/lua/utility/graphql.lua +163 -0
  111. package/project/.sdk/tm/lua/utility/make_options.lua +1 -1
  112. package/project/.sdk/tm/lua/utility/make_response.lua +6 -0
  113. package/project/.sdk/tm/lua/utility/make_spec.lua +18 -2
  114. package/project/.sdk/tm/lua/utility/register.lua +3 -0
  115. package/project/.sdk/tm/ocaml/sdk_features.ml +164 -20
  116. package/project/.sdk/tm/ocaml/sdk_runtime.ml +143 -4
  117. package/project/.sdk/tm/ocaml/sdk_types.ml +2 -0
  118. package/project/.sdk/tm/perl/feature/paging_feature.pm +91 -3
  119. package/project/.sdk/tm/perl/utility/graphql.pm +150 -0
  120. package/project/.sdk/tm/perl/utility/make_options.pm +1 -1
  121. package/project/.sdk/tm/perl/utility/make_response.pm +6 -0
  122. package/project/.sdk/tm/perl/utility/make_spec.pm +20 -2
  123. package/project/.sdk/tm/perl/utility/register.pm +1 -0
  124. package/project/.sdk/tm/php/core/UtilityType.php +2 -0
  125. package/project/.sdk/tm/php/feature/PagingFeature.php +106 -4
  126. package/project/.sdk/tm/php/utility/Graphql.php +176 -0
  127. package/project/.sdk/tm/php/utility/MakeOptions.php +1 -1
  128. package/project/.sdk/tm/php/utility/MakeResponse.php +7 -0
  129. package/project/.sdk/tm/php/utility/MakeSpec.php +20 -2
  130. package/project/.sdk/tm/php/utility/Register.php +3 -0
  131. package/project/.sdk/tm/py/pkg/core/__init__.py +0 -0
  132. package/project/.sdk/tm/py/{core → pkg/core}/context.py +8 -8
  133. package/project/.sdk/tm/py/{core → pkg/core}/operation.py +1 -1
  134. package/project/.sdk/tm/py/{core → pkg/core}/response.py +1 -1
  135. package/project/.sdk/tm/py/{core → pkg/core}/result.py +1 -1
  136. package/project/.sdk/tm/py/{core → pkg/core}/utility_type.py +2 -0
  137. package/project/.sdk/tm/py/pkg/entity/__init__.py +0 -0
  138. package/project/.sdk/tm/py/pkg/feature/__init__.py +0 -0
  139. package/project/.sdk/tm/py/{feature → pkg/feature}/audit_feature.py +1 -1
  140. package/project/.sdk/tm/py/{feature → pkg/feature}/cache_feature.py +1 -1
  141. package/project/.sdk/tm/py/{feature → pkg/feature}/clienttrack_feature.py +1 -1
  142. package/project/.sdk/tm/py/{feature → pkg/feature}/debug_feature.py +1 -1
  143. package/project/.sdk/tm/py/{feature → pkg/feature}/idempotency_feature.py +1 -1
  144. package/project/.sdk/tm/py/{feature → pkg/feature}/log_feature.py +1 -1
  145. package/project/.sdk/tm/py/{feature → pkg/feature}/metrics_feature.py +1 -1
  146. package/project/.sdk/tm/py/{feature → pkg/feature}/netsim_feature.py +1 -1
  147. package/project/.sdk/tm/py/{feature → pkg/feature}/paging_feature.py +87 -6
  148. package/project/.sdk/tm/py/{feature → pkg/feature}/proxy_feature.py +1 -1
  149. package/project/.sdk/tm/py/{feature → pkg/feature}/ratelimit_feature.py +1 -1
  150. package/project/.sdk/tm/py/{feature → pkg/feature}/rbac_feature.py +1 -1
  151. package/project/.sdk/tm/py/{feature → pkg/feature}/retry_feature.py +1 -1
  152. package/project/.sdk/tm/py/{feature → pkg/feature}/streaming_feature.py +1 -1
  153. package/project/.sdk/tm/py/{feature → pkg/feature}/telemetry_feature.py +1 -1
  154. package/project/.sdk/tm/py/{feature → pkg/feature}/test_feature.py +2 -2
  155. package/project/.sdk/tm/py/{feature → pkg/feature}/timeout_feature.py +1 -1
  156. package/project/.sdk/tm/py/pkg/utility/__init__.py +0 -0
  157. package/project/.sdk/tm/py/{utility → pkg/utility}/feature_init.py +1 -1
  158. package/project/.sdk/tm/py/{utility → pkg/utility}/fetcher.py +1 -1
  159. package/project/.sdk/tm/py/pkg/utility/graphql.py +145 -0
  160. package/project/.sdk/tm/py/{utility → pkg/utility}/make_context.py +1 -1
  161. package/project/.sdk/tm/py/{utility → pkg/utility}/make_error.py +5 -5
  162. package/project/.sdk/tm/py/{utility → pkg/utility}/make_fetch_def.py +2 -2
  163. package/project/.sdk/tm/py/{utility → pkg/utility}/make_options.py +2 -2
  164. package/project/.sdk/tm/py/{utility → pkg/utility}/make_point.py +2 -2
  165. package/project/.sdk/tm/py/{utility → pkg/utility}/make_request.py +2 -2
  166. package/project/.sdk/tm/py/{utility → pkg/utility}/make_response.py +6 -0
  167. package/project/.sdk/tm/py/{utility → pkg/utility}/make_spec.py +19 -4
  168. package/project/.sdk/tm/py/{utility → pkg/utility}/make_url.py +1 -1
  169. package/project/.sdk/tm/py/{utility → pkg/utility}/param.py +2 -2
  170. package/project/.sdk/tm/py/{utility → pkg/utility}/prepare_auth.py +1 -1
  171. package/project/.sdk/tm/py/{utility → pkg/utility}/prepare_headers.py +1 -1
  172. package/project/.sdk/tm/py/{utility → pkg/utility}/prepare_method.py +1 -1
  173. package/project/.sdk/tm/py/{utility → pkg/utility}/prepare_params.py +1 -1
  174. package/project/.sdk/tm/py/{utility → pkg/utility}/prepare_path.py +1 -1
  175. package/project/.sdk/tm/py/{utility → pkg/utility}/prepare_query.py +1 -1
  176. package/project/.sdk/tm/py/pkg/utility/register.py +71 -0
  177. package/project/.sdk/tm/py/{utility → pkg/utility}/transform_request.py +2 -2
  178. package/project/.sdk/tm/py/{utility → pkg/utility}/transform_response.py +2 -2
  179. package/project/.sdk/tm/py/test/feature_harness.py +6 -6
  180. package/project/.sdk/tm/py/test/runner.py +1 -1
  181. package/project/.sdk/tm/py/test/struct_runner.py +1 -1
  182. package/project/.sdk/tm/py/test/test_pipeline.py +5 -5
  183. package/project/.sdk/tm/py/test/test_primary_utility.py +8 -8
  184. package/project/.sdk/tm/py/test/test_struct_utility.py +3 -3
  185. package/project/.sdk/tm/py-data/LICENSE +22 -0
  186. package/project/.sdk/tm/py-data/Makefile +57 -0
  187. package/project/.sdk/tm/py-data/pkg/auth.py +131 -0
  188. package/project/.sdk/tm/py-data/pkg/fetch.py +178 -0
  189. package/project/.sdk/tm/py-data/pkg/frames.py +236 -0
  190. package/project/.sdk/tm/py-data/src/feature/README.md +8 -0
  191. package/project/.sdk/tm/py-data/src/feature/debug/.gitkeep +0 -0
  192. package/project/.sdk/tm/py-data/src/feature/idempotency/.gitkeep +0 -0
  193. package/project/.sdk/tm/py-data/src/feature/log/.gitkeep +0 -0
  194. package/project/.sdk/tm/py-data/src/feature/metrics/.gitkeep +0 -0
  195. package/project/.sdk/tm/py-data/src/feature/netsim/.gitkeep +0 -0
  196. package/project/.sdk/tm/py-data/src/feature/paging/.gitkeep +0 -0
  197. package/project/.sdk/tm/py-data/src/feature/proxy/.gitkeep +0 -0
  198. package/project/.sdk/tm/py-data/src/feature/ratelimit/.gitkeep +0 -0
  199. package/project/.sdk/tm/py-data/src/feature/rbac/.gitkeep +0 -0
  200. package/project/.sdk/tm/py-data/src/feature/retry/.gitkeep +0 -0
  201. package/project/.sdk/tm/py-data/src/feature/streaming/.gitkeep +0 -0
  202. package/project/.sdk/tm/py-data/src/feature/telemetry/.gitkeep +0 -0
  203. package/project/.sdk/tm/py-data/src/feature/test/.gitkeep +0 -0
  204. package/project/.sdk/tm/py-data/src/feature/timeout/.gitkeep +0 -0
  205. package/project/.sdk/tm/py-data/test/__init__.py +0 -0
  206. package/project/.sdk/tm/py-data/test/test_auth.py +95 -0
  207. package/project/.sdk/tm/py-data/test/test_fetch.py +152 -0
  208. package/project/.sdk/tm/py-data/test/test_frames.py +250 -0
  209. package/project/.sdk/tm/rb/core/utility_type.rb +1 -0
  210. package/project/.sdk/tm/rb/feature/paging_feature.rb +89 -3
  211. package/project/.sdk/tm/rb/utility/graphql.rb +131 -0
  212. package/project/.sdk/tm/rb/utility/make_options.rb +1 -1
  213. package/project/.sdk/tm/rb/utility/make_response.rb +6 -0
  214. package/project/.sdk/tm/rb/utility/make_spec.rb +18 -2
  215. package/project/.sdk/tm/rb/utility/register.rb +3 -0
  216. package/project/.sdk/tm/rust/feature/paging.rs +124 -2
  217. package/project/.sdk/tm/rust/utility/graphql.rs +193 -0
  218. package/project/.sdk/tm/rust/utility/make_options.rs +1 -1
  219. package/project/.sdk/tm/rust/utility/make_response.rs +6 -0
  220. package/project/.sdk/tm/rust/utility/make_spec.rs +32 -4
  221. package/project/.sdk/tm/rust/utility/mod.rs +1 -0
  222. package/project/.sdk/tm/scala/core/SdkClient.scala +90 -0
  223. package/project/.sdk/tm/scala/core/Utility.scala +4 -0
  224. package/project/.sdk/tm/scala/feature/PagingFeature.scala +104 -3
  225. package/project/.sdk/tm/scala/utility/Graphql.scala +160 -0
  226. package/project/.sdk/tm/scala/utility/Make.scala +7 -1
  227. package/project/.sdk/tm/scala/utility/MakeSpec.scala +22 -2
  228. package/project/.sdk/tm/scala/utility/Register.scala +2 -0
  229. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Utility.swift +4 -0
  230. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +86 -1
  231. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Graphql.swift +142 -0
  232. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +24 -2
  233. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +1 -1
  234. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Register.swift +2 -0
  235. package/project/.sdk/tm/ts/src/Point.ts +7 -0
  236. package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +82 -3
  237. package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +14 -2
  238. package/project/.sdk/tm/ts/src/utility/GraphqlUtility.ts +152 -0
  239. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +1 -1
  240. package/project/.sdk/tm/ts/src/utility/MakeResponseUtility.ts +7 -0
  241. package/project/.sdk/tm/ts/src/utility/MakeSpecUtility.ts +19 -2
  242. package/project/.sdk/tm/ts/src/utility/Utility.ts +4 -0
  243. package/project/.sdk/tm/zig/core/utility.zig +198 -3
  244. package/project/.sdk/tm/zig/feature/paging.zig +128 -1
  245. package/src/cmp/AgentGuideContent.ts +5 -0
  246. package/src/cmp/Feature.ts +13 -0
  247. package/src/helpers/canonType.ts +46 -0
  248. package/src/helpers/packageMeta.ts +7 -0
  249. package/src/sdkgen.ts +6 -1
  250. package/project/.sdk/tm/py/utility/register.py +0 -68
  251. /package/project/.sdk/tm/py/{core → pkg/core}/control.py +0 -0
  252. /package/project/.sdk/tm/py/{core → pkg/core}/error.py +0 -0
  253. /package/project/.sdk/tm/py/{core → pkg/core}/helpers.py +0 -0
  254. /package/project/.sdk/tm/py/{core → pkg/core}/spec.py +0 -0
  255. /package/project/.sdk/tm/py/{feature → pkg/feature}/base_feature.py +0 -0
  256. /package/project/.sdk/tm/py/{utility → pkg/utility}/clean.py +0 -0
  257. /package/project/.sdk/tm/py/{utility → pkg/utility}/done.py +0 -0
  258. /package/project/.sdk/tm/py/{utility → pkg/utility}/feature_add.py +0 -0
  259. /package/project/.sdk/tm/py/{utility → pkg/utility}/feature_hook.py +0 -0
  260. /package/project/.sdk/tm/py/{utility → pkg/utility}/make_result.py +0 -0
  261. /package/project/.sdk/tm/py/{utility → pkg/utility}/prepare_body.py +0 -0
  262. /package/project/.sdk/tm/py/{utility → pkg/utility}/result_basic.py +0 -0
  263. /package/project/.sdk/tm/py/{utility → pkg/utility}/result_body.py +0 -0
  264. /package/project/.sdk/tm/py/{utility → pkg/utility}/result_headers.py +0 -0
  265. /package/project/.sdk/tm/py/{utility → pkg/utility}/voxgig_struct/__init__.py +0 -0
  266. /package/project/.sdk/tm/py/{utility → pkg/utility}/voxgig_struct/voxgig_struct.py +0 -0
  267. /package/project/.sdk/tm/{py/core/__init__.py → py-data/src/feature/audit/.gitkeep} +0 -0
  268. /package/project/.sdk/tm/{py/entity/__init__.py → py-data/src/feature/base/.gitkeep} +0 -0
  269. /package/project/.sdk/tm/{py/feature/__init__.py → py-data/src/feature/cache/.gitkeep} +0 -0
  270. /package/project/.sdk/tm/{py/utility/__init__.py → py-data/src/feature/clienttrack/.gitkeep} +0 -0
@@ -149,7 +149,37 @@ class ProjectNameSDK
149
149
  fetchdef
150
150
  end
151
151
 
152
+ # Raw endpoint access is operator-controllable, like every entity op.
153
+ # Blocking it means denying BOTH the 'direct' and 'graphql' tokens, since
154
+ # either one reaches the same endpoint.
152
155
  def direct(fetchargs = {})
156
+ return op_denied("direct") unless op_allowed?("direct")
157
+
158
+ raw_request(fetchargs)
159
+ end
160
+
161
+ # Is this raw-access op permitted by the SDK's allow.op option?
162
+ def op_allowed?(op)
163
+ allow_op = VoxgigStruct.getpath(@options, "allow.op")
164
+ allow_op.is_a?(String) && allow_op.include?(op)
165
+ end
166
+
167
+ def op_denied(op)
168
+ allow_op = VoxgigStruct.getpath(@options, "allow.op")
169
+ {
170
+ "ok" => false,
171
+ "err" => ProjectNameError.new(
172
+ "#{op}_allow",
173
+ "ProjectNameSDK: #{op}: operation not allowed by" \
174
+ " SDK option allow.op value: \"#{allow_op}\""),
175
+ }
176
+ end
177
+
178
+ # Ungated request path shared by direct and graphql, each of which checks
179
+ # its own allow.op token first. Separate, rather than a flag on fetchargs:
180
+ # a caller-supplied marker would let anyone opt straight back out of the
181
+ # gate by passing it.
182
+ def raw_request(fetchargs = {})
153
183
  utility = @_utility
154
184
 
155
185
  # direct() is the raw-HTTP escape hatch: it always returns a result hash
@@ -217,6 +247,47 @@ class ProjectNameSDK
217
247
  }
218
248
  end
219
249
 
250
+ # Raw GraphQL access: the pressure valve that makes the generated surface's
251
+ # deliberate omissions (per-call selection sets, typed filter builders,
252
+ # batching, subscriptions) livable — the whole schema stays reachable.
253
+ #
254
+ # Thin wrapper over the same prepare/fetch path direct uses, with the one
255
+ # thing raw direct cannot do for GraphQL: a GraphQL failure rides HTTP 200
256
+ # as a top-level `errors` array, so status alone would report a failed
257
+ # query as ok.
258
+ #
259
+ # NOTE: like direct, this bypasses the feature pipeline — no retry,
260
+ # ratelimit or paging features apply.
261
+ def graphql(query, variables = nil, ctrl = nil)
262
+ return op_denied("graphql") unless op_allowed?("graphql")
263
+
264
+ res = raw_request({
265
+ "method" => "POST",
266
+ "headers" => { "content-type" => "application/json" },
267
+ "body" => { "query" => query, "variables" => variables || {} },
268
+ "ctrl" => ctrl || {},
269
+ })
270
+
271
+ # Errors are read BEFORE any status check: a GraphQL parse or validation
272
+ # failure comes back as HTTP 400 carrying the standard { errors: [...] }
273
+ # body, and the raw path represents a non-2xx as ok:false with no err —
274
+ # so returning early on status would discard the server's own
275
+ # diagnostics, which are the only useful part of that response.
276
+ errors = VoxgigStruct.getpath(res, "data.errors")
277
+
278
+ if errors.is_a?(Array) && !errors.empty?
279
+ first = errors[0].is_a?(Hash) ? errors[0] : {}
280
+ msg = first["message"]
281
+ msg = "graphql error" if msg.nil? || msg.to_s.empty?
282
+ res["ok"] = false
283
+ res["err"] = ProjectNameError.new(
284
+ "graphql_error", "ProjectNameSDK: graphql: #{msg}")
285
+ res["graphql"] = errors
286
+ end
287
+
288
+ res
289
+ end
290
+
220
291
  # <[SLOT]>
221
292
 
222
293
  def self.test(testopts = nil, sdkopts = nil)
@@ -179,7 +179,43 @@ impl ProjectNameSDK {
179
179
  utility.make_fetch_def(&ctx)
180
180
  }
181
181
 
182
+ // Raw endpoint access is operator-controllable, like every entity op.
183
+ // Blocking it means denying BOTH the 'direct' and 'graphql' tokens,
184
+ // since either one reaches the same endpoint.
182
185
  pub fn direct(&self, fetchargs: Value) -> Result<Value, ProjectNameError> {
186
+ if !self.op_allowed("direct") {
187
+ return Ok(self.op_denied("direct"));
188
+ }
189
+
190
+ self.raw_request(fetchargs)
191
+ }
192
+
193
+ // Is this raw-access op permitted by the SDK's allow.op option?
194
+ fn op_allowed(&self, op: &str) -> bool {
195
+ match getpath(&["allow", "op"], &self.options_map()) {
196
+ Value::Str(s) => s.contains(op),
197
+ _ => false,
198
+ }
199
+ }
200
+
201
+ fn op_denied(&self, op: &str) -> Value {
202
+ let allow = match getpath(&["allow", "op"], &self.options_map()) {
203
+ Value::Str(s) => s,
204
+ _ => String::new(),
205
+ };
206
+ jo(vec![
207
+ ("ok", Value::Bool(false)),
208
+ ("err", Value::str(format!(
209
+ "ProjectNameSDK: {}: operation not allowed by SDK option \
210
+ allow.op value: \"{}\"", op, allow))),
211
+ ])
212
+ }
213
+
214
+ // Ungated request path shared by direct and graphql, each of which checks
215
+ // its own allow.op token first. Private, rather than a flag on fetchargs:
216
+ // a caller-supplied marker would let anyone opt straight back out of the
217
+ // gate by passing it.
218
+ fn raw_request(&self, fetchargs: Value) -> Result<Value, ProjectNameError> {
183
219
  let utility = &self.utility;
184
220
 
185
221
  let fetchdef = match self.prepare(fetchargs.clone()) {
@@ -264,6 +300,65 @@ impl ProjectNameSDK {
264
300
  ]))
265
301
  }
266
302
 
303
+ // Raw GraphQL access: the pressure valve that makes the generated
304
+ // surface's deliberate omissions (per-call selection sets, typed filter
305
+ // builders, batching, subscriptions) livable — the whole schema stays
306
+ // reachable.
307
+ //
308
+ // Thin wrapper over the same prepare/fetch path direct uses, with the one
309
+ // thing raw direct cannot do for GraphQL: a GraphQL failure rides HTTP
310
+ // 200 as a top-level `errors` array, so status alone would report a
311
+ // failed query as ok.
312
+ //
313
+ // NOTE: like direct, this bypasses the feature pipeline — no retry,
314
+ // ratelimit or paging features apply.
315
+ pub fn graphql(
316
+ &self, query: &str, variables: Value, ctrl: Value,
317
+ ) -> Result<Value, ProjectNameError> {
318
+ if !self.op_allowed("graphql") {
319
+ return Ok(self.op_denied("graphql"));
320
+ }
321
+
322
+ let vars = match &variables {
323
+ Value::Map(_) => variables,
324
+ _ => Value::empty_map(),
325
+ };
326
+ let ctl = match &ctrl {
327
+ Value::Map(_) => ctrl,
328
+ _ => Value::empty_map(),
329
+ };
330
+
331
+ let res = self.raw_request(jo(vec![
332
+ ("method", Value::str("POST")),
333
+ ("headers", jo(vec![("content-type", Value::str("application/json"))])),
334
+ ("body", jo(vec![("query", Value::str(query)), ("variables", vars)])),
335
+ ("ctrl", ctl),
336
+ ]))?;
337
+
338
+ // Errors are read BEFORE any status check: a GraphQL parse or
339
+ // validation failure comes back as HTTP 400 carrying the standard
340
+ // { errors: [...] } body, and the raw path represents a non-2xx as
341
+ // ok:false with no err — so returning early on status would discard
342
+ // the server's own diagnostics, which are the only useful part of
343
+ // that response.
344
+ let errors = getpath(&["data", "errors"], &res);
345
+
346
+ if let Value::List(items) = &errors {
347
+ let first = items.borrow().first().cloned();
348
+ if let Some(first) = first {
349
+ let msg = get_str(&first, "message")
350
+ .filter(|m| !m.is_empty())
351
+ .unwrap_or_else(|| "graphql error".to_string());
352
+ setp(&res, "ok", Value::Bool(false));
353
+ setp(&res, "err",
354
+ Value::str(format!("ProjectNameSDK: graphql: {}", msg)));
355
+ setp(&res, "graphql", errors.clone());
356
+ }
357
+ }
358
+
359
+ Ok(res)
360
+ }
361
+
267
362
  // <[SLOT]>
268
363
  }
269
364
 
@@ -126,7 +126,39 @@ public final class ProjectNameSDK {
126
126
  return try utility.makeFetchDef(ctx)
127
127
  }
128
128
 
129
+ // Raw endpoint access is operator-controllable, like every entity op.
130
+ // Blocking it means denying BOTH the 'direct' and 'graphql' tokens, since
131
+ // either one reaches the same endpoint.
129
132
  public func direct(_ fetchargsIn: VMap?) -> VMap {
133
+ if !opAllowed("direct") {
134
+ return opDenied("direct")
135
+ }
136
+
137
+ return rawRequest(fetchargsIn)
138
+ }
139
+
140
+ // Is this raw-access op permitted by the SDK's allow.op option?
141
+ private func opAllowed(_ op: String) -> Bool {
142
+ guard let allow = gpath(options, "allow", "op").asString else { return false }
143
+ return allow.contains(op)
144
+ }
145
+
146
+ private func opDenied(_ op: String) -> VMap {
147
+ let allow = gpath(options, "allow", "op").asString ?? ""
148
+ let r = VMap()
149
+ r.entries["ok"] = .bool(false)
150
+ r.entries["err"] = .nat(ProjectNameError(
151
+ op + "_allow",
152
+ "ProjectNameSDK: \(op): operation not allowed by SDK option "
153
+ + "allow.op value: \"\(allow)\"", nil))
154
+ return r
155
+ }
156
+
157
+ // Ungated request path shared by direct and graphql, each of which checks
158
+ // its own allow.op token first. Private, rather than a flag on fetchargs:
159
+ // a caller-supplied marker would let anyone opt straight back out of the
160
+ // gate by passing it.
161
+ private func rawRequest(_ fetchargsIn: VMap?) -> VMap {
130
162
  let utility = self.utility
131
163
 
132
164
  let fetchdef: VMap
@@ -194,6 +226,60 @@ public final class ProjectNameSDK {
194
226
  return r
195
227
  }
196
228
 
229
+ // Raw GraphQL access: the pressure valve that makes the generated surface's
230
+ // deliberate omissions (per-call selection sets, typed filter builders,
231
+ // batching, subscriptions) livable — the whole schema stays reachable.
232
+ //
233
+ // Thin wrapper over the same prepare/fetch path direct uses, with the one
234
+ // thing raw direct cannot do for GraphQL: a GraphQL failure rides HTTP 200
235
+ // as a top-level `errors` array, so status alone would report a failed
236
+ // query as ok.
237
+ //
238
+ // NOTE: like direct, this bypasses the feature pipeline — no retry,
239
+ // ratelimit or paging features apply.
240
+ public func graphql(
241
+ _ query: String, _ variables: VMap? = nil, _ ctrl: VMap? = nil
242
+ ) -> VMap {
243
+ if !opAllowed("graphql") {
244
+ return opDenied("graphql")
245
+ }
246
+
247
+ let headers = VMap()
248
+ headers.entries["content-type"] = .string("application/json")
249
+
250
+ let body = VMap()
251
+ body.entries["query"] = .string(query)
252
+ body.entries["variables"] = .map(variables ?? VMap())
253
+
254
+ let fetchargs = VMap()
255
+ fetchargs.entries["method"] = .string("POST")
256
+ fetchargs.entries["headers"] = .map(headers)
257
+ fetchargs.entries["body"] = .map(body)
258
+ fetchargs.entries["ctrl"] = .map(ctrl ?? VMap())
259
+
260
+ let res = rawRequest(fetchargs)
261
+
262
+ // Errors are read BEFORE any status check: a GraphQL parse or validation
263
+ // failure comes back as HTTP 400 carrying the standard { errors: [...] }
264
+ // body, and the raw path represents a non-2xx as ok:false with no err —
265
+ // so returning early on status would discard the server's own
266
+ // diagnostics, which are the only useful part of that response.
267
+ guard let errors = gp(gp(.map(res), "data"), "errors").asList,
268
+ !errors.items.isEmpty else {
269
+ return res
270
+ }
271
+
272
+ var msg = gp(errors.items[0], "message").asString ?? ""
273
+ if msg.isEmpty { msg = "graphql error" }
274
+
275
+ res.entries["ok"] = .bool(false)
276
+ res.entries["err"] = .nat(ProjectNameError(
277
+ "graphql_error", "ProjectNameSDK: graphql: " + msg, nil))
278
+ res.entries["graphql"] = .list(errors)
279
+
280
+ return res
281
+ }
282
+
197
283
  // <[SLOT]>
198
284
 
199
285
  public static func testSDK(_ testoptsIn: VMap?, _ sdkoptsIn: VMap?) -> ProjectNameSDK {
@@ -140,8 +140,29 @@ class ProjectNameSDK {
140
140
  }
141
141
 
142
142
 
143
+ // Raw endpoint access is operator-controllable, like every entity op.
144
+ // Blocking it means denying BOTH the 'direct' and 'graphql' tokens, since
145
+ // either one reaches the same endpoint.
143
146
  async direct(fetchargs?: any) {
147
+ if (!this._options.allow.op.includes('direct')) {
148
+ return {
149
+ ok: false,
150
+ err: new Error('ProjectNameSDK: direct: operation not allowed by' +
151
+ ' SDK option allow.op value: "' + this._options.allow.op + '"'),
152
+ }
153
+ }
154
+
155
+ return this._rawRequest(fetchargs)
156
+ }
157
+
158
+
159
+ // Ungated request path shared by direct() and graphql(), each of which
160
+ // checks its own allow.op token first. Private, rather than a flag on
161
+ // fetchargs: a caller-supplied marker would let anyone opt straight back
162
+ // out of the gate by passing it.
163
+ async _rawRequest(fetchargs?: any) {
144
164
  const utility = this._utility
165
+
145
166
  const fetcher = utility.fetcher
146
167
  const makeContext = utility.makeContext
147
168
 
@@ -201,6 +222,60 @@ class ProjectNameSDK {
201
222
  }
202
223
 
203
224
 
225
+
226
+ // Raw GraphQL access: the pressure valve that makes the generated
227
+ // surface's deliberate omissions (per-call selection sets, typed filter
228
+ // builders, batching, subscriptions) livable — the whole schema stays
229
+ // reachable.
230
+ //
231
+ // Thin wrapper over the same prepare/fetch path `direct` uses, with the
232
+ // one thing raw `direct` cannot do for GraphQL: a GraphQL failure rides
233
+ // HTTP 200 as a top-level `errors` array, so status alone would report a
234
+ // failed query as ok.
235
+ //
236
+ // NOTE: like `direct`, this bypasses the feature pipeline — no retry,
237
+ // ratelimit or paging features apply.
238
+ async graphql(query: string, variables?: any, ctrl?: any) {
239
+ const options = this._options
240
+
241
+ if (!options.allow.op.includes('graphql')) {
242
+ return {
243
+ ok: false,
244
+ err: new Error('ProjectNameSDK: graphql: operation not allowed by' +
245
+ ' SDK option allow.op value: "' + options.allow.op + '"'),
246
+ }
247
+ }
248
+
249
+ const res: any = await this._rawRequest({
250
+ method: 'POST',
251
+ headers: { 'content-type': 'application/json' },
252
+ body: { query, variables: variables || {} },
253
+ ctrl,
254
+ })
255
+
256
+ if (res instanceof Error) {
257
+ return res
258
+ }
259
+
260
+ // Errors are read BEFORE any status check: a GraphQL parse or validation
261
+ // failure comes back as HTTP 400 carrying the standard { errors: [...] }
262
+ // body, and the raw path represents a non-2xx as { ok: false } with no
263
+ // err — so returning early on status would discard the server's own
264
+ // diagnostics, which are the only useful part of that response.
265
+ const errors = null == res.data ? undefined : res.data.errors
266
+
267
+ if (null != errors && Array.isArray(errors) && 0 < errors.length) {
268
+ const first = errors[0] || {}
269
+ const err: any = new Error('ProjectNameSDK: graphql: ' +
270
+ (first.message || 'graphql error'))
271
+ err.graphql = errors
272
+ return { ok: false, status: res.status, headers: res.headers, err, data: res.data }
273
+ }
274
+
275
+ return res
276
+ }
277
+
278
+
204
279
  // <[SLOT]>
205
280
 
206
281
 
@@ -163,7 +163,43 @@ pub const ProjectNameSDK = struct {
163
163
  return utility.make_fetch_def(ctx);
164
164
  }
165
165
 
166
+ // Raw endpoint access is operator-controllable, like every entity op.
167
+ // Blocking it means denying BOTH the 'direct' and 'graphql' tokens,
168
+ // since either one reaches the same endpoint.
166
169
  pub fn direct(self: *ProjectNameSDK, fetchargs_in: Value) Value {
170
+ if (!self.op_allowed("direct")) return self.op_denied("direct");
171
+
172
+ return self.raw_request(fetchargs_in);
173
+ }
174
+
175
+ // Is this raw-access op permitted by the SDK's allow.op option?
176
+ fn op_allowed(self: *ProjectNameSDK, op: []const u8) bool {
177
+ const allow: []const u8 = switch (h.getpath(&.{ "allow", "op" }, self.options)) {
178
+ .string => |s| s,
179
+ else => "",
180
+ };
181
+ return std.mem.indexOf(u8, allow, op) != null;
182
+ }
183
+
184
+ fn op_denied(self: *ProjectNameSDK, op: []const u8) Value {
185
+ const allow: []const u8 = switch (h.getpath(&.{ "allow", "op" }, self.options)) {
186
+ .string => |s| s,
187
+ else => "",
188
+ };
189
+ const msg = std.fmt.allocPrint(h.A(),
190
+ "ProjectNameSDK: {s}: operation not allowed by" ++
191
+ " SDK option allow.op value: \"{s}\"", .{ op, allow }) catch "";
192
+ return h.jo(&.{
193
+ .{ "ok", h.vbool(false) },
194
+ .{ "err", h.vstr(msg) },
195
+ });
196
+ }
197
+
198
+ // Ungated request path shared by direct and graphql, each of which checks
199
+ // its own allow.op token first. Private, rather than a flag on fetchargs:
200
+ // a caller-supplied marker would let anyone opt straight back out of the
201
+ // gate by passing it.
202
+ fn raw_request(self: *ProjectNameSDK, fetchargs_in: Value) Value {
167
203
  const utility = self.utility;
168
204
 
169
205
  const fetchdef = self.prepare(fetchargs_in) catch {
@@ -232,6 +268,65 @@ pub const ProjectNameSDK = struct {
232
268
  });
233
269
  }
234
270
 
271
+ // Raw GraphQL access: the pressure valve that makes the generated
272
+ // surface's deliberate omissions (per-call selection sets, typed filter
273
+ // builders, batching, subscriptions) livable — the whole schema stays
274
+ // reachable.
275
+ //
276
+ // Thin wrapper over the same prepare/fetch path direct uses, with the one
277
+ // thing raw direct cannot do for GraphQL: a GraphQL failure rides HTTP
278
+ // 200 as a top-level `errors` array, so status alone would report a
279
+ // failed query as ok.
280
+ //
281
+ // NOTE: like direct, this bypasses the feature pipeline — no retry,
282
+ // ratelimit or paging features apply.
283
+ pub fn graphql(
284
+ self: *ProjectNameSDK, query: []const u8, variables: Value, ctrl: Value,
285
+ ) Value {
286
+ if (!self.op_allowed("graphql")) return self.op_denied("graphql");
287
+
288
+ const vars: Value = switch (variables) {
289
+ .object => variables,
290
+ else => h.omap(),
291
+ };
292
+ const ctl: Value = switch (ctrl) {
293
+ .object => ctrl,
294
+ else => h.omap(),
295
+ };
296
+
297
+ const res = self.raw_request(h.jo(&.{
298
+ .{ "method", h.vstr("POST") },
299
+ .{ "headers", h.jo(&.{.{ "content-type", h.vstr(utility_mod.GRAPHQL_CONTENT_TYPE) }}) },
300
+ .{ "body", h.jo(&.{ .{ "query", h.vstr(query) }, .{ "variables", vars } }) },
301
+ .{ "ctrl", ctl },
302
+ }));
303
+
304
+ if (res != .object) return res;
305
+
306
+ // Errors are read BEFORE any status check: a GraphQL parse or
307
+ // validation failure comes back as HTTP 400 carrying the standard
308
+ // { errors: [...] } body, and the raw path represents a non-2xx as
309
+ // ok:false with no err — so returning early on status would discard
310
+ // the server's own diagnostics, which are the only useful part of
311
+ // that response.
312
+ const errors = h.getp(h.getp(res, "data"), "errors");
313
+
314
+ if (errors == .array and 0 < errors.array.data.items.len) {
315
+ const first = errors.array.data.items[0];
316
+ const m: []const u8 = switch (h.getp(first, "message")) {
317
+ .string => |x| if (x.len == 0) "graphql error" else x,
318
+ else => "graphql error",
319
+ };
320
+ const msg = std.fmt.allocPrint(h.A(),
321
+ "ProjectNameSDK: graphql: {s}", .{m}) catch "";
322
+ h.setp(res, "ok", h.vbool(false));
323
+ h.setp(res, "err", h.vstr(msg));
324
+ h.setp(res, "graphql", errors);
325
+ }
326
+
327
+ return res;
328
+ }
329
+
235
330
  // <[SLOT]>
236
331
  };
237
332
 
@@ -423,6 +423,9 @@ ProjectNameSDK* projectname_sdk_new(voxgig_value* options);
423
423
  ProjectNameSDK* test_sdk(voxgig_value* testopts, voxgig_value* sdkopts);
424
424
  voxgig_value* sdk_prepare(ProjectNameSDK* sdk, voxgig_value* fetchargs, PNError** err);
425
425
  voxgig_value* sdk_direct(ProjectNameSDK* sdk, voxgig_value* fetchargs, PNError** err);
426
+ voxgig_value* sdk_graphql(ProjectNameSDK* sdk, const char* query,
427
+ voxgig_value* variables, voxgig_value* ctrl,
428
+ PNError** err);
426
429
 
427
430
  // Generated config (core/config.c).
428
431
  voxgig_value* make_config(void);
@@ -456,6 +459,10 @@ const char* prepare_method_util(Context* ctx); // static string
456
459
  voxgig_value* prepare_params_util(Context* ctx);
457
460
  char* prepare_path_util(Context* ctx); // malloc'd
458
461
  voxgig_value* prepare_query_util(Context* ctx);
462
+ const char* graphql_error_code(voxgig_value* gqlerr);
463
+ voxgig_value* graphql_body_util(Context* ctx);
464
+ bool graphql_errors_util(Context* ctx);
465
+ #define GRAPHQL_CONTENT_TYPE "application/json"
459
466
  SdkResult* result_basic_util(Context* ctx);
460
467
  SdkResult* result_body_util(Context* ctx);
461
468
  SdkResult* result_headers_util(Context* ctx);