@voxgig/sdkgen 0.44.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/cmp/ReadmeEntity.js +9 -153
  3. package/dist/cmp/ReadmeEntity.js.map +1 -1
  4. package/dist/cmp/ReadmeIntro.js +9 -14
  5. package/dist/cmp/ReadmeIntro.js.map +1 -1
  6. package/dist/cmp/ReadmeModel.js +6 -4
  7. package/dist/cmp/ReadmeModel.js.map +1 -1
  8. package/dist/cmp/ReadmeOptions.js +9 -61
  9. package/dist/cmp/ReadmeOptions.js.map +1 -1
  10. package/dist/cmp/ReadmeRef.js +10 -1328
  11. package/dist/cmp/ReadmeRef.js.map +1 -1
  12. package/dist/sdkgen.d.ts +2 -2
  13. package/dist/sdkgen.js +2 -1
  14. package/dist/sdkgen.js.map +1 -1
  15. package/dist/utility.d.ts +2 -1
  16. package/dist/utility.js +9 -0
  17. package/dist/utility.js.map +1 -1
  18. package/package.json +3 -3
  19. package/project/.sdk/src/cmp/go/Config_go.ts +9 -4
  20. package/project/.sdk/src/cmp/go/Entity_go.ts +2 -2
  21. package/project/.sdk/src/cmp/go/Main_go.ts +8 -4
  22. package/project/.sdk/src/cmp/go/Package_go.ts +2 -2
  23. package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +138 -0
  24. package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +2 -2
  25. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +8 -5
  26. package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +2 -2
  27. package/project/.sdk/src/cmp/go/ReadmeIntro_go.ts +18 -0
  28. package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +8 -5
  29. package/project/.sdk/src/cmp/go/ReadmeOptions_go.ts +58 -0
  30. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +13 -9
  31. package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +354 -0
  32. package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +8 -6
  33. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +2 -2
  34. package/project/.sdk/src/cmp/go/TestDirect_go.ts +222 -41
  35. package/project/.sdk/src/cmp/go/TestEntity_go.ts +142 -60
  36. package/project/.sdk/src/cmp/go/Test_go.ts +2 -2
  37. package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +21 -4
  38. package/project/.sdk/src/cmp/js/Config_js.ts +18 -0
  39. package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +138 -0
  40. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +11 -6
  41. package/project/.sdk/src/cmp/js/ReadmeIntro_js.ts +18 -0
  42. package/project/.sdk/src/cmp/js/ReadmeModel_js.ts +6 -3
  43. package/project/.sdk/src/cmp/js/ReadmeOptions_js.ts +58 -0
  44. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +6 -4
  45. package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +384 -0
  46. package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +6 -4
  47. package/project/.sdk/src/cmp/js/TestDirect_js.ts +23 -12
  48. package/project/.sdk/src/cmp/js/TestEntity_js.ts +107 -74
  49. package/project/.sdk/src/cmp/js/fragment/Config.fragment.js +1 -5
  50. package/project/.sdk/src/cmp/lua/Config_lua.ts +9 -4
  51. package/project/.sdk/src/cmp/lua/Package_lua.ts +9 -2
  52. package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +138 -0
  53. package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +6 -3
  54. package/project/.sdk/src/cmp/lua/ReadmeIntro_lua.ts +18 -0
  55. package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +6 -3
  56. package/project/.sdk/src/cmp/lua/ReadmeOptions_lua.ts +58 -0
  57. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +6 -4
  58. package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +360 -0
  59. package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +6 -4
  60. package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +172 -29
  61. package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +120 -52
  62. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +20 -4
  63. package/project/.sdk/src/cmp/php/Config_php.ts +10 -8
  64. package/project/.sdk/src/cmp/php/Package_php.ts +7 -1
  65. package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +138 -0
  66. package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +6 -3
  67. package/project/.sdk/src/cmp/php/ReadmeIntro_php.ts +18 -0
  68. package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +6 -3
  69. package/project/.sdk/src/cmp/php/ReadmeOptions_php.ts +58 -0
  70. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +6 -4
  71. package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +358 -0
  72. package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +6 -4
  73. package/project/.sdk/src/cmp/php/TestDirect_php.ts +171 -28
  74. package/project/.sdk/src/cmp/php/TestEntity_php.ts +126 -55
  75. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +17 -3
  76. package/project/.sdk/src/cmp/py/Config_py.ts +9 -4
  77. package/project/.sdk/src/cmp/py/Package_py.ts +8 -1
  78. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +138 -0
  79. package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +6 -3
  80. package/project/.sdk/src/cmp/py/ReadmeIntro_py.ts +18 -0
  81. package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +6 -3
  82. package/project/.sdk/src/cmp/py/ReadmeOptions_py.ts +58 -0
  83. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +9 -6
  84. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +356 -0
  85. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +9 -6
  86. package/project/.sdk/src/cmp/py/TestDirect_py.ts +164 -27
  87. package/project/.sdk/src/cmp/py/TestEntity_py.ts +125 -51
  88. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +19 -4
  89. package/project/.sdk/src/cmp/rb/Config_rb.ts +9 -4
  90. package/project/.sdk/src/cmp/rb/Package_rb.ts +9 -2
  91. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +138 -0
  92. package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +6 -3
  93. package/project/.sdk/src/cmp/rb/ReadmeIntro_rb.ts +18 -0
  94. package/project/.sdk/src/cmp/rb/ReadmeModel_rb.ts +6 -3
  95. package/project/.sdk/src/cmp/rb/ReadmeOptions_rb.ts +58 -0
  96. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +6 -4
  97. package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +361 -0
  98. package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +6 -4
  99. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +172 -29
  100. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +120 -52
  101. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +19 -3
  102. package/project/.sdk/src/cmp/ts/Config_ts.ts +18 -0
  103. package/project/.sdk/src/cmp/ts/Package_ts.ts +1 -1
  104. package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +138 -0
  105. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +11 -6
  106. package/project/.sdk/src/cmp/ts/ReadmeIntro_ts.ts +18 -0
  107. package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +9 -5
  108. package/project/.sdk/src/cmp/ts/ReadmeOptions_ts.ts +58 -0
  109. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +6 -4
  110. package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +384 -0
  111. package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +6 -4
  112. package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +213 -42
  113. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +168 -75
  114. package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +1 -5
  115. package/project/.sdk/src/cmp/ts/fragment/Direct.test.fragment.ts +8 -1
  116. package/project/.sdk/src/cmp/ts/fragment/Entity.test.fragment.ts +8 -2
  117. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +21 -1
  118. package/project/.sdk/tm/go/feature/test_feature.go +51 -3
  119. package/project/.sdk/tm/go/test/runner_test.go +106 -6
  120. package/project/.sdk/tm/go/test/sdk-test-control.json +19 -0
  121. package/project/.sdk/tm/go/utility/fetcher.go +10 -0
  122. package/project/.sdk/tm/go/utility/make_url.go +12 -0
  123. package/project/.sdk/tm/go/utility/prepare_auth.go +15 -1
  124. package/project/.sdk/tm/js/src/utility/PrepareAuthUtility.js +7 -1
  125. package/project/.sdk/tm/lua/feature/test_feature.lua +41 -3
  126. package/project/.sdk/tm/lua/test/runner.lua +74 -0
  127. package/project/.sdk/tm/lua/test/sdk-test-control.json +19 -0
  128. package/project/.sdk/tm/lua/utility/fetcher.lua +13 -0
  129. package/project/.sdk/tm/lua/utility/make_url.lua +16 -0
  130. package/project/.sdk/tm/lua/utility/prepare_auth.lua +9 -1
  131. package/project/.sdk/tm/php/feature/TestFeature.php +185 -43
  132. package/project/.sdk/tm/php/test/Runner.php +62 -0
  133. package/project/.sdk/tm/php/test/sdk-test-control.json +19 -0
  134. package/project/.sdk/tm/php/utility/Fetcher.php +132 -9
  135. package/project/.sdk/tm/php/utility/MakeUrl.php +16 -0
  136. package/project/.sdk/tm/php/utility/PrepareAuth.php +11 -1
  137. package/project/.sdk/tm/py/feature/test_feature.py +35 -3
  138. package/project/.sdk/tm/py/test/runner.py +60 -0
  139. package/project/.sdk/tm/py/test/sdk-test-control.json +19 -0
  140. package/project/.sdk/tm/py/utility/fetcher.py +13 -0
  141. package/project/.sdk/tm/py/utility/make_url.py +13 -0
  142. package/project/.sdk/tm/py/utility/prepare_auth.py +10 -1
  143. package/project/.sdk/tm/rb/feature/test_feature.rb +36 -3
  144. package/project/.sdk/tm/rb/test/runner.rb +46 -0
  145. package/project/.sdk/tm/rb/test/sdk-test-control.json +19 -0
  146. package/project/.sdk/tm/rb/utility/fetcher.rb +49 -28
  147. package/project/.sdk/tm/rb/utility/make_url.rb +16 -0
  148. package/project/.sdk/tm/rb/utility/prepare_auth.rb +8 -1
  149. package/project/.sdk/tm/ts/src/utility/MakeUrlUtility.ts +7 -8
  150. package/project/.sdk/tm/ts/src/utility/PrepareAuthUtility.ts +7 -1
  151. package/project/.sdk/tm/ts/test/sdk-test-control.json +19 -0
  152. package/project/.sdk/tm/ts/test/utility.ts +120 -2
  153. package/src/cmp/ReadmeEntity.ts +11 -178
  154. package/src/cmp/ReadmeIntro.ts +11 -25
  155. package/src/cmp/ReadmeModel.ts +7 -5
  156. package/src/cmp/ReadmeOptions.ts +12 -74
  157. package/src/cmp/ReadmeRef.ts +11 -1372
  158. package/src/sdkgen.ts +2 -1
  159. package/src/utility.ts +12 -0
  160. /package/project/.sdk/tm/go/utility/{make_target.go → make_point.go} +0 -0
