@voxgig/sdkgen 4.48.1 → 4.49.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 (119) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/package.json +1 -1
  3. package/project/.sdk/model/feature/secrets.aontu +3 -0
  4. package/project/.sdk/src/cmp/c/Config_c.ts +6 -1
  5. package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +0 -10
  6. package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +0 -9
  7. package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +0 -11
  8. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +0 -7
  9. package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +0 -10
  10. package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +2 -11
  11. package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +0 -10
  12. package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +0 -11
  13. package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +2 -10
  14. package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +0 -13
  15. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +0 -10
  16. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +0 -10
  17. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +0 -10
  18. package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +0 -12
  19. package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +0 -10
  20. package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +0 -9
  21. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +0 -7
  22. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +1 -14
  23. package/project/.sdk/tm/c/feature/cache.c +16 -1
  24. package/project/.sdk/tm/c/feature/secrets.c +149 -18
  25. package/project/.sdk/tm/c/tests/feature/secrets/secrets_test.c +319 -70
  26. package/project/.sdk/tm/c/tests/feature_test.c +31 -0
  27. package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +74 -29
  28. package/project/.sdk/tm/clojure/src/sdk/core.clj +8 -1
  29. package/project/.sdk/tm/clojure/src/sdk/features.clj +16 -2
  30. package/project/.sdk/tm/clojure/test/sdk/test/feature/secrets.clj +191 -48
  31. package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +16 -0
  32. package/project/.sdk/tm/cpp/core/types.hpp +1 -11
  33. package/project/.sdk/tm/cpp/feature/cache.hpp +14 -1
  34. package/project/.sdk/tm/cpp/feature/secrets.hpp +133 -18
  35. package/project/.sdk/tm/cpp/test/feature/secrets/secrets_test.cpp +175 -8
  36. package/project/.sdk/tm/cpp/test/feature_test.cpp +27 -0
  37. package/project/.sdk/tm/csharp/core/Control.cs +0 -5
  38. package/project/.sdk/tm/csharp/feature/CacheFeature.cs +16 -0
  39. package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +77 -38
  40. package/project/.sdk/tm/csharp/test/FeatureTest.cs +29 -0
  41. package/project/.sdk/tm/csharp/test/feature/secrets/SecretsFeatureTest.cs +315 -68
  42. package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +0 -13
  43. package/project/.sdk/tm/elixir/lib/projectname/feature/cache.ex +32 -10
  44. package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +78 -22
  45. package/project/.sdk/tm/elixir/test/feature/secrets/secrets_test.exs +178 -19
  46. package/project/.sdk/tm/elixir/test/feature_test.exs +20 -0
  47. package/project/.sdk/tm/go/feature/cache_feature.go +14 -1
  48. package/project/.sdk/tm/go/feature/secrets_feature.go +110 -15
  49. package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +373 -87
  50. package/project/.sdk/tm/go/test/feature_test.go +32 -0
  51. package/project/.sdk/tm/go/utility/media.go +2 -2
  52. package/project/.sdk/tm/java/core/Control.java +0 -5
  53. package/project/.sdk/tm/java/feature/CacheFeature.java +12 -0
  54. package/project/.sdk/tm/java/feature/SecretsFeature.java +104 -34
  55. package/project/.sdk/tm/java/test/FeatureTest.java +25 -0
  56. package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +39 -0
  57. package/project/.sdk/tm/java/test/feature/secrets/SecretsFeatureTest.java +267 -53
  58. package/project/.sdk/tm/java/utility/Fetcher.java +18 -2
  59. package/project/.sdk/tm/java/utility/Media.java +2 -2
  60. package/project/.sdk/tm/js/src/feature/cache/CacheFeature.js +13 -0
  61. package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +79 -29
  62. package/project/.sdk/tm/js/test/feature/secrets/Secrets.test.js +282 -93
  63. package/project/.sdk/tm/js/test/feature.test.js +17 -0
  64. package/project/.sdk/tm/kotlin/core/Control.kt +0 -5
  65. package/project/.sdk/tm/kotlin/feature/CacheFeature.kt +12 -0
  66. package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +84 -24
  67. package/project/.sdk/tm/kotlin/test/FeatureTest.kt +24 -0
  68. package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +35 -0
  69. package/project/.sdk/tm/kotlin/test/feature/secrets/SecretsTest.kt +236 -54
  70. package/project/.sdk/tm/kotlin/utility/Fetcher.kt +13 -1
  71. package/project/.sdk/tm/lua/feature/cache_feature.lua +20 -0
  72. package/project/.sdk/tm/lua/feature/secrets_feature.lua +92 -15
  73. package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +208 -43
  74. package/project/.sdk/tm/lua/test/feature_test.lua +18 -0
  75. package/project/.sdk/tm/lua/utility/clean.lua +1 -0
  76. package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +100 -14
  77. package/project/.sdk/tm/ocaml/sdk_features.ml +7 -1
  78. package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +143 -7
  79. package/project/.sdk/tm/ocaml/test/t_feature.ml +15 -0
  80. package/project/.sdk/tm/perl/feature/cache_feature.pm +13 -0
  81. package/project/.sdk/tm/perl/feature/secrets_feature.pm +87 -32
  82. package/project/.sdk/tm/perl/t/feature/secrets/secrets.t +177 -24
  83. package/project/.sdk/tm/perl/t/feature.t +24 -0
  84. package/project/.sdk/tm/php/feature/CacheFeature.php +13 -0
  85. package/project/.sdk/tm/php/feature/SecretsFeature.php +79 -23
  86. package/project/.sdk/tm/php/test/FeatureTest.php +23 -0
  87. package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +258 -48
  88. package/project/.sdk/tm/py/pkg/feature/cache_feature.py +7 -1
  89. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +90 -29
  90. package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +313 -80
  91. package/project/.sdk/tm/py/test/test_feature.py +18 -0
  92. package/project/.sdk/tm/rb/feature/cache_feature.rb +12 -0
  93. package/project/.sdk/tm/rb/feature/secrets_feature.rb +68 -21
  94. package/project/.sdk/tm/rb/test/feature/secrets/secrets_feature_test.rb +214 -43
  95. package/project/.sdk/tm/rb/test/feature_test.rb +20 -0
  96. package/project/.sdk/tm/rust/feature/cache.rs +15 -1
  97. package/project/.sdk/tm/rust/feature/secrets.rs +103 -23
  98. package/project/.sdk/tm/rust/tests/feature/secrets/main.rs +357 -67
  99. package/project/.sdk/tm/rust/tests/feature_test.rs +41 -0
  100. package/project/.sdk/tm/scala/core/Control.scala +0 -5
  101. package/project/.sdk/tm/scala/feature/CacheFeature.scala +12 -0
  102. package/project/.sdk/tm/scala/feature/SecretsFeature.scala +88 -22
  103. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +61 -1
  104. package/project/.sdk/tm/scala/sdktest/feature/secrets/SecretsTestMain.scala +230 -73
  105. package/project/.sdk/tm/scala/utility/Fetcher.scala +13 -1
  106. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Control.swift +0 -5
  107. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CacheFeature.swift +11 -0
  108. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +76 -16
  109. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +21 -0
  110. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/feature/secrets/SecretsFeatureTest.swift +257 -73
  111. package/project/.sdk/tm/ts/src/feature/cache/CacheFeature.ts +13 -0
  112. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +77 -17
  113. package/project/.sdk/tm/ts/test/feature/secrets/Secrets.test.ts +282 -87
  114. package/project/.sdk/tm/ts/test/feature.test.ts +17 -0
  115. package/project/.sdk/tm/zig/feature/cache.zig +15 -1
  116. package/project/.sdk/tm/zig/feature/secrets.zig +109 -32
  117. package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +232 -9
  118. package/project/.sdk/tm/zig/test/feature_test.zig +33 -0
  119. package/project/sdkgen-package.json +1 -1
