@voxgig/sdkgen 4.5.3 → 4.7.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 (248) 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/cmp/AgentGuide.js +1 -1
  5. package/dist/cmp/AgentGuide.js.map +1 -1
  6. package/dist/cmp/AgentGuideContent.d.ts +1 -1
  7. package/dist/cmp/AgentGuideContent.js +8 -2
  8. package/dist/cmp/AgentGuideContent.js.map +1 -1
  9. package/dist/cmp/Feature.js +22 -0
  10. package/dist/cmp/Feature.js.map +1 -1
  11. package/dist/cmp/FeatureDocs.d.ts +1 -1
  12. package/dist/cmp/FeatureDocs.js +6 -1
  13. package/dist/cmp/FeatureDocs.js.map +1 -1
  14. package/dist/cmp/ReadmeExplanation.js +3 -1
  15. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  16. package/dist/cmp/ReadmeFeatures.js +1 -1
  17. package/dist/cmp/ReadmeFeatures.js.map +1 -1
  18. package/dist/cmp/ReadmeRefFeatures.js +1 -1
  19. package/dist/cmp/ReadmeRefFeatures.js.map +1 -1
  20. package/dist/cmp/TestControl.d.ts +4 -0
  21. package/dist/cmp/TestControl.js +51 -0
  22. package/dist/cmp/TestControl.js.map +1 -0
  23. package/dist/helpers/applicability.d.ts +6 -0
  24. package/dist/helpers/applicability.js +103 -0
  25. package/dist/helpers/applicability.js.map +1 -0
  26. package/dist/helpers/collectDeps.js +4 -2
  27. package/dist/helpers/collectDeps.js.map +1 -1
  28. package/dist/helpers/featureSource.d.ts +3 -1
  29. package/dist/helpers/featureSource.js +105 -0
  30. package/dist/helpers/featureSource.js.map +1 -1
  31. package/dist/helpers/serverVars.d.ts +2 -1
  32. package/dist/helpers/serverVars.js +17 -0
  33. package/dist/helpers/serverVars.js.map +1 -1
  34. package/dist/sdkgen.d.ts +5 -3
  35. package/dist/sdkgen.js +16 -4
  36. package/dist/sdkgen.js.map +1 -1
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/dist/utility.d.ts +2 -1
  39. package/dist/utility.js +59 -1
  40. package/dist/utility.js.map +1 -1
  41. package/model/sdkgen.aon +97 -0
  42. package/package.json +1 -1
  43. package/project/.sdk/model/feature/feature-index.aon +1 -0
  44. package/project/.sdk/model/feature/secrets.aon +200 -0
  45. package/project/.sdk/model/target/ts.aon +8 -1
  46. package/project/.sdk/src/cmp/c/Config_c.ts +5 -1
  47. package/project/.sdk/src/cmp/cpp/Config_cpp.ts +5 -1
  48. package/project/.sdk/src/cmp/cpp/Main_cpp.ts +2 -1
  49. package/project/.sdk/src/cmp/cpp/Test_cpp.ts +5 -1
  50. package/project/.sdk/src/cmp/csharp/Config_csharp.ts +5 -1
  51. package/project/.sdk/src/cmp/csharp/Main_csharp.ts +2 -1
  52. package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +30 -6
  53. package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +29 -5
  54. package/project/.sdk/src/cmp/csharp/Test_csharp.ts +5 -1
  55. package/project/.sdk/src/cmp/dart/Config_dart.ts +5 -1
  56. package/project/.sdk/src/cmp/dart/Main_dart.ts +2 -1
  57. package/project/.sdk/src/cmp/dart/TestDirect_dart.ts +23 -6
  58. package/project/.sdk/src/cmp/dart/TestEntity_dart.ts +28 -7
  59. package/project/.sdk/src/cmp/dart/Test_dart.ts +5 -1
  60. package/project/.sdk/src/cmp/elixir/Config_elixir.ts +5 -1
  61. package/project/.sdk/src/cmp/elixir/Main_elixir.ts +5 -1
  62. package/project/.sdk/src/cmp/go/Config_go.ts +5 -1
  63. package/project/.sdk/src/cmp/go/Main_go.ts +8 -3
  64. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +16 -3
  65. package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +16 -3
  66. package/project/.sdk/src/cmp/go/TestDirect_go.ts +28 -4
  67. package/project/.sdk/src/cmp/go/TestEntity_go.ts +43 -10
  68. package/project/.sdk/src/cmp/go/Test_go.ts +5 -1
  69. package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +5 -5
  70. package/project/.sdk/src/cmp/java/Config_java.ts +22 -1
  71. package/project/.sdk/src/cmp/java/Main_java.ts +7 -2
  72. package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +17 -3
  73. package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +17 -3
  74. package/project/.sdk/src/cmp/java/TestDirect_java.ts +23 -4
  75. package/project/.sdk/src/cmp/java/TestEntity_java.ts +29 -4
  76. package/project/.sdk/src/cmp/java/Test_java.ts +5 -1
  77. package/project/.sdk/src/cmp/js/Config_js.ts +5 -1
  78. package/project/.sdk/src/cmp/js/Main_js.ts +7 -2
  79. package/project/.sdk/src/cmp/js/Package_js.ts +4 -1
  80. package/project/.sdk/src/cmp/js/TestDirect_js.ts +30 -5
  81. package/project/.sdk/src/cmp/js/TestEntity_js.ts +35 -5
  82. package/project/.sdk/src/cmp/js/Test_js.ts +5 -1
  83. package/project/.sdk/src/cmp/js/fragment/Direct.test.fragment.js +7 -1
  84. package/project/.sdk/src/cmp/js/fragment/Entity.test.fragment.js +7 -1
  85. package/project/.sdk/src/cmp/kotlin/Config_kotlin.ts +5 -1
  86. package/project/.sdk/src/cmp/kotlin/Main_kotlin.ts +2 -1
  87. package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +5 -1
  88. package/project/.sdk/src/cmp/lean/Config_lean.ts +5 -1
  89. package/project/.sdk/src/cmp/lua/Config_lua.ts +5 -1
  90. package/project/.sdk/src/cmp/lua/Main_lua.ts +7 -2
  91. package/project/.sdk/src/cmp/lua/Package_lua.ts +4 -1
  92. package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +28 -4
  93. package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +24 -4
  94. package/project/.sdk/src/cmp/lua/Test_lua.ts +5 -1
  95. package/project/.sdk/src/cmp/ocaml/Config_ocaml.ts +5 -1
  96. package/project/.sdk/src/cmp/ocaml/Gitignore_ocaml.ts +1 -0
  97. package/project/.sdk/src/cmp/perl/Main_perl.ts +7 -2
  98. package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +25 -4
  99. package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +24 -4
  100. package/project/.sdk/src/cmp/perl/Test_perl.ts +5 -1
  101. package/project/.sdk/src/cmp/perl/utility_perl.ts +10 -0
  102. package/project/.sdk/src/cmp/php/Config_php.ts +5 -1
  103. package/project/.sdk/src/cmp/php/Main_php.ts +7 -2
  104. package/project/.sdk/src/cmp/php/TestDirect_php.ts +24 -5
  105. package/project/.sdk/src/cmp/php/TestEntity_php.ts +28 -4
  106. package/project/.sdk/src/cmp/php/Test_php.ts +5 -1
  107. package/project/.sdk/src/cmp/py/Config_py.ts +5 -1
  108. package/project/.sdk/src/cmp/py/Main_py.ts +7 -2
  109. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +16 -3
  110. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +16 -3
  111. package/project/.sdk/src/cmp/py/TestDirect_py.ts +24 -5
  112. package/project/.sdk/src/cmp/py/TestEntity_py.ts +23 -3
  113. package/project/.sdk/src/cmp/py/Test_py.ts +5 -1
  114. package/project/.sdk/src/cmp/rb/Config_rb.ts +5 -1
  115. package/project/.sdk/src/cmp/rb/Main_rb.ts +7 -2
  116. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +24 -5
  117. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +24 -4
  118. package/project/.sdk/src/cmp/rb/Test_rb.ts +5 -1
  119. package/project/.sdk/src/cmp/rb/utility_rb.ts +3 -1
  120. package/project/.sdk/src/cmp/rust/Config_rust.ts +5 -1
  121. package/project/.sdk/src/cmp/rust/Main_rust.ts +7 -2
  122. package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +31 -4
  123. package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +37 -4
  124. package/project/.sdk/src/cmp/rust/Test_rust.ts +5 -1
  125. package/project/.sdk/src/cmp/scala/Config_scala.ts +5 -1
  126. package/project/.sdk/src/cmp/scala/Main_scala.ts +7 -2
  127. package/project/.sdk/src/cmp/scala/Test_scala.ts +5 -1
  128. package/project/.sdk/src/cmp/swift/Config_swift.ts +5 -1
  129. package/project/.sdk/src/cmp/ts/Config_ts.ts +55 -9
  130. package/project/.sdk/src/cmp/ts/Main_ts.ts +67 -3
  131. package/project/.sdk/src/cmp/ts/Package_ts.ts +4 -1
  132. package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +15 -3
  133. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +18 -5
  134. package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +19 -5
  135. package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +75 -8
  136. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +36 -5
  137. package/project/.sdk/src/cmp/ts/Test_ts.ts +5 -1
  138. package/project/.sdk/src/cmp/ts/fragment/Direct.test.fragment.ts +9 -2
  139. package/project/.sdk/src/cmp/ts/fragment/Entity.test.fragment.ts +9 -2
  140. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +7 -0
  141. package/project/.sdk/src/cmp/zig/Config_zig.ts +5 -1
  142. package/project/.sdk/tm/c/utility/make_options.c +22 -0
  143. package/project/.sdk/tm/clojure/src/sdk/core.clj +18 -1
  144. package/project/.sdk/tm/cpp/utility/pipeline.hpp +23 -0
  145. package/project/.sdk/tm/csharp/test/CustomUtilityTest.cs +15 -0
  146. package/project/.sdk/tm/csharp/test/Runner.cs +45 -0
  147. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +23 -0
  148. package/project/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +22 -0
  149. package/project/.sdk/tm/dart/test/utility.dart +39 -0
  150. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +19 -0
  151. package/project/.sdk/tm/go/core/context.go +1 -1
  152. package/project/.sdk/tm/go/feature/cost_feature.go +1 -1
  153. package/project/.sdk/tm/go/feature/paging_feature.go +5 -5
  154. package/project/.sdk/tm/go/feature/test_feature.go +12 -5
  155. package/project/.sdk/tm/go/test/custom_utility_test.go +15 -0
  156. package/project/.sdk/tm/go/test/feature_corpus_test.go +7 -0
  157. package/project/.sdk/tm/go/test/runner_test.go +46 -0
  158. package/project/.sdk/tm/go/test/struct_runner_test.go +7 -7
  159. package/project/.sdk/tm/go/test/struct_utility_test.go +63 -27
  160. package/project/.sdk/tm/go/utility/fetcher.go +2 -2
  161. package/project/.sdk/tm/go/utility/make_options.go +24 -5
  162. package/project/.sdk/tm/go/utility/make_point.go +1 -1
  163. package/project/.sdk/tm/go/utility/make_spec.go +17 -1
  164. package/project/.sdk/tm/go/utility/prepare_auth.go +1 -1
  165. package/project/.sdk/tm/go/utility/struct/voxgigstruct.go +370 -307
  166. package/project/.sdk/tm/go/utility/transform_request.go +29 -1
  167. package/project/.sdk/tm/go/utility/transform_response.go +20 -1
  168. package/project/.sdk/tm/java/test/CustomUtilityTest.java +10 -0
  169. package/project/.sdk/tm/java/test/FeatureCorpusTest.java +7 -0
  170. package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +6 -0
  171. package/project/.sdk/tm/java/test/RunnerSupport.java +43 -0
  172. package/project/.sdk/tm/java/utility/MakeOptions.java +84 -1
  173. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +24 -0
  174. package/project/.sdk/tm/js/src/utility/StructUtility.js +2076 -1837
  175. package/project/.sdk/tm/js/test/feature/Corpus.test.js +9 -0
  176. package/project/.sdk/tm/js/test/sdk-test-control.json +19 -0
  177. package/project/.sdk/tm/js/test/utility.js +91 -1
  178. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +21 -0
  179. package/project/.sdk/tm/lean/src/SdkUtility.lean +12 -1
  180. package/project/.sdk/tm/lua/test/runner.lua +40 -0
  181. package/project/.sdk/tm/ocaml/sdk_runtime.ml +11 -0
  182. package/project/.sdk/tm/ocaml/test/harness.ml +14 -4
  183. package/project/.sdk/tm/perl/t/runner.pm +30 -0
  184. package/project/.sdk/tm/perl/utility/make_options.pm +18 -0
  185. package/project/.sdk/tm/php/test/FeatureCorpusTest.php +10 -1
  186. package/project/.sdk/tm/php/test/Runner.php +36 -0
  187. package/project/.sdk/tm/php/utility/MakeOptions.php +24 -0
  188. package/project/.sdk/tm/py/pkg/utility/make_options.py +20 -0
  189. package/project/.sdk/tm/py/test/runner.py +32 -0
  190. package/project/.sdk/tm/py/test/test_feature_corpus.py +10 -1
  191. package/project/.sdk/tm/rb/test/feature_corpus_test.rb +9 -1
  192. package/project/.sdk/tm/rb/test/runner.rb +25 -0
  193. package/project/.sdk/tm/rb/utility/make_options.rb +17 -0
  194. package/project/.sdk/tm/rust/tests/common/mod.rs +32 -0
  195. package/project/.sdk/tm/rust/utility/make_options.rs +26 -1
  196. package/project/.sdk/tm/scala/utility/Make.scala +17 -0
  197. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +21 -0
  198. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +419 -0
  199. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/Sekreto.ts +387 -0
  200. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/Sigv4.ts +175 -0
  201. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/index.ts +51 -0
  202. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/Registry.ts +90 -0
  203. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/addr.ts +48 -0
  204. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/aws.ts +219 -0
  205. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/azuresecrets.ts +144 -0
  206. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/boru.ts +113 -0
  207. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/doppler.ts +77 -0
  208. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/dotenv.ts +51 -0
  209. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/env.ts +31 -0
  210. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/file.ts +54 -0
  211. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/gcpsecrets.ts +118 -0
  212. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/hashicorp.ts +159 -0
  213. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/http.ts +66 -0
  214. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/infisical.ts +107 -0
  215. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/memory.ts +33 -0
  216. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/onepassword.ts +120 -0
  217. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/support.ts +176 -0
  218. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +18 -0
  219. package/project/.sdk/tm/ts/src/utility/StructUtility.ts +1321 -710
  220. package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +9 -0
  221. package/project/.sdk/tm/ts/test/feature/secrets/Secrets.test.ts +764 -0
  222. package/project/.sdk/tm/ts/test/omni.test.ts +84 -0
  223. package/project/.sdk/tm/ts/test/omni.ts +86 -0
  224. package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +6 -2
  225. package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +2 -2
  226. package/project/.sdk/tm/ts/test/utility.ts +122 -0
  227. package/project/.sdk/tm/ts/test/vendor/omni/Runner.ts +694 -0
  228. package/project/.sdk/tm/ts/test/vendor/omni/Util.ts +244 -0
  229. package/project/.sdk/tm/ts/test/vendor/omni/compat.ts +188 -0
  230. package/project/.sdk/tm/ts/test/vendor/omni/index.ts +38 -0
  231. package/project/.sdk/tm/zig/core/utility.zig +24 -1
  232. package/project/sdkgen-package.json +2 -1
  233. package/src/action/check.ts +18 -0
  234. package/src/cmp/AgentGuide.ts +1 -1
  235. package/src/cmp/AgentGuideContent.ts +9 -2
  236. package/src/cmp/Feature.ts +24 -0
  237. package/src/cmp/FeatureDocs.ts +7 -1
  238. package/src/cmp/ReadmeExplanation.ts +4 -1
  239. package/src/cmp/ReadmeFeatures.ts +1 -1
  240. package/src/cmp/ReadmeRefFeatures.ts +1 -1
  241. package/src/cmp/TestControl.ts +64 -0
  242. package/src/helpers/applicability.ts +123 -0
  243. package/src/helpers/collectDeps.ts +5 -1
  244. package/src/helpers/featureSource.ts +130 -0
  245. package/src/helpers/serverVars.ts +19 -0
  246. package/src/sdkgen.ts +16 -1
  247. package/src/utility.ts +71 -1
  248. package/project/.sdk/tm/ts/test/runner.ts +0 -425
