@voxgig/sdkgen 0.16.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.
- package/dist/action/feature.js +3 -2
- package/dist/action/feature.js.map +1 -1
- package/dist/action/target.js +11 -6
- package/dist/action/target.js.map +1 -1
- package/dist/cmp/Entity.js +2 -1
- package/dist/cmp/Entity.js.map +1 -1
- package/dist/cmp/Main.js +23 -9
- package/dist/cmp/Main.js.map +1 -1
- package/dist/sdkgen.d.ts +7 -1
- package/dist/sdkgen.js +5 -2
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utility.js +1 -2
- package/dist/utility.js.map +1 -1
- package/model/sdkgen.jsonic +8 -5
- package/package.json +7 -5
- package/project/.sdk/model/feature/limit.jsonic +12 -0
- package/project/.sdk/model/feature/log.jsonic +32 -0
- package/project/.sdk/model/feature/page.jsonic +9 -0
- package/project/.sdk/model/feature/telemetry.jsonic +10 -0
- package/project/.sdk/model/target/go.jsonic +7 -0
- package/project/.sdk/model/target/js.jsonic +23 -0
- package/project/.sdk/model/target/ts.jsonic +25 -0
- package/project/.sdk/src/cmp/js/Config_js.ts +49 -0
- package/project/.sdk/src/cmp/js/Entity_js.ts +92 -0
- package/project/.sdk/src/cmp/js/MainEntity_js.ts +22 -0
- package/project/.sdk/src/cmp/js/Main_js.ts +88 -0
- package/project/.sdk/src/cmp/js/Package_js.ts +58 -0
- package/project/.sdk/src/cmp/js/Quick_js.ts +82 -0
- package/project/.sdk/src/cmp/js/ReadmeInstall_js.ts +19 -0
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +25 -0
- package/project/.sdk/src/cmp/js/TestAcceptEntity_js.ts +13 -0
- package/project/.sdk/src/cmp/js/TestAccept_js.ts +18 -0
- package/project/.sdk/src/cmp/js/TestEntity_js.ts +13 -0
- package/project/.sdk/src/cmp/js/TestMain_js.ts +19 -0
- package/project/.sdk/src/cmp/js/Test_js.ts +24 -0
- package/project/.sdk/src/cmp/js/fragment/Entity.fragment.js +79 -0
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +61 -0
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +57 -0
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +61 -0
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +61 -0
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +61 -0
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +67 -0
- package/project/.sdk/src/cmp/ts/Config_ts.ts +36 -0
- package/project/.sdk/src/cmp/ts/Entity_ts.ts +93 -0
- package/project/.sdk/src/cmp/ts/MainEntity_ts.ts.off +22 -0
- package/project/.sdk/src/cmp/ts/Main_ts.ts +88 -0
- package/project/.sdk/src/cmp/ts/Main_ts.ts~ +88 -0
- package/project/.sdk/src/cmp/ts/Package_ts.ts +63 -0
- package/project/.sdk/src/cmp/ts/Package_ts.ts~ +58 -0
- package/project/.sdk/src/cmp/ts/Quick_ts.ts.off +82 -0
- package/project/.sdk/src/cmp/ts/ReadmeInstall_ts.ts.off +19 -0
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts.off +25 -0
- package/project/.sdk/src/cmp/ts/TestAcceptEntity_ts.ts.off +13 -0
- package/project/.sdk/src/cmp/ts/TestAccept_ts.ts.off +18 -0
- package/project/.sdk/src/cmp/ts/TestEntity_ts.ts.off +13 -0
- package/project/.sdk/src/cmp/ts/TestMain_ts.ts.off +19 -0
- package/project/.sdk/src/cmp/ts/Test_ts.ts.off +24 -0
- package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +15 -0
- package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.js +79 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.js +61 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.js +57 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.js +61 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.js +61 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.js +61 -0
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.js +67 -0
- package/project/.sdk/tm/go/LICENSE +22 -0
- package/project/.sdk/tm/js/LICENSE +22 -0
- package/project/.sdk/tm/js/src/feature/log/LogFeature.js +108 -0
- package/project/.sdk/tm/js/src/utility/AuthUtility.js +21 -0
- package/project/.sdk/tm/js/src/utility/BodyUtility.js +29 -0
- package/project/.sdk/tm/js/src/utility/DoneUtility.js +15 -0
- package/project/.sdk/tm/js/src/utility/ErrorUtility.js +33 -0
- package/project/.sdk/tm/js/src/utility/FindparamUtility.js +31 -0
- package/project/.sdk/tm/js/src/utility/FullurlUtility.js +39 -0
- package/project/.sdk/tm/js/src/utility/HeadersUtility.js +13 -0
- package/project/.sdk/tm/js/src/utility/JoinurlUtility.js +14 -0
- package/project/.sdk/tm/js/src/utility/MethodUtility.js +22 -0
- package/project/.sdk/tm/js/src/utility/OperatorUtility.js +44 -0
- package/project/.sdk/tm/js/src/utility/OptionsUtility.js +54 -0
- package/project/.sdk/tm/js/src/utility/ParamsUtility.js +21 -0
- package/project/.sdk/tm/js/src/utility/QueryUtility.js +21 -0
- package/project/.sdk/tm/js/src/utility/ReqformUtility.js +32 -0
- package/project/.sdk/tm/js/src/utility/RequestUtility.js +48 -0
- package/project/.sdk/tm/js/src/utility/ResbasicUtility.js +27 -0
- package/project/.sdk/tm/js/src/utility/ResbodyUtility.js +15 -0
- package/project/.sdk/tm/js/src/utility/ResformUtility.js +34 -0
- package/project/.sdk/tm/js/src/utility/ResheadersUtility.js +19 -0
- package/project/.sdk/tm/js/src/utility/ResponseUtility.js +37 -0
- package/project/.sdk/tm/js/src/utility/ResultUtility.js +28 -0
- package/project/.sdk/tm/js/src/utility/SpecUtility.js +35 -0
- package/project/.sdk/tm/js/src/utility/StructUtility.js +1203 -0
- package/project/.sdk/tm/js/src/utility/Utility.js +74 -0
- package/project/.sdk/tm/js/test/runner.js +171 -0
- package/project/.sdk/tm/js/test/utility/Custom.test.js +85 -0
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +187 -0
- package/project/.sdk/tm/js/test/utility/StructUtility.test.js +367 -0
- package/project/.sdk/tm/py/LICENSE +22 -0
- package/project/.sdk/tm/ts/LICENSE +22 -0
- package/project/.sdk/tm/ts/src/README.md +1 -0
- package/project/.sdk/tm/ts/src/feature/README.md +1 -0
- package/project/.sdk/tm/ts/src/tsconfig.json +15 -0
- package/project/.sdk/tm/ts/src/utility/README.md +3 -0
- package/project/.sdk/tm/ts/test/README.md +2 -0
- package/project/.sdk/tm/ts/test/README.md~ +2 -0
- package/project/.sdk/tm/ts/test/tsconfig.json +13 -0
- package/src/action/feature.ts +4 -3
- package/src/action/target.ts +12 -6
- package/src/cmp/Entity.ts +3 -1
- package/src/cmp/Main.ts +30 -10
- package/src/sdkgen.ts +15 -5
- package/src/utility.ts +1 -2
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
import { names, getx, each, cmp, File, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const Quick = cmp(function Quick(props: any) {
|
|
6
|
+
const { target } = props
|
|
7
|
+
const { model, meta: { spec } } = props.ctx$
|
|
8
|
+
|
|
9
|
+
// get quick entity from target config
|
|
10
|
+
|
|
11
|
+
let ent: any
|
|
12
|
+
let entmap = getx(spec.config.guideModel, 'guide entity?test:quick:active=true')
|
|
13
|
+
|
|
14
|
+
if (entmap) {
|
|
15
|
+
ent = Object.values(entmap)[0]
|
|
16
|
+
ent.name = Object.keys(entmap)[0]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
ent = ent || { name: 'Entity' }
|
|
20
|
+
names(ent, ent.name)// , ent.key$ || 'name')
|
|
21
|
+
|
|
22
|
+
// TODO: selected features should be active by default!
|
|
23
|
+
|
|
24
|
+
const featureOptions = each(model.main.sdk.feature)
|
|
25
|
+
.filter((f: any) => f.active)
|
|
26
|
+
.reduce((a: any, f: any) => a + `\n ${f.name}: { active: true },`, '')
|
|
27
|
+
|
|
28
|
+
// console.log('QUICK', ent, featureOptions)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
File({ name: 'quick.' + target.name }, () => {
|
|
32
|
+
|
|
33
|
+
Content(`
|
|
34
|
+
// ENT 3
|
|
35
|
+
require('dotenv').config({ path: ['../../.env.local']})
|
|
36
|
+
|
|
37
|
+
const { ${model.const.Name}SDK } = require('../')
|
|
38
|
+
|
|
39
|
+
run()
|
|
40
|
+
|
|
41
|
+
async function run() {
|
|
42
|
+
const client = new ${model.const.Name}SDK({
|
|
43
|
+
endpoint: process.env.${model.NAME}_ENDPOINT,
|
|
44
|
+
apikey: process.env.${model.NAME}_APIKEY,
|
|
45
|
+
${featureOptions}
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
`)
|
|
49
|
+
|
|
50
|
+
if (ent.test?.quick.create) {
|
|
51
|
+
Content(`
|
|
52
|
+
out = await client.${ent.Name}().create(${JSON.stringify(ent.test?.quick.create)})
|
|
53
|
+
console.log('${ent.Name}.load', out)
|
|
54
|
+
`)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (ent.test?.quick.load) {
|
|
58
|
+
Content(`
|
|
59
|
+
out = await client.${ent.Name}().load(${JSON.stringify(ent.test?.quick.load)})
|
|
60
|
+
console.log('${ent.Name}.load', out)
|
|
61
|
+
`)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (ent.test?.quick.list) {
|
|
65
|
+
Content(`
|
|
66
|
+
out = await client.${ent.Name}().list(${JSON.stringify(ent.test?.quick.list)})
|
|
67
|
+
console.log('${ent.Name}.list', out)
|
|
68
|
+
`)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
Content(`
|
|
72
|
+
}
|
|
73
|
+
`)
|
|
74
|
+
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
Quick
|
|
81
|
+
}
|
|
82
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const ReadmeInstall = cmp(function ReadmeInstall(props: any) {
|
|
6
|
+
const { target } = props
|
|
7
|
+
|
|
8
|
+
Content('```js')
|
|
9
|
+
Content(`
|
|
10
|
+
npm install ${target.module.name}
|
|
11
|
+
`)
|
|
12
|
+
Content('```')
|
|
13
|
+
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
ReadmeInstall
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
|
|
6
|
+
const { target, ctx$: { model } } = props
|
|
7
|
+
|
|
8
|
+
Content('```js')
|
|
9
|
+
Content(`
|
|
10
|
+
const { ${model.const.Name}SDK } = require('${target.module.name}')
|
|
11
|
+
|
|
12
|
+
const client = ${model.const.Name}SDK.make({
|
|
13
|
+
endpoint: process.env.${model.NAME}_ENDPOINT,
|
|
14
|
+
apikey: process.env.${model.NAME}_APIKEY,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
`)
|
|
18
|
+
Content('```')
|
|
19
|
+
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
ReadmeQuick
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, each, File, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import { TestAcceptEntity } from './TestAcceptEntity_js'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const TestAccept = cmp(function TestMain(props: any) {
|
|
9
|
+
const { target } = props
|
|
10
|
+
const { model } = props.ctx$
|
|
11
|
+
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
TestAccept
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -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
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, File, Content, Folder } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import { Quick } from './Quick_js'
|
|
5
|
+
import { TestMain } from './TestMain_js'
|
|
6
|
+
import { TestAccept } from './TestAccept_js'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const Test = cmp(function Test(props: any) {
|
|
10
|
+
const { target } = props
|
|
11
|
+
|
|
12
|
+
Folder({ name: 'test' }, () => {
|
|
13
|
+
Quick({ target })
|
|
14
|
+
TestMain({ target })
|
|
15
|
+
Folder({ name: 'accept' }, () => {
|
|
16
|
+
TestAccept({ target })
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
Test
|
|
24
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
|
|
2
|
+
class NameEntity {
|
|
3
|
+
#client
|
|
4
|
+
#options
|
|
5
|
+
#features
|
|
6
|
+
#utility
|
|
7
|
+
#data
|
|
8
|
+
#match
|
|
9
|
+
|
|
10
|
+
constructor(client, options) {
|
|
11
|
+
options = options || {}
|
|
12
|
+
options.active = false !== options.active
|
|
13
|
+
|
|
14
|
+
this.#client = client
|
|
15
|
+
this.#options = options
|
|
16
|
+
this.#features = client.features()
|
|
17
|
+
this.#utility = client.utility()
|
|
18
|
+
this.#data = {}
|
|
19
|
+
this.#match = {}
|
|
20
|
+
|
|
21
|
+
// #PostConstructEntity-Hook
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
options() {
|
|
25
|
+
return { ...this.#options }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
client() {
|
|
29
|
+
return this.#client
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
make() {
|
|
33
|
+
return new NameEntity(this.#client, this.options())
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
data(data) {
|
|
38
|
+
// NOTE: data can be mutated.
|
|
39
|
+
if(null != data) {
|
|
40
|
+
|
|
41
|
+
// #SetData-Hook
|
|
42
|
+
|
|
43
|
+
this.#data = { ...data }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let out = { ...this.#data }
|
|
47
|
+
|
|
48
|
+
// #GetData-Hook
|
|
49
|
+
|
|
50
|
+
return out
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
match() {
|
|
55
|
+
// NOTE: match cannot be mutated.
|
|
56
|
+
let out = { ...this.#match }
|
|
57
|
+
|
|
58
|
+
// #GetMatch-Hook
|
|
59
|
+
|
|
60
|
+
return out
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
// #LoadOp
|
|
65
|
+
|
|
66
|
+
// #ListOp
|
|
67
|
+
|
|
68
|
+
// #CreateOp
|
|
69
|
+
|
|
70
|
+
// #UpdateOp
|
|
71
|
+
|
|
72
|
+
// #RemoveOp
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
module.exports = {
|
|
78
|
+
NameEntity
|
|
79
|
+
}
|
|
@@ -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
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
const { Config } = require('./Config')
|
|
3
|
+
const { Utility } = require('./utility/Utility')
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class NameSDK {
|
|
7
|
+
#options
|
|
8
|
+
#features
|
|
9
|
+
#utility = Utility
|
|
10
|
+
|
|
11
|
+
constructor(options) {
|
|
12
|
+
|
|
13
|
+
this.#options = this.#utility.options({
|
|
14
|
+
client: this,
|
|
15
|
+
utility: this.#utility,
|
|
16
|
+
config: Config,
|
|
17
|
+
options,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// #FeatureOptions
|
|
21
|
+
|
|
22
|
+
this.#features = {
|
|
23
|
+
// #BuildFeature
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// #PostConstruct-Hook
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
options() {
|
|
31
|
+
return { ...this.#options }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
features() {
|
|
35
|
+
return { ...this.#features }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
utility() {
|
|
39
|
+
return { ...this.#utility }
|
|
40
|
+
}
|
|
41
|
+
|
|
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
|
+
|
|
58
|
+
// <[SLOT]>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
const SDK = NameSDK
|
|
63
|
+
|
|
64
|
+
module.exports = {
|
|
65
|
+
NameSDK,
|
|
66
|
+
SDK,
|
|
67
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) $$const.year$$ $$const.Name$$
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|