package/bin/voxgig-sdkgen CHANGED
@@ -8,7 +8,7 @@ const { Shape, Nof, Skip } = require('shape')
8
8
 
9
9
  const { SdkGen } = require('../dist/sdkgen.js')
10
10
 
11
- const VERSION = '4.48.1'
11
+ const VERSION = '4.49.0'
12
12
  const KONSOLE = console
13
13
 
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voxgig/sdkgen",
3
- "version": "4.48.1",
3
+ "version": "4.49.0",
4
4
  "main": "dist/sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "engines": {
@@ -948,6 +948,9 @@ main: kit: feature: secrets: {
948
948
  # failure — a revoked refresh token, the wrong account — and retrying
949
949
  # it turns that into a spin instead of an error.
950
950
  retries: 1
951
+
952
+ # 'same-origin' lets a 307 or 308 through on the exchange's own origin.
953
+ redirect: 'refuse'
951
954
  }
952
955
  }
953
956
  }
@@ -236,8 +236,13 @@ voxgig_value* secrets_rawfetch(Context* ctx, const char* url,
236
236
 
237
237
  CURLcode rc = curl_easy_perform(curl);
238
238
  long status = 0;
239
+ // Where a redirect points, resolved by curl, which follows none.
240
+ voxgig_value* rheaders = v_map();
239
241
  if (CURLE_OK == rc) {
242
+ char* location = NULL;
240
243
  curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
244
+ curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &location);
245
+ if (NULL != location) setp(rheaders, "location", v_str(location));
241
246
  }
