@voxgig/sdkgen 4.45.0 → 4.46.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.
Files changed (156) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/action/check.js +15 -0
  3. package/dist/action/check.js.map +1 -1
  4. package/dist/action/copies.js +1 -0
  5. package/dist/action/copies.js.map +1 -1
  6. package/dist/action/doctor.d.ts +21 -2
  7. package/dist/action/doctor.js +166 -9
  8. package/dist/action/doctor.js.map +1 -1
  9. package/dist/action/package.js +9 -0
  10. package/dist/action/package.js.map +1 -1
  11. package/dist/action/remove.js +2 -1
  12. package/dist/action/remove.js.map +1 -1
  13. package/dist/action/target.d.ts +2 -1
  14. package/dist/action/target.js +50 -11
  15. package/dist/action/target.js.map +1 -1
  16. package/dist/cmp/AgentGuide.js +19 -8
  17. package/dist/cmp/AgentGuide.js.map +1 -1
  18. package/dist/cmp/AgentGuideContent.d.ts +6 -4
  19. package/dist/cmp/AgentGuideContent.js +51 -32
  20. package/dist/cmp/AgentGuideContent.js.map +1 -1
  21. package/dist/cmp/AgentGuideFeature.js +5 -3
  22. package/dist/cmp/AgentGuideFeature.js.map +1 -1
  23. package/dist/cmp/AgentGuideTop.js +84 -46
  24. package/dist/cmp/AgentGuideTop.js.map +1 -1
  25. package/dist/cmp/Changelog.js +12 -1
  26. package/dist/cmp/Changelog.js.map +1 -1
  27. package/dist/cmp/Deploy.js +22 -20
  28. package/dist/cmp/Deploy.js.map +1 -1
  29. package/dist/cmp/ExternalTarget.js +5 -5
  30. package/dist/cmp/ExternalTarget.js.map +1 -1
  31. package/dist/cmp/Feature.js +10 -3
  32. package/dist/cmp/Feature.js.map +1 -1
  33. package/dist/cmp/FeatureDocs.d.ts +6 -4
  34. package/dist/cmp/FeatureDocs.js +14 -39
  35. package/dist/cmp/FeatureDocs.js.map +1 -1
  36. package/dist/cmp/FeatureHook.d.ts +7 -1
  37. package/dist/cmp/FeatureHook.js +34 -1
  38. package/dist/cmp/FeatureHook.js.map +1 -1
  39. package/dist/cmp/PublishWorkflow.js +30 -6
  40. package/dist/cmp/PublishWorkflow.js.map +1 -1
  41. package/dist/cmp/ReadmeErrors.js +521 -18
  42. package/dist/cmp/ReadmeErrors.js.map +1 -1
  43. package/dist/cmp/ReadmeExplanation.js +280 -44
  44. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  45. package/dist/cmp/ReadmeFeatures.js +16 -7
  46. package/dist/cmp/ReadmeFeatures.js.map +1 -1
  47. package/dist/cmp/ReadmeIntro.js +3 -2
  48. package/dist/cmp/ReadmeIntro.js.map +1 -1
  49. package/dist/cmp/ReadmeRefFeatures.js +34 -24
  50. package/dist/cmp/ReadmeRefFeatures.js.map +1 -1
  51. package/dist/cmp/ReadmeStation.js +11 -8
  52. package/dist/cmp/ReadmeStation.js.map +1 -1
  53. package/dist/cmp/ReadmeTop.js +472 -373
  54. package/dist/cmp/ReadmeTop.js.map +1 -1
  55. package/dist/cmp/ReadmeUnions.js +8 -2
  56. package/dist/cmp/ReadmeUnions.js.map +1 -1
  57. package/dist/cmp/Security.js +3 -2
  58. package/dist/cmp/Security.js.map +1 -1
  59. package/dist/helpers/applicability.d.ts +2 -1
  60. package/dist/helpers/applicability.js +26 -0
  61. package/dist/helpers/applicability.js.map +1 -1
  62. package/dist/helpers/copymerge.d.ts +3 -0
  63. package/dist/helpers/copymerge.js +43 -10
  64. package/dist/helpers/copymerge.js.map +1 -1
  65. package/dist/helpers/doccheck.d.ts +11 -0
  66. package/dist/helpers/doccheck.js +146 -0
  67. package/dist/helpers/doccheck.js.map +1 -0
  68. package/dist/helpers/doctext.d.ts +11 -0
  69. package/dist/helpers/doctext.js +84 -0
  70. package/dist/helpers/doctext.js.map +1 -0
  71. package/dist/helpers/exampleCall.d.ts +16 -0
  72. package/dist/helpers/exampleCall.js +334 -0
  73. package/dist/helpers/exampleCall.js.map +1 -0
  74. package/dist/helpers/exportnames.d.ts +4 -0
  75. package/dist/helpers/exportnames.js +35 -0
  76. package/dist/helpers/exportnames.js.map +1 -0
  77. package/dist/helpers/facts.d.ts +2 -1
  78. package/dist/helpers/facts.js +37 -2
  79. package/dist/helpers/facts.js.map +1 -1
  80. package/dist/helpers/modelcheck.d.ts +2 -1
  81. package/dist/helpers/modelcheck.js +13 -0
  82. package/dist/helpers/modelcheck.js.map +1 -1
  83. package/dist/helpers/opExample.d.ts +9 -2
  84. package/dist/helpers/opExample.js +22 -2
  85. package/dist/helpers/opExample.js.map +1 -1
  86. package/dist/helpers/opShape.d.ts +2 -1
  87. package/dist/helpers/opShape.js +12 -0
  88. package/dist/helpers/opShape.js.map +1 -1
  89. package/dist/helpers/packageMeta.js +21 -8
  90. package/dist/helpers/packageMeta.js.map +1 -1
  91. package/dist/helpers/semver.d.ts +2 -1
  92. package/dist/helpers/semver.js +7 -0
  93. package/dist/helpers/semver.js.map +1 -1
  94. package/dist/sdkgen.js +21 -2
  95. package/dist/sdkgen.js.map +1 -1
  96. package/dist/testkit.d.ts +1 -0
  97. package/dist/testkit.js +23 -19
  98. package/dist/testkit.js.map +1 -1
  99. package/dist/tsconfig.tsbuildinfo +1 -1
  100. package/dist/utility.js +2 -1
  101. package/dist/utility.js.map +1 -1
  102. package/model/fact.aontu +44 -0
  103. package/model/sdkgen.aontu +6 -2
  104. package/package.json +3 -1
  105. package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +1 -1
  106. package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +1 -1
  107. package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +12 -3
  108. package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +4 -1
  109. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +1 -0
  110. package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +3 -0
  111. package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -1
  112. package/project/.sdk/src/cmp/zig/ReadmeOptions_zig.ts +1 -1
  113. package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +2 -2
  114. package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
  115. package/project/sdkgen-package.json +1 -1
  116. package/src/action/check.ts +21 -0
  117. package/src/action/copies.ts +2 -0
  118. package/src/action/doctor.ts +244 -13
  119. package/src/action/package.ts +10 -0
  120. package/src/action/remove.ts +2 -1
  121. package/src/action/target.ts +66 -15
  122. package/src/cmp/AgentGuide.ts +24 -10
  123. package/src/cmp/AgentGuideContent.ts +53 -32
  124. package/src/cmp/AgentGuideFeature.ts +6 -4
  125. package/src/cmp/AgentGuideTop.ts +108 -47
  126. package/src/cmp/Changelog.ts +13 -2
  127. package/src/cmp/Deploy.ts +23 -21
  128. package/src/cmp/ExternalTarget.ts +6 -6
  129. package/src/cmp/Feature.ts +11 -4
  130. package/src/cmp/FeatureDocs.ts +21 -40
  131. package/src/cmp/FeatureHook.ts +38 -1
  132. package/src/cmp/PublishWorkflow.ts +33 -7
  133. package/src/cmp/ReadmeErrors.ts +555 -25
  134. package/src/cmp/ReadmeExplanation.ts +316 -52
  135. package/src/cmp/ReadmeFeatures.ts +18 -8
  136. package/src/cmp/ReadmeIntro.ts +3 -2
  137. package/src/cmp/ReadmeRefFeatures.ts +39 -27
  138. package/src/cmp/ReadmeStation.ts +12 -14
  139. package/src/cmp/ReadmeTop.ts +528 -387
  140. package/src/cmp/ReadmeUnions.ts +10 -2
  141. package/src/cmp/Security.ts +3 -2
  142. package/src/helpers/applicability.ts +28 -0
  143. package/src/helpers/copymerge.ts +58 -10
  144. package/src/helpers/doccheck.ts +174 -0
  145. package/src/helpers/doctext.ts +113 -0
  146. package/src/helpers/exampleCall.ts +415 -0
  147. package/src/helpers/exportnames.ts +47 -0
  148. package/src/helpers/facts.ts +47 -2
  149. package/src/helpers/modelcheck.ts +16 -0
  150. package/src/helpers/opExample.ts +34 -2
  151. package/src/helpers/opShape.ts +13 -0
  152. package/src/helpers/packageMeta.ts +21 -8
  153. package/src/helpers/semver.ts +9 -0
  154. package/src/sdkgen.ts +27 -3
  155. package/src/testkit.ts +30 -20
  156. package/src/utility.ts +2 -1