@@ -1,192 +1,25 @@
1
1
 
2
- import { cmp, each, Content } from 'jostraca'
2
+ import { cmp } from 'jostraca'
3
3
 
4
- import {
5
- KIT,
6
- getModelPath
7
- } from '../types'
8
-
9
-
10
- const OP_DESC: Record<string, { method: string, goMethod: string, desc: string }> = {
11
- load: { method: 'load(match)', goMethod: 'Load(match, ctrl)', desc: 'Load a single entity by match criteria.' },
12
- list: { method: 'list(match)', goMethod: 'List(match, ctrl)', desc: 'List entities matching the criteria.' },
13
- create: { method: 'create(data)', goMethod: 'Create(data, ctrl)', desc: 'Create a new entity with the given data.' },
14
- update: { method: 'update(data)', goMethod: 'Update(data, ctrl)', desc: 'Update an existing entity.' },
15
- remove: { method: 'remove(match)', goMethod: 'Remove(match, ctrl)', desc: 'Remove the matching entity.' },
16
- }
4
+ import { requirePath } from '../utility'
17
5
 
18
6
 
7
+ // Per-language Entities section lives in
8
+ // `project/.sdk/src/cmp/<lang>/ReadmeEntity_<lang>.ts`.
9
+ // Each language emits its own create-instance call style and
10
+ // op-method spelling (Go's `Load(match, ctrl)` vs TS's `load(match)`).
19
11
  const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