242
247
  curl_slist_free_all(hdrs);
243
248
  curl_easy_cleanup(curl);
@@ -256,7 +261,7 @@ voxgig_value* secrets_rawfetch(Context* ctx, const char* url,
256
261
  voxgig_value* out = cmap(5,
257
262
  "status", v_num((double)status),
258
263
  "statusText", v_str(status >= 400 ? "ERR" : "OK"),
259
- "headers", v_map(),
264
+ "headers", rheaders,
260
265
  "json", json_thunk(parsed),
261
266
  "body", v_str(text));
262
267
  free(body.data);
@@ -141,8 +141,6 @@ static voxgig_value* entyvar_stream_items(voxgig_value* data, PNError** err) {
141
141
  // caller walks (voxgig_as_list). `callopts` parameterises the call:
142
142
  // - inbound (download): the items/chunks the streaming feature produces when
143
143
  // active, else the materialised items;
144
- // - outbound (upload): a `body` in `callopts` is attached to the request
145
- // (reqdata `body$`) so the transport can stream a payload;
146
144
  // - `ctrl` (pipeline control) threads pipeline options.
147
145
  voxgig_value* entyvar_stream(Entity* e, const char* action, voxgig_value* args,
148
146
  voxgig_value* callopts, PNError** err) {
@@ -174,14 +172,6 @@ voxgig_value* entyvar_stream(Entity* e, const char* action, voxgig_value* args,
174
172
  cs.reqmatch = reqmatch;
175
173
  Context* ctx = make_context_util(cs, entyvar_ent_ctx(self));
176
174
 
177
- // Outbound: attach a caller `body` so the transport can stream a payload.
178
- voxgig_value* body = getp(stream_opts, "body");
179
- if (!v_is_noval(body) && !v_is_null(body)) {
180
- voxgig_value* reqdata = voxgig_is_map(ctx->reqdata) ? ctx->reqdata : voxgig_new_map();
181
- setp(reqdata, "body$", v_share(body));
182
- ctx->reqdata = reqdata;
183
- }
184
-
185
175
  PNError* pe = NULL;
186
176
 
187
177
  feature_hook_util(ctx, "PrePoint");
@@ -138,8 +138,6 @@
138
138
  ;; record, the struct map its data-get returns.
139
139
  ;; `callopts` parameterises the call:
140
140
  ;; - ctrl: per-call pipeline control (threaded onto the op ctx);
141
- ;; - body: an async-iterable/list payload for outbound (upload) streaming,
142
- ;; attached to the request (reqdata.body$ + a stream-out marker);
143
141
  ;; - signal: an optional 0-arg fn; when it returns true iteration stops.
144
142
  (defn stream [ent action args callopts]
145
143
  (let [callopts (let [m (core/to-map callopts)] (if m m (vs/jm)))
@@ -153,13 +151,6 @@
153
151
  (doseq [item (or (vs/items am) [])]
154
152
  (.put ^java.util.Map ctxmap (vs/getprop item 0) (vs/getprop item 1))))
155
153
  ctx (core/make-context ctxmap (:_entctx ent))]
156
- ;; Outbound: expose an async-iterable/list payload so the request builder /
157
- ;; transport can stream it as the request body.
158
- (when-let [body (vs/getprop callopts "body")]
159
- (let [reqdata (let [r (core/to-map (core/oget ctx :reqdata))] (if r r (vs/jm)))]
160
- (.put ^java.util.Map reqdata "body$" body)
161
- (core/oset! ctx :reqdata reqdata)
162
- (core/oset! ctx :stream-out body)))
163
154
  (run-op ctx (fn []))
164
155
  (let [result (core/oget ctx :result)
165
156
  signal (vs/getprop callopts "signal")
@@ -251,8 +251,6 @@ public abstract class ProjectNameEntityBase : IEntity
251
251
  // `callopts` parameterises the call:
252
252
  // - inbound (download): iterate the yielded items/chunks (from the
253
253
  // streaming feature when active, else the materialised items);
254
- // - outbound (upload): pass a streamable payload as callopts["body"] - it
255
- // is attached to the request so the transport can send it;
256
254
  // - callopts["ctrl"] threads pipeline control and callopts["signal"] (a
257
255
  // CancellationToken) is honoured between yields.
258
256
  public async IAsyncEnumerable<object?> Stream(
@@ -294,15 +292,6 @@ public abstract class ProjectNameEntityBase : IEntity
294
292
 
295
293
  var ctx = utility.MakeContext(ctxmap, entctx);
296
294
 
297
- // Outbound: expose the caller's streamable payload so the request
298
- // builder / transport can stream it as the request body.
299
- var body = StructUtils.GetProp(callopts, "body");
300
- if (body != null)
301
- {
302
- ctx.Reqdata["body$"] = body;
303
- ctx.Ctrl.Stream_out = body;
304
- }
305
-
306
295
  // Run the same pipeline the op methods run.
307
296
  var materialised = RunOp(ctx, () =>
308
297
  {
@@ -177,13 +177,6 @@ func (e *EntyClass) Stream(action string, args map[string]any, callopts map[stri
177
177
  ctx := utility.MakeContext(ctxmap, e.entctx)
178
178
  ctx.Meta["stream"] = callopts
179
179
 
180
- // Outbound: expose the caller's payload so the request builder / transport
181
- // can stream it as the request body.
182
- if body := callopts["body"]; body != nil {
183
- ctx.Reqdata["body$"] = body
184
- ctx.Meta["stream_out"] = body
185
- }
186
-
187
180
  send := func(item core.StreamItem) bool {
188
181
  select {
189
182
  case <-signal:
@@ -198,8 +198,6 @@ public abstract class EntityBase implements SdkEntity {
198
198
  * `callopts` parameterises the call:
199
199
  * - inbound (download): iterate the yielded items/chunks (from the
200
200
  * streaming feature when active, else the materialised items);
201
- * - outbound (upload): pass a streamable payload as callopts["body"] - it
202
- * is attached to the request so the transport can send it;
203
201
  * - callopts["ctrl"] threads pipeline control and callopts["signal"] (a
204
202
  * BooleanSupplier that returns true when aborted) is honoured between
205
203
  * yields.
@@ -235,14 +233,6 @@ public abstract class EntityBase implements SdkEntity {
235
233
 
236
234
  Context ctx = this.utility.makeContext.apply(ctxmap, this.entctx);
237
235
 
238
- // Outbound: expose the caller's streamable payload so the request
239
- // builder / transport can stream it as the request body.
240
- Object body = callopts.get("body");
241
- if (body != null) {
242
- ctx.reqdata.put("body$", body);
243
- ctx.ctrl.streamOut = body;
244
- }
245
-
246
236
  // Run the same pipeline the op methods run.
247
237
  Object materialised = runOp(ctx, () -> {});
248
238
 
@@ -99,10 +99,8 @@ class ProjectNameEntityBase {
99
99
  // incremental output, when that feature is active, is reachable from a
100
100
  // generated entity (a normal op call materialises the whole result).
101
101
  // `callopts` parameterises the call:
102
- // - inbound (download): iterate the yielded items/chunks (from the
103
- // streaming feature when active, else the materialised items);
104
- // - outbound (upload): pass an async-iterable `body` to stream a request
105
- // payload — it is attached to the request so the transport can send it;
102
+ // - iterate the yielded items/chunks (from the streaming feature when
103
+ // active, else the materialised items);
106
104
  // - `ctrl` (pipeline control) and `signal` (AbortSignal) are honoured:
107
105
  // an abort cancels the request and ends the iteration.
108
106
  async *stream(action, args, callopts) {
@@ -128,13 +126,6 @@ class ProjectNameEntityBase {
128
126
  ...(args || {}),
129
127
  }, this._entctx)
130
128
 
131
- // Outbound: expose the caller's async-iterable payload so the request
132
- // builder / transport can stream it as the request body.
133
- if (null != callopts.body) {
134
- ctx.reqdata = { ...(ctx.reqdata || {}), body$: callopts.body }
135
- ctx.stream_out = callopts.body
136
- }
137
-
138
129
  try {
139
130
  const failed = await this._streamSteps(ctx)
140
131
  const result = ctx.result
@@ -172,8 +172,6 @@ abstract class EntityBase(nm: String, clientIn: SdkClient, entoptsIn: MutableMap
172
172
  * the call:
173
173
  * - inbound (download): iterate the yielded items/chunks (from the
174
174
  * streaming feature when active, else the materialised items);
175
- * - outbound (upload): pass a streamable payload as callopts["body"] - it
176
- * is attached to the request so the transport can send it;
177
175
  * - callopts["ctrl"] threads pipeline control and callopts["signal"] (a
178
176
  * () -> Boolean that returns true when aborted) is honoured between
179
177
  * yields.
@@ -202,14 +200,6 @@ abstract class EntityBase(nm: String, clientIn: SdkClient, entoptsIn: MutableMap
202
200
 
203
201
  val ctx = this.utility.makeContext(ctxmap, this.entctx)
204
202
 
205
- // Outbound: expose the caller's streamable payload so the request builder
206
- // / transport can stream it as the request body.
207
- val body = opts["body"]
208
- if (body != null) {
209
- ctx.reqdata["body\$"] = body
210
- ctx.ctrl.streamOut = body
211
- }
212
-
213
203
  // Run the same pipeline the op methods run.
214
204
  val materialised = runOp(ctx) {}
215
205
 
@@ -124,8 +124,6 @@ end
124
124
  -- ent:stream("list") do ... end`. `callopts` parameterises the call:
125
125
  -- - inbound (download): iterate items/chunks (from the streaming feature
126
126
  -- when active, else the materialised items);
127
- -- - outbound (upload): an iterable `body` in callopts is attached to the
128
- -- request so the transport can stream the payload;
129
127
  -- - `ctrl` (pipeline control) and `signal` (cancellation) honoured.
130
128
  function EntyClass:stream(action, args, callopts)
131
129
  local utility = self._utility
@@ -154,15 +152,6 @@ function EntyClass:stream(action, args, callopts)
154
152
 
155
153
  local ctx = utility.make_context(ctxmap, self._entctx)
156
154
 
157
- -- Outbound: expose the caller's iterable payload so the request builder /
158
- -- transport can stream it as the request body.
159
- local body = callopts["body"]
160
- if body ~= nil then
161
- ctx.reqdata = ctx.reqdata or {}
162
- ctx.reqdata["body$"] = body
163
- ctx.meta["stream_out"] = body
164
- end
165
-
166
155
  local function aborted()
167
156
  if signal == nil then
168
157
  return false
@@ -112,9 +112,8 @@ let rec make (client : sdk_client) (entopts_in : value) : entity_obj =
112
112
  * the whole result). When the streaming feature is active the result carries
113
113
  * a stream closure and this yields from it (honouring chunkSize); otherwise
114
114
  * it falls back to the materialised items, so stream always yields.
115
- * callopts parameterises the call: ctrl (per-call pipeline control), body (an
116
- * enumerable/list payload attached to the request for outbound streaming),
117
- * and signal (a 0-arity fn -> Bool; iteration stops when it returns true). *)
115
+ * callopts parameterises the call: ctrl (per-call pipeline control) and
116
+ * signal (a 0-arity fn -> Bool; iteration stops when it returns true). *)
118
117
  ent.e_stream <- (fun action args callopts ->
119
118
  let callopts = match to_map callopts with Map _ as m -> m | _ -> empty_map () in
120
119
  (* A copy: the caller's ctrl gains no key, and explain stays its own record. *)
@@ -131,13 +130,6 @@ let rec make (client : sdk_client) (entopts_in : value) : entity_obj =
131
130
  cs_match = Some ent.e_match; cs_data = Some ent.e_data;
132
131
  cs_reqmatch = Some reqmatch }
133
132
  (Some entctx) in
134
- let body = getp callopts "body" in
135
- (if not (is_nullish body) then begin
136
- let reqdata = match to_map ctx.c_reqdata with Map _ as m -> m | _ -> empty_map () in
137
- setp reqdata "body$" body;
138
- ctx.c_reqdata <- reqdata;
139
- scratch_set ctx "stream_out" body
140
- end);
141
133
  ignore (run_op ctx (fun () -> ()));
142
134
  let signal = getp callopts "signal" in
143
135
  let aborted () = match signal with Func _ -> call_json signal = Bool true | _ -> false in
@@ -142,9 +142,6 @@ sub match_get {
142
142
  #
143
143
  # $callopts parameterises the call:
144
144
  # - ctrl: per-call pipeline control (threaded onto the op ctx);
145
- # - body: an iterator coderef / arrayref payload for outbound (upload)
146
- # streaming - attached to the request (reqdata.body$ + a
147
- # stream_out marker on ctx) so the transport can stream it;
148
145
  # - signal: an optional coderef; when it returns true the iterator stops.
149
146
  sub stream {
150
147
  my ($self, $action, $args, $callopts) = @_;
@@ -164,16 +161,6 @@ sub stream {
164
161
  %{ ProjectNameHelpers::to_map($args) || {} },
165
162
  }, $self->{_entctx});
166
163
 
167
- # Outbound: expose an async-iterable/list payload so the request builder /
168
- # transport can stream it as the request body.
169
- my $body = ProjectNameHelpers::gp($callopts, 'body');
170
- if (defined $body) {
171
- my $reqdata = ProjectNameHelpers::to_map($ctx->{reqdata}) || {};
172
- $reqdata->{'body$'} = $body;
173
- $ctx->{reqdata} = $reqdata;
174
- $ctx->{stream_out} = $body;
175
- }
176
-
177
164
  $self->_run_op($ctx, sub { return });
178
165
 
179
166
  # Unwrap an Entity instance to its bare record; recurse into chunk arrays.
@@ -141,8 +141,6 @@ class EntyClass
141
141
  * call materialises the whole result). `callopts` parameterises the call:
142
142
  * - inbound (download): yield items/chunks (from the streaming feature
143
143
  * when active, else the materialised items);
144
- * - outbound (upload): an iterable `body` in callopts is attached to the
145
- * request so the transport can stream the payload;
146
144
  * - `ctrl` (pipeline control) and `signal` (cancellation) honoured.
147
145
  */
148
146
  public function stream(string $action, ?array $args = null, ?array $callopts = null): \Generator
@@ -168,14 +166,6 @@ class EntyClass
168
166
 
169
167
  $ctx = ($utility->make_context)($ctxmap, $this->_entctx);
170
168
 
171
- // Outbound: expose the caller's iterable payload so the request builder
172
- // / transport can stream it as the request body.
173
- $body = $callopts['body'] ?? null;
174
- if ($body !== null) {
175
- $ctx->reqdata['body$'] = $body;
176
- $ctx->meta['stream_out'] = $body;
177
- }
178
-
179
169
  $aborted = function () use ($signal): bool {
180
170
  if ($signal === null) {
181
171
  return false;
@@ -79,8 +79,6 @@ class EntyClass:
79
79
  # the call:
80
80
  # - inbound (download): yield items/chunks (from the streaming
81
81
  # feature when active, else the materialised items);
82
- # - outbound (upload): an iterable `body` in callopts is attached to
83
- # the request so the transport can stream the payload;
84
82
  # - `ctrl` (pipeline control) and `signal` (cancellation) honoured.
85
83
  utility = self._utility
86
84
 
@@ -103,14 +101,6 @@ class EntyClass:
103
101
 
104
102
  ctx = utility.make_context(ctxmap, self._entctx)
105
103
 
106
- # Outbound: expose the caller's iterable payload so the request builder
107
- # / transport can stream it as the request body.
108
- body = callopts.get("body")
109
- if body is not None:
110
- ctx.reqdata = dict(ctx.reqdata or {})
111
- ctx.reqdata["body$"] = body
112
- ctx.meta["stream_out"] = body
113
-
114
104
  def aborted():
115
105
  if signal is None:
116
106
  return False
@@ -98,8 +98,6 @@ class EntyClass
98
98
  # call materialises the whole result). `callopts` parameterises the call:
99
99
  # - inbound (download): the Enumerator yields items/chunks (from the
100
100
  # streaming feature when active, else the materialised items);
101
- # - outbound (upload): an iterable `body` in callopts is attached to the
102
- # request so the transport can stream the payload;
103
101
  # - `ctrl` (pipeline control) and `signal` (cancellation) honoured.
104
102
  def stream(action, args = nil, callopts = nil)
105
103
  utility = @_utility
@@ -119,14 +117,6 @@ class EntyClass
119
117
 
120
118
  ctx = utility.make_context.call(ctxmap, @_entctx)
121
119
 
122
- # Outbound: expose the caller's iterable payload so the request builder /
123
- # transport can stream it as the request body.
124
- body = callopts["body"]
125
- unless body.nil?
126
- ctx.reqdata["body$"] = body
127
- ctx.meta["stream_out"] = body
128
- end
129
-
130
120
  aborted = lambda do
131
121
  return false if signal.nil?
132
122
  return !!signal.call if signal.respond_to?(:call)
@@ -171,18 +171,6 @@ impl EntyClass {
171
171
  Some(&self.ent_ctx()),
172
172
  );
173
173
 
174
- // Outbound: attach a caller `body` so the transport can stream a
175
- // request payload (reqdata `body$`).
176
- let body = getp(&stream_opts, "body");
177
- if !body.is_noval() && !body.is_null() {
178
- let reqdata = match ctx.reqdata.borrow().clone() {
179
- Value::Map(m) => Value::Map(m),
180
- _ => Value::empty_map(),
181
- };
182
- setp(&reqdata, "body$", body);
183
- *ctx.reqdata.borrow_mut() = reqdata;
184
- }
185
-
186
174
  // Run the same pipeline as run_op. A failed step leaves through
187
175
  // make_error, as an operation's does.
188
176
  let fail = |e: ProjectNameError| self.utility.make_error(&ctx, Some(e)).map(stream_items);
@@ -155,8 +155,6 @@ abstract class EntityBase(name0: String, client0: SdkClient, entopts0: JMap[Stri
155
155
  // the call:
156
156
  // - inbound (download): iterate the yielded items/chunks (from the
157
157
  // streaming feature when active, else the materialised items);
158
- // - outbound (upload): pass a streamable payload as callopts["body"] - it
159
- // is attached to the request so the transport can send it;
160
158
  // - callopts["ctrl"] threads pipeline control and callopts["signal"] (a
161
159
  // () => Boolean that returns true when aborted) is honoured between
162
160
  // yields.
@@ -181,14 +179,6 @@ abstract class EntityBase(name0: String, client0: SdkClient, entopts0: JMap[Stri
181
179
 
182
180
  val ctx = this.utility.makeContext(ctxmap, this.entctx)
183
181
 
184
- // Outbound: expose the caller's streamable payload so the request builder
185
- // / transport can stream it as the request body.
186
- val body = opts.get("body")
187
- if (body != null) {
188
- ctx.reqdata.put("body$", body)
189
- ctx.ctrl.streamOut = body
190
- }
191
-
192
182
  // Run the same pipeline the op methods run.
193
183
  val materialised = runOp(ctx, () => {})
194
184
 
@@ -181,8 +181,6 @@ open class ProjectNameEntityBase: Entity {
181
181
  // the call:
182
182
  // - inbound (download): iterate the yielded items/chunks (from the
183
183
  // streaming feature when active, else the materialised items);
184
- // - outbound (upload): pass a streamable payload as callopts["body"] - it
185
- // is attached to the request so the transport can send it;
186
184
  // - callopts["ctrl"] threads pipeline control and callopts["signal"] (a
187
185
  // native () -> Bool that returns true when aborted) is honoured between
188
186
  // yields.
@@ -213,13 +211,6 @@ open class ProjectNameEntityBase: Entity {
213
211
 
214
212
  let ctx = utility.makeContext(ctxmap, entctx)
215
213
 
216
- // Outbound: expose the caller's streamable payload so the request builder
217
- // / transport can stream it as the request body.
218
- if let body = opts.entries["body"], !isNil(body) {
219
- ctx.reqdata.entries["body$"] = body
220
- ctx.ctrl.streamOut = body
221
- }
222
-
223
214
  // Run the same pipeline the op methods run.
224
215
  let materialised = try runOp(ctx, {})
225
216
 
@@ -131,13 +131,6 @@ class ProjectNameEntityBase<D = any> {
131
131
  ...(args || {}),
132
132
  }, this._entctx)
133
133
 
134
- // Outbound: expose the caller's async-iterable payload so the request
135
- // builder / transport can stream it as the request body.
136
- if (null != callopts.body) {
137
- ;(ctx as any).reqdata = { ...((ctx as any).reqdata || {}), body$: callopts.body }
138
- ;(ctx as any).stream_out = callopts.body
139
- }
140
-
141
134
  try {
142
135
  const failed = await this._streamSteps(ctx)
143
136
  const result: any = ctx.result
@@ -172,8 +172,7 @@ pub const EntyClass = struct {
172
172
  /// are a materialised slice the caller walks; a failed operation is
173
173
  /// `.err`, as an operation's is. `callopts` parameterises the call:
174
174
  /// inbound yields the streaming feature's items when active, else the
175
- /// materialised items; outbound attaches an iterable `body` to the
176
- /// request (reqdata `body$`); `ctrl` threads pipeline control.
175
+ /// materialised items; `ctrl` threads pipeline control.
177
176
  pub fn stream(self: *EntyClass, action: []const u8, args: Value, callopts: Value) StreamResult {
178
177
  const utility = self.utility;
179
178
 
@@ -204,18 +203,6 @@ pub const EntyClass = struct {
204
203
  .reqmatch = reqmatch,
205
204
  }, self.ent_ctx());
206
205
 
207
- // Outbound: attach a caller `body` so the transport can stream a
208
- // request payload (reqdata `body$`).
209
- const body = h.getp(stream_opts, "body");
210
- if (!h.is_noval(body)) {
211
- const reqdata: Value = switch (ctx.reqdata) {
212
- .object => ctx.reqdata,
213
- else => h.omap(),
214
- };
215
- h.setp(reqdata, "body$", body);
216
- ctx.reqdata = reqdata;
217
- }
218
-
219
206
  // Run the same pipeline as run_op, firing the feature hooks (an
220
207
  // active streaming feature attaches result.stream on PreResult). A
221
208
  // failed step leaves through make_error, as an operation's does.
@@ -94,6 +94,21 @@ static bool storable(voxgig_value* res) {
94
94
  return fres_status(res, &status) && status >= 200 && status < 300 && !unreadable;
95
95
  }
96
96
 
97
+ // A body that declares another type than JSON passes by, unread.
98
+ static bool json(voxgig_value* res) {
99
+ voxgig_value* rh = getp(res, "headers");
100
+ if (!voxgig_is_map(rh)) return true;
101
+ voxgig_map* hm = voxgig_as_map(rh);
102
+ for (size_t i = 0; i < hm->len; i++) {
103
+ voxgig_value* v = hm->entries[i].value;
104
+ if (0 == strcasecmp(hm->entries[i].key, "content-type") && voxgig_is_string(v)) {
105
+ const char* t = voxgig_as_string(v);
106
+ return '\0' == t[strspn(t, " \t")] || media_is_json(t);
107
+ }
108
+ }
109
+ return true;
110
+ }
111
+
97
112
  // snapshot captures the response as a re-readable map:
98
113
  // { status: num, statusText: str, data: <json>, headers: <lowercased map> }.
99
114
  static voxgig_value* snapshot(voxgig_value* res) {
@@ -193,7 +208,7 @@ static voxgig_value* through(Fetcher* self, Context* ctx, const char* url,
193
208
  PNError* e = NULL;
194
209
  voxgig_value* out = st->inner->fn(st->inner, ctx, url, fetchdef, &e);
195
210
 
196
- if (!e && storable(out)) {
211
+ if (!e && storable(out) && json(out)) {
197
212
  voxgig_value* snap = snapshot(out);
198
213
  int64_t ttl = fopt_int(options, "ttl", 5000);
199
214
  evict(track, options);