@voxgig/sdkgen 4.17.0 → 4.17.1

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.17.0'
11
+ const VERSION = '4.17.1'
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.17.0",
3
+ "version": "4.17.1",
4
4
  "main": "dist/sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "engines": {
@@ -15,8 +15,10 @@ CFLAGS ?= -std=c11 -Wall -Wextra -Wno-unused-parameter -D_GNU_SOURCE -O0 -g
15
15
  # point.h / types.h shadow nothing: the SDK's own value.h (utility/struct)
16
16
  # is reached by its neighbours through the including file's directory,
17
17
  # which a quoted include searches before any -I.
18
- PAYLOAD_DIRS := $(patsubst %/,%,$(wildcard feature/*/*/))
19
- INC := -I core -I utility/struct -I feature $(addprefix -I ,$(PAYLOAD_DIRS))
18
+ PAYLOAD_DIRS := $(sort $(dir $(wildcard feature/*/*/*.h)))
19
+ # Payload headers are quoted includes; they must not shadow system headers
20
+ # such as <regex.h> with the plugin library's own regex.h.
21
+ INC := -I core -I utility/struct -I feature $(addprefix -iquote ,$(PAYLOAD_DIRS))
20
22
  # The vendored omni test runner (tests/vendor/omni) is TEST-ONLY: it is
21
23
  # reachable from tests/ alone, never from LIB_SRCS, so it cannot enter the
22
24
  # shipped libsdk.a. That is why it lives under tests/ and not utility/.
@@ -74,6 +76,18 @@ all: build
74
76
 
75
77
  build: libsdk.a
76
78
 
79
+ # Keep this before the generic rule for GNU make 3.81 on macOS.
80
+ # omni's util.c includes <regex.h>. CFLAGS is `?=`, so an operator override
81
+ # can drop the -D_GNU_SOURCE that exposes it; -D_POSIX_C_SOURCE is the
82
+ # minimum omni itself compiles under (its own test/run.c sets exactly this).
83
+ # _DARWIN_C_SOURCE is needed BESIDE it, not instead of it: on Darwin,
84
+ # defining _POSIX_C_SOURCE alone LOWERS __DARWIN_C_LEVEL and hides regex_t,
85
+ # so the same flag that exposes the header on glibc hides it on macOS. Each
86
+ # platform ignores the other's macro.
87
+ tests/vendor/omni/%.o: tests/vendor/omni/%.c
88
+ $(CC) $(CFLAGS) -D_POSIX_C_SOURCE=200809L -D_DARWIN_C_SOURCE -c $< -o $@
89
+
90
+
77
91
  %.o: %.c
78
92
  $(CC) $(CFLAGS) $(INC) -c $< -o $@
79
93
 
@@ -87,15 +101,6 @@ libsdk.a: $(LIB_OBJS)
87
101
  @rm -f $@
88
102
  ar rcs $@ $(LIB_OBJS)
89
103
 
90
- # omni's util.c includes <regex.h>. CFLAGS is `?=`, so an operator override
91
- # can drop the -D_GNU_SOURCE that exposes it; -D_POSIX_C_SOURCE is the
92
- # minimum omni itself compiles under (its own test/run.c sets exactly this).
93
- # _DARWIN_C_SOURCE is needed BESIDE it, not instead of it: on Darwin,
94
- # defining _POSIX_C_SOURCE alone LOWERS __DARWIN_C_LEVEL and hides regex_t,
95
- # so the same flag that exposes the header on glibc hides it on macOS. Each
96
- # platform ignores the other's macro.
97
- tests/vendor/omni/%.o: tests/vendor/omni/%.c
98
- $(CC) $(CFLAGS) -D_POSIX_C_SOURCE=200809L -D_DARWIN_C_SOURCE -c $< -o $@
99
104
 
100
105
  libomni.a: $(OMNI_OBJS)
101
106
  @rm -f $@
@@ -93,7 +93,7 @@ static void pushitem(sek_pool *pool, sek_json *arr, sek_json *item) {
93
93
  arr->itemlen++;
94
94
  }
95
95
 