20
- const { target } = props
21
- const { model } = props.ctx$
12
+ const { target, ctx$ } = props
22
13
 
23
- const entity = getModelPath(model, `main.${KIT}.entity`)
24
- const isGo = target.name === 'go'
25
- const lang = isGo ? 'go' : 'ts'
14
+ const ReadmeEntity_sdk =
15
+ requirePath(ctx$, `./cmp/${target.name}/ReadmeEntity_${target.name}`, { ignore: true })
26
16
 
27
- const publishedEntities = each(entity)
28
- .filter((entity: any) => entity.active !== false)
29
-
30
- if (0 === publishedEntities.length) {
31
- return
17
+ if (ReadmeEntity_sdk) {
18
+ ReadmeEntity_sdk['ReadmeEntity']({ target })
32
19
  }
33
-
34
- Content(`
35
-
36
- ## Entities
37
-
38
- `)
39
-
40
- publishedEntities.map((entity: any) => {
41
- const opnames = Object.keys(entity.op || {})
42
- const fields = entity.fields || []
43
-
44
- Content(`
45
- ### ${entity.Name}
46
-
47
- `)
48
-
49
- if (entity.short) {
50
- Content(`${entity.short}
51
-
52
- `)
53
- }
54
-
55
- if (isGo) {
56
- Content(`Create an instance: \`${entity.name} := client.${entity.Name}(nil)\`
57
-
58
- `)
59
- }
60
- else {
61
- Content(`Create an instance: \`const ${entity.name} = client.${entity.Name}()\`
62
-
63
- `)
64
- }
65
-
66
- // Operations table
67
- if (opnames.length > 0) {
68
- Content(`#### Operations
69
-
70
- | Method | Description |
71
- | --- | --- |
72
- `)
73
- opnames.map((opname: string) => {
74
- const info = OP_DESC[opname]
75
- if (info) {
76
- const method = isGo ? info.goMethod : info.method
77
- Content(`| \`${method}\` | ${info.desc} |
78
- `)
79
- }
80
- })
81
-
82
- Content(`
83
- `)
84
- }
85
-
86
- // Fields table
87
- if (fields.length > 0) {
88
- Content(`#### Fields
89
-
90
- | Field | Type | Description |
91
- | --- | --- | --- |
92
- `)
93
-
94
- each(fields, (field: any) => {
95
- const desc = field.short || ''
96
- Content(`| \`${field.name}\` | \`${field.type || 'any'}\` | ${desc} |
97
- `)
98
- })
99
-
100
- Content(`
101
- `)
102
- }
103
-
104
- // Example usage
105
- if (isGo) {
106
- if (opnames.includes('load')) {
107
- Content(`#### Example: Load
108
-
109
- \`\`\`go
110
- result, err := client.${entity.Name}(nil).Load(map[string]any{"id": "${entity.name}_id"}, nil)
111
- \`\`\`
112
-
113
- `)
114
- }
115
-
116
- if (opnames.includes('list')) {
117
- Content(`#### Example: List
118
-
119
- \`\`\`go
120
- results, err := client.${entity.Name}(nil).List(nil, nil)
121
- \`\`\`
122
-
123
- `)
124
- }
125
-
126
- if (opnames.includes('create')) {
127
- Content(`#### Example: Create
128
-
129
- \`\`\`go
130
- result, err := client.${entity.Name}(nil).Create(map[string]any{
131
- `)
132
- each(fields, (field: any) => {
133
- if ('id' !== field.name && field.req) {
134
- Content(` "${field.name}": /* ${field.type || 'value'} */,
135
- `)
136
- }
137
- })
138
- Content(`}, nil)
139
- \`\`\`
140
-
141
- `)
142
- }
143
- }
144
- else {
145
- if (opnames.includes('load')) {
146
- Content(`#### Example: Load
147
-
148
- \`\`\`ts
149
- const ${entity.name} = await client.${entity.Name}().load({ id: '${entity.name}_id' })
150
- \`\`\`
151
-
152
- `)
153
- }
154
-
155
- if (opnames.includes('list')) {
156
- Content(`#### Example: List
157
-
158
- \`\`\`ts
159
- const ${entity.name}s = await client.${entity.Name}().list()
160
- \`\`\`
161
-
162
- `)
163
- }
164
-
165
- if (opnames.includes('create')) {
166
- Content(`#### Example: Create
167
-
168
- \`\`\`ts
169
- const ${entity.name} = await client.${entity.Name}().create({
170
- `)
171
- each(fields, (field: any) => {
172
- if ('id' !== field.name && field.req) {
173
- Content(` ${field.name}: /* ${field.type || 'value'} */,
174
- `)
175
- }
176
- })
177
- Content(`})
178
- \`\`\`
179
-
180
- `)
181
- }
182
- }
183
-
184
- })
185
-
186
20
  })
