@voxgig/sdkgen 0.17.0 → 0.18.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 (138) hide show
  1. package/dist/action/feature.js +3 -2
  2. package/dist/action/feature.js.map +1 -1
  3. package/dist/action/target.js +11 -6
  4. package/dist/action/target.js.map +1 -1
  5. package/dist/cmp/Entity.js +2 -1
  6. package/dist/cmp/Entity.js.map +1 -1
  7. package/dist/cmp/Main.js +23 -9
  8. package/dist/cmp/Main.js.map +1 -1
  9. package/dist/sdkgen.d.ts +7 -1
  10. package/dist/sdkgen.js +5 -2
  11. package/dist/sdkgen.js.map +1 -1
  12. package/dist/tsconfig.tsbuildinfo +1 -1
  13. package/dist/utility.js +1 -2
  14. package/dist/utility.js.map +1 -1
  15. package/model/sdkgen.jsonic +8 -5
  16. package/package.json +5 -5
  17. package/project/{generate → .sdk}/model/feature/log.jsonic +5 -1
  18. package/project/{generate → .sdk}/model/target/js.jsonic +0 -1
  19. package/project/.sdk/model/target/ts.jsonic +25 -0
  20. package/project/{generate → .sdk}/src/cmp/js/Config_js.ts +17 -2
  21. package/project/{generate → .sdk}/src/cmp/js/Entity_js.ts +16 -15
  22. package/project/{generate → .sdk}/src/cmp/js/Main_js.ts +22 -16
  23. package/project/{generate → .sdk}/src/cmp/js/Package_js.ts +2 -1
  24. package/project/.sdk/src/cmp/js/TestAcceptEntity_js.ts +13 -0
  25. package/project/.sdk/src/cmp/js/TestAccept_js.ts +18 -0
  26. package/project/.sdk/src/cmp/js/TestEntity_js.ts +13 -0
  27. package/project/.sdk/src/cmp/js/TestMain_js.ts +19 -0
  28. package/project/{generate → .sdk}/src/cmp/js/fragment/Entity.fragment.js +15 -7
  29. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +61 -0
  30. package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +57 -0
  31. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +61 -0
  32. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +61 -0
  33. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +61 -0
  34. package/project/{generate → .sdk}/src/cmp/js/fragment/Main.fragment.js +26 -3
  35. package/project/.sdk/src/cmp/ts/Config_ts.ts +36 -0
  36. package/project/.sdk/src/cmp/ts/Entity_ts.ts +93 -0
  37. package/project/.sdk/src/cmp/ts/MainEntity_ts.ts.off +22 -0
  38. package/project/.sdk/src/cmp/ts/Main_ts.ts +88 -0
  39. package/project/.sdk/src/cmp/ts/Main_ts.ts~ +88 -0
  40. package/project/.sdk/src/cmp/ts/Package_ts.ts +63 -0
  41. package/project/.sdk/src/cmp/ts/Package_ts.ts~ +58 -0
  42. package/project/.sdk/src/cmp/ts/Quick_ts.ts.off +82 -0
  43. package/project/.sdk/src/cmp/ts/ReadmeInstall_ts.ts.off +19 -0
  44. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts.off +25 -0
  45. package/project/.sdk/src/cmp/ts/TestAcceptEntity_ts.ts.off +13 -0
  46. package/project/.sdk/src/cmp/ts/TestAccept_ts.ts.off +18 -0
  47. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts.off +13 -0
  48. package/project/.sdk/src/cmp/ts/TestMain_ts.ts.off +19 -0
  49. package/project/.sdk/src/cmp/ts/Test_ts.ts.off +24 -0
  50. package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +15 -0
  51. package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.js +79 -0
  52. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.js +61 -0
  53. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.js +57 -0
  54. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.js +61 -0
  55. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.js +61 -0
  56. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.js +61 -0
  57. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.js +67 -0
  58. package/project/{generate → .sdk}/tm/js/src/feature/log/LogFeature.js +14 -10
  59. package/project/.sdk/tm/js/src/utility/AuthUtility.js +21 -0
  60. package/project/.sdk/tm/js/src/utility/BodyUtility.js +29 -0
  61. package/project/.sdk/tm/js/src/utility/DoneUtility.js +15 -0
  62. package/project/.sdk/tm/js/src/utility/ErrorUtility.js +33 -0
  63. package/project/.sdk/tm/js/src/utility/FindparamUtility.js +31 -0
  64. package/project/.sdk/tm/js/src/utility/FullurlUtility.js +39 -0
  65. package/project/{generate → .sdk}/tm/js/src/utility/HeadersUtility.js +2 -1
  66. package/project/.sdk/tm/js/src/utility/JoinurlUtility.js +14 -0
  67. package/project/{generate → .sdk}/tm/js/src/utility/MethodUtility.js +2 -1
  68. package/project/.sdk/tm/js/src/utility/OperatorUtility.js +44 -0
  69. package/project/.sdk/tm/js/src/utility/OptionsUtility.js +54 -0
  70. package/project/{generate → .sdk}/tm/js/src/utility/ParamsUtility.js +5 -4
  71. package/project/{generate → .sdk}/tm/js/src/utility/QueryUtility.js +6 -4
  72. package/project/.sdk/tm/js/src/utility/ReqformUtility.js +32 -0
  73. package/project/.sdk/tm/js/src/utility/RequestUtility.js +48 -0
  74. package/project/.sdk/tm/js/src/utility/ResbasicUtility.js +27 -0
  75. package/project/.sdk/tm/js/src/utility/ResbodyUtility.js +15 -0
  76. package/project/.sdk/tm/js/src/utility/ResformUtility.js +34 -0
  77. package/project/.sdk/tm/js/src/utility/ResheadersUtility.js +19 -0
  78. package/project/{generate → .sdk}/tm/js/src/utility/ResponseUtility.js +11 -10
  79. package/project/.sdk/tm/js/src/utility/ResultUtility.js +28 -0
  80. package/project/{generate → .sdk}/tm/js/src/utility/SpecUtility.js +6 -12
  81. package/project/.sdk/tm/js/src/utility/StructUtility.js +1203 -0
  82. package/project/.sdk/tm/js/src/utility/Utility.js +74 -0
  83. package/project/.sdk/tm/js/test/runner.js +171 -0
  84. package/project/.sdk/tm/js/test/utility/Custom.test.js +85 -0
  85. package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +187 -0
  86. package/project/.sdk/tm/js/test/utility/StructUtility.test.js +367 -0
  87. package/project/.sdk/tm/py/LICENSE +22 -0
  88. package/project/.sdk/tm/ts/LICENSE +22 -0
  89. package/project/.sdk/tm/ts/src/README.md +1 -0
  90. package/project/.sdk/tm/ts/src/feature/README.md +1 -0
  91. package/project/.sdk/tm/ts/src/tsconfig.json +15 -0
  92. package/project/.sdk/tm/ts/src/utility/README.md +3 -0
  93. package/project/.sdk/tm/ts/test/README.md +2 -0
  94. package/project/.sdk/tm/ts/test/README.md~ +2 -0
  95. package/project/.sdk/tm/ts/test/tsconfig.json +13 -0
  96. package/src/action/feature.ts +4 -3
  97. package/src/action/target.ts +12 -6
  98. package/src/cmp/Entity.ts +3 -1
  99. package/src/cmp/Main.ts +30 -10
  100. package/src/sdkgen.ts +15 -5
  101. package/src/utility.ts +1 -2
  102. package/project/generate/src/cmp/js/TestAcceptEntity_js.ts +0 -101
  103. package/project/generate/src/cmp/js/TestAccept_js.ts +0 -60
  104. package/project/generate/src/cmp/js/TestEntity_js.ts +0 -24
  105. package/project/generate/src/cmp/js/TestMain_js.ts +0 -120
  106. package/project/generate/src/cmp/js/fragment/EntityCreateOp.fragment.js +0 -66
  107. package/project/generate/src/cmp/js/fragment/EntityListOp.fragment.js +0 -72
  108. package/project/generate/src/cmp/js/fragment/EntityLoadOp.fragment.js +0 -66
  109. package/project/generate/src/cmp/js/fragment/EntityRemoveOp.fragment.js +0 -66
  110. package/project/generate/src/cmp/js/fragment/EntityUpdateOp.fragment.js +0 -66
  111. package/project/generate/tm/js/src/utility/AuthUtility.js +0 -16
  112. package/project/generate/tm/js/src/utility/BodyUtility.js +0 -27
  113. package/project/generate/tm/js/src/utility/EmptyUtility.js +0 -8
  114. package/project/generate/tm/js/src/utility/ErrorUtility.js +0 -15
  115. package/project/generate/tm/js/src/utility/EscreUtility.js +0 -8
  116. package/project/generate/tm/js/src/utility/EscurlUtility.js +0 -8
  117. package/project/generate/tm/js/src/utility/FetchUtility.js +0 -33
  118. package/project/generate/tm/js/src/utility/FullurlUtility.js +0 -41
  119. package/project/generate/tm/js/src/utility/InwardUtility.js +0 -23
  120. package/project/generate/tm/js/src/utility/JoinurlUtility.js +0 -12
  121. package/project/generate/tm/js/src/utility/OperatorUtility.js +0 -36
  122. package/project/generate/tm/js/src/utility/OptionsUtility.js +0 -22
  123. package/project/generate/tm/js/src/utility/OutwardUtility.js +0 -23
  124. package/project/generate/tm/js/src/utility/ResbasicUtility.js +0 -17
  125. package/project/generate/tm/js/src/utility/ResbodyUtility.js +0 -10
  126. package/project/generate/tm/js/src/utility/ResheadersUtility.js +0 -11
  127. package/project/generate/tm/js/src/utility/Utility.js +0 -55
  128. /package/project/{generate → .sdk}/model/feature/limit.jsonic +0 -0
  129. /package/project/{generate → .sdk}/model/feature/page.jsonic +0 -0
  130. /package/project/{generate → .sdk}/model/feature/telemetry.jsonic +0 -0
  131. /package/project/{generate → .sdk}/model/target/go.jsonic +0 -0
  132. /package/project/{generate → .sdk}/src/cmp/js/MainEntity_js.ts +0 -0
  133. /package/project/{generate → .sdk}/src/cmp/js/Quick_js.ts +0 -0
  134. /package/project/{generate → .sdk}/src/cmp/js/ReadmeInstall_js.ts +0 -0
  135. /package/project/{generate → .sdk}/src/cmp/js/ReadmeQuick_js.ts +0 -0
  136. /package/project/{generate → .sdk}/src/cmp/js/Test_js.ts +0 -0
  137. /package/project/{generate → .sdk}/tm/go/LICENSE +0 -0
  138. /package/project/{generate → .sdk}/tm/js/LICENSE +0 -0
