@voxgig/sdkgen 4.5.0 → 4.5.2

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 CHANGED
@@ -8,7 +8,7 @@ const { Shape, One, Skip } = require('shape')
8
8
 
9
9
  const { SdkGen } = require('../dist/sdkgen.js')
10
10
 
11
- const VERSION = '4.5.0'
11
+ const VERSION = '4.5.2'
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.5.0",
3
+ "version": "4.5.2",
4
4
  "main": "dist/sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "engines": {
@@ -1012,8 +1012,12 @@
1012
1012
  config (or (oget ctx :config) (vs/jm))
1013
1013
  cfgopts (let [c (vs/getprop config "options")] (if (vs/ismap c) c (vs/jm)))
1014
1014
  optspec (vs/jm
1015
- "apikey" "" "base" "http://localhost:8000" "prefix" "" "suffix" ""
1016
- "auth" (vs/jm "prefix" "")
1015
+ "apikey" "" "secret" "" "base" "http://localhost:8000" "prefix" "" "suffix" ""
1016
+ ;; `basic` and `secret`: HTTP Basic Auth needs a second
1017
+ ;; credential and a flag to say the pair is Basic rather
1018
+ ;; than a single bearer token. Absent from the shape, a
1019
+ ;; client passing them is refused with "Unexpected keys".
1020
+ "auth" (vs/jm "prefix" "" "basic" false)
1017
1021
  "headers" (vs/jm "`$CHILD`" "`$STRING`")
1018
1022
  "allow" (vs/jm "method" "GET,PUT,POST,PATCH,DELETE,OPTIONS"
1019
1023
  "op" "create,update,load,list,remove,command,direct,graphql")
@@ -150,12 +150,17 @@ public static partial class SdkUtility
150
150
  var optspec = new Dictionary<string, object?>
151
151
  {
152
152
  ["apikey"] = "",
153
+ ["secret"] = "",
153
154
  ["base"] = "http://localhost:8000",
154
155
  ["prefix"] = "",
155
156
  ["suffix"] = "",
157
+ // `basic` and `secret`: HTTP Basic Auth needs a second credential
158
+ // and a flag to say the pair is Basic rather than a single bearer
159
+ // token.
156
160
  ["auth"] = new Dictionary<string, object?>
157
161
  {
158
162
  ["prefix"] = "",
163
+ ["basic"] = false,
159
164
  },
160
165
  ["headers"] = new Dictionary<string, object?>
161
166
  {
@@ -21,10 +21,14 @@ dynamic makeOptions(dynamic ctx) {
21
21
  final optspec = {
22
22
  'apikey': '',
23
23
  'base': 'http://localhost:8000',
24
+ 'secret': '',
24
25
  'prefix': '',
25
26
  'suffix': '',
27
+ // `basic` and `secret`: HTTP Basic Auth needs a second credential and a
28
+ // flag to say the pair is Basic rather than a single bearer token.
26
29
  'auth': {
27
30
  'prefix': '',
31
+ 'basic': false,
28
32
  },
29
33
  'headers': {
30
34
  '`\$CHILD`': '`\$STRING`',
@@ -285,10 +285,13 @@ defmodule ProjectName.Utility do
285
285
  optspec =
286
286
  H.deep(%{
287
287
  "apikey" => "",
288
+ "secret" => "",
288
289
  "base" => "http://localhost:8000",
289
290
  "prefix" => "",
290
291
  "suffix" => "",
291
- "auth" => %{"prefix" => ""},
292
+ # `basic` and `secret`: HTTP Basic Auth needs a second credential and
293
+ # a flag to say the pair is Basic rather than a single bearer token.
294
+ "auth" => %{"prefix" => "", "basic" => false},
292
295
  "headers" => %{"`$CHILD`" => "`$STRING`"},
293
296
  "allow" => %{
294
297
  "method" => "GET,PUT,POST,PATCH,DELETE,OPTIONS",
@@ -1440,7 +1440,15 @@ local function merge(val, maxdepth)
1440
1440
  -- Descend into override node.
1441
1441
  else
1442
1442
  -- Descend into destination node using same key.
1443
- dst[pI + 1] = 0 < pI and getprop(dst[pI], key) or dst[pI + 1]
1443
+ -- NOT `a and b or c`: that idiom silently yields `c` whenever `b`
1444
+ -- is falsy, and `getprop` returns exactly that for a key the
1445
+ -- destination does not have. `dst[pI + 1]` then kept the PREVIOUS
1446
+ -- sibling's destination node, so the next key descended into it:
1447
+ -- merging {auth={prefix}} with {auth={...}, feature={...}} left
1448
+ -- `auth` and `feature` as ONE table holding the union of both.
1449
+ if 0 < pI then
1450
+ dst[pI + 1] = getprop(dst[pI], key)
1451
+ end
1444
1452
  local tval = dst[pI + 1]
1445
1453
 
1446
1454
  -- Destination empty, so create node (unless override is class instance).
@@ -937,10 +937,13 @@ let fetcher_util (ctx : ctx) (fullurl : string) (fetchdef : value) : (value * sd
937
937
  let opt_spec_value () : value =
938
938
  jo [
939
939
  ("apikey", Str "");
940
+ ("secret", Str "");
940
941
  ("base", Str "http://localhost:8000");
941
942
  ("prefix", Str "");
942
943
  ("suffix", Str "");
943
- ("auth", jo [("prefix", Str "")]);
944
+ (* `basic` and `secret`: HTTP Basic Auth needs a second credential and a
945
+ flag to say the pair is Basic rather than a single bearer token. *)
946
+ ("auth", jo [("prefix", Str ""); ("basic", Bool false)]);
944
947
  ("headers", jo [("`$CHILD`", Str "`$STRING`")]);
945
948
  ("allow", jo [("method", Str "GET,PUT,POST,PATCH,DELETE,OPTIONS");
946
949
  ("op", Str "create,update,load,list,remove,command,direct,graphql")]);
@@ -108,9 +108,12 @@ $REGISTRY{make_options} = sub {
108
108
  my $optspec = {
109
109
  'apikey' => '',
110
110
  'base' => 'http://localhost:8000',
111
+ 'secret' => '',
111
112
  'prefix' => '',
112
113
  'suffix' => '',
113
- 'auth' => { 'prefix' => '' },
114
+ # `basic` and `secret`: HTTP Basic Auth needs a second credential and a
115
+ # flag to say the pair is Basic rather than a single bearer token.
116
+ 'auth' => { 'prefix' => '', 'basic' => $JF },
114
117
  'headers' => { '`$CHILD`' => '`$STRING`' },
115
118
  'allow' => {
116
119
  'method' => 'GET,PUT,POST,PATCH,DELETE,OPTIONS',
@@ -69,9 +69,12 @@ module ProjectNameUtilities
69
69
  optspec = {
70
70
  "apikey" => "",
71
71
  "base" => "http://localhost:8000",
72
+ "secret" => "",
72
73
  "prefix" => "",
73
74
  "suffix" => "",
74
- "auth" => { "prefix" => "" },
75
+ # `basic` and `secret`: HTTP Basic Auth needs a second credential and
76
+ # a flag to say the pair is Basic rather than a single bearer token.
77
+ "auth" => { "prefix" => "", "basic" => false },
75
78
  "headers" => { "`$CHILD`" => "`$STRING`" },
76
79
  "allow" => {
77
80
  "method" => "GET,PUT,POST,PATCH,DELETE,OPTIONS",
@@ -3,7 +3,7 @@
3
3
  "package": 1
4
4
  },
5
5
  "name": "@voxgig/sdkgen",
6
- "version": "4.5.0",
6
+ "version": "4.5.2",
7
7
  "provides": {
8
8
  "target": [
9
9
  "c",