187
21
 
188
22
 
189
-
190
23
  export {
191
24
  ReadmeEntity
192
25
  }
@@ -1,38 +1,24 @@
1
1
 
2
- import { cmp, Content } from 'jostraca'
2
+ import { cmp } from 'jostraca'
3
3
 
4
- import {
5
- KIT,
6
- getModelPath
7
- } from '../types'
8
-
9
-
10
- const TARGET_INTRO: Record<string, string> = {
11
- ts: 'Provides a type-safe,\nentity-oriented interface with full async/await support.',
12
- go: 'Provides an entity-oriented interface\nusing standard Go conventions \u2014 no generics required, data flows as\n`map[string]any`.',
13
- js: 'Provides an entity-oriented\ninterface with full async/await support.',
14
- }
4
+ import { requirePath } from '../utility'
15
5
 
16
6
 
7
+ // Per-language intro lives in `project/.sdk/src/cmp/<lang>/ReadmeIntro_<lang>.ts`.
8
+ // Each language declares its own tagline and stylistic emphasis (Go's
9
+ // `map[string]any` data-flow note, TS's async/await emphasis, etc.).
17
10
  const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
18
- const { target } = props
19
- const { model } = props.ctx$
20
-
21
- const desc = model.main.def.desc || ''
22
-
23
- const targetIntro = TARGET_INTRO[target.name] || 'Provides an entity-oriented interface.'
11
+ const { target, ctx$ } = props
24
12
 