@@ -1,8 +1,9 @@
1
1
  import { Content } from 'jostraca'
2
2
  import { cmp } from '../helpers/component'
3
3
 
4
- import { featureDocs, honoursActivationOrder } from './FeatureDocs'
4
+ import { featureDocs, codeList, honoursActivationOrder } from './FeatureDocs'
5
5
  import type { FeatureDoc } from './FeatureDocs'
6
+ import { originName } from '../helpers/packageMeta'
6
7
 
7
8
 
8
9
  const ReadmeRefFeatures = cmp(function ReadmeRefFeatures(props: any) {
@@ -15,30 +16,37 @@ const ReadmeRefFeatures = cmp(function ReadmeRefFeatures(props: any) {
15
16
  return
16
17
  }
17
18
 
19
+ const on = features.filter((f: FeatureDoc) => f.on).map((f: FeatureDoc) => f.name)
20
+ const ordered = honoursActivationOrder({ name: originName(model, target.name) })
21
+ const wrapping = features.filter((f) => f.wraps)
22
+ const hooked = features.filter((f) => 'none' === f.transport)
23
+ // Order decides nothing until one wrapping feature sits inside another.
24
+ const nests = 1 < wrapping.length
25
+
18
26
  // Emitted INSIDE the per-language `## Features` section, after its summary
19
27
  // table and activation snippet, so these are subsections of it rather than
20
28
  // a competing heading.
21
29
  Content(`
22
30
  ### Configuring features
23
31
 
24
- Each feature is inactive until switched on, and an SDK with no feature
25
- configured does no feature work at all. Every option below keeps its default
26
- unless you name it.
32
+ ${0 === on.length ? `Each feature is inactive until switched on, and an SDK with no feature
33
+ configured does no feature work at all.` : `${codeList(on)} ${1 === on.length ? 'is' : 'are'} active by default${
34
+ on.length < features.length ? '; every other feature is inactive until switched on' : ''}.`}
35
+ Every option below keeps its default unless you name it.
27
36
 
28
- ${honoursActivationOrder(target) ?
29
- 'The array form of \\`feature\\` is significant: several features wrap the\ntransport, and the order you list them in is the order they nest.' :
30
- 'This SDK takes \\`feature\\` as a map and composes the transport-wrapping\nfeatures in a fixed catalog order, so activation order does not change\nnesting here.'}
37
+ ${!nests ? '' : (ordered ?
38
+ 'The array form of `feature` is significant: several features wrap the\ntransport, and the order you list them in is the order they nest.' :
39
+ 'This SDK takes `feature` as a map and composes the transport-wrapping\nfeatures in a fixed catalog order, so activation order does not change\nnesting here.') + '\n\n'}`)
31
40
 
32
- `)
33
-
34
- const wrapping = features.filter((f) => f.wraps)
35
- const hooked = features.filter((f) => !f.wraps)
36
-
37
- if (0 < wrapping.length) {
41
+ if (nests) {
42
+ const hookedNames = hooked.map((f) => '`' + f.name + '`').join(', ')
43
+ const hookedLine = 0 === hooked.length ? '' : '\n' + hookedNames + (1 === hooked.length ?
44
+ ' attaches to pipeline hooks\nrather than the transport, so its order does not affect what it observes.\n' :
45
+ ' attach to pipeline hooks\nrather than the transport, so their order does not affect what they observe.\n')
38
46
  Content(`#### Ordering
39
47
 
40
48
  ${wrapping.map((f) => '`' + f.name + '`').join(', ')} wrap the transport. Each
41
- wraps whatever is already installed${honoursActivationOrder(target) ?
49
+ wraps whatever is already installed${ordered ?
42
50
  ', so **activation order is nesting order**:\na feature activated later sits OUTSIDE one activated earlier, and sees the call\nfirst.' :
43
51
  '. This SDK fixes that order in its own\ncatalog rather than taking it from the caller.'}
44
52
 
@@ -48,12 +56,9 @@ sits inside it, so a response served from the cache never reaches \\\`cost\\\` a
48
56
  correctly charged nothing; reverse them and every cache hit is billed for money
49
57
  that was never spent.
50
58
  ` : `That decides behaviour, not just sequence: a feature that short-circuits the
51
- call, such as a cache serving a hit, stops every feature nested inside it from
59
+ call${features.some((f) => 'cache' === f.name) ? ', such as a cache serving a hit,' : ''} stops every feature nested inside it from
52
60
  ever seeing that call.
53
- `}
54
- ${hooked.map((f) => '`' + f.name + '`').join(', ')} attach to pipeline hooks
55
- rather than the transport, so their order does not affect what they observe.
56
-
61
+ `}${hookedLine}
57
62
  `)
58
63
  }
59
64
 
@@ -75,7 +80,7 @@ ${f.title}.
75
80
  |---|---|
76
81
  `)
77
82
  for (const o of f.options) {
78
- Content(`| \`${o.name}\` | \`${o.value}\` |
83
+ Content(`| \`${o.name}\` | ${o.code} |
79
84
  `)
