@voxgig/sdkgen 0.24.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/bin/voxgig-sdkgen +6 -6
  2. package/dist/action/action.js +1 -2
  3. package/dist/action/action.js.map +1 -1
  4. package/dist/action/feature.js +4 -2
  5. package/dist/action/feature.js.map +1 -1
  6. package/dist/action/target.js +4 -2
  7. package/dist/action/target.js.map +1 -1
  8. package/dist/cmp/Entity.js +2 -1
  9. package/dist/cmp/Entity.js.map +1 -1
  10. package/dist/cmp/FeatureHook.js +2 -1
  11. package/dist/cmp/FeatureHook.js.map +1 -1
  12. package/dist/cmp/Main.js.map +1 -1
  13. package/dist/cmp/ReadmeEntity.js +2 -1
  14. package/dist/cmp/ReadmeEntity.js.map +1 -1
  15. package/dist/cmp/Test.d.ts +2 -0
  16. package/dist/cmp/Test.js +17 -0
  17. package/dist/cmp/Test.js.map +1 -0
  18. package/dist/sdkgen.d.ts +2 -1
  19. package/dist/sdkgen.js +17 -28
  20. package/dist/sdkgen.js.map +1 -1
  21. package/dist/tsconfig.tsbuildinfo +1 -1
  22. package/dist/types.d.ts +3 -1
  23. package/dist/types.js +4 -0
  24. package/dist/types.js.map +1 -1
  25. package/model/sdkgen.jsonic +8 -8
  26. package/package.json +8 -6
  27. package/project/.sdk/model/feature/log.jsonic +2 -2
  28. package/project/.sdk/model/feature/test.jsonic +7 -2
  29. package/project/.sdk/model/target/js.jsonic +2 -2
  30. package/project/.sdk/model/target/ts.jsonic +2 -2
  31. package/project/.sdk/src/cmp/js/Main_js.ts +3 -3
  32. package/project/.sdk/src/cmp/js/Quick_js.ts +1 -1
  33. package/project/.sdk/src/cmp/ts/Config_ts.ts +53 -6
  34. package/project/.sdk/src/cmp/ts/EntityOperation_ts.ts +3 -21
  35. package/project/.sdk/src/cmp/ts/Entity_ts.ts +3 -5
  36. package/project/.sdk/src/cmp/ts/Main_ts.ts +22 -12
  37. package/project/.sdk/src/cmp/ts/Package_ts.ts +32 -12
  38. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +341 -2
  39. package/project/.sdk/src/cmp/ts/TestMain_ts.ts +0 -3
  40. package/project/.sdk/src/cmp/ts/Test_ts.ts +21 -3
  41. package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +38 -5
  42. package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.ts +50 -38
  43. package/project/.sdk/src/cmp/ts/fragment/Entity.test.fragment.ts +9 -7
  44. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +47 -31
  45. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +49 -31
  46. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +50 -33
  47. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +50 -31
  48. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +51 -31
  49. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +70 -34
  50. package/project/.sdk/src/cmp/ts/tsconfig.json +15 -0
  51. package/project/.sdk/src/cmp/ts/utility_ts.ts +55 -1
  52. package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +158 -104
  53. package/project/.sdk/tm/ts/src/types.ts +164 -34
  54. package/project/.sdk/tm/ts/src/utility/AuthUtility.ts +8 -2
  55. package/project/.sdk/tm/ts/src/utility/BodyUtility.ts +9 -6
  56. package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +17 -31
  57. package/project/.sdk/tm/ts/src/utility/ContextUtility.ts +14 -54
  58. package/project/.sdk/tm/ts/src/utility/DoneUtility.ts +1 -1
  59. package/project/.sdk/tm/ts/src/utility/ErrorUtility.ts +7 -3
  60. package/project/.sdk/tm/ts/src/utility/FeaturehookUtility.ts +8 -5
  61. package/project/.sdk/tm/ts/src/utility/FetcherUtility.ts +18 -2
  62. package/project/.sdk/tm/ts/src/utility/FindparamUtility.ts +12 -5
  63. package/project/.sdk/tm/ts/src/utility/FullurlUtility.ts +21 -5
  64. package/project/.sdk/tm/ts/src/utility/InitfeatureUtility.ts +3 -1
  65. package/project/.sdk/tm/ts/src/utility/OperationUtility.ts +23 -0
  66. package/project/.sdk/tm/ts/src/utility/OptionsUtility.ts +25 -3
  67. package/project/.sdk/tm/ts/src/utility/ParamsUtility.ts +10 -10
  68. package/project/.sdk/tm/ts/src/utility/PreparePathUtility.ts +18 -0
  69. package/project/.sdk/tm/ts/src/utility/QueryUtility.ts +2 -2
  70. package/project/.sdk/tm/ts/src/utility/ReqformUtility.ts +2 -2
  71. package/project/.sdk/tm/ts/src/utility/RequestUtility.ts +20 -3
  72. package/project/.sdk/tm/ts/src/utility/ResbasicUtility.ts +1 -1
  73. package/project/.sdk/tm/ts/src/utility/ResbodyUtility.ts +5 -3
  74. package/project/.sdk/tm/ts/src/utility/ResformUtility.ts +3 -3
  75. package/project/.sdk/tm/ts/src/utility/ResheadersUtility.ts +9 -7
  76. package/project/.sdk/tm/ts/src/utility/ResponseUtility.ts +35 -4
  77. package/project/.sdk/tm/ts/src/utility/ResultUtility.ts +24 -4
  78. package/project/.sdk/tm/ts/src/utility/SelectionUtility.ts +78 -0
  79. package/project/.sdk/tm/ts/src/utility/SpecUtility.ts +34 -27
  80. package/project/.sdk/tm/ts/src/utility/StructUtility.ts +1117 -509
  81. package/project/.sdk/tm/ts/src/utility/Utility.ts +10 -8
  82. package/project/.sdk/tm/ts/test/exists.test.ts +0 -1
  83. package/project/.sdk/tm/ts/test/runner.ts +12 -10
  84. package/project/.sdk/tm/ts/test/utility/Custom.test.ts +30 -29
  85. package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +53 -47
  86. package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +433 -189
  87. package/src/action/action.ts +1 -2
  88. package/src/action/feature.ts +7 -2
  89. package/src/action/target.ts +7 -7
  90. package/src/cmp/Entity.ts +7 -1
  91. package/src/cmp/FeatureHook.ts +6 -1
  92. package/src/cmp/Main.ts +4 -0
  93. package/src/cmp/ReadmeEntity.ts +6 -1
  94. package/src/cmp/Test.ts +31 -0
  95. package/src/sdkgen.ts +19 -34
  96. package/src/types.ts +10 -1
  97. package/project/.sdk/src/cmp/ts/EntityTest_ts.ts +0 -180
  98. package/project/.sdk/tm/ts/src/utility/OperatorUtility.ts +0 -90
