@voxgig/sdkgen 4.42.0 → 4.43.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/cmp/ReadmeIntro.js +21 -6
- package/dist/cmp/ReadmeIntro.js.map +1 -1
- package/dist/helpers/opShape.d.ts +2 -1
- package/dist/helpers/opShape.js +17 -0
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/sdkgen.d.ts +2 -2
- package/dist/sdkgen.js +5 -4
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/project/.sdk/src/cmp/c/ReadmeIntro_c.ts +6 -25
- package/project/.sdk/src/cmp/clojure/ReadmeIntro_clojure.ts +6 -25
- package/project/.sdk/src/cmp/cpp/ReadmeIntro_cpp.ts +6 -25
- package/project/.sdk/src/cmp/csharp/ReadmeIntro_csharp.ts +6 -25
- package/project/.sdk/src/cmp/elixir/ReadmeIntro_elixir.ts +6 -25
- package/project/.sdk/src/cmp/go/ReadmeIntro_go.ts +7 -37
- package/project/.sdk/src/cmp/java/ReadmeIntro_java.ts +6 -25
- package/project/.sdk/src/cmp/js/ReadmeIntro_js.ts +6 -25
- package/project/.sdk/src/cmp/kotlin/ReadmeIntro_kotlin.ts +6 -25
- package/project/.sdk/src/cmp/lua/ReadmeIntro_lua.ts +6 -25
- package/project/.sdk/src/cmp/ocaml/ReadmeIntro_ocaml.ts +6 -25
- package/project/.sdk/src/cmp/perl/ReadmeIntro_perl.ts +6 -25
- package/project/.sdk/src/cmp/php/ReadmeIntro_php.ts +6 -25
- package/project/.sdk/src/cmp/py/ReadmeIntro_py.ts +6 -25
- package/project/.sdk/src/cmp/rb/ReadmeIntro_rb.ts +6 -25
- package/project/.sdk/src/cmp/rust/ReadmeIntro_rust.ts +6 -25
- package/project/.sdk/src/cmp/scala/ReadmeIntro_scala.ts +6 -25
- package/project/.sdk/src/cmp/swift/ReadmeIntro_swift.ts +6 -25
- package/project/.sdk/src/cmp/ts/ReadmeIntro_ts.ts +6 -36
- package/project/.sdk/src/cmp/zig/ReadmeIntro_zig.ts +6 -25
- package/project/sdkgen-package.json +1 -1
- package/src/cmp/ReadmeIntro.ts +22 -8
- package/src/helpers/opShape.ts +17 -0
- package/src/sdkgen.ts +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content,
|
|
2
|
+
import { cmp, Content, introOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -8,16 +8,10 @@ import {
|
|
|
8
8
|
} from '@voxgig/apidef'
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
|
|
12
12
|
const { target, ctx$: { model } } = props
|
|
13
|
-
const info = modelText(model)
|
|
14
|
-
const tagline = info.tagline || ''
|
|
15
13
|
|
|
16
|
-
Content(
|
|
17
|
-
|
|
18
|
-
${tagline}
|
|
19
|
-
|
|
20
|
-
The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
|
|
14
|
+
Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
|
|
21
15
|
following idiomatic Perl conventions.
|
|
22
16
|
|
|
23
17
|
`)
|
|
@@ -33,20 +27,7 @@ following idiomatic Perl conventions.
|
|
|
33
27
|
? `for example \`$client->${nom(exampleEntity, 'Name')}\` — each`
|
|
34
28
|
: 'each'
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
// expose (a read-only entity has just list+load); never claim
|
|
38
|
-
// create/update/remove exist when no entity has them.
|
|
39
|
-
const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
|
|
40
|
-
const opSet = new Set<string>()
|
|
41
|
-
Object.values(entity || {}).forEach((e: any) => {
|
|
42
|
-
if (!e || e.active === false) return
|
|
43
|
-
Object.keys(e.op || {}).forEach((o: string) => {
|
|
44
|
-
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
const opNames = CANON_OPS.filter((o) => opSet.has(o))
|
|
48
|
-
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
49
|
-
const opList = (opNames.length ? opNames : ['list', 'load'])
|
|
30
|
+
const opList = introOps(model)
|
|
50
31
|
.map((o) => '`' + o + '`').join(', ')
|
|
51
32
|
|
|
52
33
|
Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
|
|
@@ -54,10 +35,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
|
|
|
54
35
|
paths and query strings. You work with named resources and verbs, which
|
|
55
36
|
keeps the cognitive load low.
|
|
56
37
|
|
|
57
|
-
|
|
38
|
+
`)
|
|
58
39
|
})
|
|
59
40
|
|
|
60
41
|
|
|
61
42
|
export {
|
|
62
|
-
|
|
43
|
+
ReadmeIntroBody
|
|
63
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, phpEntityAccessor,
|
|
2
|
+
import { cmp, Content, phpEntityAccessor, introOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -8,30 +8,15 @@ import {
|
|
|
8
8
|
} from '@voxgig/apidef'
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
|
|
12
12
|
const { target, ctx$: { model } } = props
|
|
13
|
-
const info = modelText(model)
|
|
14
|
-
const tagline = info.tagline || ''
|
|
15
13
|
|
|
16
14
|
// Derive a representative entity (and its operations) from the model so the
|
|
17
15
|
// semantic-entity pitch names something real rather than a placeholder.
|
|
18
16
|
const entity = getModelPath(model, `main.${KIT}.entity`) || {}
|
|
19
17
|
const exampleEntity = Object.values(entity).find((e: any) => e && e.active !== false) as any
|
|
20
18
|
const eName = exampleEntity ? nom(exampleEntity, 'Name') : null
|
|
21
|
-
|
|
22
|
-
// actually expose (a read-only entity has just list+load), in canonical
|
|
23
|
-
// order; never claim create/update/remove exist when no entity has them.
|
|
24
|
-
const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
|
|
25
|
-
const opSet = new Set<string>()
|
|
26
|
-
Object.values(entity || {}).forEach((e: any) => {
|
|
27
|
-
if (!e || e.active === false) return
|
|
28
|
-
Object.keys(e.op || {}).forEach((o: string) => {
|
|
29
|
-
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
const opnames = CANON_OPS.filter((o) => opSet.has(o))
|
|
33
|
-
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
34
|
-
const opList = (opnames.length > 0 ? opnames : ['list', 'load']).join('`/`')
|
|
19
|
+
const opList = introOps(model).join('`/`')
|
|
35
20
|
|
|
36
21
|
const semantic = eName
|
|
37
22
|
? `The SDK exposes the API as capitalised, semantic **Entities** — for example \`$client->${phpEntityAccessor(eName)}()\` — with named operations (\`${opList}\`) instead of raw URL paths and query strings. Working with resources and verbs keeps call sites self-describing and reduces cognitive load.
|
|
@@ -39,16 +24,12 @@ const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
|
|
|
39
24
|
`
|
|
40
25
|
: ''
|
|
41
26
|
|
|
42
|
-
Content(
|
|
27
|
+
Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client using PHP conventions.
|
|
43
28
|
|
|
44
|
-
${
|
|
45
|
-
|
|
46
|
-
The ${target.title} SDK for the ${model.Name} API — an entity-oriented client using PHP conventions.
|
|
47
|
-
|
|
48
|
-
${semantic}${alongsideNote(model, target.name)}`)
|
|
29
|
+
${semantic}`)
|
|
49
30
|
})
|
|
50
31
|
|
|
51
32
|
|
|
52
33
|
export {
|
|
53
|
-
|
|
34
|
+
ReadmeIntroBody
|
|
54
35
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content,
|
|
2
|
+
import { cmp, Content, introOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -8,16 +8,10 @@ import {
|
|
|
8
8
|
} from '@voxgig/apidef'
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
|
|
12
12
|
const { target, ctx$: { model } } = props
|
|
13
|
-
const info = modelText(model)
|
|
14
|
-
const tagline = info.tagline || ''
|
|
15
13
|
|
|
16
|
-
Content(
|
|
17
|
-
|
|
18
|
-
${tagline}
|
|
19
|
-
|
|
20
|
-
The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following Pythonic conventions.
|
|
14
|
+
Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following Pythonic conventions.
|
|
21
15
|
|
|
22
16
|
`)
|
|
23
17
|
|
|
@@ -32,20 +26,7 @@ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
|
|
|
32
26
|
? `for example \`client.${nom(exampleEntity, 'Name')}()\` — each`
|
|
33
27
|
: 'each'
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
// expose (a read-only entity has just list+load); never claim
|
|
37
|
-
// create/update/remove exist when no entity has them.
|
|
38
|
-
const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
|
|
39
|
-
const opSet = new Set<string>()
|
|
40
|
-
Object.values(entity || {}).forEach((e: any) => {
|
|
41
|
-
if (!e || e.active === false) return
|
|
42
|
-
Object.keys(e.op || {}).forEach((o: string) => {
|
|
43
|
-
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
const opNames = CANON_OPS.filter((o) => opSet.has(o))
|
|
47
|
-
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
48
|
-
const opList = (opNames.length ? opNames : ['list', 'load'])
|
|
29
|
+
const opList = introOps(model)
|
|
49
30
|
.map((o) => '`' + o + '`').join(', ')
|
|
50
31
|
|
|
51
32
|
Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
|
|
@@ -53,10 +34,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
|
|
|
53
34
|
paths and query strings. You work with named resources and verbs, which
|
|
54
35
|
keeps the cognitive load low.
|
|
55
36
|
|
|
56
|
-
|
|
37
|
+
`)
|
|
57
38
|
})
|
|
58
39
|
|
|
59
40
|
|
|
60
41
|
export {
|
|
61
|
-
|
|
42
|
+
ReadmeIntroBody
|
|
62
43
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content,
|
|
2
|
+
import { cmp, Content, introOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -8,30 +8,15 @@ import {
|
|
|
8
8
|
} from '@voxgig/apidef'
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
|
|
12
12
|
const { target, ctx$: { model } } = props
|
|
13
|
-
const info = modelText(model)
|
|
14
|
-
const tagline = info.tagline || ''
|
|
15
13
|
|
|
16
14
|
// Derive a representative entity (and its operations) from the model so the
|
|
17
15
|
// semantic-entity pitch names something real rather than a placeholder.
|
|
18
16
|
const entity = getModelPath(model, `main.${KIT}.entity`) || {}
|
|
19
17
|
const exampleEntity = Object.values(entity).find((e: any) => e && e.active !== false) as any
|
|
20
18
|
const eName = exampleEntity ? nom(exampleEntity, 'Name') : null
|
|
21
|
-
|
|
22
|
-
// actually expose (a read-only entity has just list+load), in canonical
|
|
23
|
-
// order; never claim create/update/remove exist when no entity has them.
|
|
24
|
-
const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
|
|
25
|
-
const opSet = new Set<string>()
|
|
26
|
-
Object.values(entity || {}).forEach((e: any) => {
|
|
27
|
-
if (!e || e.active === false) return
|
|
28
|
-
Object.keys(e.op || {}).forEach((o: string) => {
|
|
29
|
-
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
const opnames = CANON_OPS.filter((o) => opSet.has(o))
|
|
33
|
-
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
34
|
-
const opList = (opnames.length > 0 ? opnames : ['list', 'load']).join('`/`')
|
|
19
|
+
const opList = introOps(model).join('`/`')
|
|
35
20
|
|
|
36
21
|
const semantic = eName
|
|
37
22
|
? `The SDK exposes the API as capitalised, semantic **Entities** — for example \`client.${eName}\` — with named operations (\`${opList}\`) instead of raw URL paths and query strings. Working with resources and verbs keeps call sites self-describing and reduces cognitive load.
|
|
@@ -39,16 +24,12 @@ const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
|
|
|
39
24
|
`
|
|
40
25
|
: ''
|
|
41
26
|
|
|
42
|
-
Content(
|
|
27
|
+
Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client using idiomatic Ruby conventions.
|
|
43
28
|
|
|
44
|
-
${
|
|
45
|
-
|
|
46
|
-
The ${target.title} SDK for the ${model.Name} API — an entity-oriented client using idiomatic Ruby conventions.
|
|
47
|
-
|
|
48
|
-
${semantic}${alongsideNote(model, target.name)}`)
|
|
29
|
+
${semantic}`)
|
|
49
30
|
})
|
|
50
31
|
|
|
51
32
|
|
|
52
33
|
export {
|
|
53
|
-
|
|
34
|
+
ReadmeIntroBody
|
|
54
35
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content,
|
|
2
|
+
import { cmp, Content, introOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -9,16 +9,10 @@ import {
|
|
|
9
9
|
import { rustVarName, rustMethodName } from './utility_rust'
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
|
|
13
13
|
const { target, ctx$: { model } } = props
|
|
14
|
-
const info = modelText(model)
|
|
15
|
-
const tagline = info.tagline || ''
|
|
16
14
|
|
|
17
|
-
Content(
|
|
18
|
-
|
|
19
|
-
${tagline}
|
|
20
|
-
|
|
21
|
-
The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Rust conventions.
|
|
15
|
+
Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Rust conventions.
|
|
22
16
|
|
|
23
17
|
`)
|
|
24
18
|
|
|
@@ -33,20 +27,7 @@ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
|
|
|
33
27
|
? `for example \`client.${rustMethodName(exampleEntity.name)}(Value::Noval)\` — each`
|
|
34
28
|
: 'each'
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
// expose (a read-only entity has just list+load); never claim
|
|
38
|
-
// create/update/remove exist when no entity has them.
|
|
39
|
-
const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
|
|
40
|
-
const opSet = new Set<string>()
|
|
41
|
-
Object.values(entity || {}).forEach((e: any) => {
|
|
42
|
-
if (!e || e.active === false) return
|
|
43
|
-
Object.keys(e.op || {}).forEach((o: string) => {
|
|
44
|
-
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
const opNames = CANON_OPS.filter((o) => opSet.has(o))
|
|
48
|
-
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
49
|
-
const opList = (opNames.length ? opNames : ['list', 'load'])
|
|
30
|
+
const opList = introOps(model)
|
|
50
31
|
.map((o) => '`' + o + '`').join(', ')
|
|
51
32
|
|
|
52
33
|
Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
|
|
@@ -54,10 +35,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
|
|
|
54
35
|
paths and query strings. You work with named resources and verbs, which
|
|
55
36
|
keeps the cognitive load low.
|
|
56
37
|
|
|
57
|
-
|
|
38
|
+
`)
|
|
58
39
|
})
|
|
59
40
|
|
|
60
41
|
|
|
61
42
|
export {
|
|
62
|
-
|
|
43
|
+
ReadmeIntroBody
|
|
63
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content,
|
|
2
|
+
import { cmp, Content, introOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -9,16 +9,10 @@ import {
|
|
|
9
9
|
import { scalaVarName } from './utility_scala'
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
|
|
13
13
|
const { target, ctx$: { model } } = props
|
|
14
|
-
const info = modelText(model)
|
|
15
|
-
const tagline = info.tagline || ''
|
|
16
14
|
|
|
17
|
-
Content(
|
|
18
|
-
|
|
19
|
-
${tagline}
|
|
20
|
-
|
|
21
|
-
The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Scala conventions.
|
|
15
|
+
Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Scala conventions.
|
|
22
16
|
|
|
23
17
|
`)
|
|
24
18
|
|
|
@@ -33,20 +27,7 @@ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
|
|
|
33
27
|
? `for example \`client.${scalaVarName(exampleEntity.name)}(null)\` — each`
|
|
34
28
|
: 'each'
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
// expose (a read-only entity has just list+load); never claim
|
|
38
|
-
// create/update/remove exist when no entity has them.
|
|
39
|
-
const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
|
|
40
|
-
const opSet = new Set<string>()
|
|
41
|
-
Object.values(entity || {}).forEach((e: any) => {
|
|
42
|
-
if (!e || e.active === false) return
|
|
43
|
-
Object.keys(e.op || {}).forEach((o: string) => {
|
|
44
|
-
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
const opNames = CANON_OPS.filter((o) => opSet.has(o))
|
|
48
|
-
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
49
|
-
const opList = (opNames.length ? opNames : ['list', 'load'])
|
|
30
|
+
const opList = introOps(model)
|
|
50
31
|
.map((o) => '`' + o + '`').join(', ')
|
|
51
32
|
|
|
52
33
|
Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
|
|
@@ -54,10 +35,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
|
|
|
54
35
|
paths and query strings. You work with named resources and verbs, which
|
|
55
36
|
keeps the cognitive load low.
|
|
56
37
|
|
|
57
|
-
|
|
38
|
+
`)
|
|
58
39
|
})
|
|
59
40
|
|
|
60
41
|
|
|
61
42
|
export {
|
|
62
|
-
|
|
43
|
+
ReadmeIntroBody
|
|
63
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content,
|
|
2
|
+
import { cmp, Content, introOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -7,16 +7,10 @@ import {
|
|
|
7
7
|
} from '@voxgig/apidef'
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
|
|
11
11
|
const { target, ctx$: { model } } = props
|
|
12
|
-
const info = modelText(model)
|
|
13
|
-
const tagline = info.tagline || ''
|
|
14
12
|
|
|
15
|
-
Content(
|
|
16
|
-
|
|
17
|
-
${tagline}
|
|
18
|
-
|
|
19
|
-
The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Swift conventions.
|
|
13
|
+
Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Swift conventions.
|
|
20
14
|
|
|
21
15
|
`)
|
|
22
16
|
|
|
@@ -31,20 +25,7 @@ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
|
|
|
31
25
|
? `for example \`client.${exampleEntity.Name}()\` — each`
|
|
32
26
|
: 'each'
|
|
33
27
|
|
|
34
|
-
|
|
35
|
-
// expose (a read-only entity has just list+load); never claim
|
|
36
|
-
// create/update/remove exist when no entity has them.
|
|
37
|
-
const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
|
|
38
|
-
const opSet = new Set<string>()
|
|
39
|
-
Object.values(entity || {}).forEach((e: any) => {
|
|
40
|
-
if (!e || e.active === false) return
|
|
41
|
-
Object.keys(e.op || {}).forEach((o: string) => {
|
|
42
|
-
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
const opNames = CANON_OPS.filter((o) => opSet.has(o))
|
|
46
|
-
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
47
|
-
const opList = (opNames.length ? opNames : ['list', 'load'])
|
|
28
|
+
const opList = introOps(model)
|
|
48
29
|
.map((o) => '`' + o + '`').join(', ')
|
|
49
30
|
|
|
50
31
|
Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
|
|
@@ -52,10 +33,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
|
|
|
52
33
|
paths and query strings. You work with named resources and verbs, which
|
|
53
34
|
keeps the cognitive load low.
|
|
54
35
|
|
|
55
|
-
|
|
36
|
+
`)
|
|
56
37
|
})
|
|
57
38
|
|
|
58
39
|
|
|
59
40
|
export {
|
|
60
|
-
|
|
41
|
+
ReadmeIntroBody
|
|
61
42
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content,
|
|
2
|
+
import { cmp, Content, introOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -8,57 +8,27 @@ import {
|
|
|
8
8
|
} from '@voxgig/apidef'
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
|
|
12
12
|
const { target, ctx$: { model } } = props
|
|
13
|
-
const info = modelText(model)
|
|
14
|
-
const tagline = info.tagline || ''
|
|
15
13
|
|
|
16
14
|
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
17
15
|
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
18
16
|
const eName = exampleEntity ? nom(exampleEntity, 'Name') : 'Entity'
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
// expose (a read-only entity has just list+load); never claim
|
|
22
|
-
// create/update/remove exist when no entity has them.
|
|
23
|
-
const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
|
|
24
|
-
const opSet = new Set<string>()
|
|
25
|
-
Object.values(entity || {}).forEach((e: any) => {
|
|
26
|
-
if (!e || e.active === false) return
|
|
27
|
-
Object.keys(e.op || {}).forEach((o: string) => {
|
|
28
|
-
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
29
|
-
})
|
|
30
|
-
})
|
|
31
|
-
const opNames = CANON_OPS.filter((o) => opSet.has(o))
|
|
32
|
-
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
33
|
-
const opList = (opNames.length ? opNames : ['list', 'load'])
|
|
18
|
+
const opList = introOps(model)
|
|
34
19
|
.map((o) => '`' + o + '`').join(', ')
|
|
35
20
|
|
|
36
|
-
|
|
37
|
-
const siblings = Object.entries(targets)
|
|
38
|
-
.filter(([name, t]: any) => name !== target.name && false !== t.active)
|
|
39
|
-
.map(([name]: any) => name)
|
|
40
|
-
.sort()
|
|
41
|
-
|
|
42
|
-
const siblingNote = 0 === siblings.length ? '' : `
|
|
43
|
-
> Also generated from this model: ${siblings.map((s: string) => '`' + s + '`').join(', ')} — see
|
|
44
|
-
> the [top-level README](../README.md).
|
|
45
|
-
`
|
|
46
|
-
|
|
47
|
-
Content(`# ${model.Name} ${target.title} SDK
|
|
48
|
-
|
|
49
|
-
${tagline}
|
|
50
|
-
|
|
51
|
-
The ${target.title} SDK for the ${model.Name} API — a type-safe, entity-oriented client with full async/await support.
|
|
21
|
+
Content(`The ${target.title} SDK for the ${model.Name} API — a type-safe, entity-oriented client with full async/await support.
|
|
52
22
|
|
|
53
23
|
The API is exposed as capitalised, semantic **Entities** — e.g.
|
|
54
24
|
\`client.${eName}()\` — each with a small set of operations (${opList})
|
|
55
25
|
instead of raw URL paths and query parameters. This keeps the surface
|
|
56
26
|
predictable and low-friction for both humans and AI agents.
|
|
57
|
-
|
|
27
|
+
|
|
58
28
|
`)
|
|
59
29
|
})
|
|
60
30
|
|
|
61
31
|
|
|
62
32
|
export {
|
|
63
|
-
|
|
33
|
+
ReadmeIntroBody
|
|
64
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content,
|
|
2
|
+
import { cmp, Content, introOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -9,16 +9,10 @@ import {
|
|
|
9
9
|
import { zigVarName } from './utility_zig'
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
|
|
13
13
|
const { target, ctx$: { model } } = props
|
|
14
|
-
const info = modelText(model)
|
|
15
|
-
const tagline = info.tagline || ''
|
|
16
14
|
|
|
17
|
-
Content(
|
|
18
|
-
|
|
19
|
-
${tagline}
|
|
20
|
-
|
|
21
|
-
The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Zig conventions.
|
|
15
|
+
Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Zig conventions.
|
|
22
16
|
|
|
23
17
|
`)
|
|
24
18
|
|
|
@@ -33,20 +27,7 @@ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
|
|
|
33
27
|
? `for example \`client.${zigVarName(exampleEntity.name)}(h.vnull())\` — each`
|
|
34
28
|
: 'each'
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
// expose (a read-only entity has just list+load); never claim
|
|
38
|
-
// create/update/remove exist when no entity has them.
|
|
39
|
-
const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
|
|
40
|
-
const opSet = new Set<string>()
|
|
41
|
-
Object.values(entity || {}).forEach((e: any) => {
|
|
42
|
-
if (!e || e.active === false) return
|
|
43
|
-
Object.keys(e.op || {}).forEach((o: string) => {
|
|
44
|
-
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
const opNames = CANON_OPS.filter((o) => opSet.has(o))
|
|
48
|
-
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
49
|
-
const opList = (opNames.length ? opNames : ['list', 'load'])
|
|
30
|
+
const opList = introOps(model)
|
|
50
31
|
.map((o) => '`' + o + '`').join(', ')
|
|
51
32
|
|
|
52
33
|
Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
|
|
@@ -54,10 +35,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
|
|
|
54
35
|
paths and query strings. You work with named resources and verbs, which
|
|
55
36
|
keeps the cognitive load low.
|
|
56
37
|
|
|
57
|
-
|
|
38
|
+
`)
|
|
58
39
|
})
|
|
59
40
|
|
|
60
41
|
|
|
61
42
|
export {
|
|
62
|
-
|
|
43
|
+
ReadmeIntroBody
|
|
63
44
|
}
|
package/src/cmp/ReadmeIntro.ts
CHANGED
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Content } from 'jostraca'
|
|
3
3
|
|
|
4
|
+
import { cmp } from '../helpers/component'
|
|
4
5
|
import { optionalComponent } from '../helpers/optional'
|
|
6
|
+
import { modelText } from '../helpers/text'
|
|
7
|
+
import { alongsideNote } from '../helpers/alongside'
|
|
5
8
|
|
|
6
9
|
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
+
// Every language README opens the same way: the title and tagline, the
|
|
11
|
+
// target's own ReadmeIntroBody, then the note naming the rest of the project.
|
|
12
|
+
// A component exporting a whole ReadmeIntro (a project's copy from before this
|
|
13
|
+
// frame, or a pack not yet moved to it) still writes its own introduction.
|
|
10
14
|
const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
|
|
11
15
|
const { target, ctx$ } = props
|
|
16
|
+
const { model } = ctx$
|
|
12
17
|
|
|
13
|
-
const
|
|
14
|
-
|
|
18
|
+
const intro = optionalComponent(ctx$, target, 'ReadmeIntro')
|
|
19
|
+
if (null == intro) return
|
|
15
20
|
|
|
16
|
-
if (
|
|
17
|
-
|
|
21
|
+
if (null == intro.ReadmeIntroBody) {
|
|
22
|
+
intro.ReadmeIntro({ target })
|
|
23
|
+
return
|
|
18
24
|
}
|
|
25
|
+
|
|
26
|
+
Content(`# ${model.Name} ${target.title} SDK
|
|
27
|
+
|
|
28
|
+
${modelText(model).tagline || ''}
|
|
29
|
+
|
|
30
|
+
`)
|
|
31
|
+
intro.ReadmeIntroBody({ target })
|
|
32
|
+
Content(alongsideNote(model, target.name))
|
|
19
33
|
})
|
|
20
34
|
|
|
21
35
|
|
package/src/helpers/opShape.ts
CHANGED
|
@@ -415,6 +415,22 @@ function entityOps(ent: any): string[] {
|
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
|
|
418
|
+
// Unlike entityOps, keeps action-only ops: the README introductions always have.
|
|
419
|
+
function introOps(model: any): string[] {
|
|
420
|
+
const entity = model?.main?.[KIT]?.entity || {}
|
|
421
|
+
const found = new Set<string>()
|
|
422
|
+
for (const e of Object.values(entity) as any[]) {
|
|
423
|
+
if (!e || false === e.active) continue
|
|
424
|
+
for (const o of Object.keys(e.op || {})) {
|
|
425
|
+
if (e.op[o] && false !== e.op[o].active) found.add(o)
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
const names = CANON_OP_ORDER.filter((o) => found.has(o))
|
|
429
|
+
.concat([...found].filter((o) => !CANON_OP_ORDER.includes(o)))
|
|
430
|
+
return 0 < names.length ? names : ['list', 'load']
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
|
|
418
434
|
type UngeneratedOp = { entity: string, op: string, points: string[] }
|
|
419
435
|
|
|
420
436
|
|
|
@@ -779,6 +795,7 @@ export {
|
|
|
779
795
|
entityDataIdField,
|
|
780
796
|
entityRecordIdField,
|
|
781
797
|
entityOps,
|
|
798
|
+
introOps,
|
|
782
799
|
invalidRequest,
|
|
783
800
|
entityPrimaryOp,
|
|
784
801
|
pickExampleEntity,
|
package/src/sdkgen.ts
CHANGED
|
@@ -71,7 +71,7 @@ import type { DepEntry } from './helpers/collectDeps'
|
|
|
71
71
|
import { canonToType, canonToDtype, canonKey, canonScalarKey } from './helpers/canonType'
|
|
72
72
|
import { canonToSpec, entityDataSpec, entityOpSpec, entitySpecs, validateSeeds } from './helpers/canonSpec'
|
|
73
73
|
import { optionSpec, featureOptionSpec, entitySpecMap } from './helpers/optspec'
|
|
74
|
-
import { OP_SUFFIX, opTypeName, opParams, opReachable, opNeedsAction, ownPoint, opActions, entityActions, entityPath, opRequestShape, entityIdField, entityDataIdField, entityRecordIdField, entityOps, invalidRequest, entityPrimaryOp, pickExampleEntity, entityClassName, entityConstructorName, entityTypeCollisions, warnEntityTypeCollisions, ungeneratedOps, warnUngeneratedOps, deriveEntityNames, entityCollection } from './helpers/opShape'
|
|
74
|
+
import { OP_SUFFIX, opTypeName, opParams, opReachable, opNeedsAction, ownPoint, opActions, entityActions, entityPath, opRequestShape, entityIdField, entityDataIdField, entityRecordIdField, entityOps, introOps, invalidRequest, entityPrimaryOp, pickExampleEntity, entityClassName, entityConstructorName, entityTypeCollisions, warnEntityTypeCollisions, ungeneratedOps, warnUngeneratedOps, deriveEntityNames, entityCollection } from './helpers/opShape'
|
|
75
75
|
import { isReservedName, safeVarName, exampleVarName, phpEntityAccessor, entityCacheField, isRbCoreConstant, isRbSdkConstant, rbSafeTypeName, isSwiftSdkType, swiftSafeTypeName, isPhpReservedType, isPhpSdkClass, phpSafeTypeName, isTsReservedType, isTsSdkType, tsSafeTypeName, isElixirReservedType, elixirSafeTypeName, elixirTypeNames, elixirTypeName, elixirAccessorNames, elixirAccessor, tsTypeName, rbTypeName, phpTypeName, swiftTypeName, jsProp, jsOptProp, jsKey, jsQuote, luaKey, luaString, prefixLeadingDigit } from './helpers/naming'
|
|
76
76
|
import { serverVariables, hasServerVariables, serverVarEnv } from './helpers/serverVars'
|
|
77
77
|
import { mcpTools, MCP_READ_OPS, MCP_WRITE_OPS } from './helpers/mcpTools'
|
|
@@ -1176,6 +1176,7 @@ export {
|
|
|
1176
1176
|
entityDataIdField,
|
|
1177
1177
|
entityRecordIdField,
|
|
1178
1178
|
entityOps,
|
|
1179
|
+
introOps,
|
|
1179
1180
|
entityPrimaryOp,
|
|
1180
1181
|
pickExampleEntity,
|
|
1181
1182
|
entityClassName,
|