@voxgig/sdkgen 0.22.0 → 0.23.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 +12 -4
- package/dist/action/action.d.ts +4 -0
- package/dist/action/action.js +35 -0
- package/dist/action/action.js.map +1 -0
- package/dist/action/feature.d.ts +4 -2
- package/dist/action/feature.js +57 -38
- package/dist/action/feature.js.map +1 -1
- package/dist/action/target.d.ts +4 -2
- package/dist/action/target.js +136 -45
- package/dist/action/target.js.map +1 -1
- package/dist/cmp/Entity.js +5 -0
- package/dist/cmp/Entity.js.map +1 -1
- package/dist/cmp/Feature.js +5 -0
- package/dist/cmp/Feature.js.map +1 -1
- package/dist/cmp/Main.js +4 -1
- package/dist/cmp/Main.js.map +1 -1
- package/dist/cmp/Top.d.ts +2 -0
- package/dist/cmp/Top.js +23 -0
- package/dist/cmp/Top.js.map +1 -0
- package/dist/sdkgen.d.ts +10 -3
- package/dist/sdkgen.js +53 -8
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +16 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utility.d.ts +3 -3
- package/dist/utility.js +7 -8
- package/dist/utility.js.map +1 -1
- package/package.json +6 -10
- package/project/.sdk/model/feature/README.md +2 -0
- package/project/.sdk/model/feature/log.jsonic +7 -4
- package/project/.sdk/model/feature/test.jsonic +26 -0
- package/project/.sdk/model/target/ts.jsonic +1 -0
- package/project/.sdk/src/cmp/ts/Config_ts.ts +7 -2
- package/project/.sdk/src/cmp/ts/EntityOperation_ts.ts +67 -0
- package/project/.sdk/src/cmp/ts/EntityTest_ts.ts +180 -0
- package/project/.sdk/src/cmp/ts/Entity_ts.ts +41 -66
- package/project/.sdk/src/cmp/ts/MainEntity_ts.ts +22 -0
- package/project/.sdk/src/cmp/ts/Main_ts.ts +52 -53
- package/project/.sdk/src/cmp/ts/Package_ts.ts +12 -7
- package/project/.sdk/src/cmp/ts/ReadmeInstall_ts.ts +19 -0
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +24 -0
- package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +13 -0
- package/project/.sdk/src/cmp/ts/TestMain_ts.ts +19 -0
- package/project/.sdk/src/cmp/ts/Test_ts.ts +20 -0
- package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +8 -1
- package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.ts +164 -0
- package/project/.sdk/src/cmp/ts/fragment/Entity.test.fragment.ts +37 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +91 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +92 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +96 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +96 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +95 -0
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +107 -0
- package/project/.sdk/src/cmp/ts/utility_ts.ts +10 -0
- package/project/.sdk/tm/ts/src/feature/base/BaseFeature.ts +43 -0
- package/project/.sdk/tm/ts/src/feature/log/LogFeature.ts +109 -0
- package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +159 -0
- package/project/.sdk/tm/ts/src/tsconfig.json +1 -1
- package/project/.sdk/tm/ts/src/types.ts +114 -0
- package/project/.sdk/tm/ts/src/utility/AddfeatureUtility.ts +47 -0
- package/project/.sdk/tm/ts/src/utility/AuthUtility.ts +42 -0
- package/project/.sdk/tm/ts/src/utility/BodyUtility.ts +29 -0
- package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +50 -0
- package/project/.sdk/tm/ts/src/utility/ContextUtility.ts +67 -0
- package/project/.sdk/tm/ts/src/utility/DoneUtility.ts +28 -0
- package/project/.sdk/tm/ts/src/utility/ErrorUtility.ts +59 -0
- package/project/.sdk/tm/ts/src/utility/FeaturehookUtility.ts +26 -0
- package/project/.sdk/tm/ts/src/utility/FetcherUtility.ts +17 -0
- package/project/.sdk/tm/ts/src/utility/FindparamUtility.ts +54 -0
- package/project/.sdk/tm/ts/src/utility/FullurlUtility.ts +46 -0
- package/project/.sdk/tm/ts/src/utility/HeadersUtility.ts +24 -0
- package/project/.sdk/tm/ts/src/utility/InitfeatureUtility.ts +13 -0
- package/project/.sdk/tm/ts/src/utility/JoinurlUtility.ts +15 -0
- package/project/.sdk/tm/ts/src/utility/MethodUtility.ts +25 -0
- package/project/.sdk/tm/ts/src/utility/OperatorUtility.ts +90 -0
- package/project/.sdk/tm/ts/src/utility/OptionsUtility.ts +72 -0
- package/project/.sdk/tm/ts/src/utility/ParamsUtility.ts +37 -0
- package/project/.sdk/tm/ts/src/utility/QueryUtility.ts +27 -0
- package/project/.sdk/tm/ts/src/utility/ReqformUtility.ts +33 -0
- package/project/.sdk/tm/ts/src/utility/RequestUtility.ts +66 -0
- package/project/.sdk/tm/ts/src/utility/ResbasicUtility.ts +34 -0
- package/project/.sdk/tm/ts/src/utility/ResbodyUtility.ts +19 -0
- package/project/.sdk/tm/ts/src/utility/ResformUtility.ts +36 -0
- package/project/.sdk/tm/ts/src/utility/ResheadersUtility.ts +23 -0
- package/project/.sdk/tm/ts/src/utility/ResponseUtility.ts +30 -0
- package/project/.sdk/tm/ts/src/utility/ResultUtility.ts +36 -0
- package/project/.sdk/tm/ts/src/utility/SpecUtility.ts +61 -0
- package/project/.sdk/tm/ts/src/utility/StructUtility.ts +2499 -0
- package/project/.sdk/tm/ts/src/utility/Utility.ts +88 -0
- package/project/.sdk/tm/ts/test/exists.test.ts +17 -0
- package/project/.sdk/tm/ts/test/runner.ts +402 -0
- package/project/.sdk/tm/ts/test/tsconfig.json +1 -1
- package/project/.sdk/tm/ts/test/utility/Custom.test.ts +62 -0
- package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +244 -0
- package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +678 -0
- package/project/.sdk/tm/ts/test/utility/index.ts +9 -0
- package/project/.sdk/tm/ts/test/utility.ts +86 -0
- package/src/action/action.ts +54 -0
- package/src/action/feature.ts +83 -47
- package/src/action/target.ts +173 -53
- package/src/cmp/Entity.ts +6 -0
- package/src/cmp/Feature.ts +6 -3
- package/src/cmp/Main.ts +4 -1
- package/src/sdkgen.ts +86 -11
- package/src/types.ts +33 -0
- package/src/utility.ts +5 -3
- package/project/.sdk/model/feature/limit.jsonic +0 -12
- package/project/.sdk/model/feature/page.jsonic +0 -9
- package/project/.sdk/model/feature/telemetry.jsonic +0 -10
- package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.js +0 -79
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.js +0 -61
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.js +0 -57
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.js +0 -61
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.js +0 -61
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.js +0 -61
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.js +0 -67
- package/project/.sdk/tm/ts/test/README.md~ +0 -2
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
|
|
2
|
+
import { test, describe } from 'node:test'
|
|
3
|
+
import { equal, deepEqual } from 'node:assert'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
makeRunner,
|
|
7
|
+
} from '../runner'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
SDK,
|
|
11
|
+
TEST_JSON_FILE
|
|
12
|
+
} from './index'
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
describe('PrimaryUtility', async () => {
|
|
17
|
+
|
|
18
|
+
const client = SDK.test()
|
|
19
|
+
const runner = await makeRunner(TEST_JSON_FILE, client)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
async function MockFetch(url: string, fetchdef: any) {
|
|
23
|
+
return {
|
|
24
|
+
status: 200,
|
|
25
|
+
statusText: 'OK',
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
function MockResponse(resdef: any) {
|
|
31
|
+
const mres = {
|
|
32
|
+
native: {
|
|
33
|
+
status: resdef.native.status,
|
|
34
|
+
statusText: resdef.native.reason,
|
|
35
|
+
json: async () => resdef.native.body,
|
|
36
|
+
headers: {
|
|
37
|
+
forEach(callback: any) {
|
|
38
|
+
Object.keys(resdef.native.headers).forEach((key) => {
|
|
39
|
+
callback(resdef.native.headers[key], key, this)
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
err: resdef.err
|
|
45
|
+
}
|
|
46
|
+
return mres
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
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
|
+
test('exists', async () => {
|
|
76
|
+
equal('function', typeof runners.auth.subject)
|
|
77
|
+
equal('function', typeof runners.body.subject)
|
|
78
|
+
equal('function', typeof runners.contextify.subject)
|
|
79
|
+
equal('function', typeof runners.done.subject)
|
|
80
|
+
equal('function', typeof runners.error.subject)
|
|
81
|
+
equal('function', typeof runners.findparam.subject)
|
|
82
|
+
equal('function', typeof runners.fullurl.subject)
|
|
83
|
+
equal('function', typeof runners.method.subject)
|
|
84
|
+
equal('function', typeof runners.operator.subject)
|
|
85
|
+
equal('function', typeof runners.options.subject)
|
|
86
|
+
equal('function', typeof runners.params.subject)
|
|
87
|
+
equal('function', typeof runners.query.subject)
|
|
88
|
+
equal('function', typeof runners.reqform.subject)
|
|
89
|
+
equal('function', typeof runners.request.subject)
|
|
90
|
+
equal('function', typeof runners.resbasic.subject)
|
|
91
|
+
equal('function', typeof runners.resbody.subject)
|
|
92
|
+
equal('function', typeof runners.resform.subject)
|
|
93
|
+
equal('function', typeof runners.resheaders.subject)
|
|
94
|
+
equal('function', typeof runners.response.subject)
|
|
95
|
+
equal('function', typeof runners.spec.subject)
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// test('auth-basic', async () => {
|
|
100
|
+
// const { runset, spec, subject } = runners.auth
|
|
101
|
+
// await runset(spec.basic, undefined, (subject: any) => (vin: any) => {
|
|
102
|
+
// return subject(vin, vin.spec)
|
|
103
|
+
// })
|
|
104
|
+
// })
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
// // NOTE: the name utilbody avoids conflict with resbody when running individual tests.
|
|
108
|
+
// test('utilbody-basic', async () => {
|
|
109
|
+
// const { runset, spec, subject } = runners.body
|
|
110
|
+
// await runset(spec.basic, subject)
|
|
111
|
+
// })
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
test('contextify-basic', async () => {
|
|
115
|
+
const { runset, spec, subject } = runners.contextify
|
|
116
|
+
await runset(spec.basic, subject)
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
test('done-basic', async () => {
|
|
121
|
+
const { runset, spec, subject } = runners.done
|
|
122
|
+
await runset(spec.basic, subject)
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
// test('error-basic', async () => {
|
|
127
|
+
// const { runset, spec, subject } = runners.error
|
|
128
|
+
// await runset(spec.basic, subject)
|
|
129
|
+
// })
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
// test('findparam-basic', async () => {
|
|
133
|
+
// const { runset, spec, subject } = runners.findparam
|
|
134
|
+
// await runset(spec.basic, subject)
|
|
135
|
+
// })
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
// test('fullurl-basic', async () => {
|
|
139
|
+
// const { runset, spec, subject } = runners.fullurl
|
|
140
|
+
// await runset(spec.basic, subject)
|
|
141
|
+
// })
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
// test('utilheaders-basic', async () => {
|
|
145
|
+
// const { runset, spec, subject } = runners.headers
|
|
146
|
+
// await runset(spec.basic, subject)
|
|
147
|
+
// })
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
test('method-basic', async () => {
|
|
151
|
+
const { runset, spec, subject } = runners.method
|
|
152
|
+
await runset(spec.basic, subject)
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
// test('operator-basic', async () => {
|
|
157
|
+
// const { runset, spec, subject } = runners.operator
|
|
158
|
+
// await runset(spec.basic, subject)
|
|
159
|
+
// })
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
// test('options-basic', async () => {
|
|
163
|
+
// const { runset, spec, subject, client } = runners.options
|
|
164
|
+
// await runset(spec.basic, (vin: any) => {
|
|
165
|
+
// vin.prep.utility = client.utility()
|
|
166
|
+
// return subject(vin.prep)
|
|
167
|
+
// })
|
|
168
|
+
// })
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
// test('params-basic', async () => {
|
|
172
|
+
// const { runset, spec, subject } = runners.params
|
|
173
|
+
// await runset(spec.basic, subject)
|
|
174
|
+
// })
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
// test('query-basic', async () => {
|
|
178
|
+
// const { runset, spec, subject } = runners.query
|
|
179
|
+
// await runset(spec.basic, subject)
|
|
180
|
+
// })
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
// test('reqform-basic', async () => {
|
|
184
|
+
// const { runset, spec, subject } = runners.reqform
|
|
185
|
+
// await runset(spec.basic, subject)
|
|
186
|
+
// })
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
// test('request-basic', async () => {
|
|
190
|
+
// const { runset, spec, subject } = runners.request
|
|
191
|
+
// await runset(spec.basic, subject)
|
|
192
|
+
// })
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
// test('resbasic-basic', async () => {
|
|
196
|
+
// const { runset, spec, subject } = runners.resbasic
|
|
197
|
+
// await runset(spec.basic, (ctx: any) => {
|
|
198
|
+
// ctx.response = MockResponse(ctx.response)
|
|
199
|
+
// return subject(ctx)
|
|
200
|
+
// })
|
|
201
|
+
// })
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
// test('resbody-basic', async () => {
|
|
205
|
+
// const { runset, spec, subject } = runners.resbody
|
|
206
|
+
// await runset(spec.basic, (ctx: any) => {
|
|
207
|
+
// ctx.response = MockResponse(ctx.response)
|
|
208
|
+
// return subject(ctx)
|
|
209
|
+
// })
|
|
210
|
+
// })
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
test('resform-basic', async () => {
|
|
214
|
+
const { runset, spec, subject } = runners.resform
|
|
215
|
+
await runset(spec.basic, subject)
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
// test('resheaders-basic', async () => {
|
|
220
|
+
// const { runset, spec, subject } = runners.resheaders
|
|
221
|
+
// await runset(spec.basic, (ctx: any) => {
|
|
222
|
+
// ctx.response = MockResponse(ctx.response)
|
|
223
|
+
// return subject(ctx)
|
|
224
|
+
// })
|
|
225
|
+
// })
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
// test('response-basic', async () => {
|
|
229
|
+
// const { runset, spec, subject } = runners.response
|
|
230
|
+
// await runset(spec.basic, (ctx: any) => {
|
|
231
|
+
// ctx.response = MockResponse(ctx.response)
|
|
232
|
+
// return subject(ctx)
|
|
233
|
+
// })
|
|
234
|
+
// })
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
// test('spec-basic', async () => {
|
|
238
|
+
// const { runset, spec, subject } = runners.spec
|
|
239
|
+
// await runset(spec.basic, subject)
|
|
240
|
+
// })
|
|
241
|
+
|
|
242
|
+
})
|
|
243
|
+
|
|
244
|
+
|