@voxgig/sdkgen 4.46.0 → 4.47.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.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/action/check.js +58 -4
- package/dist/action/check.js.map +1 -1
- package/dist/action/doctor.d.ts +5 -0
- package/dist/action/doctor.js +44 -4
- package/dist/action/doctor.js.map +1 -1
- package/dist/action/package.d.ts +1 -1
- package/dist/action/package.js +6 -16
- package/dist/action/package.js.map +1 -1
- package/dist/action/remove.js +15 -4
- package/dist/action/remove.js.map +1 -1
- package/dist/action/resolve.d.ts +1 -0
- package/dist/action/resolve.js +10 -4
- package/dist/action/resolve.js.map +1 -1
- package/dist/admin/status.d.ts +7 -1
- package/dist/admin/status.js +34 -5
- package/dist/admin/status.js.map +1 -1
- package/dist/cmp/AgentGuide.js +27 -15
- package/dist/cmp/AgentGuide.js.map +1 -1
- package/dist/cmp/AgentGuideContent.d.ts +3 -3
- package/dist/cmp/AgentGuideContent.js +22 -11
- package/dist/cmp/AgentGuideContent.js.map +1 -1
- package/dist/cmp/AgentGuideFeature.js +14 -6
- package/dist/cmp/AgentGuideFeature.js.map +1 -1
- package/dist/cmp/AgentGuideTop.js +16 -8
- package/dist/cmp/AgentGuideTop.js.map +1 -1
- package/dist/cmp/Changelog.js +37 -7
- package/dist/cmp/Changelog.js.map +1 -1
- package/dist/cmp/Deploy.js +52 -16
- package/dist/cmp/Deploy.js.map +1 -1
- package/dist/cmp/Entity.js +1 -1
- package/dist/cmp/Entity.js.map +1 -1
- package/dist/cmp/ExternalTarget.js +5 -0
- package/dist/cmp/ExternalTarget.js.map +1 -1
- package/dist/cmp/Feature.js +2 -2
- package/dist/cmp/Feature.js.map +1 -1
- package/dist/cmp/Main.js +1 -1
- package/dist/cmp/Main.js.map +1 -1
- package/dist/cmp/PublishWorkflow.js +63 -53
- package/dist/cmp/PublishWorkflow.js.map +1 -1
- package/dist/cmp/ReadmeIntro.js +1 -1
- package/dist/cmp/ReadmeIntro.js.map +1 -1
- package/dist/cmp/ReadmeModel.js +2 -2
- package/dist/cmp/ReadmeModel.js.map +1 -1
- package/dist/cmp/ReadmeStation.js +3 -3
- package/dist/cmp/ReadmeStation.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +57 -59
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/cmp/Registered.js +1 -1
- package/dist/cmp/Registered.js.map +1 -1
- package/dist/cmp/Security.js +23 -3
- package/dist/cmp/Security.js.map +1 -1
- package/dist/cmp/Test.js +1 -1
- package/dist/cmp/Test.js.map +1 -1
- package/dist/helpers/alongside.d.ts +2 -3
- package/dist/helpers/alongside.js +16 -15
- package/dist/helpers/alongside.js.map +1 -1
- package/dist/helpers/applicability.d.ts +2 -1
- package/dist/helpers/applicability.js +14 -1
- package/dist/helpers/applicability.js.map +1 -1
- package/dist/helpers/component.js +9 -1
- package/dist/helpers/component.js.map +1 -1
- package/dist/helpers/definitionPlan.js +0 -1
- package/dist/helpers/definitionPlan.js.map +1 -1
- package/dist/helpers/doctext.js +1 -0
- package/dist/helpers/doctext.js.map +1 -1
- package/dist/helpers/facts.js +174 -4
- package/dist/helpers/facts.js.map +1 -1
- package/dist/helpers/flowGuard.d.ts +1 -1
- package/dist/helpers/flowGuard.js +20 -7
- package/dist/helpers/flowGuard.js.map +1 -1
- package/dist/helpers/generated.d.ts +1 -0
- package/dist/helpers/generated.js +1 -1
- package/dist/helpers/generated.js.map +1 -1
- package/dist/helpers/graphqlPoint.d.ts +2 -1
- package/dist/helpers/graphqlPoint.js +17 -0
- package/dist/helpers/graphqlPoint.js.map +1 -1
- package/dist/helpers/guardModel.d.ts +2 -0
- package/dist/helpers/guardModel.js +41 -0
- package/dist/helpers/guardModel.js.map +1 -0
- package/dist/helpers/manifest.d.ts +2 -1
- package/dist/helpers/manifest.js +16 -0
- package/dist/helpers/manifest.js.map +1 -1
- package/dist/helpers/mcpTools.d.ts +2 -1
- package/dist/helpers/mcpTools.js +8 -1
- package/dist/helpers/mcpTools.js.map +1 -1
- package/dist/helpers/opShape.js +17 -17
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/packageMeta.d.ts +6 -4
- package/dist/helpers/packageMeta.js +68 -46
- package/dist/helpers/packageMeta.js.map +1 -1
- package/dist/helpers/placement.d.ts +15 -0
- package/dist/helpers/placement.js +76 -0
- package/dist/helpers/placement.js.map +1 -0
- package/dist/helpers/semver.d.ts +2 -1
- package/dist/helpers/semver.js +21 -0
- package/dist/helpers/semver.js.map +1 -1
- package/dist/helpers/serverVars.js +3 -2
- package/dist/helpers/serverVars.js.map +1 -1
- package/dist/helpers/shipped.d.ts +2 -1
- package/dist/helpers/shipped.js +12 -0
- package/dist/helpers/shipped.js.map +1 -1
- package/dist/helpers/sourcestring.d.ts +3 -0
- package/dist/helpers/sourcestring.js +43 -0
- package/dist/helpers/sourcestring.js.map +1 -0
- package/dist/helpers/stdrep.d.ts +1 -1
- package/dist/helpers/stdrep.js +5 -1
- package/dist/helpers/stdrep.js.map +1 -1
- package/dist/helpers/surface.d.ts +7 -0
- package/dist/helpers/surface.js +69 -0
- package/dist/helpers/surface.js.map +1 -0
- package/dist/helpers/targetguard.d.ts +13 -0
- package/dist/helpers/targetguard.js +65 -0
- package/dist/helpers/targetguard.js.map +1 -0
- package/dist/helpers/text.d.ts +3 -1
- package/dist/helpers/text.js +16 -0
- package/dist/helpers/text.js.map +1 -1
- package/dist/helpers/textguard.d.ts +31 -0
- package/dist/helpers/textguard.js +157 -0
- package/dist/helpers/textguard.js.map +1 -0
- package/dist/helpers/title.d.ts +4 -0
- package/dist/helpers/title.js +52 -0
- package/dist/helpers/title.js.map +1 -0
- package/dist/sdkgen.d.ts +4 -6
- package/dist/sdkgen.js +59 -69
- package/dist/sdkgen.js.map +1 -1
- package/dist/testkit.d.ts +6 -2
- package/dist/testkit.js +4 -1
- package/dist/testkit.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/fact.aontu +106 -0
- package/model/sdkgen.aontu +9 -1
- package/package.json +1 -1
- package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +1 -1
- package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +1 -1
- package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +1 -1
- package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +1 -1
- package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +1 -1
- package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +1 -1
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +1 -1
- package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +1 -1
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +1 -1
- package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +1 -1
- package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +1 -1
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +1 -1
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +1 -1
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +1 -1
- package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +1 -1
- package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +1 -1
- package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +1 -1
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +1 -1
- package/project/.sdk/src/cmp/ts/TestDefinition_ts.ts +3 -1
- package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +1 -1
- package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
- package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +2 -1
- package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +11 -2
- package/project/sdkgen-package.json +1 -1
- package/src/action/check.ts +78 -4
- package/src/action/doctor.ts +62 -4
- package/src/action/package.ts +1 -13
- package/src/action/remove.ts +19 -5
- package/src/action/resolve.ts +11 -4
- package/src/admin/status.ts +25 -5
- package/src/cmp/AgentGuide.ts +28 -15
- package/src/cmp/AgentGuideContent.ts +22 -11
- package/src/cmp/AgentGuideFeature.ts +15 -6
- package/src/cmp/AgentGuideTop.ts +17 -8
- package/src/cmp/Changelog.ts +46 -6
- package/src/cmp/Deploy.ts +59 -20
- package/src/cmp/Entity.ts +1 -1
- package/src/cmp/ExternalTarget.ts +6 -0
- package/src/cmp/Feature.ts +3 -3
- package/src/cmp/Main.ts +1 -1
- package/src/cmp/PublishWorkflow.ts +66 -58
- package/src/cmp/ReadmeIntro.ts +1 -1
- package/src/cmp/ReadmeModel.ts +2 -2
- package/src/cmp/ReadmeStation.ts +4 -5
- package/src/cmp/ReadmeTop.ts +60 -60
- package/src/cmp/Registered.ts +1 -1
- package/src/cmp/Security.ts +32 -5
- package/src/cmp/Test.ts +1 -1
- package/src/helpers/alongside.ts +16 -19
- package/src/helpers/applicability.ts +16 -1
- package/src/helpers/component.ts +11 -1
- package/src/helpers/definitionPlan.ts +0 -1
- package/src/helpers/doctext.ts +3 -1
- package/src/helpers/facts.ts +214 -5
- package/src/helpers/flowGuard.ts +22 -7
- package/src/helpers/generated.ts +3 -1
- package/src/helpers/graphqlPoint.ts +20 -1
- package/src/helpers/guardModel.ts +50 -0
- package/src/helpers/manifest.ts +19 -0
- package/src/helpers/mcpTools.ts +11 -1
- package/src/helpers/opShape.ts +16 -16
- package/src/helpers/packageMeta.ts +67 -43
- package/src/helpers/placement.ts +114 -0
- package/src/helpers/semver.ts +26 -0
- package/src/helpers/serverVars.ts +4 -2
- package/src/helpers/shipped.ts +13 -0
- package/src/helpers/sourcestring.ts +47 -0
- package/src/helpers/stdrep.ts +6 -1
- package/src/helpers/surface.ts +82 -0
- package/src/helpers/targetguard.ts +91 -0
- package/src/helpers/text.ts +22 -0
- package/src/helpers/textguard.ts +208 -0
- package/src/helpers/title.ts +59 -0
- package/src/sdkgen.ts +65 -85
- package/src/testkit.ts +12 -0
package/model/fact.aontu
CHANGED
|
@@ -26,8 +26,32 @@ main: kit: target: &: {
|
|
|
26
26
|
agentguide: active: *true | boolean
|
|
27
27
|
test: active: *true | boolean
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
derive: {
|
|
31
|
+
origin: match(maybe(..origname), "", maybe(..name), maybe(..origname))
|
|
32
|
+
legacy: match(maybe(..scaffold), true, match(.origin,
|
|
33
|
+
"go-cli", { surface: "cli", consumes: "go" },
|
|
34
|
+
"go-mcp", { surface: "mcp", consumes: "go" },
|
|
35
|
+
"py-data", { surface: "data", consumes: "py" },
|
|
36
|
+
{ surface: "", consumes: "" }), { surface: "", consumes: "" })
|
|
37
|
+
wraps: match(maybe(..consumes), "", maybe(.legacy.consumes), maybe(..consumes))
|
|
38
|
+
}
|
|
29
39
|
fact: {
|
|
40
|
+
origin: maybe(..derive.origin)
|
|
41
|
+
surface: match(maybe(..surface), "", match(maybe(..derive.legacy.surface), "",
|
|
42
|
+
match(maybe(.phase.entity), false, "", "sdk"), maybe(..derive.legacy.surface)),
|
|
43
|
+
maybe(..surface))
|
|
44
|
+
surfaceFrom: match(maybe(..surface), "", match(maybe(..derive.legacy.surface), "",
|
|
45
|
+
match(maybe(.phase.entity), false, "unknown", "entities"), "legacy"), "slot")
|
|
30
46
|
place: match(maybe(..output), { root: true }, "root", { path: "" }, "folder", "external")
|
|
47
|
+
link: {
|
|
48
|
+
readme: match(maybe(..place), "folder", match(maybe($.main.kit.fact."top"), true, "../README.md", ""), "")
|
|
49
|
+
agents: match(maybe(..place), "folder", match(maybe($.main.kit.fact."top"), true, "../AGENTS.md", ""), "")
|
|
50
|
+
}
|
|
51
|
+
docs: {
|
|
52
|
+
readme: match(maybe(..place), "folder", maybe(..phase.readme), false)
|
|
53
|
+
agents: match(maybe(..place), "folder", maybe(..phase.agentguide), false)
|
|
54
|
+
}
|
|
31
55
|
phase: {
|
|
32
56
|
entity: ...phase.entity.active
|
|
33
57
|
feature: ...phase.feature.active
|
|
@@ -39,6 +63,88 @@ main: kit: target: &: {
|
|
|
39
63
|
}
|
|
40
64
|
|
|
41
65
|
|
|
66
|
+
# An unset slot reads as '' here, and an unset prefix as false, because '' is a
|
|
67
|
+
# prefix a project may declare.
|
|
68
|
+
main: kit: config: auth: {
|
|
69
|
+
active: *'' | top
|
|
70
|
+
basic: *'' | top
|
|
71
|
+
in: *'' | top
|
|
72
|
+
name: *'' | top
|
|
73
|
+
prefix: *false | top
|
|
74
|
+
}
|
|
75
|
+
main: kit: info: {
|
|
76
|
+
auth: *'' | top
|
|
77
|
+
security: {
|
|
78
|
+
type: *'' | top
|
|
79
|
+
in: *'' | top
|
|
80
|
+
name: *'' | top
|
|
81
|
+
prefix: *false | top
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
main: kit: derive: auth: {
|
|
86
|
+
declared: match(maybe($.main.kit.info.auth), false, false, true)
|
|
87
|
+
basic: match(maybe($.main.kit.info.security.type), "http",
|
|
88
|
+
match(maybe($.main.kit.info.security.prefix), false, false,
|
|
89
|
+
match(lower(maybe($.main.kit.info.security.prefix)), "basic", true, false)), false)
|
|
90
|
+
in: match(maybe($.main.kit.info.security.in), "", "header", lower(maybe($.main.kit.info.security.in)))
|
|
91
|
+
name: match(maybe($.main.kit.info.security.name), "", "Authorization", maybe($.main.kit.info.security.name))
|
|
92
|
+
prefix: match(maybe($.main.kit.info.security.prefix), false, "Bearer", maybe($.main.kit.info.security.prefix))
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
main: kit: fact: auth: {
|
|
96
|
+
apikey: match(maybe($.main.kit.config.auth.active), true, true, false, false,
|
|
97
|
+
maybe($.main.kit.derive.auth.declared))
|
|
98
|
+
suppressed: match(maybe($.main.kit.config.auth.active), false, true, false)
|
|
99
|
+
basic: match(maybe($.main.kit.config.auth.basic), true, true, false, false,
|
|
100
|
+
"", maybe($.main.kit.derive.auth.basic), true)
|
|
101
|
+
in: match(maybe($.main.kit.config.auth.in), "", maybe($.main.kit.derive.auth.in),
|
|
102
|
+
lower(maybe($.main.kit.config.auth.in)))
|
|
103
|
+
name: match(maybe($.main.kit.config.auth.name), "", maybe($.main.kit.derive.auth.name),
|
|
104
|
+
maybe($.main.kit.config.auth.name))
|
|
105
|
+
prefix: match(maybe($.main.kit.config.auth.prefix), false, maybe($.main.kit.derive.auth.prefix),
|
|
106
|
+
maybe($.main.kit.config.auth.prefix))
|
|
107
|
+
secret: match(maybe($.main.kit.fact.auth.basic), true,
|
|
108
|
+
match(maybe($.main.kit.fact.auth.in), "header",
|
|
109
|
+
match(maybe($.main.kit.fact.auth.suppressed), false, true, false), false), false)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# An out-of-tree target that declares no sdkrel has it derived at generate.
|
|
113
|
+
main: kit: target: &: {
|
|
114
|
+
fact: {
|
|
115
|
+
dir: match(maybe(.place), "root", ".", "folder", maybe(..name), maybe(..output.path))
|
|
116
|
+
sdkrel: match(maybe(.place), "folder", "..", "root", ".", maybe(..output.sdkrel))
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
# Spelled as envToken spells them, from the name the pass supplies.
|
|
121
|
+
main: kit: fact: env: {
|
|
122
|
+
prefix: rep(rep(upper($.name), "[^A-Z0-9]+", "_"), "^_+|_+$", "")
|
|
123
|
+
apikey: $.main.kit.fact.env.prefix + "_APIKEY"
|
|
124
|
+
secret: $.main.kit.fact.env.prefix + "_SECRET"
|
|
125
|
+
base: $.main.kit.fact.env.prefix + "_BASE"
|
|
126
|
+
live: $.main.kit.fact.env.prefix + "_TEST_LIVE"
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
# The first server, as the pass supplies it. Only a word-character name can be
|
|
130
|
+
# one the URL uses in braces; re() takes a bare `-`, and an escaped one not.
|
|
131
|
+
server: variables: &: {
|
|
132
|
+
fact: {
|
|
133
|
+
word: match(key(2), re("^[A-Za-z0-9_]+$"), true, false)
|
|
134
|
+
url: match($.server.url, re(".*[{]" + rep(key(2), "[.\\\\+*?()\\[\\]{}|^$/]", "\\$&") + "[}].*"), true, false)
|
|
135
|
+
used: match(maybe(.word), true, maybe(.url), false)
|
|
136
|
+
required: match(maybe(..default), "", maybe(.used), false)
|
|
137
|
+
env: $.main.kit.fact.env.prefix + "_SERVER_" + upper(key(2))
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
entity: &: {
|
|
142
|
+
fact: {
|
|
143
|
+
entid: $.main.kit.fact.env.prefix + "_TEST_" +
|
|
144
|
+
rep(rep(upper(key(2)), "[^A-Z0-9]+", "_"), "^_+|_+$", "") + "_ENTID"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
42
148
|
escape: &: {
|
|
43
149
|
raw: string
|
|
44
150
|
vendor: boolean
|
package/model/sdkgen.aontu
CHANGED
|
@@ -61,11 +61,13 @@ main: kit: text: close({
|
|
|
61
61
|
|
|
62
62
|
# Who publishes the SDK: the LICENSE copyright holder, the default package
|
|
63
63
|
# author, and where SECURITY.md sends a vulnerability report. An empty name
|
|
64
|
-
# is Voxgig, whose url and security contact then apply.
|
|
64
|
+
# is Voxgig, whose url and security contact then apply. An official
|
|
65
|
+
# publisher owns the API, so nothing calls the SDK unofficial.
|
|
65
66
|
main: kit: publisher: {
|
|
66
67
|
name: *'' | string
|
|
67
68
|
url: *'' | string
|
|
68
69
|
security: *'' | string
|
|
70
|
+
official: *false | boolean
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
|
|
@@ -96,6 +98,10 @@ main: kit: target: &: {
|
|
|
96
98
|
base: *'' | string
|
|
97
99
|
origname: *'' | string
|
|
98
100
|
package: *'' | string
|
|
101
|
+
|
|
102
|
+
surface: *'' | string
|
|
103
|
+
consumes: *'' | string
|
|
104
|
+
|
|
99
105
|
module: {
|
|
100
106
|
name: string
|
|
101
107
|
|
|
@@ -179,6 +185,8 @@ main: kit: entity: &: {
|
|
|
179
185
|
active: *true | boolean
|
|
180
186
|
|
|
181
187
|
alias: {}
|
|
188
|
+
|
|
189
|
+
op: &: active: *true | boolean
|
|
182
190
|
}
|
|
183
191
|
|
|
184
192
|
|
package/package.json
CHANGED
|
@@ -160,7 +160,7 @@ if (err) {
|
|
|
160
160
|
// shape so the docs reference REAL writable fields.
|
|
161
161
|
const examplePairs = (opname: string): string[] => {
|
|
162
162
|
const items = requestExampleItems(exampleEntity, opname)
|
|
163
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
163
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
164
164
|
('create' === opname && !it.optional))
|
|
165
165
|
const required = items.filter((it: any) => !it.optional)
|
|
166
166
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -151,7 +151,7 @@ its record.
|
|
|
151
151
|
// Model-driven example fields from the op shape (opRequestShape).
|
|
152
152
|
const examplePairs = (opname: string): string[] => {
|
|
153
153
|
const items = requestExampleItems(exampleEntity, opname)
|
|
154
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
154
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
155
155
|
('create' === opname && !it.optional))
|
|
156
156
|
const required = items.filter((it: any) => !it.optional)
|
|
157
157
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -161,7 +161,7 @@ try {
|
|
|
161
161
|
|
|
162
162
|
const examplePairs = (opname: string): string[] => {
|
|
163
163
|
const items = requestExampleItems(exampleEntity, opname)
|
|
164
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
164
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
165
165
|
('create' === opname && !it.optional))
|
|
166
166
|
const required = items.filter((it: any) => !it.optional)
|
|
167
167
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -164,7 +164,7 @@ catch (Exception err)
|
|
|
164
164
|
// shape (opRequestShape) so the docs reference REAL writable fields.
|
|
165
165
|
const examplePairs = (opname: string): string[] => {
|
|
166
166
|
const items = requestExampleItems(exampleEntity, opname)
|
|
167
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
167
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
168
168
|
('create' === opname && !it.optional))
|
|
169
169
|
const required = items.filter((it: any) => !it.optional)
|
|
170
170
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -141,7 +141,7 @@ end
|
|
|
141
141
|
// shape so the docs reference REAL writable fields.
|
|
142
142
|
const examplePairs = (opname: string): string[] => {
|
|
143
143
|
const items = requestExampleItems(exampleEntity, opname)
|
|
144
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
144
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
145
145
|
('create' === opname && !it.optional))
|
|
146
146
|
const required = items.filter((it: any) => !it.optional)
|
|
147
147
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -51,7 +51,7 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
|
|
|
51
51
|
|
|
52
52
|
const exampleFields = (opname: string): string[] => {
|
|
53
53
|
const items = requestExampleItems(exampleEntity, opname)
|
|
54
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
54
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
55
55
|
('create' === opname && !it.optional))
|
|
56
56
|
const required = items.filter((it: any) => !it.optional)
|
|
57
57
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -175,7 +175,7 @@ catch (RuntimeException err) {
|
|
|
175
175
|
// shape (opRequestShape) so the docs reference REAL writable fields.
|
|
176
176
|
const examplePairs = (opname: string): string[] => {
|
|
177
177
|
const items = javaMapItems(requestExampleItems(exampleEntity, opname))
|
|
178
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
178
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
179
179
|
('create' === opname && !it.optional))
|
|
180
180
|
const required = items.filter((it: any) => !it.optional)
|
|
181
181
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -46,7 +46,7 @@ const client = ${ctor}
|
|
|
46
46
|
const eVar = exampleVarName(exampleEntity.name, 'js')
|
|
47
47
|
const exampleFields = (opname: string): string[] => {
|
|
48
48
|
const items = requestExampleItems(exampleEntity, opname)
|
|
49
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
49
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
50
50
|
('create' === opname && !it.optional))
|
|
51
51
|
const required = items.filter((it: any) => !it.optional)
|
|
52
52
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -173,7 +173,7 @@ catch (err: RuntimeException) {
|
|
|
173
173
|
// shape (opRequestShape) so the docs reference REAL writable fields.
|
|
174
174
|
const examplePairs = (opname: string): string[] => {
|
|
175
175
|
const items = requestExampleItems(exampleEntity, opname)
|
|
176
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
176
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
177
177
|
('create' === opname && !it.optional))
|
|
178
178
|
const required = items.filter((it: any) => !it.optional)
|
|
179
179
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -162,7 +162,7 @@ ${printRecord(eVar, printCols, '')}
|
|
|
162
162
|
|
|
163
163
|
const examplePairs = (opname: string): string[] => {
|
|
164
164
|
const items = requestExampleItems(exampleEntity, opname)
|
|
165
|
-
.filter((it: any) => !idNames.has(it.name) ||
|
|
165
|
+
.filter((it: any) => (it.name !== idF && (!idNames.has(it.name) || !it.optional)) ||
|
|
166
166
|
('create' === opname && !it.optional))
|
|
167
167
|
const required = items.filter((it: any) => !it.optional)
|
|
168
168
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -143,7 +143,7 @@ record.
|
|
|
143
143
|
// shape so the docs reference REAL writable fields.
|
|
144
144
|
const examplePairs = (opname: string): string[] => {
|
|
145
145
|
const items = requestExampleItems(exampleEntity, opname)
|
|
146
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
146
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
147
147
|
('create' === opname && !it.optional))
|
|
148
148
|
const required = items.filter((it: any) => !it.optional)
|
|
149
149
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -155,7 +155,7 @@ else {
|
|
|
155
155
|
// stays (the call is invalid without it).
|
|
156
156
|
const examplePairs = (opname: string): string[] => {
|
|
157
157
|
const items = requestExampleItems(exampleEntity, opname)
|
|
158
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
158
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
159
159
|
('create' === opname && !it.optional))
|
|
160
160
|
const required = items.filter((it: any) => !it.optional)
|
|
161
161
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -155,7 +155,7 @@ try {
|
|
|
155
155
|
|
|
156
156
|
const examplePairs = (opname: string): string[] => {
|
|
157
157
|
const items = requestExampleItems(exampleEntity, opname)
|
|
158
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
158
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
159
159
|
('create' === opname && !it.optional))
|
|
160
160
|
const required = items.filter((it: any) => !it.optional)
|
|
161
161
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -153,7 +153,7 @@ except Exception as err:
|
|
|
153
153
|
|
|
154
154
|
const examplePairs = (opname: string): string[] => {
|
|
155
155
|
const items = requestExampleItems(exampleEntity, opname)
|
|
156
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
156
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
157
157
|
('create' === opname && !it.optional))
|
|
158
158
|
const required = items.filter((it: any) => !it.optional)
|
|
159
159
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -159,7 +159,7 @@ end
|
|
|
159
159
|
|
|
160
160
|
const examplePairs = (opname: string): string[] => {
|
|
161
161
|
const items = requestExampleItems(exampleEntity, opname)
|
|
162
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
162
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
163
163
|
('create' === opname && !it.optional))
|
|
164
164
|
const required = items.filter((it: any) => !it.optional)
|
|
165
165
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -147,7 +147,7 @@ match client.${method}(Value::Noval).load(${loadArg}, Value::Noval) {
|
|
|
147
147
|
// shape so the docs reference REAL writable fields.
|
|
148
148
|
const examplePairs = (opname: string): string[] => {
|
|
149
149
|
const items = requestExampleItems(exampleEntity, opname)
|
|
150
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
150
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
151
151
|
('create' === opname && !it.optional))
|
|
152
152
|
const required = items.filter((it: any) => !it.optional)
|
|
153
153
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -158,7 +158,7 @@ catch {
|
|
|
158
158
|
// shape (opRequestShape) so the docs reference REAL writable fields.
|
|
159
159
|
const examplePairs = (opname: string): string[] => {
|
|
160
160
|
const items = javaMapItems(requestExampleItems(exampleEntity, opname))
|
|
161
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
161
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
162
162
|
('create' === opname && !it.optional))
|
|
163
163
|
const required = items.filter((it: any) => !it.optional)
|
|
164
164
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -179,7 +179,7 @@ catch {
|
|
|
179
179
|
// shape (opRequestShape) so the docs reference REAL writable fields.
|
|
180
180
|
const examplePairs = (opname: string): string[] => {
|
|
181
181
|
const items = requestExampleItems(exampleEntity, opname)
|
|
182
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
182
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
183
183
|
('create' === opname && !it.optional))
|
|
184
184
|
const required = items.filter((it: any) => !it.optional)
|
|
185
185
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -154,7 +154,7 @@ try {
|
|
|
154
154
|
opnames.includes('remove')) {
|
|
155
155
|
const exampleFields = (opname: string): string[] => {
|
|
156
156
|
const items = requestExampleItems(exampleEntity, opname)
|
|
157
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
157
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
158
158
|
('create' === opname && !it.optional))
|
|
159
159
|
const required = items.filter((it: any) => !it.optional)
|
|
160
160
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -16,7 +16,9 @@ import { isControlSkipped } from './utility'
|
|
|
16
16
|
// Generated from the API definition, not from the model this SDK was built
|
|
17
17
|
// from: the route, the declared query parameters, the credential the security
|
|
18
18
|
// scheme names, and the definition's own response example.
|
|
19
|
-
|
|
19
|
+
// A JSON string, not an array literal: tsc types a literal as the union of its
|
|
20
|
+
// elements, and past about a thousand routes fails with TS2590.
|
|
21
|
+
const PLAN: any[] = JSON.parse(${JSON.stringify(JSON.stringify(plan))})
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
describe('definition', () => {
|
|
@@ -145,7 +145,7 @@ switch (client.${method}(h.vnull()).load(${loadArg}, h.vnull())) {
|
|
|
145
145
|
// shape so the docs reference REAL writable fields.
|
|
146
146
|
const examplePairs = (opname: string): string[] => {
|
|
147
147
|
const items = requestExampleItems(exampleEntity, opname)
|
|
148
|
-
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
148
|
+
.filter((it: any) => (it.name !== idF && (it.name !== 'id' || !it.optional)) ||
|
|
149
149
|
('create' === opname && !it.optional))
|
|
150
150
|
const required = items.filter((it: any) => !it.optional)
|
|
151
151
|
const optional = items.filter((it: any) => it.optional)
|
|
@@ -300,7 +300,9 @@ let drive_entity (client : sdk_client) (r : recorder) : (unit, string) Stdlib.re
|
|
|
300
300
|
(* An op the entity does not define, or a route the call
|
|
301
301
|
* cannot fill, fails before the chain is consulted: keep
|
|
302
302
|
* going. Anything else is the answer. *)
|
|
303
|
-
if
|
|
303
|
+
if List.mem e.err_code
|
|
304
|
+
["unsupported_op"; "url_param_missing"; "point_no_match"; "point_action_required"]
|
|
305
|
+
then ops more
|
|
304
306
|
else (out := Error e.err_msg)
|
|
305
307
|
| exception e -> out := Error (Printexc.to_string e))
|
|
306
308
|
in
|
|
@@ -294,7 +294,8 @@ class ProjectNameSecretsTest extends TestCase
|
|
|
294
294
|
function (\Throwable $error) use (&$caught) {
|
|
295
295
|
// A call whose route it cannot fill is refused before the
|
|
296
296
|
// chain is consulted, so it is not the refusal under test.
|
|
297
|
-
if ($error instanceof ProjectNameError &&
|
|
297
|
+
if ($error instanceof ProjectNameError &&
|
|
298
|
+
!in_array($error->sdk_code, ['url_param_missing', 'point_no_match', 'point_action_required'], true)) {
|
|
298
299
|
$caught = $error;
|
|
299
300
|
}
|
|
300
301
|
});
|
|
@@ -54,6 +54,15 @@ fn vnull() Value {
|
|
|
54
54
|
return Value{ .null = {} };
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
// A route the call cannot fill is refused before the chain is consulted.
|
|
58
|
+
fn refusedBeforeChain(code: []const u8) bool {
|
|
59
|
+
const codes = [_][]const u8{ "url_param_missing", "point_no_match", "point_action_required" };
|
|
60
|
+
for (codes) |c| {
|
|
61
|
+
if (std.mem.eql(u8, code, c)) return true;
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
57
66
|
// Every block runs only when the feature is in THIS SDK - build.zig lists
|
|
58
67
|
// this file only then, so this is belt and braces rather than a gate.
|
|
59
68
|
fn present() bool {
|
|
@@ -294,14 +303,14 @@ fn drive_entity(client: *sdk.SDK) Drive {
|
|
|
294
303
|
if (h.getp(ops, "load") == .object) {
|
|
295
304
|
const res = ent.load(h.jo(&.{.{ "id", h.vstr("s01") }}), vnull());
|
|
296
305
|
switch (res) {
|
|
297
|
-
.err => |e| if (!
|
|
306
|
+
.err => |e| if (!refusedBeforeChain(e.code))
|
|
298
307
|
return .{ .ran = true, .ok = false, .msg = e.msg },
|
|
299
308
|
.ok => return .{ .ran = true, .ok = true, .msg = "" },
|
|
300
309
|
}
|
|
301
310
|
} else if (h.getp(ops, "list") == .object) {
|
|
302
311
|
const res = ent.list(h.omap(), vnull());
|
|
303
312
|
switch (res) {
|
|
304
|
-
.err => |e| if (!
|
|
313
|
+
.err => |e| if (!refusedBeforeChain(e.code))
|
|
305
314
|
return .{ .ran = true, .ok = false, .msg = e.msg },
|
|
306
315
|
.ok => return .{ .ran = true, .ok = true, .msg = "" },
|
|
307
316
|
}
|
package/src/action/check.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { kindCollection } from '../helpers/kindCollection'
|
|
2
2
|
|
|
3
3
|
import { unknownTags, TAGS } from '../helpers/applicability'
|
|
4
|
+
import { SURFACES, SURFACE_SINCE } from '../helpers/surface'
|
|
5
|
+
import { applyFacts, fact } from '../helpers/facts'
|
|
6
|
+
import { admitsBelow } from '../helpers/semver'
|
|
7
|
+
import { SDKGEN_VERSION } from '../helpers/shipped'
|
|
8
|
+
import { entityless, entitylessNote } from '../helpers/targetguard'
|
|
4
9
|
import Path from 'node:path'
|
|
5
10
|
|
|
6
11
|
import { KIT } from '../types'
|
|
@@ -14,6 +19,7 @@ import { SdkGenError } from '../utility'
|
|
|
14
19
|
|
|
15
20
|
import {
|
|
16
21
|
MANIFEST,
|
|
22
|
+
parityFinding,
|
|
17
23
|
probePackage,
|
|
18
24
|
validateManifest,
|
|
19
25
|
} from '../helpers/manifest'
|
|
@@ -190,7 +196,11 @@ function checkItems(fs: any, sdk: string, manifest?: Manifest): Finding[] {
|
|
|
190
196
|
continue
|
|
191
197
|
}
|
|
192
198
|
|
|
193
|
-
found.push(...checkDefinition(fs, kind, name, file
|
|
199
|
+
found.push(...checkDefinition(fs, kind, name, file, {
|
|
200
|
+
manifest: Path.join(sdk, '..', MANIFEST),
|
|
201
|
+
tier: manifest?.parity?.[name],
|
|
202
|
+
range: manifest?.engines?.sdkgen,
|
|
203
|
+
}))
|
|
194
204
|
}
|
|
195
205
|
}
|
|
196
206
|
|
|
@@ -198,8 +208,12 @@ function checkItems(fs: any, sdk: string, manifest?: Manifest): Finding[] {
|
|
|
198
208
|
}
|
|
199
209
|
|
|
200
210
|
|
|
211
|
+
// What the manifest says about an item, for the checks that compare the two.
|
|
212
|
+
type Declared = { manifest: string, tier?: string, range?: string }
|
|
213
|
+
|
|
214
|
+
|
|
201
215
|
function checkDefinition(
|
|
202
|
-
fs: any, kind: string, name: string, file: string,
|
|
216
|
+
fs: any, kind: string, name: string, file: string, pkg?: Declared,
|
|
203
217
|
): Finding[] {
|
|
204
218
|
const found: Finding[] = []
|
|
205
219
|
const raw = String(fs.readFileSync(file, 'utf8'))
|
|
@@ -209,7 +223,7 @@ function checkDefinition(
|
|
|
209
223
|
const legacyFile = isLegacyPath(file)
|
|
210
224
|
const legacy = legacyFile || src !== raw
|
|
211
225
|
|
|
212
|
-
const at = (level: 'error' | 'warn', point: string, note: string): Finding =>
|
|
226
|
+
const at = (level: 'error' | 'warn' | 'info', point: string, note: string): Finding =>
|
|
213
227
|
({ level, point, kind, name, file, note: file + ': ' + note })
|
|
214
228
|
|
|
215
229
|
if (legacy) {
|
|
@@ -314,6 +328,17 @@ function checkDefinition(
|
|
|
314
328
|
|
|
315
329
|
if ('target' === kind) {
|
|
316
330
|
found.push(...checkTargetModel(checked, name, file, at))
|
|
331
|
+
|
|
332
|
+
if (0 === unified.errors.length && null != declared) {
|
|
333
|
+
found.push(...checkTargetSurface(unified.model, name, pkg, at))
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const title = (declared as any)?.title
|
|
337
|
+
if (null != declared && ('string' !== typeof title || '' === title.trim())) {
|
|
338
|
+
found.push(at('warn', 'target-title-missing',
|
|
339
|
+
'declares no `title` — the generated documents name this target by its ' +
|
|
340
|
+
"origin's label, else as `" + name + '`'))
|
|
341
|
+
}
|
|
317
342
|
}
|
|
318
343
|
|
|
319
344
|
if ('feature' === kind) {
|
|
@@ -325,7 +350,56 @@ function checkDefinition(
|
|
|
325
350
|
}
|
|
326
351
|
|
|
327
352
|
|
|
328
|
-
type At = (level: 'error' | 'warn', point: string, note: string) => Finding
|
|
353
|
+
type At = (level: 'error' | 'warn' | 'info', point: string, note: string) => Finding
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
// The surface the fact rules give the target, against its parity tier, and
|
|
357
|
+
// its declared word against the releases that read it. Generation reads a
|
|
358
|
+
// word it does not know as unknown, so no word fails it.
|
|
359
|
+
function checkTargetSurface(
|
|
360
|
+
model: any, name: string, pkg: Declared | undefined, at: At,
|
|
361
|
+
): Finding[] {
|
|
362
|
+
let surface: string
|
|
363
|
+
|
|
364
|
+
try {
|
|
365
|
+
applyFacts(model)
|
|
366
|
+
surface = fact(model.main[KIT].target[name], 'surface')
|
|
367
|
+
}
|
|
368
|
+
catch (err: any) {
|
|
369
|
+
return [at('error', 'target-facts', 'the fact rules fail on this target alone: ' + err.message)]
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const found: Finding[] = null == pkg?.tier ? [] :
|
|
373
|
+
parityFinding(pkg.manifest, name, pkg.tier, surface)
|
|
374
|
+
|
|
375
|
+
const target = model.main[KIT].target[name]
|
|
376
|
+
if (entityless(target)) {
|
|
377
|
+
found.push(at('error', 'target-entity-off', entitylessNote(name)))
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const word = target.surface
|
|
381
|
+
if ('string' !== typeof word || '' === word) {
|
|
382
|
+
return found
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const since = SURFACE_SINCE[word]
|
|
386
|
+
if (null == since) {
|
|
387
|
+
found.push(at('warn', 'target-surface-unknown',
|
|
388
|
+
'declares surface `' + word + '`, which sdkgen ' + SDKGEN_VERSION +
|
|
389
|
+
' does not know (' + SURFACES.join(', ') + '): generation reads it as unknown ' +
|
|
390
|
+
'and names the target by its title. A release that introduces the word reads it, ' +
|
|
391
|
+
'from that release on; otherwise it is a misspelling'))
|
|
392
|
+
}
|
|
393
|
+
else if (false !== admitsBelow(pkg?.range ?? '', since)) {
|
|
394
|
+
found.push(at('info', 'target-surface-since',
|
|
395
|
+
'declares surface `' + word + '`, which sdkgen reads from ' + since + '; ' +
|
|
396
|
+
(null == pkg?.range ? 'the manifest declares no `engines.sdkgen`, so it' :
|
|
397
|
+
'`engines.sdkgen` `' + pkg.range + '`') +
|
|
398
|
+
' admits older releases, which ignore the slot'))
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return found
|
|
402
|
+
}
|
|
329
403
|
|
|
330
404
|
|
|
331
405
|
// The publish-override probe: unify the target model with a project that sets
|