@voxgig/sdkgen 4.44.1 → 4.44.3

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 (29) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/helpers/opShape.js +3 -6
  3. package/dist/helpers/opShape.js.map +1 -1
  4. package/dist/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +1 -1
  6. package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +3 -3
  7. package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +3 -3
  8. package/project/.sdk/tm/c/utility/make_point.c +9 -5
  9. package/project/.sdk/tm/clojure/src/sdk/core.clj +7 -1
  10. package/project/.sdk/tm/cpp/utility/pipeline.hpp +15 -11
  11. package/project/.sdk/tm/csharp/utility/MakePoint.cs +19 -15
  12. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +13 -1
  13. package/project/.sdk/tm/go/utility/make_point.go +16 -12
  14. package/project/.sdk/tm/java/utility/MakePoint.java +18 -13
  15. package/project/.sdk/tm/js/src/utility/MakePointUtility.js +13 -6
  16. package/project/.sdk/tm/kotlin/utility/MakePoint.kt +17 -12
  17. package/project/.sdk/tm/lua/utility/make_point.lua +14 -10
  18. package/project/.sdk/tm/ocaml/sdk_runtime.ml +8 -4
  19. package/project/.sdk/tm/perl/utility/make_point.pm +8 -4
  20. package/project/.sdk/tm/php/utility/MakePoint.php +9 -4
  21. package/project/.sdk/tm/py/pkg/utility/make_point.py +12 -8
  22. package/project/.sdk/tm/rb/utility/make_point.rb +8 -4
  23. package/project/.sdk/tm/rust/utility/make_point.rs +12 -8
  24. package/project/.sdk/tm/scala/utility/Make.scala +8 -4
  25. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +14 -11
  26. package/project/.sdk/tm/ts/src/utility/MakePointUtility.ts +13 -6
  27. package/project/.sdk/tm/zig/core/utility.zig +8 -5
  28. package/project/sdkgen-package.json +1 -1
  29. package/src/helpers/opShape.ts +3 -7
