@voxgig/sdkgen 4.34.4 → 4.34.6
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/package.json +1 -1
- package/project/.sdk/src/cmp/c/Config_c.ts +5 -0
- package/project/.sdk/src/cmp/go/Config_go.ts +4 -1
- package/project/.sdk/src/cmp/js/Config_js.ts +4 -1
- package/project/.sdk/src/cmp/lua/Config_lua.ts +4 -1
- package/project/.sdk/src/cmp/php/Config_php.ts +4 -1
- package/project/.sdk/src/cmp/py/Config_py.ts +4 -1
- package/project/.sdk/src/cmp/swift/TestClean_swift.ts +4 -1
- package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +2 -1
- package/project/.sdk/tm/c/tests/pipeline_test.c +4 -4
- package/project/sdkgen-package.json +1 -1
package/bin/voxgig-sdkgen
CHANGED
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
isConfigData,
|
|
12
12
|
resolveAuthIn,
|
|
13
13
|
resolveAuthName,
|
|
14
|
+
isHttpBasicAuth,
|
|
14
15
|
resolveAuthPrefix,
|
|
15
16
|
targetFeatures,
|
|
16
17
|
} from '@voxgig/sdkgen'
|
|
@@ -304,6 +305,7 @@ const Config = cmp(async function Config(props: any) {
|
|
|
304
305
|
// to what it generated before (Config_ts and Config_go do the same).
|
|
305
306
|
const authIn = resolveAuthIn(model)
|
|
306
307
|
const authName = resolveAuthName(model)
|
|
308
|
+
const authBasic = isHttpBasicAuth(model)
|
|
307
309
|
|
|
308
310
|
let baseUrl = ''
|
|
309
311
|
try { baseUrl = getModelPath(model, `main.${KIT}.info.servers.0.url`) } catch (_e) { }
|
|
@@ -336,6 +338,9 @@ const Config = cmp(async function Config(props: any) {
|
|
|
336
338
|
}
|
|
337
339
|
if (authActive) {
|
|
338
340
|
options.auth = { prefix: authPrefix }
|
|
341
|
+
if (authBasic) {
|
|
342
|
+
options.auth.basic = true
|
|
343
|
+
}
|
|
339
344
|
if ('header' !== authIn) {
|
|
340
345
|
options.auth.in = authIn
|
|
341
346
|
}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
isConfigData,
|
|
17
17
|
resolveAuthIn,
|
|
18
18
|
resolveAuthName,
|
|
19
|
+
isHttpBasicAuth,
|
|
19
20
|
resolveAuthPrefix,
|
|
20
21
|
serverVariables,
|
|
21
22
|
targetFeatures,
|
|
@@ -67,9 +68,11 @@ const Config = cmp(async function Config(props: any) {
|
|
|
67
68
|
// what it generated before.
|
|
68
69
|
const authIn = resolveAuthIn(model)
|
|
69
70
|
const authName = resolveAuthName(model)
|
|
71
|
+
const authBasic = isHttpBasicAuth(model)
|
|
70
72
|
const authBlock = authActive
|
|
71
73
|
? ` "auth": map[string]any{
|
|
72
|
-
"prefix": "${authPrefix}",${
|
|
74
|
+
"prefix": "${authPrefix}",${authBasic ? `
|
|
75
|
+
"basic": true,` : ''}${'header' === authIn ? '' : `
|
|
73
76
|
"in": "${authIn}",`}${'Authorization' === authName ? '' : `
|
|
74
77
|
"name": "${authName}",`}
|
|
75
78
|
},\n`
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
isConfigData,
|
|
17
17
|
resolveAuthIn,
|
|
18
18
|
resolveAuthName,
|
|
19
|
+
isHttpBasicAuth,
|
|
19
20
|
resolveAuthPrefix,
|
|
20
21
|
serverVariables,
|
|
21
22
|
targetFeatures,
|
|
@@ -57,9 +58,11 @@ const Config = cmp(async function Config(props: any) {
|
|
|
57
58
|
// what it generated before.
|
|
58
59
|
const authIn = resolveAuthIn(model)
|
|
59
60
|
const authName = resolveAuthName(model)
|
|
61
|
+
const authBasic = isHttpBasicAuth(model)
|
|
60
62
|
const authBlock = authActive
|
|
61
63
|
? `auth: {
|
|
62
|
-
prefix: '${authPrefix}',${
|
|
64
|
+
prefix: '${authPrefix}',${authBasic ? `
|
|
65
|
+
basic: true,` : ''}${'header' === authIn ? '' : `
|
|
63
66
|
in: '${authIn}',`}${'Authorization' === authName ? '' : `
|
|
64
67
|
name: '${authName}',`}
|
|
65
68
|
},
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
isConfigData,
|
|
16
16
|
resolveAuthIn,
|
|
17
17
|
resolveAuthName,
|
|
18
|
+
isHttpBasicAuth,
|
|
18
19
|
resolveAuthPrefix,
|
|
19
20
|
serverVariables,
|
|
20
21
|
targetFeatures,
|
|
@@ -97,9 +98,11 @@ const Config = cmp(async function Config(props: any) {
|
|
|
97
98
|
|
|
98
99
|
const authIn = resolveAuthIn(model)
|
|
99
100
|
const authName = resolveAuthName(model)
|
|
101
|
+
const authBasic = isHttpBasicAuth(model)
|
|
100
102
|
const authBlock = authActive
|
|
101
103
|
? ` auth = {
|
|
102
|
-
prefix = "${authPrefix}",${
|
|
104
|
+
prefix = "${authPrefix}",${authBasic ? `
|
|
105
|
+
basic = true,` : ''}${'header' === authIn ? '' : `
|
|
103
106
|
["in"] = "${authIn}",`}${'Authorization' === authName ? '' : `
|
|
104
107
|
name = "${authName}",`}
|
|
105
108
|
},\n`
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
rawStringLiteral,
|
|
17
17
|
resolveAuthIn,
|
|
18
18
|
resolveAuthName,
|
|
19
|
+
isHttpBasicAuth,
|
|
19
20
|
resolveAuthPrefix,
|
|
20
21
|
serverVariables,
|
|
21
22
|
targetFeatures,
|
|
@@ -88,6 +89,7 @@ const Config = cmp(async function Config(props: any) {
|
|
|
88
89
|
// what it generated before.
|
|
89
90
|
const authIn = resolveAuthIn(model)
|
|
90
91
|
const authName = resolveAuthName(model)
|
|
92
|
+
const authBasic = isHttpBasicAuth(model)
|
|
91
93
|
|
|
92
94
|
let baseUrl = ''
|
|
93
95
|
try { baseUrl = getModelPath(model, `main.${KIT}.info.servers.0.url`) } catch (_e) { }
|
|
@@ -101,7 +103,8 @@ const Config = cmp(async function Config(props: any) {
|
|
|
101
103
|
|
|
102
104
|
const authBlock = authActive
|
|
103
105
|
? ` "auth" => [
|
|
104
|
-
"prefix" => "${authPrefix}",${
|
|
106
|
+
"prefix" => "${authPrefix}",${authBasic ? `
|
|
107
|
+
"basic" => true,` : ''}${'header' === authIn ? '' : `
|
|
105
108
|
"in" => ${phps(authIn)},`}${'Authorization' === authName ? '' : `
|
|
106
109
|
"name" => ${phps(authName)},`}
|
|
107
110
|
],\n`
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
isConfigData,
|
|
16
16
|
resolveAuthIn,
|
|
17
17
|
resolveAuthName,
|
|
18
|
+
isHttpBasicAuth,
|
|
18
19
|
resolveAuthPrefix,
|
|
19
20
|
serverVariables,
|
|
20
21
|
targetFeatures,
|
|
@@ -89,6 +90,7 @@ const Config = cmp(async function Config(props: any) {
|
|
|
89
90
|
// what it generated before.
|
|
90
91
|
const authIn = resolveAuthIn(model)
|
|
91
92
|
const authName = resolveAuthName(model)
|
|
93
|
+
const authBasic = isHttpBasicAuth(model)
|
|
92
94
|
|
|
93
95
|
let baseUrl = ''
|
|
94
96
|
try { baseUrl = getModelPath(model, `main.${KIT}.info.servers.0.url`) } catch (_e) { }
|
|
@@ -101,7 +103,8 @@ const Config = cmp(async function Config(props: any) {
|
|
|
101
103
|
|
|
102
104
|
const authBlock = authActive
|
|
103
105
|
? ` "auth": {
|
|
104
|
-
"prefix": "${authPrefix}",${
|
|
106
|
+
"prefix": "${authPrefix}",${authBasic ? `
|
|
107
|
+
"basic": True,` : ''}${'header' === authIn ? '' : `
|
|
105
108
|
"in": "${authIn}",`}${'Authorization' === authName ? '' : `
|
|
106
109
|
"name": "${authName}",`}
|
|
107
110
|
},\n`
|
|
@@ -519,8 +519,11 @@ ${candidateLines}
|
|
|
519
519
|
for (label, extra) in streams {
|
|
520
520
|
let explain = VMap()
|
|
521
521
|
let streamed = ${Name}CleanTest.makeSdk(${Name}CleanTest.scenarios[0], box, nil, extra)
|
|
522
|
+
let reqmatch = VMap()
|
|
523
|
+
for p in target.params { reqmatch.entries[p] = .string("p1") }
|
|
522
524
|
XCTAssertNoThrow(try target.candidate.accessor(streamed).stream(
|
|
523
|
-
target.op,
|
|
525
|
+
target.op, vm(("reqmatch", .map(reqmatch))),
|
|
526
|
+
vm(("ctrl", .map(vm(("explain", .map(explain))))))), label + ": the stream should not fail")
|
|
524
527
|
XCTAssertFalse(explain.entries.isEmpty, label + ": the explain record was not filled")
|
|
525
528
|
box.sinks += ${Name}CleanTest.formsOf(label + ":explain", explain)
|
|
526
529
|
}
|
|
@@ -206,7 +206,8 @@ open class ProjectNameEntityBase: Entity {
|
|
|
206
206
|
"data": data,
|
|
207
207
|
]
|
|
208
208
|
if let a = args {
|
|
209
|
-
|
|
209
|
+
// The context reads reqmatch and reqdata as a VMap, never a Value.
|
|
210
|
+
for (k, v) in a.entries { ctxmap[k] = v.asMap ?? v }
|
|
210
211
|
}
|
|
211
212
|
|
|
212
213
|
let ctx = utility.makeContext(ctxmap, entctx)
|
|
@@ -403,7 +403,7 @@ static void test_prepare_auth_guards_missing_spec(void) {
|
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
static void test_prepare_auth_apikey_with_prefix_space_joined(void) {
|
|
406
|
-
pl_client(cmap(2, "apikey", v_str("K"), "auth", cmap(
|
|
406
|
+
pl_client(cmap(2, "apikey", v_str("K"), "auth", cmap(2, "prefix", v_str("Bearer"), "basic", v_bool(false))));
|
|
407
407
|
Context* ctx = pl_ctx(NULL);
|
|
408
408
|
ctx->spec = auth_spec(v_undef());
|
|
409
409
|
PNError* err = NULL;
|
|
@@ -413,7 +413,7 @@ static void test_prepare_auth_apikey_with_prefix_space_joined(void) {
|
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
static void test_prepare_auth_raw_apikey_empty_prefix_as_is(void) {
|
|
416
|
-
pl_client(cmap(2, "apikey", v_str("K"), "auth", cmap(
|
|
416
|
+
pl_client(cmap(2, "apikey", v_str("K"), "auth", cmap(2, "prefix", v_str(""), "basic", v_bool(false))));
|
|
417
417
|
Context* ctx = pl_ctx(NULL);
|
|
418
418
|
ctx->spec = auth_spec(v_undef());
|
|
419
419
|
PNError* err = NULL;
|
|
@@ -422,7 +422,7 @@ static void test_prepare_auth_raw_apikey_empty_prefix_as_is(void) {
|
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
static void test_prepare_auth_empty_apikey_drops_header(void) {
|
|
425
|
-
pl_client(cmap(2, "apikey", v_str(""), "auth", cmap(
|
|
425
|
+
pl_client(cmap(2, "apikey", v_str(""), "auth", cmap(2, "prefix", v_str("Bearer"), "basic", v_bool(false))));
|
|
426
426
|
Context* ctx = pl_ctx(NULL);
|
|
427
427
|
ctx->spec = auth_spec(cmap(1, "authorization", v_str("stale")));
|
|
428
428
|
PNError* err = NULL;
|
|
@@ -432,7 +432,7 @@ static void test_prepare_auth_empty_apikey_drops_header(void) {
|
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
static void test_prepare_auth_missing_apikey_drops_header(void) {
|
|
435
|
-
pl_client(cmap(1, "auth", cmap(
|
|
435
|
+
pl_client(cmap(1, "auth", cmap(2, "prefix", v_str("Bearer"), "basic", v_bool(false))));
|
|
436
436
|
voxgig_value* options = sdk_options_map(PL_CLIENT);
|
|
437
437
|
const char* k = get_str(options, "apikey");
|
|
438
438
|
if (k && k[0] != '\0') {
|