96
- static void setkey(sek_pool *pool, sek_json *obj, const char *key, sek_json *val) {
96
+ static void sek_json_assign_member(sek_pool *pool, sek_json *obj, const char *key, sek_json *val) {
97
97
  size_t index;
98
98
 
99
99
  for (index = 0; index < obj->maplen; index++) {
@@ -128,7 +128,7 @@ void sek_json_push(sek_pool *pool, sek_json *arr, sek_json *item) {
128
128
  }
129
129
 
130
130
  void sek_json_set(sek_pool *pool, sek_json *obj, const char *key, sek_json *val) {
131
- setkey(pool, obj, key, val);
131
+ sek_json_assign_member(pool, obj, key, val);
132
132
  }
133
133
 
134
134
  /* ---- reads --------------------------------------------------------- */
@@ -607,7 +607,7 @@ static sek_json *readobject(reader *rd) {
607
607
  return NULL;
608
608
  }
609
609
 
610
- setkey(rd->pool, out, key, val);
610
+ sek_json_assign_member(rd->pool, out, key, val);
611
611
  skipspace(rd);
612
612
 
613
613
  if (rd->at >= rd->len) {
@@ -240,7 +240,7 @@ class ProjectNameSecretsTest extends TestCase
240
240
  // seeded data, a scripted response); an op the API does not define fails
241
241
  // before it reaches the transport, which is why several may need
242
242
  // driving.
243
- private function driveUntil($client, string $what, callable $stop): void
243
+ private function driveUntil($client, string $what, callable $stop, ?callable $onError = null): void
244
244
  {
245
245
  foreach ($this->entityAccessors($client) as $accessor) {
246
246
  try {
@@ -255,7 +255,10 @@ class ProjectNameSecretsTest extends TestCase
255
255
  try {
256
256
  $ent->$opname();
257
257
  } catch (\Throwable $e) {
258
- // The op's own failure is not the assertion.
258
+ // The op's own failure is not the assertion unless observed.
259
+ if ($onError !== null) {
260
+ $onError($e);
261
+ }
259
262
  }
260
263
  if ($stop()) {
261
264
  return;
@@ -265,6 +268,20 @@ class ProjectNameSecretsTest extends TestCase
265
268
  $this->fail('no entity operation ' . $what . ' - nothing to assert on');
266
269
  }
267
270
 
271
+ // Capture a refusal from an operation this API actually defines.
272
+ private function entityError($client): ProjectNameError
273
+ {
274
+ $caught = null;
275
+ $this->driveUntil($client, 'returned an SDK error',
276
+ function () use (&$caught) { return $caught !== null; },
277
+ function (\Throwable $error) use (&$caught) {
278
+ if ($error instanceof ProjectNameError) {
279
+ $caught = $error;
280
+ }
281
+ });
282
+ return $caught;
283
+ }
284
+
268
285
  // Drive ops until one request reached the recorder.
269
286
  private function driveOp($client, ProjectNameSecretsWire $wire): void
270
287
  {
@@ -469,15 +486,7 @@ class ProjectNameSecretsTest extends TestCase
469
486
  ]],
470
487
  ]);
471
488
 
472
- $accessor = $this->entityAccessors($client)[0] ?? null;
473
- $this->assertNotNull($accessor, 'no entity accessor - nothing to assert on');
474
-
475
- $caught = null;
476
- try {
477
- $client->$accessor()->list();
478
- } catch (ProjectNameError $e) {
479
- $caught = $e;
480
- }
489
+ $caught = $this->entityError($client);
481
490
 
482
491
  $this->assertNotNull($caught, 'the entity path must fail closed');
483
492
  $this->assertStringContainsString('vault unreachable', $caught->msg);
@@ -970,15 +979,8 @@ class ProjectNameSecretsTest extends TestCase
970
979
  ]],
971
980
  ]);
972
981
 
973
- $accessor = $this->entityAccessors($client)[0] ?? null;
974
- $this->assertNotNull($accessor);
975
-
976
- try {
977
- $client->$accessor()->list();
978
- $this->fail('the op must fail closed');
979
- } catch (ProjectNameError $e) {
980
- // expected
981
- }
982
+ $caught = $this->entityError($client);
983
+ $this->assertStringContainsString('vault unreachable', $caught->msg);
982
984
 
983
985
  $this->assertSame(1, $calls, 'the refusal must not be retried');
984
986
  $this->assertCount(0, $wire->calls);
@@ -3,7 +3,7 @@
3
3
  "package": 1
4
4
  },
5
5
  "name": "@voxgig/sdkgen",
6
- "version": "4.17.0",
6
+ "version": "4.17.1",
7
7
  "provides": {
8
8
  "target": [
9
9
  "c",