@@ -116,7 +116,7 @@ const Main = cmp(function Main(props: any) {
116
116
  ex.push(`./${bin} --help`)
117
117
  ex.push('')
118
118
  ex.push('# 3. Provide credentials once, via the environment')
119
- ex.push(`export ${apiKeyEnv}=sk_live_xxx`)
119
+ ex.push(`export ${apiKeyEnv}=apikey_xxx`)
120
120
  ex.push('')
121
121
  ex.push('# 4. Each command line is ONE boru expression, run against the API:')
122
122
  if (firstHas('list')) ex.push(`./${bin} list ${firstEntity}`)
@@ -172,7 +172,7 @@ record is printed back.`)
172
172
  Configuration is read from the environment — nothing is written to disk:
173
173
 
174
174
  \`\`\`sh
175
- export ${apiKeyEnv}=sk_live_xxx # API key
175
+ export ${apiKeyEnv}=apikey_xxx # API key
176
176
  export ${baseEnv}=https://api.example.com # optional: override the API base URL
177
177
  ./${bin} ${cliExampleExpr}
178
178
  \`\`\`
@@ -233,7 +233,7 @@ ${exampleBlock}
233
233
  2. **Set your API key** (read from the environment):
234
234
 
235
235
  \`\`\`sh
236
- export ${apiKeyEnv}=sk_live_xxx
236
+ export ${apiKeyEnv}=apikey_xxx
237
237
  \`\`\`
238
238
 
239
239
  3. **Run a query.** Evaluate an boru expression against the API (or run with no
@@ -278,7 +278,7 @@ ${writeText}
278
278
  make build
279
279
 
280
280
  # 2. Provide credentials via the environment
281
- export ${apiKeyEnv}=sk_live_xxx
281
+ export ${apiKeyEnv}=apikey_xxx
282
282
 
283
283
  # 3a. Install into Claude Code over stdio (most common)
284
284
  claude mcp add --scope user ${slugLower} \\
@@ -303,7 +303,7 @@ ${callText}> The rest of this guide follows the [Diátaxis](https://diataxis.fr)
303
303
  2. **Set your API key:**
304
304
 
305
305
  \`\`\`sh
306
- export ${apiKeyEnv}=sk_live_xxx
306
+ export ${apiKeyEnv}=apikey_xxx
307
307
  \`\`\`
308
308
 
309
309
  3. **Install it into Claude Code** (stdio transport):
@@ -322,7 +322,7 @@ ${restart}
322
322
  Configuration is read from the environment — nothing is written to disk:
323
323
 
324
324
  \`\`\`sh
325
- export ${apiKeyEnv}=sk_live_xxx # API key
325
+ export ${apiKeyEnv}=apikey_xxx # API key
326
326
  export ${baseEnv}=https://api.example.com # optional: override the API base URL
327
327
  \`\`\`
328
328
 
@@ -131,13 +131,17 @@ voxgig_value* make_point_util(Context* ctx, PNError** err) {
131
131
  return NULL;
132
132
  }
133
133
 
134
- if (plen == 1) {
134
+ bool is_data = strcmp(op->input, "data") == 0;
135
+ voxgig_value* reqselector = is_data ? ctx->reqdata : ctx->reqmatch;
136
+ voxgig_value* selector = is_data ? ctx->data : ctx->mtch;
137
+
138
+ // A lone point still needs the call's action to agree with its own; the
139
+ // selection below refuses a mismatch either way.
140
+ if (plen == 1 &&
141
+ v_eq(getp(reqselector, "$action"),
142
+ getp(to_map(getp(get_elem_i(points, 0), "select")), "$action"))) {
135
143
  ctx->point = get_elem_i(points, 0);
136
144
  } else {
137
- bool is_data = strcmp(op->input, "data") == 0;
138
- voxgig_value* reqselector = is_data ? ctx->reqdata : ctx->reqmatch;
139
- voxgig_value* selector = is_data ? ctx->data : ctx->mtch;
140
-
141
145
  voxgig_value* point = voxgig_new_undef();
142
146
  bool matched = false;
143
147
  for (int64_t i = 0; i < plen; i++) {
@@ -1188,7 +1188,13 @@
1188
1188
  (zero? (vs/size (op-points op)))
1189
1189
  [nil (ctx-error ctx "point_no_points"
1190
1190
  (str "Operation \"" (op-name op) "\" has no endpoint definitions."))]
1191
- (= 1 (vs/size (op-points op)))
1191
+ ;; A lone point still needs the call's action to agree with its
1192
+ ;; own; the selection below refuses a mismatch either way.
1193
+ (and (= 1 (vs/size (op-points op)))
1194
+ (= (vs/getprop (if (= (op-input op) "data") (oget ctx :reqdata) (oget ctx :reqmatch))
1195
+ "$action")
1196
+ (vs/getprop (to-map (vs/getprop (vs/getelem (op-points op) 0) "select"))
1197
+ "$action")))
1192
1198
  (do (oset! ctx :point (vs/getelem (op-points op) 0)) [(oget ctx :point) nil])
1193
1199
  :else
1194
1200
  (let [datainput (= (op-input op) "data")
@@ -801,19 +801,23 @@ inline Value makePoint(CtxPtr ctx) {
801
801
  "Operation \"" + op->name + "\" has no endpoint definitions.");
802
802
  }
803
803
 
804
- if (op->points.size() == 1) {
805
- ctx->point = op->points[0];
804
+ Value reqselector;
805
+ Value selector;
806
+ if (op->input == "data") {
807
+ reqselector = ctx->reqdata;
808
+ selector = ctx->data;
806
809
  } else {
807
- Value reqselector;
808
- Value selector;
809
- if (op->input == "data") {
810
- reqselector = ctx->reqdata;
811
- selector = ctx->data;
812
- } else {
813
- reqselector = ctx->reqmatch;
814
- selector = ctx->match;
815
- }
810
+ reqselector = ctx->reqmatch;
811
+ selector = ctx->match;
812
+ }
816
813
 
814
+ // A lone point still needs the call's action to agree with its own; the
815
+ // selection below refuses a mismatch either way.
816
+ if (op->points.size() == 1 &&
817
+ getp(reqselector, "$action", Value(nullptr)) ==
818
+ getp(Helpers::toMapAny(getp(op->points[0], "select")), "$action", Value(nullptr))) {
819
+ ctx->point = op->points[0];
820
+ } else {
817
821
  Value point;
818
822
  bool matched = false;
819
823
  for (size_t i = 0; i < op->points.size(); i++) {
@@ -109,26 +109,30 @@ public static partial class SdkUtility
109
109
  "Operation \"" + op.Name + "\" has no endpoint definitions.");
110
110
  }
111
111
 
112
- if (op.Points.Count == 1)
112
+ Dictionary<string, object?>? reqselector;
113
+ Dictionary<string, object?>? selector;
114
+
115
+ if (op.Input == "data")
113
116
  {
114
- ctx.Point = op.Points[0];
117
+ reqselector = ctx.Reqdata;
118
+ selector = ctx.Data;
115
119
  }
116
120
  else
117
121
  {
118
- Dictionary<string, object?>? reqselector;
119
- Dictionary<string, object?>? selector;
120
-
121
- if (op.Input == "data")
122
- {
123
- reqselector = ctx.Reqdata;
124
- selector = ctx.Data;
125
- }
126
- else
127
- {
128
- reqselector = ctx.Reqmatch;
129
- selector = ctx.Match;
130
- }
122
+ reqselector = ctx.Reqmatch;
123
+ selector = ctx.Match;
124
+ }
131
125
 
126
+ // A lone point still needs the call's action to agree with its own;
127
+ // the selection below refuses a mismatch either way.
128
+ if (op.Points.Count == 1 && Equals(
129
+ StructUtils.GetProp(reqselector, "$action"),
130
+ StructUtils.GetProp(Helpers.ToMapAny(StructUtils.GetProp(op.Points[0], "select")), "$action")))
131
+ {
132
+ ctx.Point = op.Points[0];
133
+ }
134
+ else
135
+ {
132
136
  Dictionary<string, object?>? point = null;
133
137
  var matched = false;
134
138
  foreach (var candidate in op.Points)
@@ -947,6 +947,18 @@ defmodule ProjectName.Utility do
947
947
  end
948
948
  end
949
949
 
950
+ # A lone point still needs the call's action to agree with its own; the
951
+ # selection below refuses a mismatch either way.
952
+ defp lone_point_agrees?(ctx, op, point) do
953
+ reqselector =
954
+ if S.getprop(op, "input") == "data",
955
+ do: S.getprop(ctx, "reqdata"),
956
+ else: S.getprop(ctx, "reqmatch")
957
+
958
+ S.getprop(reqselector, "$action") ==
959
+ S.getprop(H.to_map(S.getprop(point, "select")), "$action")
960
+ end
961
+
950
962
  def make_point_impl(ctx) do
951
963
  out = S.getprop(ctx, "out")
952
964
  pre = S.getprop(out, "point")
@@ -979,7 +991,7 @@ defmodule ProjectName.Utility do
979
991
  Context.make_error(ctx, "point_no_points",
980
992
  "Operation \"" <> opname <> "\" has no endpoint definitions.")}
981
993
 
982
- npoints == 1 ->
994
+ npoints == 1 and lone_point_agrees?(ctx, op, S.getelem(points, 0)) ->
983
995
  S.setprop(ctx, "point", S.getelem(points, 0))
984
996
  {S.getprop(ctx, "point"), nil}
985
997
 
@@ -95,20 +95,24 @@ func makePointUtil(ctx *core.Context) (map[string]any, error) {
95
95
  "Operation \""+op.Name+"\" has no endpoint definitions.")
96
96
  }
97
97
 
98
- if len(op.Points) == 1 {
99
- ctx.Point = op.Points[0]
98
+ var reqselector map[string]any
99
+ var selector map[string]any
100
+
101
+ if op.Input == "data" {
102
+ reqselector = ctx.Reqdata
103
+ selector = ctx.Data
100
104
  } else {
101
- var reqselector map[string]any
102
- var selector map[string]any
103
-
104
- if op.Input == "data" {
105
- reqselector = ctx.Reqdata
106
- selector = ctx.Data
107
- } else {
108
- reqselector = ctx.Reqmatch
109
- selector = ctx.Match
110
- }
105
+ reqselector = ctx.Reqmatch
106
+ selector = ctx.Match
107
+ }
111
108
 
109
+ // A lone point still needs the call's action to agree with its own; the
110
+ // selection below refuses a mismatch either way.
111
+ if len(op.Points) == 1 &&
112
+ vs.GetProp(reqselector, "$action") ==
113
+ vs.GetProp(vs.GetProp(op.Points[0], "select"), "$action") {
114
+ ctx.Point = op.Points[0]
115
+ } else {
112
116
  var point map[string]any
113
117
  matched := false
114
118
  for i := 0; i < len(op.Points); i++ {
@@ -105,22 +105,27 @@ final class MakePoint {
105
105
  "Operation \"" + op.name + "\" has no endpoint definitions.");
106
106
  }
107
107
 
108
- if (op.points.size() == 1) {
109
- ctx.point = op.points.get(0);
108
+ Map<String, Object> reqselector;
109
+ Map<String, Object> selector;
110
+
111
+ if ("data".equals(op.input)) {
112
+ reqselector = ctx.reqdata;
113
+ selector = ctx.data;
110
114
  }
111
115
  else {
112
- Map<String, Object> reqselector;
113
- Map<String, Object> selector;
114
-
115
- if ("data".equals(op.input)) {
116
- reqselector = ctx.reqdata;
117
- selector = ctx.data;
118
- }
119
- else {
120
- reqselector = ctx.reqmatch;
121
- selector = ctx.match;
122
- }
116
+ reqselector = ctx.reqmatch;
117
+ selector = ctx.match;
118
+ }
123
119
 
120
+ // A lone point still needs the call's action to agree with its own; the
121
+ // selection below refuses a mismatch either way.
122
+ if (op.points.size() == 1 && java.util.Objects.equals(
123
+ Struct.getprop(reqselector, "$action", null),
124
+ Struct.getprop(Helpers.toMapAny(Struct.getprop(op.points.get(0), "select")),
125
+ "$action", null))) {
126
+ ctx.point = op.points.get(0);
127
+ }
128
+ else {
124
129
  Map<String, Object> point = null;
125
130
  boolean matched = false;
126
131
  for (int i = 0; i < op.points.size(); i++) {
@@ -48,6 +48,11 @@ function ownPoint(points) {
48
48
  }
49
49
 
50
50
 
51
+ function sameAction(called, declared) {
52
+ return null == called ? null == declared : called === declared
53
+ }
54
+
55
+
51
56
  // The path parameters of a point that neither the call nor the entity gives a
52
57
  // value for, looked up as prepareParams looks them up.
53
58
  function unfilled(ctx, point) {
@@ -84,15 +89,17 @@ function makePoint(ctx) {
84
89
  'Operation "' + op.name + '" has no endpoint definitions.')
85
90
  }
86
91
 
87
- // Choose the appropriate point based on the match or data.
88
- if (1 === op.points.length) {
92
+ // Operation argument has priority, but also look in current data or match.
93
+ const reqselector = getprop(ctx, 'req' + op.input)
94
+ const selector = getprop(ctx, op.input)
95
+
96
+ // A lone point still needs the call's action to agree with its own; the
97
+ // selection below refuses a mismatch either way.
98
+ if (1 === op.points.length &&
99
+ sameAction(getprop(reqselector, '$action'), getprop(op.points[0].select, '$action'))) {
89
100
  ctx.point = op.points[0]
90
101
  }
91
102
  else {
92
- // Operation argument has priority, but also look in current data or match.
93
- const reqselector = getprop(ctx, 'req' + op.input)
94
- const selector = getprop(ctx, op.input)
95
-
96
103
  let point
97
104
  let matched = false
98
105
  for (let i = 0; i < op.points.length; i++) {
@@ -93,20 +93,25 @@ fun makePoint(ctx: Context): Map<String, Any?> {
93
93
  )
94
94
  }
95
95
 
96
- if (op.points.size == 1) {
97
- ctx.point = op.points[0]
96
+ val reqselector: MutableMap<String, Any?>?
97
+ val selector: MutableMap<String, Any?>?
98
+
99
+ if ("data" == op.input) {
100
+ reqselector = ctx.reqdata
101
+ selector = ctx.data
98
102
  } else {
99
- val reqselector: MutableMap<String, Any?>?
100
- val selector: MutableMap<String, Any?>?
101
-
102
- if ("data" == op.input) {
103
- reqselector = ctx.reqdata
104
- selector = ctx.data
105
- } else {
106
- reqselector = ctx.reqmatch
107
- selector = ctx.match
108
- }
103
+ reqselector = ctx.reqmatch
104
+ selector = ctx.match
105
+ }
109
106
 
107
+ // A lone point still needs the call's action to agree with its own; the
108
+ // selection below refuses a mismatch either way.
109
+ if (op.points.size == 1 &&
110
+ Struct.getprop(reqselector, "\$action", null) ==
111
+ Struct.getprop(Helpers.toMapAny(Struct.getprop(op.points[0], "select")), "\$action", null)
112
+ ) {
113
+ ctx.point = op.points[0]
114
+ } else {
110
115
  var point: MutableMap<String, Any?>? = null
111
116
  var matched = false
112
117
  for (i in op.points.indices) {
@@ -94,18 +94,22 @@ local function make_point_util(ctx)
94
94
  'Operation "' .. op.name .. '" has no endpoint definitions.')
95
95
  end
96
96
 
97
- if #op.points == 1 then
98
- ctx.point = op.points[1]
97
+ local reqselector, selector
98
+ if op.input == "data" then
99
+ reqselector = ctx.reqdata
100
+ selector = ctx.data
99
101
  else
100
- local reqselector, selector
101
- if op.input == "data" then
102
- reqselector = ctx.reqdata
103
- selector = ctx.data
104
- else
105
- reqselector = ctx.reqmatch
106
- selector = ctx.match
107
- end
102
+ reqselector = ctx.reqmatch
103
+ selector = ctx.match
104
+ end
108
105
 
106
+ -- A lone point still needs the call's action to agree with its own; the
107
+ -- selection below refuses a mismatch either way.
108
+ if #op.points == 1 and
109
+ vs.getprop(reqselector, "$action") ==
110
+ vs.getprop(vs.getprop(op.points[1], "select"), "$action") then
111
+ ctx.point = op.points[1]
112
+ else
109
113
  local point = nil
110
114
  local matched = false
111
115
  for i = 1, #op.points do
@@ -1190,14 +1190,18 @@ let make_point_util (ctx : ctx) : (value * sdk_error option) =
1190
1190
  ("Operation \"" ^ op.op_name ^ "\" not allowed by SDK option allow.op value: \"" ^ allow_op ^ "\"")))
1191
1191
  else begin
1192
1192
  let points = match op.op_points with List r -> !r | _ -> [] in
1193
+ let reqselector, selector =
1194
+ if op.op_input = "data" then ctx.c_reqdata, ctx.c_data
1195
+ else ctx.c_reqmatch, ctx.c_match in
1196
+ (* A lone point still needs the call's action to agree with its own; the
1197
+ selection below refuses a mismatch either way. *)
1198
+ let agrees single =
1199
+ getp reqselector "$action" = getp (to_map (getp single "select")) "$action" in
1193
1200
  match points with
1194
1201
  | [] -> (Noval, Some (ctx_make_error ctx "point_no_points"
1195
1202
  ("Operation \"" ^ op.op_name ^ "\" has no endpoint definitions.")))
1196
- | [single] -> ctx.c_point <- single; (ctx.c_point, None)
1203
+ | [single] when agrees single -> ctx.c_point <- single; (ctx.c_point, None)
1197
1204
  | _ ->
1198
- let reqselector, selector =
1199
- if op.op_input = "data" then ctx.c_reqdata, ctx.c_data
1200
- else ctx.c_reqmatch, ctx.c_match in
1201
1205
  let chosen = ref Noval in
1202
1206
  let matched = ref false in
1203
1207
  let n = List.length points in
@@ -100,13 +100,17 @@ $REGISTRY{make_point} = sub {
100
100
  "Operation \"$op->{name}\" has no endpoint definitions."));
101
101
  }
102
102
 
103
- if (1 == @{ $op->{points} }) {
103
+ my $reqselector = ('data' eq $op->{input}) ? $ctx->{reqdata} : $ctx->{reqmatch};
104
+ my $selector = ('data' eq $op->{input}) ? $ctx->{data} : $ctx->{match};
105
+
106
+ # A lone point still needs the call's action to agree with its own; the
107
+ # selection below refuses a mismatch either way.
108
+ if (1 == @{ $op->{points} } &&
109
+ ProjectNameHelpers::eqv(ProjectNameHelpers::gp($reqselector, '$action'),
110
+ ProjectNameHelpers::gp(ProjectNameHelpers::gp($op->{points}[0], 'select'), '$action'))) {
104
111
  $ctx->{point} = $op->{points}[0];
105
112
  }
106
113
  else {
107
- my $reqselector = ('data' eq $op->{input}) ? $ctx->{reqdata} : $ctx->{reqmatch};
108
- my $selector = ('data' eq $op->{input}) ? $ctx->{data} : $ctx->{match};
109
-
110
114
  my $point;
111
115
  my $matched = 0;
112
116
  for my $p (@{ $op->{points} }) {
@@ -53,12 +53,17 @@ class ProjectNameMakePoint
53
53
  "Operation \"{$op->name}\" has no endpoint definitions.")];
54
54
  }
55
55
 
56
- if (count($op->points) === 1) {
56
+ $reqselector = $op->input === 'data' ? $ctx->reqdata : $ctx->reqmatch;
57
+ $selector = $op->input === 'data' ? $ctx->data : $ctx->match;
58
+
59
+ // A lone point still needs the call's action to agree with its own;
60
+ // the selection below refuses a mismatch either way.
61
+ if (count($op->points) === 1 &&
62
+ \Voxgig\Struct\Struct::getprop($reqselector, '$action') ===
63
+ \Voxgig\Struct\Struct::getprop(
64
+ \Voxgig\Struct\Struct::getprop($op->points[0], 'select'), '$action')) {
57
65
  $ctx->point = $op->points[0];
58
66
  } else {
59
- $reqselector = $op->input === 'data' ? $ctx->reqdata : $ctx->reqmatch;
60
- $selector = $op->input === 'data' ? $ctx->data : $ctx->match;
61
-
62
67
  $point = null;
63
68
  $matched = false;
64
69
  foreach ($op->points as $p) {
@@ -80,16 +80,20 @@ def make_point_util(ctx):
80
80
  return None, ctx.make_error("point_no_points",
81
81
  'Operation "' + op.name + '" has no endpoint definitions.')
82
82
 
83
- if len(op.points) == 1:
83
+ if op.input == "data":
84
+ reqselector = ctx.reqdata
85
+ selector = ctx.data
86
+ else:
87
+ reqselector = ctx.reqmatch
88
+ selector = ctx.match
89
+
90
+ # A lone point still needs the call's action to agree with its own; the
91
+ # selection below refuses a mismatch either way.
92
+ if len(op.points) == 1 and \
93
+ vs.getprop(reqselector, "$action") == \
94
+ vs.getprop(vs.getprop(op.points[0], "select"), "$action"):
84
95
  ctx.point = op.points[0]
85
96
  else:
86
- if op.input == "data":
87
- reqselector = ctx.reqdata
88
- selector = ctx.data
89
- else:
90
- reqselector = ctx.reqmatch
91
- selector = ctx.match
92
-
93
97
  point = None
94
98
  matched = False
95
99
  for i in range(len(op.points)):
@@ -41,12 +41,16 @@ module ProjectNameUtilities
41
41
  "Operation \"#{op.name}\" has no endpoint definitions.")
42
42
  end
43
43
 
44
- if op.points.length == 1
44
+ reqselector = op.input == "data" ? ctx.reqdata : ctx.reqmatch
45
+ selector = op.input == "data" ? ctx.data : ctx.match
46
+
47
+ # A lone point still needs the call's action to agree with its own; the
48
+ # selection below refuses a mismatch either way.
49
+ if op.points.length == 1 &&
50
+ VoxgigStruct.getprop(reqselector, "$action") ==
51
+ VoxgigStruct.getprop(VoxgigStruct.getprop(op.points[0], "select"), "$action")
45
52
  ctx.point = op.points[0]
46
53
  else
47
- reqselector = op.input == "data" ? ctx.reqdata : ctx.reqmatch
48
- selector = op.input == "data" ? ctx.data : ctx.match
49
-
50
54
  point = nil
51
55
  matched = false
52
56
  op.points.each do |p|
@@ -113,16 +113,20 @@ pub fn make_point_util(ctx: &Rc<Context>) -> Result<Value, ProjectNameError> {
113
113
  ));
114
114
  }
115
115
 
116
- if plen == 1 {
117
- let point = vs::get_elem(&points, &Value::Num(0.0), Value::Noval);
118
- *ctx.point.borrow_mut() = point;
116
+ let (reqselector, selector) = if op.input == "data" {
117
+ (ctx.reqdata.borrow().clone(), ctx.data.borrow().clone())
119
118
  } else {
120
- let (reqselector, selector) = if op.input == "data" {
121
- (ctx.reqdata.borrow().clone(), ctx.data.borrow().clone())
122
- } else {
123
- (ctx.reqmatch.borrow().clone(), ctx.mtch.borrow().clone())
124
- };
119
+ (ctx.reqmatch.borrow().clone(), ctx.mtch.borrow().clone())
120
+ };
125
121
 
122
+ // A lone point still needs the call's action to agree with its own; the
123
+ // selection below refuses a mismatch either way.
124
+ let lone = vs::get_elem(&points, &Value::Num(0.0), Value::Noval);
125
+ if plen == 1
126
+ && getp(&reqselector, "$action") == getp(&to_map(&getp(&lone, "select")), "$action")
127
+ {
128
+ *ctx.point.borrow_mut() = lone;
129
+ } else {
126
130
  let mut point = Value::Noval;
127
131
  let mut matched = false;
128
132
  for i in 0..plen {
@@ -148,12 +148,16 @@ object MakePoint {
148
148
  throw ctx.makeError("point_no_points", "Operation \"" + op.name + "\" has no endpoint definitions.")
149
149
  }
150
150
 
151
- if (op.points.size() == 1) {
151
+ val reqselector: JMap[String, Object] = if ("data" == op.input) ctx.reqdata else ctx.reqmatch
152
+ val selector: JMap[String, Object] = if ("data" == op.input) ctx.data else ctx.matchData
153
+
154
+ // A lone point still needs the call's action to agree with its own; the
155
+ // selection below refuses a mismatch either way.
156
+ if (op.points.size() == 1 && Objects.equals(
157
+ Struct.getprop(reqselector, "$action", null),
158
+ Struct.getprop(Helpers.toMapAny(Struct.getprop(op.points.get(0), "select")), "$action", null))) {
152
159
  ctx.point = op.points.get(0)
153
160
  } else {
154
- val reqselector: JMap[String, Object] = if ("data" == op.input) ctx.reqdata else ctx.reqmatch
155
- val selector: JMap[String, Object] = if ("data" == op.input) ctx.data else ctx.matchData
156
-
157
161
  var point: JMap[String, Object] = null
158
162
  var matched = false
159
163
  var i = 0
@@ -56,19 +56,22 @@ func makePointUtil(_ ctx: Context) throws -> VMap? {
56
56
  "Operation \"\(op.name)\" has no endpoint definitions.")
57
57
  }
58
58
 
59
- if op.points.count == 1 {
60
- ctx.point = op.points[0]
59
+ let reqselector: VMap
60
+ let selector: VMap
61
+ if op.input == "data" {
62
+ reqselector = ctx.reqdata
63
+ selector = ctx.data
61
64
  } else {
62
- let reqselector: VMap
63
- let selector: VMap
64
- if op.input == "data" {
65
- reqselector = ctx.reqdata
66
- selector = ctx.data
67
- } else {
68
- reqselector = ctx.reqmatch
69
- selector = ctx.match
70
- }
65
+ reqselector = ctx.reqmatch
66
+ selector = ctx.match
67
+ }
71
68
 
69
+ // A lone point still needs the call's action to agree with its own; the
70
+ // selection below refuses a mismatch either way.
71
+ if op.points.count == 1 &&
72
+ gp(reqselector, "$action") == gp(gp(op.points[0], "select"), "$action") {
73
+ ctx.point = op.points[0]
74
+ } else {
72
75
  var point: VMap? = nil
73
76
  var matched = false
74
77
  for candidate in op.points {
@@ -29,6 +29,11 @@ function ownPoint(points: any[]): any {
29
29
  }
30
30
 
31
31
 
32
+ function sameAction(called: any, declared: any): boolean {
33
+ return null == called ? null == declared : called === declared
34
+ }
35
+
36
+
32
37
  // The path parameters of a point that neither the call nor the entity gives a
33
38
  // value for, looked up as prepareParams looks them up.
34
39
  function unfilled(ctx: Context, point: any): string[] {
@@ -64,15 +69,17 @@ function makePoint(ctx: Context): Point | Error {
64
69
  'Operation "' + op.name + '" has no endpoint definitions.')
65
70
  }
66
71
 
67
- // Choose the appropriate point based on the match or data.
68
- if (1 === op.points.length) {
72
+ // Operation argument has priority, but also look in current data or match.
73
+ const reqselector = getprop(ctx, 'req' + op.input)
74
+ const selector = getprop(ctx, op.input)
75
+
76
+ // A lone point still needs the call's action to agree with its own; the
77
+ // selection below refuses a mismatch either way.
78
+ if (1 === op.points.length &&
79
+ sameAction(getprop(reqselector, '$action'), getprop(op.points[0].select, '$action'))) {
69
80
  ctx.point = op.points[0]
70
81
  }
71
82
  else {
72
- // Operation argument has priority, but also look in current data or match.
73
- const reqselector = getprop(ctx, 'req' + op.input)
74
- const selector = getprop(ctx, op.input)
75
-
76
83
  let point
77
84
  let matched = false
78
85
  for (let i = 0; i < op.points.length; i++) {