@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
@@ -1,15 +0,0 @@
1
-
2
- function error(ctx) {
3
-
4
- const err = new Error('Error: '+ctx.op.name+': '+(ctx.result.err?.message||'unknown'))
5
- err.result = ctx.result
6
- err.spec = ctx.spec
7
-
8
- // TODO: model option to return instead
9
- throw err
10
- }
11
-
12
-
13
- module.exports = {
14
- error
15
- }
@@ -1,8 +0,0 @@
1
-
2
- function escre(s) {
3
- return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
4
- }
5
-
6
- module.exports = {
7
- escre
8
- }
@@ -1,8 +0,0 @@
1
-
2
- function escurl(s) {
3
- return encodeURIComponent(s)
4
- }
5
-
6
- module.exports = {
7
- escurl
8
- }
@@ -1,33 +0,0 @@
1
-
2
- const { fullurl } = require('./FullurlUtility')
3
-
4
- // Make HTTP request.
5
- async function fetch(ctx) {
6
- const {op, spec} = ctx
7
- let response = {}
8
-
9
- try {
10
- const url = spec.url = fullurl(ctx)
11
-
12
- const fetchReq = {
13
- method: spec.method,
14
- headers: spec.headers,
15
- }
16
-
17
- if(null != spec.body) {
18
- fetchReq.body =
19
- 'object' === typeof spec.body ? JSON.stringify(spec.body) : spec.body
20
- }
21
-
22
- response = global.fetch(url, fetchReq)
23
- }
24
- catch(err) {
25
- response.err = err
26
- }
27
-
28
- return response
29
- }
30
-
31
- module.exports = {
32
- fetch
33
- }
@@ -1,41 +0,0 @@
1
-
2
- const { joinurl } = require('./JoinurlUtility')
3
- const { escurl } = require('./EscurlUtility')
4
- const { escre } = require('./EscreUtility')
5
-
6
-
7
- function fullurl(ctx) {
8
- const { op, spec } = ctx
9
- const { query, data } = op
10
-
11
- let url = joinurl(spec.base, spec.prefix, spec.path, spec.suffix)
12
-
13
- const params = spec.params
14
- for(let key of op.params) {
15
- if(null == params[key]) {
16
- params[key] = 'res' === op.kind ? query[key] : data[key]
17
- }
18
- }
19
-
20
- for(let key in params) {
21
- const val = spec.params[key]
22
- if(null != val) {
23
- url = url.replace(RegExp('{'+escre(key)+'}'), escurl(val))
24
- }
25
- }
26
-
27
- let qsep = '?'
28
- for(let key in spec.query) {
29
- const val = spec.query[key]
30
- if(null != val) {
31
- url += qsep + escurl(key) + '=' + escurl(val)
32
- qsep = '&'
33
- }
34
- }
35
-
36
- return url
37
- }
38
-
39
- module.exports = {
40
- fullurl
41
- }
@@ -1,23 +0,0 @@
1
-
2
- const { error } = require('./ErrorUtility')
3
-
4
- function inward(ctx) {
5
- if (!ctx.result.ok) {
6
- return undefined
7
- }
8
-
9
- try {
10
- return ctx.op.inward(ctx)
11
- }
12
- catch (err) {
13
- // TDOD: need error codes and err msg text
14
- ctx.result.ok = false
15
- ctx.result.err = err
16
- return error(ctx)
17
- }
18
- }
19
-
20
-
21
- module.exports = {
22
- inward
23
- }
@@ -1,12 +0,0 @@
1
-
2
- function joinurl(...s) {
3
- return s
4
- .filter(s=>null!=s&&''!==s)
5
- .map(s=>s.replace(/^\/+/,'').replace(/\/+$/,''))
6
- .filter(s=>null!=s&&''!==s)
7
- .join('/')
8
- }
9
-
10
- module.exports = {
11
- joinurl
12
- }
@@ -1,36 +0,0 @@
1
-
2
-
3
- // NOTE: duplicated in @voxgig/apidef - dedup to @voxgig/util?
4
- const OPKIND = {
5
- create: 'req',
6
- update: 'req',
7
- remove: 'req',
8
- load: 'res',
9
- list: 'res',
10
- }
11
-
12
-
13
- // Ensure standard operation definition.
14
- function operator(ctx) {
15
- const { op } = ctx
16
-
17
- let out = {
18
- name: op.name,
19
- kind: OPKIND[op.name],
20
- entity: op.entity,
21
- path: op.path,
22
- params: op.params || [],
23
- query: {...op.query} || {},
24
- data: {...op.data} || {},
25
- state: op.state,
26
- inward: op.inward,
27
- outward: op.outward,
28
- }
29
-
30
- return out
31
- }
32
-
33
-
34
- module.exports = {
35
- operator
36
- }
@@ -1,22 +0,0 @@
1
-
2
- const { empty } = require('./EmptyUtility')
3
-
4
- function options(ctx) {
5
- let config = ctx.config || {}
6
- let copts = config.options || {}
7
-
8
- let options = { ...(ctx.options||{}) }
9
-
10
- options.base = empty(options.base) ?
11
- empty(copts.base) ? 'http://localhost:8000' :
12
- copts.base : options.base
13
-
14
- options.prefix = empty(options.prefix) ? '' : options.prefix
15
- options.suffix = empty(options.suffix) ? '' : options.suffix
16
-
17
- return options
18
- }
19
-
20
- module.exports = {
21
- options
22
- }
@@ -1,23 +0,0 @@
1
-
2
- const { error } = require('./ErrorUtility')
3
-
4
- function outward(ctx) {
5
- if (!ctx.result.ok) {
6
- return undefined
7
- }
8
-
9
- try {
10
- return ctx.op.outward(ctx)
11
- }
12
- catch (err) {
13
- // TDOD: need error codes and err msg text
14
- ctx.result.ok = false
15
- ctx.result.err = err
16
- return error(ctx)
17
- }
18
- }
19
-
20
-
21
- module.exports = {
22
- outward
23
- }
@@ -1,17 +0,0 @@
1
-
2
- function resbasic(response, fetchResponse) {
3
- response.status = fetchResponse.status
4
- response.statusText = fetchResponse.statusText || 'no-status'
5
-
6
- // TODO: use spec!
7
- if(400 <= response.status) {
8
- response.ok = false
9
- response.err = new Error(response.status+': '+response.statusText)
10
- }
11
-
12
- return response
13
- }
14
-
15
- module.exports = {
16
- resbasic
17
- }
@@ -1,10 +0,0 @@
1
-
2
- async function resbody(response, fetchResponse) {
3
- const json = await fetchResponse.json()
4
- response.body = json
5
- return response
6
- }
7
-
8
- module.exports = {
9
- resbody
10
- }
@@ -1,11 +0,0 @@
1
-
2
- function resheaders(response, fetchResponse) {
3
- out = {}
4
- fetchResponse.headers.forEach((v,k)=>out[k]=v)
5
- response.headers = out
6
- return response
7
- }
8
-
9
- module.exports = {
10
- resheaders
11
- }
@@ -1,55 +0,0 @@
1
-
2
- const { auth } = require('./AuthUtility')
3
- const { body } = require('./BodyUtility')
4
- const { empty } = require('./EmptyUtility')
5
- const { error } = require('./ErrorUtility')
6
- const { escre } = require('./EscreUtility')
7
- const { escurl } = require('./EscurlUtility')
8
- const { fetch } = require('./FetchUtility')
9
- const { fullurl } = require('./FullurlUtility')
10
- const { headers } = require('./HeadersUtility')
11
- const { inward } = require('./InwardUtility')
12
- const { joinurl } = require('./JoinurlUtility')
13
- const { method } = require('./MethodUtility')
14
- const { operator } = require('./OperatorUtility')
15
- const { options } = require('./OptionsUtility')
16
- const { outward } = require('./outwardUtility')
17
- const { params } = require('./ParamsUtility')
18
- const { query } = require('./QueryUtility')
19
- const { resbasic } = require('./ResbasicUtility')
20
- const { resbody } = require('./ResbodyUtility')
21
- const { resheaders } = require('./ResheadersUtility')
22
- const { response } = require('./ResponseUtility')
23
- const { spec } = require('./SpecUtility')
24
-
25
-
26
- const Utility = {
27
- auth,
28
- body,
29
- empty,
30
- error,
31
- escre,
32
- escurl,
33
- fetch,
34
- fullurl,
35
- headers,
36
- inward,
37
- joinurl,
38
- method,
39
- operator,
40
- options,
41
- outward,
42
- params,
43
- query,
44
- resbasic,
45
- resbody,
46
- resheaders,
47
- response,
48
- spec,
49
- }
50
-
51
-
52
- module.exports = {
53
- Utility
54
- }
55
-
File without changes
File without changes