@@ -15,24 +15,24 @@
15
15
  */
16
16
 
17
17
 
18
-
19
18
  import { addfeature } from './AddfeatureUtility'
20
19
  import { auth } from './AuthUtility'
21
20
  import { body } from './BodyUtility'
22
21
  import { clean } from './CleanUtility'
23
- import { contextify } from './ContextUtility'
24
22
  import { done } from './DoneUtility'
25
23
  import { error } from './ErrorUtility'
26
- import { featurehook } from './FeaturehookUtility'
24
+ import { featureHook } from './FeatureHookUtility'
27
25
  import { fetcher } from './FetcherUtility'
28
26
  import { findparam } from './FindparamUtility'
29
27
  import { fullurl } from './FullurlUtility'
30
28
  import { headers } from './HeadersUtility'
31
29
  import { initfeature } from './InitfeatureUtility'
30
+ import { makeContext } from './ContextUtility'
31
+ import { makeOperation } from './OperationUtility'
32
32
  import { method } from './MethodUtility'
33
- import { operator, opify } from './OperatorUtility'
34
33
  import { options } from './OptionsUtility'
35
34
  import { params } from './ParamsUtility'
35
+ import { preparePath } from './PreparePathUtility'
36
36
  import { query } from './QueryUtility'
37
37
  import { reqform } from './ReqformUtility'