80
85
  }
81
86
  Content(`
@@ -114,13 +119,9 @@ its default unless you name it.
114
119
  `)
115
120
 
116
121
  if (f.wraps) {
117
- Content(`- Wraps the transport: its place in the activation order decides what it
122
+ Content(nests ? `- Wraps the transport: its place in the activation order decides what it
118
123
  sees. See [Ordering](#ordering) above.
119
- `)
120
- }
121
- else {
122
- Content(`- Attaches to pipeline hooks, not the transport, so activation order does
123
- not change what it observes.
124
+ ` : `- Wraps the transport.
124
125
  `)
125
126
  }
126
127
 
@@ -130,7 +131,18 @@ its default unless you name it.
130
131
  `)
131
132
  }
132
133
 
133
- Content(`- Inactive by default: leaving it out costs nothing at runtime.
134
+ if ('none' === f.transport) {
135
+ Content(`- Attaches to pipeline hooks, not the transport, so activation order does
136
+ not change what it observes.
137
+ `)
138
+ }
139
+ else if (0 < f.hooks.length) {
140
+ Content(`- Also attaches to pipeline hooks.
141
+ `)
142
+ }
143
+
144
+ Content(`- ${f.on ? `Active by default: set \`feature.${f.name}.active\` to false to switch it off.` :
145
+ 'Inactive by default: leaving it out costs nothing at runtime.'}
134
146
 
135
147
  `)
136
148
  }
@@ -2,12 +2,10 @@
2
2
  import { Content } from 'jostraca'
3
3
  import { cmp } from '../helpers/component'
4
4
 
5
- import {
6
- KIT,
7
- getModelPath
8
- } from '../types'
9
-
10
- import { envName, packageName } from '../helpers/packageMeta'
5
+ import { envName, originName, packageName } from '../helpers/packageMeta'
6
+ import { targetFeatures } from '../helpers/applicability'
7
+ import { fact } from '../helpers/facts'
8
+ import { isAuthActive } from '../utility'
11
9
 
12
10
 
13
11
 
@@ -25,9 +23,7 @@ const ReadmeStation = cmp(function ReadmeStation(props: any) {
25
23
  const { target } = props
26
24
  const { model } = props.ctx$
27
25
 
28
- const features = getModelPath(model, `main.${KIT}.feature`,
29
- { only_active: false, required: false }) || {}
30
- const station = Object.values(features)
26
+ const station = Object.values(targetFeatures(model, target))
31
27
  .find((f: any) => 'station' === f?.name)
32
28
  if (null == station) { return }
33
29
 
@@ -38,8 +34,9 @@ const ReadmeStation = cmp(function ReadmeStation(props: any) {
38
34
  const env = envName(model)
39
35
  const secretbase = env.toLowerCase()
40
36
  const secretname = secretbase + '.apikey'
41
- const connect = CONNECT_TARGETS.includes(target.name)
42
- const selfreg = SELF_REGISTER_TARGETS.includes(target.name)
37
+ const origin = originName(model, target.name)
38
+ const connect = CONNECT_TARGETS.includes(origin)
39
+ const selfreg = SELF_REGISTER_TARGETS.includes(origin)
43
40
 
44
41
  Content(`
45
42
  ## Use with Station
@@ -47,7 +44,8 @@ const ReadmeStation = cmp(function ReadmeStation(props: any) {
47
44
  This SDK ships as a [voxgig/station](https://github.com/voxgig/station)
48
45
  plugin: bind it to a local \`Station\` and outbound configuration,
49
46
  credentials, and observability move to one place. The feature is
50
- present but **off by default** — nothing changes until you bind.
47
+ present ${fact(station, 'on') ? 'and **on by default**.' :
48
+ 'but **off by default** — nothing changes until you bind.'}
51
49
 
52
50
  ### Declarative: \`station.json\` + \`station.sdk()\`
53
51
 
@@ -86,7 +84,7 @@ SDK features are configured in the same file too: fleet-wide, per api,
86
84
  or per instance. \`station.check()\` resolves and constructs every
87
85
  active instance without sending a request — run it in CI.
88
86
 
89
- ### The secret name derives from the instance
87
+ ${isAuthActive(model) ? `### The secret name derives from the instance
90
88
 
91
89
  The credential comes from [sekreto](https://github.com/voxgig/sekreto)
92
90
  under a name derived from the **instance** name — the instance token
@@ -102,7 +100,7 @@ vault later and application code does not change; sekreto's own
102
100
  documentation covers the stores. The key stays out of \`options()\` and
103
101
  \`prepare()\` output; \`station.tap(...)\` shows live traffic.
104
102
 
105
- ### Imperative: ${connect ? '`connect()`' : 'inverted binding'} — the retrofit path
103
+ ` : ''}### Imperative: ${connect ? '`connect()`' : 'inverted binding'} — the retrofit path
106
104
 
107
105
  ${connect
108
106
  ? `Bind by passing the SDK class to the station: