@voxgig/sdkgen 4.42.0 → 4.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/action/feature.js +16 -0
- package/dist/action/feature.js.map +1 -1
- package/dist/action/kind.js +3 -0
- package/dist/action/kind.js.map +1 -1
- package/dist/action/remove.js +4 -0
- package/dist/action/remove.js.map +1 -1
- package/dist/action/resolve.d.ts +1 -0
- package/dist/action/resolve.js +30 -0
- package/dist/action/resolve.js.map +1 -1
- package/dist/action/target.js +10 -4
- package/dist/action/target.js.map +1 -1
- package/dist/cmp/AgentGuideContent.js +12 -6
- package/dist/cmp/AgentGuideContent.js.map +1 -1
- package/dist/cmp/ReadmeIntro.js +21 -6
- package/dist/cmp/ReadmeIntro.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +23 -9
- package/dist/cmp/ReadmeTop.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/action/feature.ts +20 -0
- package/src/action/kind.ts +4 -0
- package/src/action/remove.ts +4 -0
- package/src/action/resolve.ts +41 -0
- package/src/action/target.ts +11 -4
- package/src/cmp/AgentGuideContent.ts +12 -6
- package/src/cmp/ReadmeIntro.ts +22 -8
- package/src/cmp/ReadmeTop.ts +23 -9
- 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/action/feature.ts
CHANGED
|
@@ -195,6 +195,14 @@ const FeatureRoot = cmp(function FeatureRoot(props: any) {
|
|
|
195
195
|
content: ctx$.meta.content.feature_index,
|
|
196
196
|
}))
|
|
197
197
|
|
|
198
|
+
if (source.owned) {
|
|
199
|
+
log.info({
|
|
200
|
+
point: 'feature-owned', feature: fname,
|
|
201
|
+
note: fname + ': defined in this project, so its files stay as they are'
|
|
202
|
+
})
|
|
203
|
+
return
|
|
204
|
+
}
|
|
205
|
+
|
|
198
206
|
each(target, (t) => {
|
|
199
207
|
// The target's OWN tree, under the name it has in ITS source — an
|
|
200
208
|
// aliased target's templates live at `tm/<origname>`, so searching
|
|
@@ -227,6 +235,18 @@ const FeatureRoot = cmp(function FeatureRoot(props: any) {
|
|
|
227
235
|
|
|
228
236
|
const tmfolder = 0 < overlay.length ? featuretm : owntm
|
|
229
237
|
|
|
238
|
+
// A target the project defines itself carries its own feature sources.
|
|
239
|
+
const inplace = 0 === sources.length && 0 < findFeatureSources(
|
|
240
|
+
fs, Path.join(ctx$.folder ?? '.', 'tm', t.name), [fname]).length
|
|
241
|
+
|
|
242
|
+
if (inplace) {
|
|
243
|
+
log.info({
|
|
244
|
+
point: 'feature-source-in-place', feature: fname, target: t.name,
|
|
245
|
+
note: fname + ': target ' + t.name + ' has its own source'
|
|
246
|
+
})
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
|
|
230
250
|
if (0 === sources.length) {
|
|
231
251
|
log.warn({
|
|
232
252
|
point: 'feature-source-missing', feature: fname, target: t.name,
|
package/src/action/kind.ts
CHANGED
package/src/action/remove.ts
CHANGED
|
@@ -200,6 +200,10 @@ async function planRemove(
|
|
|
200
200
|
plan.refused.push('(source not found: the copy cannot be compared with what' +
|
|
201
201
|
' `' + kind + ' add` wrote; every file below is deleted only under --force)')
|
|
202
202
|
}
|
|
203
|
+
else if (source.owned) {
|
|
204
|
+
plan.refused.push('(defined in this project: these files are its only' +
|
|
205
|
+
' source, and are deleted only under --force)')
|
|
206
|
+
}
|
|
203
207
|
|
|
204
208
|
// The feature being removed counts as selected, so its own source is
|
|
205
209
|
// compared rather than written off as stale — see checkTarget.
|