@@ -0,0 +1,13 @@
1
+
2
+ import { cmp, camelify, Content } from '@voxgig/sdkgen'
3
+
4
+
5
+ const TestEntity = cmp(function TestEntity(props: any) {
6
+ const { entity } = props
7
+
8
+ })
9
+
10
+
11
+ export {
12
+ TestEntity
13
+ }
@@ -0,0 +1,19 @@
1
+
2
+ import { cmp, each, File, Content } from '@voxgig/sdkgen'
3
+
4
+
5
+ import { TestEntity } from './TestEntity_js'
6
+
7
+
8
+ const TestMain = cmp(function TestMain(props: any) {
9
+ const { target } = props
10
+ const { model } = props.ctx$
11
+
12
+
13
+ })
14
+
15
+
16
+ export {
17
+ TestMain
18
+ }
19
+
@@ -5,7 +5,7 @@ class NameEntity {
5
5
  #features
6
6
  #utility
7
7
  #data
8
- #query
8
+ #match
9
9
 
10
10
  constructor(client, options) {
11
11
  options = options || {}
@@ -16,7 +16,9 @@ class NameEntity {
16
16
  this.#features = client.features()
17
17
  this.#utility = client.utility()
18
18
  this.#data = {}
19
- this.#query = {}
19
+ this.#match = {}
20
+
21
+ // #PostConstructEntity-Hook
20
22
  }
21
23
 
22
24
  options() {
@@ -27,8 +29,13 @@ class NameEntity {
27
29
  return this.#client
28
30
  }
29
31
 
32
+ make() {
33
+ return new NameEntity(this.#client, this.options())
34
+ }
35
+
36
+
30
37
  data(data) {
31
- // NOTE: query cannot be mutated.
38
+ // NOTE: data can be mutated.
32
39
  if(null != data) {
33
40
 
34
41
  // #SetData-Hook
@@ -43,11 +50,12 @@ class NameEntity {
43
50
  return out
44
51
  }
45
52
 
46
- query() {
47
- // NOTE: query cannot be mutated.
48
- let out = { ...this.#query }
53
+
54
+ match() {
55
+ // NOTE: match cannot be mutated.
56
+ let out = { ...this.#match }
49
57
 
50
- // #GetQuery-Hook
58
+ // #GetMatch-Hook
51
59
 
52
60
  return out
53
61
  }
@@ -0,0 +1,61 @@
1
+ class EntityOperation { // REMOVED
2
+
3
+ async create(data) {
4
+ let entity = this
5
+ let client = this.#client
6
+ const utility = this.#utility
7
+ const { operator, spec, request, response, result, error, struct, done } = utility
8
+
9
+ let op = {
10
+ entity: 'Name',
11
+ name: 'create',
12
+ path: 'PATH',
13
+ params: ['PARAM-LIST'],
14
+ alias: {'ALIAS':'MAP'},
15
+ match: this.#match,
16
+ data: null == data ? this.#data : data,
17
+ state: {},
18
+ reqform: 'REQFORM',
19
+ resform: 'RESFORM',
20
+ }
21
+
22
+ let ctx = { client, op, utility, entity }
23
+
24
+
25
+ // #PreOperation-Hook
26
+
27
+ await operator(ctx)
28
+
29
+
30
+ // #PreSpec-Hook
31
+
32
+ this.#data = ctx.op.data
33
+
34
+ await spec(ctx)
35
+
36
+
37
+ // #PreRequest-Hook
38
+
39
+ await request(ctx)
40
+
41
+
42
+ // #PreResponse-Hook
43
+
44
+ await response(ctx)
45
+
46
+
47
+ // #PreResult-Hook
48
+
49
+ await result(ctx)
50
+
51
+
52
+ // #PostOperation-Hook
53
+
54
+ if(null != ctx.result.resdata) {
55
+ this.#data = ctx.result.resdata
56
+ }
57
+
58
+ return done(ctx)
59
+ }
60
+
61
+ } // REMOVED
@@ -0,0 +1,57 @@
1
+ class EntityOperation { // REMOVED
2
+
3
+ async list(match) {
4
+ let entity = this
5
+ let client = this.#client
6
+ const utility = this.#utility
7
+ const { operator, spec, request, response, result, error, struct, done } = utility
8
+
9
+ let op = {
10
+ entity: 'Name',
11
+ name: 'list',
12
+ path: 'PATH',
13
+ params: ['PARAM-LIST'],
14
+ alias: {'ALIAS':'MAP'},
15
+ match,
16
+ data: this.#data,
17
+ state: {},
18
+ reqform: 'REQFORM',
19
+ resform: 'RESFORM',
20
+ }
21
+
22
+ let ctx = { client, entity, op, utility}
23
+
24
+
25
+ // #PreOperation-Hook
26
+
27
+ await operator(ctx)
28
+
29
+
30
+ // #PreSpec-Hook
31
+
32
+ this.#match = ctx.op.match
33
+
34
+ await spec(ctx)
35
+
36
+
37
+ // #PreRequest-Hook
38
+
39
+ await request(ctx)
40
+
41
+
42
+ // #PreResponse-Hook
43
+
44
+ await response(ctx)
45
+
46
+
47
+ // #PreResult-Hook
48
+
49
+ await result(ctx)
50
+
51
+
52
+ // #PostOperation-Hook
53
+
54
+ return done(ctx)
55
+ }
56
+
57
+ } // REMOVED
@@ -0,0 +1,61 @@
1
+ class EntityOperation { // REMOVED
2
+
3
+ async load(match) {
4
+ const entity = this
5
+ const client = this.#client
6
+ const utility = this.#utility
7
+ const { operator, spec, request, response, result, error, struct, done } = utility
8
+
9
+ const op = {
10
+ entity: 'Name',
11
+ name: 'load',
12
+ path: 'PATH',
13
+ params: ['PARAM-LIST'],
14
+ alias: {'ALIAS':'MAP'},
15
+ match,
16
+ data: this.#data,
17
+ state: {},
18
+ reqform: 'REQFORM',
19
+ resform: 'RESFORM',
20
+ }
21
+
22
+ let ctx = { client, entity, op, utility}
23
+
24
+
25
+ // #PreOperation-Hook
26
+
27
+ await operator(ctx)
28
+
29
+
30
+ // #PreSpec-Hook
31
+
32
+ this.#match = op.match
33
+
34
+ await spec(ctx)
35
+
36
+
37
+ // #PreRequest-Hook
38
+
39
+ await request(ctx)
40
+
41
+
42
+ // #PreResponse-Hook
43
+
44
+ await response(ctx)
45
+
46
+
47
+ // #PreResult-Hook
48
+
49
+ await result(ctx)
50
+
51
+
52
+ // #PostOperation-Hook
53
+
54
+ if(null != ctx.result.resdata) {
55
+ this.#data = ctx.result.resdata
56
+ }
57
+
58
+ return done(ctx)
59
+ }
60
+
61
+ } // REMOVED
@@ -0,0 +1,61 @@
1
+ class EntityOperation { // REMOVED
2
+
3
+ async remove(match) {
4
+ let entity = this
5
+ let client = this.#client
6
+ const utility = this.#utility
7
+ const { operator, spec, request, response, result, error, struct, done } = utility
8
+
9
+ let op = {
10
+ entity: 'Name',
11
+ name: 'remove',
12
+ path: 'PATH',
13
+ params: ['PARAM-LIST'],
14
+ alias: {'ALIAS':'MAP'},
15
+ match,
16
+ data: this.#data,
17
+ state: {},
18
+ reqform: 'REQFORM',
19
+ resform: 'RESFORM',
20
+ }
21
+
22
+ let ctx = {client, entity, op, utility}
23
+
24
+
25
+ // #PreOperation-Hook
26
+
27
+ await operator(ctx)
28
+
29
+
30
+ // #PreSpec-Hook
31
+
32
+ this.#data = op.data
33
+
34
+ await spec(ctx)
35
+
36
+
37
+ // #PreRequest-Hook
38
+
39
+ await request(ctx)
40
+
41
+
42
+ // #PreResponse-Hook
43
+
44
+ await response(ctx)
45
+
46
+
47
+ // #PreResult-Hook
48
+
49
+ await result(ctx)
50
+
51
+
52
+ // #PostOperation-Hook
53
+
54
+ if(null != ctx.result.resdata) {
55
+ this.#data = ctx.result.resdata
56
+ }
57
+
58
+ return done(ctx)
59
+ }
60
+
61
+ } // REMOVED
@@ -0,0 +1,61 @@
1
+ class EntityOperation { // REMOVED
2
+
3
+ async update(data) {
4
+ let entity = this
5
+ let client = this.#client
6
+ const utility = this.#utility
7
+ const { operator, spec, request, response, result, error, struct, done } = utility
8
+
9
+ let op = {
10
+ entity: 'Name',
11
+ name: 'update',
12
+ path: 'PATH',
13
+ params: ['PARAM-LIST'],
14
+ alias: {'ALIAS':'MAP'},
15
+ match: this.#match,
16
+ data: null == data ? this.#data : data,
17
+ state: {},
18
+ reqform: 'REQFORM',
19
+ resform: 'RESFORM',
20
+ }
21
+
22
+ let ctx = {client, entity, op, utility}
23
+
24
+
25
+ // #PreOperation-Hook
26
+
27
+ await operator(ctx)
28
+
29
+
30
+ // #PreSpec-Hook
31
+
32
+ this.#data = op.data
33
+
34
+ await spec(ctx)
35
+
36
+
37
+ // #PreRequest-Hook
38
+
39
+ await request(ctx)
40
+
41
+
42
+ // #PreResponse-Hook
43
+
44
+ await response(ctx)
45
+
46
+
47
+ // #PreResult-Hook
48
+
49
+ await result(ctx)
50
+
51
+
52
+ // #PostOperation-Hook
53
+
54
+ if(null != ctx.result.resdata) {
55
+ this.#data = ctx.result.resdata
56
+ }
57
+
58
+ return done(ctx)
59
+ }
60
+
61
+ } // REMOVED
@@ -10,9 +10,14 @@ class NameSDK {
10
10
 
11
11
  constructor(options) {
12
12
 
13
- // # CustomUtility
13
+ this.#options = this.#utility.options({
14
+ client: this,
15
+ utility: this.#utility,
16
+ config: Config,
17
+ options,
18
+ })
14
19
 
15
- this.#options = this.#utility.options({self:this, options, config:Config})
20
+ // #FeatureOptions
16
21
 
17
22
  this.#features = {
18
23
  // #BuildFeature
@@ -35,10 +40,28 @@ class NameSDK {
35
40
  }
36
41
 
37
42
 
43
+ static test(opts) {
44
+ return new NameSDK({
45
+ // #TestOptions
46
+ ...(opts || {})
47
+ })
48
+ }
49
+
50
+ test(opts) {
51
+ return new NameSDK({
52
+ // #TestOptions
53
+ ...(opts || this.#options || {})
54
+ })
55
+ }
56
+
57
+
38
58
  // <[SLOT]>
39
59
  }
40
60
 
41
61
 
62
+ const SDK = NameSDK
63
+
42
64
  module.exports = {
43
- NameSDK
65
+ NameSDK,
66
+ SDK,
44
67
  }
@@ -0,0 +1,36 @@
1
+
2
+ import * as Path from 'node:path'
3
+
4
+ import {
5
+ cmp, each, names,
6
+ List, File, Content, Copy, Folder, Fragment, Line, FeatureHook,
7
+ } from '@voxgig/sdkgen'
8
+
9
+
10
+
11
+ const Config = cmp(async function Config(props: any) {
12
+ const { target, ctx$: { model } } = props
13
+ const { main: { sdk: { entity } } } = model
14
+
15
+ const ff = Path.normalize(__dirname + '/../../../src/cmp/ts/fragment/')
16
+
17
+ File({ name: 'Config.' + target.ext }, () => {
18
+
19
+ Fragment({
20
+ from: ff + 'Config.fragment.ts',
21
+ replace: {
22
+ '// #EntityConfigs': () => each(entity, (entity: any) => {
23
+ Content(`
24
+ ${entity.name}: {
25
+ },
26
+ `)
27
+ })
28
+ }
29
+ })
30
+ })
31
+ })
32
+
33
+
34
+ export {
35
+ Config
36
+ }
@@ -0,0 +1,93 @@
1
+
2
+ import * as Path from 'node:path'
3
+
4
+ import {
5
+ cmp, each, camelify,
6
+ File, Content, Folder, Fragment, Line, FeatureHook,
7
+ } from '@voxgig/sdkgen'
8
+
9
+
10
+
11
+ const Operation = cmp(function Operation(props: any) {
12
+ const { ff, opname, indent, entity, entitySDK } = props
13
+
14
+ const entop = entity.op[opname]
15
+ const path = entop.path
16
+ // console.log('ENTOP', entop)
17
+
18
+ // TODO: move up to to common Entity
19
+ const params = JSON.stringify(path
20
+ .match(/\{[^}]+\}/g)
21
+ .map((p: string) => p.substring(1, p.length - 1))
22
+ .filter((p: string) => null != p && '' !== p))
23
+
24
+ const aliasmap = JSON.stringify(entitySDK.alias.field)
25
+
26
+ // const hasp = '' != entop.place
27
+
28
+ Fragment({
29
+ from: ff + '/Entity' + camelify(opname) + 'Op.fragment.js',
30
+ indent,
31
+ replace: {
32
+ Name: entity.Name,
33
+ PATH: entop.path,
34
+ "['PARAM-LIST']": params,
35
+ "{'ALIAS':'MAP'}": aliasmap,
36
+ "'REQFORM'": JSON.stringify(entop.reqform),
37
+ "'RESFORM'": JSON.stringify(entop.resform),
38
+ 'class EntityOperation { // REMOVED': '',
39
+ '} // REMOVED': '',
40
+
41
+ '#Feature-Hook': ({ name, indent }: any) =>
42
+ FeatureHook({ name }, (f: any) =>
43
+ Line({ indent },
44
+ `${f.await ? 'await ' : ''}this.#features.${f.name}.${name}(ctx)`)),
45
+ }
46
+ })
47
+ })
48
+
49
+
50
+
51
+ const Entity = cmp(function Entity(props: any) {
52
+ const { target, entity, entitySDK } = props
53
+ // console.log('ENTITY', props)
54
+
55
+ const ff = Path.normalize(__dirname + '/../../../src/cmp/ts/fragment/')
56
+
57
+ // Folder({ name: 'src/entity' }, () => {
58
+
59
+ // File({ name: entity.Name + 'Entity.' + target.name }, () => {
60
+
61
+ // const opnames = Object.keys(entity.op)
62
+
63
+ // const opfrags =
64
+ // (['load', 'list', 'create', 'update', 'remove']
65
+ // .reduce((a: any, opname: string) =>
66
+ // (a['#' + camelify(opname) + 'Op'] =
67
+ // !opnames.includes(opname) ? '' : ({ indent }: any) => {
68
+ // Operation({ ff, opname, indent, entity, entitySDK })
69
+ // }, a), {}))
70
+
71
+ // Fragment({
72
+ // from: ff + 'Entity.fragment.js',
73
+ // replace: {
74
+ // Name: entity.Name,
75
+
76
+ // '#Feature-Hook': ({ name, indent }: any) =>
77
+ // FeatureHook({ name }, (f: any) =>
78
+ // Line({ indent },
79
+ // `${f.await ? 'await ' : ''}this.#features.${f.name}.${name}({entity:this})`)),
80
+
81
+ // ...opfrags,
82
+ // }
83
+ // })
84
+
85
+ // })
86
+ // })
87
+
88
+ })
89
+
90
+
91
+ export {
92
+ Entity
93
+ }
@@ -0,0 +1,22 @@
1
+
2
+
3
+ import { cmp, each, File, Content } from '@voxgig/sdkgen'
4
+
5
+
6
+ const MainEntity = cmp(async function MainEntity(props: any) {
7
+ const { entity } = props
8
+
9
+ Content(`
10
+ ${entity.Name}(data) {
11
+ const self = this
12
+ return new ${entity.Name}Entity(self,data)
13
+ }
14
+
15
+ `)
16
+
17
+ })
18
+
19
+
20
+ export {
21
+ MainEntity
22
+ }
@@ -0,0 +1,88 @@
1
+
2
+ import * as Path from 'node:path'
3
+
4
+ import {
5
+ cmp, each, names, cmap,
6
+ List, File, Content, Copy, Folder, Fragment, Line, FeatureHook,
7
+ } from '@voxgig/sdkgen'
8
+
9
+
10
+ import { Package } from './Package_ts'
11
+ import { Config } from './Config_ts'
12
+ //import { MainEntity } from './MainEntity_ts'
13
+ //import { Test } from './Test_ts'
14
+
15
+
16
+ const Main = cmp(async function Main(props: any) {
17
+ const { target } = props
18
+ const { model } = props.ctx$
19
+
20
+ const { entity } = model.main.api
21
+ const { feature } = model.main.sdk
22
+
23
+ Package({ target })
24
+
25
+ // Test({ target })
26
+
27
+ Folder({ name: 'src' }, () => {
28
+
29
+ // File({ name: model.const.Name + 'SDK.' + target.name }, () => {
30
+
31
+ // Line(`// ${model.const.Name} ${target.Name} SDK\n`)
32
+
33
+ // List({ item: feature }, ({ item }: any) =>
34
+ // Line(`const { ${item.Name + 'Feature'} } = ` +
35
+ // `require('./feature/${item.name}/${item.Name}Feature')`))
36
+
37
+ // List({ item: entity }, ({ item }: any) =>
38
+ // Line(`const { ${item.Name}Entity } = require('./entity/${item.Name}Entity')`))
39
+
40
+ // Fragment({
41
+ // from: Path.normalize(__dirname + '/../../../src/cmp/js/fragment/Main.fragment.js'),
42
+ // replace: {
43
+ // Name: model.const.Name,
44
+
45
+
46
+ // '#FeatureOptions': ({ indent }: any) =>
47
+ // Line({ indent }, `const fopts = this.#options.feature || {}`),
48
+
49
+ // '#BuildFeature': ({ indent }: any) => {
50
+ // List({ item: feature, line: false }, ({ item }: any) =>
51
+ // Line({ indent }, `${item.name}: ` +
52
+ // `new ${item.Name}Feature(this, fopts.${item.name}, ` +
53
+ // `${JSON.stringify(item.config || {})}), `))
54
+ // },
55
+
56
+ // '#Feature-Hook': ({ name, indent }: any) =>
57
+ // FeatureHook({ name }, (f: any) =>
58
+ // Line({ indent },
59
+ // `${f.await ? 'await ' : ''}this.#features.${f.name}.${name}({ client: this })`)),
60
+
61
+ // '#TestOptions': ({ indent }: any) => {
62
+ // const topts = {
63
+ // feature: cmap(feature, {
64
+ // active: false
65
+ // }),
66
+ // }
67
+ // Content({ indent },
68
+ // JSON.stringify(topts, null, 2)
69
+ // .replace(/^{\n /, '').replace(/\n}$/, ',\n').replace(/\n /g, '\n'))
70
+ // }
71
+ // }
72
+ // }, () => {
73
+ // each(entity, (entity: any) => {
74
+ // // console.log('ENTITY', entity.name)
75
+ // MainEntity({ target, entity, entitySDK: model.main.sdk.entity[entity.name] })
76
+ // })
77
+ // })
78
+ // })
79
+
80
+ Config({ target })
81
+
82
+ })
83
+ })
84
+
85
+
86
+ export {
87
+ Main
88
+ }