25
- Content(`# ${model.Name} ${target.title} SDK
26
-
27
- The ${target.title} SDK for the ${model.Name} API. ${targetIntro}
28
-
29
- `)
13
+ const ReadmeIntro_sdk =
14
+ requirePath(ctx$, `./cmp/${target.name}/ReadmeIntro_${target.name}`, { ignore: true })
30
15
 
16
+ if (ReadmeIntro_sdk) {
17
+ ReadmeIntro_sdk['ReadmeIntro']({ target })
18
+ }
31
19
  })
32
20
 
33
21
 
34
-
35
-
36
22
  export {
37
23
  ReadmeIntro
38
24
  }
@@ -6,7 +6,7 @@ import {
6
6
  getModelPath
7
7
  } from '../types'
8
8
 
9
- import { requirePath } from '../utility'
9
+ import { requirePath, isAuthActive } from '../utility'
10
10
 
11
11
 
12
12
  const ReadmeModel = cmp(function ReadmeModel(props: any) {
@@ -30,13 +30,16 @@ const ReadmeModel = cmp(function ReadmeModel(props: any) {
30
30
  }
31
31
  else {
32
32
  // Fallback: generic reference summary
33
- ReadmeModelGeneric({ target, model, entityList })
33
+ ReadmeModelGeneric({ target, model, entityList, authActive: isAuthActive(model) })
34
34
  }
35
35
  })
36
36
 
37
37
 
38
38
  const ReadmeModelGeneric = cmp(function ReadmeModelGeneric(props: any) {
39
- const { target, model, entityList } = props
39
+ const { target, model, entityList, authActive } = props
40
+ const apikeyRow = authActive
41
+ ? '| `apikey` | `string` | API key for authentication. |\n'
42
+ : ''
40
43
 
41
44
  Content(`### ${model.Name}SDK
42
45
 
@@ -44,8 +47,7 @@ const ReadmeModelGeneric = cmp(function ReadmeModelGeneric(props: any) {
44
47
 
45
48
  | Option | Type | Description |
46
49
  | --- | --- | --- |
47
- | \`apikey\` | \`string\` | API key for authentication. |
48
- | \`base\` | \`string\` | Base URL of the API server. |
50
+ ${apikeyRow}| \`base\` | \`string\` | Base URL of the API server. |
49
51
  | \`prefix\` | \`string\` | URL path prefix prepended to all requests. |
50
52
  | \`suffix\` | \`string\` | URL path suffix appended to all requests. |
51
53
  | \`feature\` | \`object\` | Feature activation flags. |
@@ -1,87 +1,25 @@
1
1
 
2
- import { cmp, each, Content } from 'jostraca'
2
+ import { cmp } from 'jostraca'
3
3
 
4
+ import { requirePath } from '../utility'
4
5
 
5
- const ReadmeOptions = cmp(function ReadmeOptions(props: any) {
6
- const { target } = props
7
- const { model } = props.ctx$
8
-
9
- const isGo = target.name === 'go'
10
-
11
- const publishedOptions = each(target.options)
12
- .filter((option: any) => option.publish)
13
-
14
- if (0 === publishedOptions.length) {
15
- return
16
- }
17
-
18
- Content(`
19
-
20
- ## Options
21
-
22
- Pass options when creating a client instance:
23
-
24
- `)
25
-
26
- if (isGo) {
27
- Content(`\`\`\`go
28
- client := sdk.New${model.const.Name}SDK(map[string]any{
29
- `)
30
6
 
31
- publishedOptions.map((option: any) => {
32
- if ('apikey' === option.name) {
33
- Content(` "${option.name}": os.Getenv("${model.NAME}_APIKEY"),
34
- `)
35
- }
36
- else {
37
- Content(` // "${option.name}": ${option.kind === 'string' ? '"..."' : '...'},
38
- `)
39
- }
40
- })
41
-
42
- Content(`})
43
- \`\`\`
44
-
45
- `)
46
- }
47
- else {
48
- Content(`\`\`\`ts
49
- const client = new ${model.Name}SDK({
50
- `)
51
-
52
- publishedOptions.map((option: any) => {
53
- if ('apikey' === option.name) {
54
- Content(` ${option.name}: process.env.${model.NAME}_APIKEY,
55
- `)
56
- }
57
- else {
58
- Content(` // ${option.name}: ${option.kind === 'string' ? "'...'" : '...'},
59
- `)
60
- }
61
- })
7
+ // Per-language Options block lives in
8
+ // `project/.sdk/src/cmp/<lang>/ReadmeOptions_<lang>.ts`.
9
+ // Each language emits its own constructor-call shape and option-table
10
+ // formatting; they share the data source (target.options).
11
+ const ReadmeOptions = cmp(function ReadmeOptions(props: any) {
12
+ const { target, ctx$ } = props
62
13
 
63
- Content(`})
64
- \`\`\`
14
+ const ReadmeOptions_sdk =
15
+ requirePath(ctx$, `./cmp/${target.name}/ReadmeOptions_${target.name}`, { ignore: true })
65
16
 
66
- `)
17
+ if (ReadmeOptions_sdk) {
18
+ ReadmeOptions_sdk['ReadmeOptions']({ target })
67
19
  }
68
-
69
- Content(`| Option | Type | Description |
70
- | --- | --- | --- |
71
- `)
72
-
73
- publishedOptions.map((option: any) => {
74
- Content(`| \`${option.name}\` | \`${option.kind}\` | ${option.short} |
75
- `)
76
- })
77
-
78
- Content(`
79
- `)
80
-
81
20
  })
82
21
 
83
22
 
84
-
85
23
  export {
86
24
  ReadmeOptions
87
25
  }