@@ -0,0 +1,120 @@
1
+ // VENDORED: @voxgig/sekreto 0.1.2 (typescript/src/provider/onepassword.ts)
2
+ // Source: https://github.com/voxgig/sekreto @ 65009cb5758850db767785ab666e71895f86086b
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
4
+ /* Copyright (c) 2025 Voxgig Ltd, MIT License */
5
+
6
+ import {
7
+ ProviderSpec, Provider, SekretoError, checkname, vaultref,
8
+ } from './support'
9
+ import { checkaddr } from './addr'
10
+ import { fetchjson } from './http'
11
+
12
+ export function onepasswordprovider(options?: {
13
+ addr?: string
14
+ token?: string
15
+ vault?: string
16
+ }): Provider {
17
+ const opts = options || {}
18
+
19
+ let vaultid: string | undefined
20
+
21
+ const auth = (): Record<string, string> => ({
22
+ authorization: 'Bearer ' + (opts.token || ''),
23
+ })
24
+
25
+ const resolvevault = async (addr: string): Promise<string> => {
26
+ const want = opts.vault || ''
27
+ if ('' === want) {
28
+ throw new SekretoError('sekreto: onepassword: no vault')
29
+ }
30
+
31
+ const res = await fetchjson('GET', addr + '/v1/vaults', auth())
32
+
33
+ if (200 !== res.status || !Array.isArray(res.body)) {
34
+ throw new SekretoError('sekreto: onepassword error: ' + res.status + ': listing vaults')
35
+ }
36
+
37
+ for (const entry of res.body) {
38
+ if (entry && (want === entry.id || want === entry.name)) {
39
+ return String(entry.id)
40
+ }
41
+ }
42
+
43
+ throw new SekretoError('sekreto: onepassword: no vault named ' + want)
44
+ }
45
+
46
+ return {
47
+ lookup: async (name: string) => {
48
+ checkname(name)
49
+
50
+ const addr = (opts.addr || '').replace(/\/$/, '')
51
+ if ('' === addr) {
52
+ throw new SekretoError('sekreto: onepassword: no addr')
53
+ }
54
+ checkaddr(addr)
55
+
56
+ if (undefined === vaultid) {
57
+ vaultid = await resolvevault(addr)
58
+ }
59
+
60
+ const filter = encodeURIComponent('title eq "' + name + '"')
61
+ const found = await fetchjson(
62
+ 'GET',
63
+ addr + '/v1/vaults/' + vaultid + '/items?filter=' + filter,
64
+ auth(),
65
+ )
66
+
67
+ if (200 !== found.status || !Array.isArray(found.body)) {
68
+ throw new SekretoError('sekreto: onepassword error: ' + found.status + ': finding ' + name)
69
+ }
70
+
71
+ if (0 === found.body.length) {
72
+ return undefined
73
+ }
74
+
75
+ const item = await fetchjson(
76
+ 'GET',
77
+ addr + '/v1/vaults/' + vaultid + '/items/' + found.body[0].id,
78
+ auth(),
79
+ )
80
+
81
+ if (200 !== item.status) {
82
+ throw new SekretoError('sekreto: onepassword error: ' + item.status + ': reading ' + name)
83
+ }
84
+
85
+ const fields = (item.body && item.body.fields) || []
86
+
87
+ for (const field of fields) {
88
+ if (field && 'PASSWORD' === field.purpose) {
89
+ return undefined === field.value || null === field.value ? undefined : String(field.value)
90
+ }
91
+ }
92
+ for (const field of fields) {
93
+ if (field && 'value' === field.label) {
94
+ return undefined === field.value || null === field.value ? undefined : String(field.value)
95
+ }
96
+ }
97
+
98
+ return undefined
99
+ },
100
+ describe: () => 'onepassword:' + (opts.vault || ''),
101
+ }
102
+ }
103
+
104
+ /** Doppler.
105
+ *
106
+ * The whole config is downloaded once - Doppler's own bulk endpoint -
107
+ * and answered from memory, like a remote .env: `api.token` is the
108
+ * `API_TOKEN` entry. A service token is config-scoped, so project and
109
+ * config are only needed with broader tokens. */
110
+
111
+
112
+ // Registering at import is what makes this module's presence the only
113
+ // thing that decides whether the kind exists in a build.
114
+ import { register } from './Registry'
115
+
116
+ register({
117
+ name: 'onepassword',
118
+ needs: ['fetch'],
119
+ define: (spec: ProviderSpec) => onepasswordprovider(spec),
120
+ })
@@ -0,0 +1,176 @@
1
+ // VENDORED: @voxgig/sekreto 0.1.2 (typescript/src/provider/support.ts)
2
+ // Source: https://github.com/voxgig/sekreto @ 65009cb5758850db767785ab666e71895f86086b
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
4
+ // The providers a Sekreto chains together.
5
+ //
6
+ // A provider answers one question: "do you have this secret?" It returns
7
+ // the value, or undefined to mean "ask the next one". Nothing else about
8
+ // a provider is visible to the caller - which is the point: an app reads
9
+ // `api.token` and never learns whether it came from the environment, a
10
+ // .env file, HashiCorp Vault, AWS, GCP, Azure or a boru vault.
11
+ //
12
+ // Two failure shapes, and they are never interchangeable. A store that
13
+ // does not hold the secret is a MISS (undefined) - the chain carries on.
14
+ // A store that could not answer - bad credentials, unreachable host,
15
+ // missing configuration - is an ERROR: falling through there would
16
+ // quietly reach for a weaker store.
17
+
18
+ import {
19
+ SekretoError,
20
+ awsparam,
21
+ checkname,
22
+ envkey,
23
+ flatname,
24
+ parsedotenv,
25
+ vaultref,
26
+ } from '../Sekreto'
27
+
28
+ // NODE BUILTINS, LOADED ON FIRST USE.
29
+ //
30
+ // These were top-level imports, which made them a side effect of importing
31
+ // sekreto AT ALL: `child_process`, `fs` and `path` entered the module graph
32
+ // for a caller who only ever used a `memory` or `env` provider, and any
33
+ // runtime lacking them failed at import time rather than at the point of
34
+ // use. Sekreto.ts imports makeprovider from this module, so the chain
35
+ // reached everything.
36
+ //
37
+ // A plain require(), not `await import()`: dotenvprovider, fileprovider and
38
+ // boruprovider all have SYNCHRONOUS lookups, and making them async to
39
+ // accommodate a dynamic import would change observable behaviour for anyone
40
+ // calling a provider directly. The package is CommonJS ("type":
41
+ // "commonjs"), so require is available and synchronous.
42
+ //
43
+ // What this buys and what it does not: the builtins are no longer evaluated
44
+ // at import time, so importing sekreto is safe in a runtime that lacks them
45
+ // and a bundler can drop an unreachable provider along with its edge. It is
46
+ // NOT by itself a complete browser story — a bundler still resolves a
47
+ // require it can see statically, so a browser build wants conditional
48
+ // exports ("browser" field) as well. That is a packaging change, tracked
49
+ // separately.
50
+ const nodemods: Record<string, any> = {}
51
+
52
+ function nodemod<T = any>(name: string): T {
53
+ let mod = nodemods[name]
54
+
55
+ if (undefined === mod) {
56
+ try {
57
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
58
+ mod = nodemods[name] = require(name)
59
+ } catch (err: any) {
60
+ throw new SekretoError(
61
+ 'sekreto: this provider needs ' +
62
+ name +
63
+ ', which this runtime does not provide: ' +
64
+ err.message,
65
+ )
66
+ }
67
+ }
68
+
69
+ return mod as T
70
+ }
71
+
72
+ export type Provider = {
73
+ /** The value, or undefined if this provider does not have it. */
74
+ lookup: (name: string) => Promise<string | undefined> | string | undefined
75
+ /** A short description, shown by `Sekreto.sources()`. */
76
+ describe: () => string
77
+ }
78
+
79
+ /** The declarative form of a provider, as used in config and in the
80
+ * shared spec. */
81
+ export type ProviderSpec = {
82
+ kind:
83
+ | 'env'
84
+ | 'dotenv'
85
+ | 'memory'
86
+ | 'file'
87
+ | 'hashicorp'
88
+ | 'boru'
89
+ | 'awssecrets'
90
+ | 'awsparams'
91
+ | 'gcpsecrets'
92
+ | 'azuresecrets'
93
+ | 'onepassword'
94
+ | 'doppler'
95
+ | 'infisical'
96
+ /** The store name `Sekreto.getfrom` addresses. Defaults to `kind`. */
97
+ name?: string
98
+ prefix?: string
99
+ /** dotenv: the file to read. */
100
+ file?: string
101
+ /** memory: literal values, keyed like environment variables. */
102
+ values?: Record<string, string>
103
+ /** file: the directory of one-secret-per-file entries. */
104
+ dir?: string
105
+ /** hashicorp / boru (wire) / gcp / 1password / doppler / infisical:
106
+ * the base URL. */
107
+ addr?: string
108
+ /** hashicorp / boru (wire) / gcp / azure / 1password / doppler /
109
+ * infisical: the access token. */
110
+ token?: string
111
+ /** hashicorp / boru (wire): the KV mount (default `secret`). */
112
+ mount?: string
113
+ /** hashicorp: KV engine version, 1 or 2 (default 2). */
114
+ kv?: number
115
+ /** hashicorp: Vault Enterprise namespace (X-Vault-Namespace). */
116
+ vaultnamespace?: string
117
+ /** hashicorp: log in for a token instead of being handed one. */
118
+ auth?: {
119
+ method: 'kubernetes' | 'approle'
120
+ /** The auth mount, defaulting to the method name. */
121
+ mount?: string
122
+ /** kubernetes: the Vault role to log in as. */
123
+ role?: string
124
+ /** kubernetes: the service-account JWT itself (tests). */
125
+ jwt?: string
126
+ /** kubernetes: where the JWT lives; the conventional pod path by
127
+ * default. */
128
+ jwtfile?: string
129
+ /** approle: the role and secret ids. */
130
+ roleid?: string
131
+ secretid?: string
132
+ }
133
+ /** boru: the executable to run (default `boru`). */
134
+ command?: string
135
+ /** boru: the namespace qualifying the alias. */
136
+ namespace?: string
137
+ /** boru: the vault home, passed as BORU_HOME. */
138
+ home?: string
139
+ /** aws: region and credentials; the standard AWS_* environment
140
+ * variables fill whichever are not given. */
141
+ region?: string
142
+ keyid?: string
143
+ secret?: string
144
+ session?: string
145
+ /** gcp / doppler / infisical: the project (GCP project id, Doppler
146
+ * project slug, Infisical workspace id). */
147
+ project?: string
148
+ /** azure: the Key Vault name or full URL. 1password: the vault name
149
+ * or id. */
150
+ vault?: string
151
+ /** azure: client-credential login. infisical: universal-auth login
152
+ * (tenant is Azure-only). */
153
+ tenant?: string
154
+ clientid?: string
155
+ clientsecret?: string
156
+ /** azure: where to log in / where IMDS answers. gcp: where the
157
+ * metadata server answers. Overridable for tests and for clouds with
158
+ * nonstandard endpoints. */
159
+ loginaddr?: string
160
+ imdsaddr?: string
161
+ metadataaddr?: string
162
+ /** azure: the Key Vault API version (default 7.4). */
163
+ apiversion?: string
164
+ /** doppler: the config slug (with `project`). */
165
+ config?: string
166
+ /** infisical: the environment slug and secret path. */
167
+ environment?: string
168
+ path?: string
169
+ }
170
+
171
+ /** Environment variables: `api.token` from `API_TOKEN`. */
172
+
173
+ export {
174
+ SekretoError, awsparam, checkname, envkey, flatname, parsedotenv, vaultref,
175
+ }
176
+ export { nodemod }
@@ -14,6 +14,19 @@ function makeOptions(ctx: Context) {
14
14
 
15
15
  let opts = { ...(options || {}) }
16
16
 
17
+ // EXPLICIT AUTH SUPPRESSION, captured BEFORE merge and validate.
18
+ //
19
+ // `auth: null` is the documented way to disable auth outright, and
20
+ // prepareAuth honours it. But struct 0.3.2's getprop treats a stored
21
+ // null as "no value", so validate fills in the optspec's `auth`
22
+ // default and the suppression silently became "use default auth" —
23
+ // transmitting a credential the caller explicitly asked not to send.
24
+ // (0.0.10 rejected `auth: null` outright, so nothing depended on the
25
+ // old behaviour, and nothing catches the new one.)
26
+ //
27
+ // Suppliedness cannot be recovered after validate, hence here.
28
+ const authSuppressed = null === (options || {}).auth
29
+
17
30
  // Feature add-order. `options.feature` may be given as an ordered ARRAY of
18
31
  // { name, active, ...opts } entries (the array position IS the order in
19
32
  // which features are added), or as a { name: {opts} } map. Normalize an
@@ -111,6 +124,11 @@ function makeOptions(ctx: Context) {
111
124
 
112
125
  opts = validate(opts, optspec)
113
126
 
127
+ // Restore the suppression the optspec default would otherwise erase.
128
+ if (authSuppressed) {
129
+ opts.auth = null
130
+ }
131
+
114
132
  // Resolve a templated base URL (e.g. https://{tenant_id}.hanko.io).
115
133
  // Every placeholder must resolve to a non-empty value: from
116
134
  // options.server (user), else the Config default. A placeholder that