38
38
  import { request } from './RequestUtility'
@@ -42,6 +42,7 @@ import { resform } from './ResformUtility'
42
42
  import { resheaders } from './ResheadersUtility'
43
43
  import { response } from './ResponseUtility'
44
44
  import { result } from './ResultUtility'
45
+ import { selection } from './SelectionUtility'
45
46
  import { spec } from './SpecUtility'
46
47
 
47
48
  import { StructUtility } from './StructUtility'
@@ -53,20 +54,20 @@ class Utility {
53
54
  auth = auth
54
55
  body = body
55
56
  clean = clean
56
- contextify = contextify
57
57
  done = done
58
58
  error = error
59
- featurehook = featurehook
59
+ featureHook = featureHook
60
60
  fetcher = fetcher
61
61
  findparam = findparam
62
62
  fullurl = fullurl
63
63
  headers = headers
64
64
  initfeature = initfeature
65
+ makeContext = makeContext
66
+ makeOperation = makeOperation
65
67
  method = method
66
- operator = operator
67
- opify = opify
68
68
  options = options
69
69
  params = params
70
+ preparePath = preparePath
70
71
  query = query
71
72
  reqform = reqform
72
73
  request = request
@@ -76,6 +77,7 @@ class Utility {
76
77
  resheaders = resheaders
77
78
  response = response
78
79
  result = result
80
+ selection = selection
79
81
  spec = spec
80
82
 
81
83
  struct = new StructUtility()
@@ -10,7 +10,6 @@ describe('exists', async () => {
10
10
 
11
11
  test('test-mode', async () => {
12
12
  const testsdk = await ProjectNameSDK.test()
13
- // console.log('testsdk', testsdk)
14
13
  equal(null !== testsdk, true)
15
14
  })
16
15
 
@@ -1,10 +1,10 @@
1
- // VERSION: @voxgig/struct 0.0.4
1
+ // VERSION: @voxgig/struct 0.0.10
2
2
  // This test utility runs the JSON-specified tests in build/test/test.json.
3
3
  // (or .sdk/test/test.json if used in a @voxgig/sdkgen project)
4
4
 
5
5
  import { readFileSync } from 'node:fs'
6
6
  import { join } from 'node:path'
7
- import { deepEqual, fail, AssertionError } from 'node:assert'
7
+ import { deepStrictEqual, fail, AssertionError } from 'node:assert'
8
8
 
9
9
  const NULLMARK = '__NULL__' // Value is JSON null
10
10
  const UNDEFMARK = '__UNDEF__' // Value is not present (thus, undefined).
@@ -16,6 +16,7 @@ type RunSet = (testspec: any, testsubject: Function) => Promise<any>
16
16
  type RunSetFlags = (testspec: any, flags: Record<string, boolean>, testsubject: Function)
17
17
  => Promise<any>
18
18
 
19
+
19
20
  type RunPack = {
20
21
  spec: Record<string, any>
21
22
  runset: RunSet
@@ -24,6 +25,7 @@ type RunPack = {
24
25
  client: any
25
26
  }
26
27
 
28
+
27
29
  type TestPack = {
28
30
  name?: string
29
31
  client: any
@@ -36,9 +38,10 @@ type Flags = Record<string, boolean>
36
38
 
37
39
  type Utility = {
38
40
  struct: any
39
- contextify: (ctxmap: Record<string, any>) => any
41
+ makeContext: (ctxmap: Record<string, any>, basectx?: any) => any
40
42
  }
41
43
 
44
+
42
45
  type Client = {
43
46
  utility: () => Utility
44
47
  }
@@ -80,7 +83,7 @@ async function makeRunner(testfile: string, client: Client) {
80
83
  res = fixJSON(res, flags)
81
84
  entry.res = res
82
85
 
83
- checkResult(entry, res, structUtils)
86
+ checkResult(entry, args, res, structUtils)
84
87
  }
85
88
  catch (err: any) {
86
89
  if (err instanceof AssertionError) {
@@ -110,8 +113,7 @@ async function makeRunner(testfile: string, client: Client) {
110
113
 
111
114
  function resolveSpec(name: string, testfile: string): Record<string, any> {
112
115
  const alltests =
113
- JSON.parse(readFileSync(join(
114
- __dirname, testfile), 'utf8'))
116
+ JSON.parse(readFileSync(join(__dirname, testfile), 'utf8'))
115
117
 
116
118
  let spec = alltests.primary?.[name] || alltests[name] || alltests
117
119
  return spec
@@ -163,7 +165,7 @@ function resolveEntry(entry: any, flags: Flags): any {
163
165
  }
164
166
 
165
167
 
166
- function checkResult(entry: any, res: any, structUtils: Record<string, any>) {
168
+ function checkResult(entry: any, args: any[], res: any, structUtils: Record<string, any>) {
167
169
  let matched = false
168
170
 
169
171
  if (entry.err) {
@@ -172,7 +174,7 @@ function checkResult(entry: any, res: any, structUtils: Record<string, any>) {
172
174
  }
173
175
 
174
176
  if (entry.match) {
175
- const result = { in: entry.in, out: entry.res, ctx: entry.ctx }
177
+ const result = { in: entry.in, args, out: entry.res, ctx: entry.ctx }
176
178
  match(
177
179
  entry.match,
178
180
  result,
@@ -193,7 +195,7 @@ function checkResult(entry: any, res: any, structUtils: Record<string, any>) {
193
195
  return
194
196
  }
195
197
 
196
- deepEqual(null != res ? JSON.parse(JSON.stringify(res)) : res, entry.out)
198
+ deepStrictEqual(null != res ? JSON.parse(JSON.stringify(res)) : res, entry.out)
197
199
  }
198
200
 
199
201
 
@@ -251,7 +253,7 @@ function resolveArgs(
251
253
  let first = args[0]
252
254
  if (structUtils.ismap(first)) {
253
255
  first = structUtils.clone(first)
254
- first = utility.contextify(first)
256
+ first = utility.makeContext(first)
255
257
  args[0] = first
256
258
  entry.ctx = first
257
259
 
@@ -4,38 +4,39 @@ import { equal } from 'node:assert'
4
4
 
5
5
  import { ProjectNameSDK } from '../..'
6
6
 
7
- const client = ProjectNameSDK.test({}, {
8
- apikey: 'APIKEY01',
9
-
10
- // NOTE: original utility.options must remain in place.
11
- utility: {
12
- auth: () => ({ util: 'AUTH' }),
13
- body: () => ({ util: 'BODY' }),
14
- contextify: () => ({ util: 'CONTEXTIFY' }),
15
- done: () => ({ util: 'DONE' }),
16
- error: () => ({ util: 'ERROR' }),
17
- findparam: () => ({ util: 'FINDPARAM' }),
18
- fullurl: () => ({ util: 'FULLURL' }),
19
- headers: () => ({ util: 'HEADERS' }),
20
- method: () => ({ util: 'METHOD' }),
21
- operator: () => ({ util: 'OPERATOR' }),
22
- params: () => ({ util: 'PARAMS' }),
23
- query: () => ({ util: 'QUERY' }),
24
- reqform: () => ({ util: 'REQFORM' }),
25
- request: () => ({ util: 'REQUEST' }),
26
- resbasic: () => ({ util: 'RESBASIC' }),
27
- resbody: () => ({ util: 'RESBODY' }),
28
- resform: () => ({ util: 'RESFORM' }),
29
- resheaders: () => ({ util: 'RESHEADERS' }),
30
- response: () => ({ util: 'RESPONSE' }),
31
- result: () => ({ util: 'RESULT' }),
32
- spec: () => ({ util: 'SPEC' }),
33
- }
34
- })
35
-
36
7
 
37
8
  describe('Custom', () => {
9
+
38
10
  test('basic', async () => {
11
+ const client = ProjectNameSDK.test({}, {
12
+ apikey: 'APIKEY01',
13
+
14
+ // NOTE: original utility.options must remain in place.
15
+ utility: {
16
+ auth: () => ({ util: 'AUTH' }),
17
+ body: () => ({ util: 'BODY' }),
18
+ contextify: () => ({ util: 'CONTEXTIFY' }),
19
+ done: () => ({ util: 'DONE' }),
20
+ error: () => ({ util: 'ERROR' }),
21
+ findparam: () => ({ util: 'FINDPARAM' }),
22
+ fullurl: () => ({ util: 'FULLURL' }),
23
+ headers: () => ({ util: 'HEADERS' }),
24
+ method: () => ({ util: 'METHOD' }),
25
+ operator: () => ({ util: 'OPERATOR' }),
26
+ params: () => ({ util: 'PARAMS' }),
27
+ query: () => ({ util: 'QUERY' }),
28
+ reqform: () => ({ util: 'REQFORM' }),
29
+ request: () => ({ util: 'REQUEST' }),
30
+ resbasic: () => ({ util: 'RESBASIC' }),
31
+ resbody: () => ({ util: 'RESBODY' }),
32
+ resform: () => ({ util: 'RESFORM' }),
33
+ resheaders: () => ({ util: 'RESHEADERS' }),
34
+ response: () => ({ util: 'RESPONSE' }),
35
+ result: () => ({ util: 'RESULT' }),
36
+ spec: () => ({ util: 'SPEC' }),
37
+ }
38
+ })
39
+
39
40
  const u: any = client.utility()
40
41
 
41
42
  equal(u.auth().util, 'AUTH')
@@ -1,6 +1,6 @@
1
1
 
2
- import { test, describe } from 'node:test'
3
- import { equal, deepEqual } from 'node:assert'
2
+ import { test, describe, before } from 'node:test'
3
+ import { equal } from 'node:assert'
4
4
 
5
5
  import {
6
6
  makeRunner,
@@ -15,8 +15,39 @@ import {
15
15
 
16
16
  describe('PrimaryUtility', async () => {
17
17
 
18
- const client = SDK.test()
19
- const runner = await makeRunner(TEST_JSON_FILE, client)
18
+ let client: any
19
+ let runner: any
20
+ let runners: any
21
+
22
+ before(async () => {
23
+ client = SDK.test()
24
+ runner = await makeRunner(TEST_JSON_FILE, client)
25
+
26
+ runners = {
27
+ auth: await runner('auth'),
28
+ body: await runner('body'),
29
+ // makeContext: await runner('makeContext'),
30
+ done: await runner('done'),
31
+ error: await runner('error'),
32
+ findparam: await runner('findparam'),
33
+ fullurl: await runner('fullurl'),
34
+ headers: await runner('headers'),
35
+ method: await runner('method'),
36
+ operator: await runner('operator'),
37
+ options: await runner('options'),
38
+ params: await runner('params'),
39
+ query: await runner('query'),
40
+ reqform: await runner('reqform'),
41
+ request: await runner('request', { fetch: MockFetch }),
42
+ resbasic: await runner('resbasic'),
43
+ resbody: await runner('resbody'),
44
+ resform: await runner('resform'),
45
+ resheaders: await runner('resheaders'),
46
+ response: await runner('response'),
47
+ spec: await runner('spec'),
48
+ }
49
+
50
+ })
20
51
 
21
52
 
22
53
  async function MockFetch(url: string, fetchdef: any) {
@@ -47,41 +78,16 @@ describe('PrimaryUtility', async () => {
47
78
  }
48
79
 
49
80
 
50
- const runners = {
51
- auth: await runner('auth'),
52
- body: await runner('body'),
53
- contextify: await runner('contextify'),
54
- done: await runner('done'),
55
- error: await runner('error'),
56
- findparam: await runner('findparam'),
57
- fullurl: await runner('fullurl'),
58
- headers: await runner('headers'),
59
- method: await runner('method'),
60
- operator: await runner('operator'),
61
- options: await runner('options'),
62
- params: await runner('params'),
63
- query: await runner('query'),
64
- reqform: await runner('reqform'),
65
- request: await runner('request', { fetch: MockFetch }),
66
- resbasic: await runner('resbasic'),
67
- resbody: await runner('resbody'),
68
- resform: await runner('resform'),
69
- resheaders: await runner('resheaders'),
70
- response: await runner('response'),
71
- spec: await runner('spec'),
72
- }
73
-
74
-
75
81
  test('exists', async () => {
76
82
  equal('function', typeof runners.auth.subject)
77
83
  equal('function', typeof runners.body.subject)
78
- equal('function', typeof runners.contextify.subject)
84
+ // equal('function', typeof runners.makeContext.subject)
79
85
  equal('function', typeof runners.done.subject)
80
86
  equal('function', typeof runners.error.subject)
81
87
  equal('function', typeof runners.findparam.subject)
82
88
  equal('function', typeof runners.fullurl.subject)
83
89
  equal('function', typeof runners.method.subject)
84
- equal('function', typeof runners.operator.subject)
90
+ // equal('function', typeof runners.operator.subject)
85
91
  equal('function', typeof runners.options.subject)
86
92
  equal('function', typeof runners.params.subject)
87
93
  equal('function', typeof runners.query.subject)
@@ -111,16 +117,16 @@ describe('PrimaryUtility', async () => {
111
117
  // })
112
118
 
113
119
 
114
- test('contextify-basic', async () => {
115
- const { runset, spec, subject } = runners.contextify
116
- await runset(spec.basic, subject)
117
- })
120
+ // test('makeContext-basic', async () => {
121
+ // const { runset, spec, subject } = runners.makeContext
122
+ // await runset(spec.basic, subject)
123
+ // })
118
124
 
119
125
 
120
- test('done-basic', async () => {
121
- const { runset, spec, subject } = runners.done
122
- await runset(spec.basic, subject)
123
- })
126
+ // test('done-basic', async () => {
127
+ // const { runset, spec, subject } = runners.done
128
+ // await runset(spec.basic, subject)
129
+ // })
124
130
 
125
131
 
126
132
  // test('error-basic', async () => {
@@ -147,10 +153,10 @@ describe('PrimaryUtility', async () => {
147
153
  // })
148
154
 
149
155
 
150
- test('method-basic', async () => {
151
- const { runset, spec, subject } = runners.method
152
- await runset(spec.basic, subject)
153
- })
156
+ // test('method-basic', async () => {
157
+ // const { runset, spec, subject } = runners.method
158
+ // await runset(spec.basic, subject)
159
+ // })
154
160
 
155
161
 
156
162
  // test('operator-basic', async () => {
@@ -210,10 +216,10 @@ describe('PrimaryUtility', async () => {
210
216
  // })
211
217
 
212
218
 
213
- test('resform-basic', async () => {
214
- const { runset, spec, subject } = runners.resform
215
- await runset(spec.basic, subject)
216
- })
219
+ // test('resform-basic', async () => {
220
+ // const { runset, spec, subject } = runners.resform
221
+ // await runset(spec.basic, subject)
222
+ // })
217
223
 
218
224
 
219
225
  // test('resheaders-basic', async () => {