@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.
- package/bin/voxgig-sdkgen +6 -6
- package/dist/action/action.js +1 -2
- package/dist/action/action.js.map +1 -1
- package/dist/action/feature.js +4 -2
- package/dist/action/feature.js.map +1 -1
- package/dist/action/target.js +4 -2
- 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/FeatureHook.js +2 -1
- package/dist/cmp/FeatureHook.js.map +1 -1
- package/dist/cmp/Main.js.map +1 -1
- package/dist/cmp/ReadmeEntity.js +2 -1
- package/dist/cmp/ReadmeEntity.js.map +1 -1
- package/dist/cmp/Test.d.ts +2 -0
- package/dist/cmp/Test.js +17 -0
- package/dist/cmp/Test.js.map +1 -0
- package/dist/sdkgen.d.ts +2 -1
- package/dist/sdkgen.js +17 -28
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -1
- package/model/sdkgen.jsonic +8 -8
- package/package.json +8 -6
- package/project/.sdk/model/feature/log.jsonic +2 -2
- package/project/.sdk/model/feature/test.jsonic +7 -2
- package/project/.sdk/model/target/js.jsonic +2 -2
- package/project/.sdk/model/target/ts.jsonic +2 -2
- package/project/.sdk/src/cmp/js/Main_js.ts +3 -3
- package/project/.sdk/src/cmp/js/Quick_js.ts +1 -1
- package/project/.sdk/src/cmp/ts/Config_ts.ts +53 -6
- package/project/.sdk/src/cmp/ts/EntityOperation_ts.ts +3 -21
- package/project/.sdk/src/cmp/ts/Entity_ts.ts +3 -5
- package/project/.sdk/src/cmp/ts/Main_ts.ts +22 -12
- package/project/.sdk/src/cmp/ts/Package_ts.ts +32 -12
- package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +341 -2
- package/project/.sdk/src/cmp/ts/TestMain_ts.ts +0 -3
- package/project/.sdk/src/cmp/ts/Test_ts.ts +21 -3
- package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +38 -5
- package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.ts +50 -38
- package/project/.sdk/src/cmp/ts/fragment/Entity.test.fragment.ts +9 -7
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +47 -31
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +49 -31
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +50 -33
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +50 -31
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +51 -31
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +70 -34
- package/project/.sdk/src/cmp/ts/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/ts/utility_ts.ts +55 -1
- package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +158 -104
- package/project/.sdk/tm/ts/src/types.ts +164 -34
- package/project/.sdk/tm/ts/src/utility/AuthUtility.ts +8 -2
- package/project/.sdk/tm/ts/src/utility/BodyUtility.ts +9 -6
- package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +17 -31
- package/project/.sdk/tm/ts/src/utility/ContextUtility.ts +14 -54
- package/project/.sdk/tm/ts/src/utility/DoneUtility.ts +1 -1
- package/project/.sdk/tm/ts/src/utility/ErrorUtility.ts +7 -3
- package/project/.sdk/tm/ts/src/utility/FeaturehookUtility.ts +8 -5
- package/project/.sdk/tm/ts/src/utility/FetcherUtility.ts +18 -2
- package/project/.sdk/tm/ts/src/utility/FindparamUtility.ts +12 -5
- package/project/.sdk/tm/ts/src/utility/FullurlUtility.ts +21 -5
- package/project/.sdk/tm/ts/src/utility/InitfeatureUtility.ts +3 -1
- package/project/.sdk/tm/ts/src/utility/OperationUtility.ts +23 -0
- package/project/.sdk/tm/ts/src/utility/OptionsUtility.ts +25 -3
- package/project/.sdk/tm/ts/src/utility/ParamsUtility.ts +10 -10
- package/project/.sdk/tm/ts/src/utility/PreparePathUtility.ts +18 -0
- package/project/.sdk/tm/ts/src/utility/QueryUtility.ts +2 -2
- package/project/.sdk/tm/ts/src/utility/ReqformUtility.ts +2 -2
- package/project/.sdk/tm/ts/src/utility/RequestUtility.ts +20 -3
- package/project/.sdk/tm/ts/src/utility/ResbasicUtility.ts +1 -1
- package/project/.sdk/tm/ts/src/utility/ResbodyUtility.ts +5 -3
- package/project/.sdk/tm/ts/src/utility/ResformUtility.ts +3 -3
- package/project/.sdk/tm/ts/src/utility/ResheadersUtility.ts +9 -7
- package/project/.sdk/tm/ts/src/utility/ResponseUtility.ts +35 -4
- package/project/.sdk/tm/ts/src/utility/ResultUtility.ts +24 -4
- package/project/.sdk/tm/ts/src/utility/SelectionUtility.ts +78 -0
- package/project/.sdk/tm/ts/src/utility/SpecUtility.ts +34 -27
- package/project/.sdk/tm/ts/src/utility/StructUtility.ts +1117 -509
- package/project/.sdk/tm/ts/src/utility/Utility.ts +10 -8
- package/project/.sdk/tm/ts/test/exists.test.ts +0 -1
- package/project/.sdk/tm/ts/test/runner.ts +12 -10
- package/project/.sdk/tm/ts/test/utility/Custom.test.ts +30 -29
- package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +53 -47
- package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +433 -189
- package/src/action/action.ts +1 -2
- package/src/action/feature.ts +7 -2
- package/src/action/target.ts +7 -7
- package/src/cmp/Entity.ts +7 -1
- package/src/cmp/FeatureHook.ts +6 -1
- package/src/cmp/Main.ts +4 -0
- package/src/cmp/ReadmeEntity.ts +6 -1
- package/src/cmp/Test.ts +31 -0
- package/src/sdkgen.ts +19 -34
- package/src/types.ts +10 -1
- package/project/.sdk/src/cmp/ts/EntityTest_ts.ts +0 -180
- package/project/.sdk/tm/ts/src/utility/OperatorUtility.ts +0 -90
|
@@ -1,79 +1,94 @@
|
|
|
1
1
|
type Context = any
|
|
2
|
-
type Operation = any
|
|
3
2
|
type Control = any
|
|
4
3
|
|
|
5
4
|
class EntityOperation {
|
|
6
5
|
|
|
6
|
+
#match: any
|
|
7
|
+
#data: any
|
|
8
|
+
#utility: any
|
|
9
|
+
|
|
10
|
+
|
|
7
11
|
// EJECT-START
|
|
8
12
|
|
|
9
13
|
async create(this: any, reqdata?: any, ctrl?: Control) {
|
|
10
|
-
|
|
11
|
-
let client = this.#client
|
|
14
|
+
|
|
12
15
|
const utility = this.#utility
|
|
13
16
|
const {
|
|
14
|
-
|
|
17
|
+
makeContext,
|
|
18
|
+
done,
|
|
19
|
+
error,
|
|
20
|
+
featureHook,
|
|
21
|
+
selection,
|
|
22
|
+
request,
|
|
23
|
+
response,
|
|
24
|
+
result,
|
|
25
|
+
spec,
|
|
15
26
|
} = utility
|
|
16
27
|
|
|
17
|
-
|
|
18
28
|
let fres: Promise<any> | undefined = undefined
|
|
19
29
|
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
name: 'create',
|
|
23
|
-
path: 'PATH',
|
|
24
|
-
pathalt: ['PATHALT'],
|
|
25
|
-
params: ['PARAM-LIST'],
|
|
26
|
-
alias: { 'ALIAS': 'MAP' },
|
|
27
|
-
state: {},
|
|
28
|
-
reqform: 'REQFORM',
|
|
29
|
-
resform: 'RESFORM',
|
|
30
|
-
validate: 'VALIDATE',
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
let ctx: Context = contextify({
|
|
30
|
+
let ctx: Context = makeContext({
|
|
31
|
+
opname: 'create',
|
|
34
32
|
ctrl,
|
|
35
|
-
op,
|
|
36
33
|
match: this.#match,
|
|
37
34
|
data: this.#data,
|
|
38
35
|
reqdata
|
|
39
|
-
}, this
|
|
36
|
+
}, this._entctx)
|
|
40
37
|
|
|
41
38
|
try {
|
|
39
|
+
// #PreSelection-Hook
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
ctx.out.selected = selection(ctx)
|
|
42
|
+
if (ctx.out.selected instanceof Error) {
|
|
43
|
+
return error(ctx, ctx.out.selected)
|
|
44
|
+
}
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
// #PreSpec-Hook
|
|
49
48
|
|
|
50
|
-
spec(ctx)
|
|
49
|
+
ctx.out.spec = spec(ctx)
|
|
50
|
+
if (ctx.out.spec instanceof Error) {
|
|
51
|
+
return error(ctx, ctx.out.spec)
|
|
52
|
+
}
|
|
51
53
|
|
|
52
54
|
|
|
53
55
|
// #PreRequest-Hook
|
|
54
56
|
|
|
55
|
-
await request(ctx)
|
|
57
|
+
ctx.out.request = await request(ctx)
|
|
58
|
+
if (ctx.out.request instanceof Error) {
|
|
59
|
+
return error(ctx, ctx.out.request)
|
|
60
|
+
}
|
|
56
61
|
|
|
57
62
|
|
|
58
63
|
// #PreResponse-Hook
|
|
59
64
|
|
|
60
|
-
await response(ctx)
|
|
65
|
+
ctx.out.response = await response(ctx)
|
|
66
|
+
if (ctx.out.response instanceof Error) {
|
|
67
|
+
return error(ctx, ctx.out.response)
|
|
68
|
+
}
|
|
61
69
|
|
|
62
70
|
|
|
63
71
|
// #PreResult-Hook
|
|
64
72
|
|
|
65
|
-
result(ctx)
|
|
73
|
+
ctx.out.result = await result(ctx)
|
|
74
|
+
if (ctx.out.result instanceof Error) {
|
|
75
|
+
return error(ctx, ctx.out.result)
|
|
76
|
+
}
|
|
66
77
|
|
|
67
78
|
|
|
68
|
-
// #
|
|
79
|
+
// #PreDone-Hook
|
|
69
80
|
|
|
70
|
-
if (null != ctx.result
|
|
71
|
-
|
|
81
|
+
if (null != ctx.result) {
|
|
82
|
+
if (null != ctx.result.resdata) {
|
|
83
|
+
this.#data = ctx.result.resdata
|
|
84
|
+
}
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
return done(ctx)
|
|
75
88
|
}
|
|
76
89
|
catch (err: any) {
|
|
90
|
+
// #PreUnexpected-Hook
|
|
91
|
+
|
|
77
92
|
err = this.#unexpected(ctx, err)
|
|
78
93
|
|
|
79
94
|
if (err) {
|
|
@@ -87,5 +102,6 @@ class EntityOperation {
|
|
|
87
102
|
|
|
88
103
|
// EJECT-END
|
|
89
104
|
|
|
105
|
+
|
|
90
106
|
#unexpected(this: any, ctx: Context, ctrl: any, err: any): any { return err }
|
|
91
107
|
}
|
|
@@ -1,78 +1,95 @@
|
|
|
1
1
|
type Context = any
|
|
2
|
-
type Operation = any
|
|
3
2
|
type Control = any
|
|
4
3
|
|
|
5
4
|
class EntityOperation {
|
|
6
5
|
|
|
6
|
+
#match: any
|
|
7
|
+
#data: any
|
|
8
|
+
#utility: any
|
|
9
|
+
|
|
10
|
+
|
|
7
11
|
// EJECT-START
|
|
8
12
|
|
|
9
13
|
async list(this: any, reqmatch?: any, ctrl?: Control) {
|
|
10
|
-
|
|
11
|
-
let client = this.#client
|
|
14
|
+
|
|
12
15
|
const utility = this.#utility
|
|
16
|
+
|
|
13
17
|
const {
|
|
14
|
-
|
|
18
|
+
makeContext,
|
|
19
|
+
done,
|
|
20
|
+
error,
|
|
21
|
+
featureHook,
|
|
22
|
+
selection,
|
|
23
|
+
request,
|
|
24
|
+
response,
|
|
25
|
+
result,
|
|
26
|
+
spec,
|
|
15
27
|
} = utility
|
|
16
28
|
|
|
17
29
|
let fres: Promise<any> | undefined = undefined
|
|
18
30
|
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
name: 'list',
|
|
22
|
-
path: 'PATH',
|
|
23
|
-
pathalt: ['PATHALT'],
|
|
24
|
-
params: ['PARAM-LIST'],
|
|
25
|
-
alias: { 'ALIAS': 'MAP' },
|
|
26
|
-
state: {},
|
|
27
|
-
reqform: 'REQFORM',
|
|
28
|
-
resform: 'RESFORM',
|
|
29
|
-
validate: 'VALIDATE',
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
let ctx: Context = contextify({
|
|
31
|
+
let ctx: Context = makeContext({
|
|
32
|
+
opname: 'list',
|
|
33
33
|
ctrl,
|
|
34
|
-
op,
|
|
35
34
|
match: this.#match,
|
|
36
35
|
data: this.#data,
|
|
37
36
|
reqmatch
|
|
38
|
-
}, this
|
|
37
|
+
}, this._entctx)
|
|
39
38
|
|
|
40
39
|
try {
|
|
40
|
+
// #PreSelection-Hook
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
ctx.out.selected = selection(ctx)
|
|
43
|
+
if (ctx.out.selected instanceof Error) {
|
|
44
|
+
return error(ctx, ctx.out.selected)
|
|
45
|
+
}
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
// #PreSpec-Hook
|
|
48
49
|
|
|
49
|
-
spec(ctx)
|
|
50
|
+
ctx.out.spec = spec(ctx)
|
|
51
|
+
if (ctx.out.spec instanceof Error) {
|
|
52
|
+
return error(ctx, ctx.out.spec)
|
|
53
|
+
}
|
|
50
54
|
|
|
51
55
|
|
|
52
56
|
// #PreRequest-Hook
|
|
53
57
|
|
|
54
|
-
await request(ctx)
|
|
58
|
+
ctx.out.request = await request(ctx)
|
|
59
|
+
if (ctx.out.request instanceof Error) {
|
|
60
|
+
return error(ctx, ctx.out.request)
|
|
61
|
+
}
|
|
55
62
|
|
|
56
63
|
|
|
57
64
|
// #PreResponse-Hook
|
|
58
65
|
|
|
59
|
-
await response(ctx)
|
|
66
|
+
ctx.out.response = await response(ctx)
|
|
67
|
+
if (ctx.out.response instanceof Error) {
|
|
68
|
+
return error(ctx, ctx.out.response)
|
|
69
|
+
}
|
|
60
70
|
|
|
61
71
|
|
|
62
72
|
// #PreResult-Hook
|
|
63
73
|
|
|
64
|
-
result(ctx)
|
|
74
|
+
ctx.out.result = await result(ctx)
|
|
75
|
+
if (ctx.out.result instanceof Error) {
|
|
76
|
+
return error(ctx, ctx.out.result)
|
|
77
|
+
}
|
|
65
78
|
|
|
66
79
|
|
|
67
|
-
// #
|
|
80
|
+
// #PreDone-Hook
|
|
68
81
|
|
|
69
|
-
if (null != ctx.result
|
|
70
|
-
|
|
82
|
+
if (null != ctx.result) {
|
|
83
|
+
if (null != ctx.result.resmatch) {
|
|
84
|
+
this.#match = ctx.result.resmatch
|
|
85
|
+
}
|
|
71
86
|
}
|
|
72
87
|
|
|
73
88
|
return done(ctx)
|
|
74
89
|
}
|
|
75
90
|
catch (err: any) {
|
|
91
|
+
// #PreUnexpected-Hook
|
|
92
|
+
|
|
76
93
|
err = this.#unexpected(ctx, err)
|
|
77
94
|
|
|
78
95
|
if (err) {
|
|
@@ -86,7 +103,8 @@ class EntityOperation {
|
|
|
86
103
|
|
|
87
104
|
// EJECT-END
|
|
88
105
|
|
|
89
|
-
|
|
106
|
+
|
|
107
|
+
#unexpected(this: any, _ctx: Context, _ctrl: any, err: any): any { return err }
|
|
90
108
|
|
|
91
109
|
}
|
|
92
110
|
|
|
@@ -1,83 +1,99 @@
|
|
|
1
1
|
type Context = any
|
|
2
|
-
type Operation = any
|
|
3
2
|
type Control = any
|
|
4
3
|
|
|
5
4
|
class EntityOperation {
|
|
6
5
|
|
|
6
|
+
#match: any
|
|
7
|
+
#data: any
|
|
8
|
+
#utility: any
|
|
9
|
+
|
|
10
|
+
|
|
7
11
|
// EJECT-START
|
|
8
12
|
|
|
9
13
|
async load(this: any, reqmatch?: any, ctrl?: Control) {
|
|
10
14
|
|
|
11
|
-
const entity = this
|
|
12
|
-
const client = this.#client
|
|
13
15
|
const utility = this.#utility
|
|
16
|
+
|
|
14
17
|
const {
|
|
15
|
-
|
|
18
|
+
makeContext,
|
|
19
|
+
done,
|
|
20
|
+
error,
|
|
21
|
+
featureHook,
|
|
22
|
+
selection,
|
|
23
|
+
request,
|
|
24
|
+
response,
|
|
25
|
+
result,
|
|
26
|
+
spec,
|
|
16
27
|
} = utility
|
|
17
28
|
|
|
18
29
|
let fres: Promise<any> | undefined = undefined
|
|
19
30
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
name: 'load',
|
|
23
|
-
path: 'PATH',
|
|
24
|
-
pathalt: ['PATHALT'],
|
|
25
|
-
params: ['PARAM-LIST'],
|
|
26
|
-
alias: { 'ALIAS': 'MAP' },
|
|
27
|
-
state: {},
|
|
28
|
-
reqform: 'REQFORM',
|
|
29
|
-
resform: 'RESFORM',
|
|
30
|
-
validate: 'VALIDATE',
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
let ctx: Context = contextify({
|
|
31
|
+
let ctx: Context = makeContext({
|
|
32
|
+
opname: 'load',
|
|
34
33
|
ctrl,
|
|
35
|
-
op,
|
|
36
34
|
match: this.#match,
|
|
37
35
|
data: this.#data,
|
|
38
36
|
reqmatch
|
|
39
|
-
}, this
|
|
37
|
+
}, this._entctx)
|
|
40
38
|
|
|
41
39
|
try {
|
|
40
|
+
// #PreSelection-Hook
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
ctx.out.selected = selection(ctx)
|
|
43
|
+
if (ctx.out.selected instanceof Error) {
|
|
44
|
+
return error(ctx, ctx.out.selected)
|
|
45
|
+
}
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
// #PreSpec-Hook
|
|
49
49
|
|
|
50
|
-
spec(ctx)
|
|
50
|
+
ctx.out.spec = spec(ctx)
|
|
51
|
+
if (ctx.out.spec instanceof Error) {
|
|
52
|
+
return error(ctx, ctx.out.spec)
|
|
53
|
+
}
|
|
51
54
|
|
|
52
55
|
|
|
53
56
|
// #PreRequest-Hook
|
|
54
57
|
|
|
55
|
-
await request(ctx)
|
|
58
|
+
ctx.out.request = await request(ctx)
|
|
59
|
+
if (ctx.out.request instanceof Error) {
|
|
60
|
+
return error(ctx, ctx.out.request)
|
|
61
|
+
}
|
|
56
62
|
|
|
57
63
|
|
|
58
64
|
// #PreResponse-Hook
|
|
59
65
|
|
|
60
|
-
await response(ctx)
|
|
66
|
+
ctx.out.response = await response(ctx)
|
|
67
|
+
if (ctx.out.response instanceof Error) {
|
|
68
|
+
return error(ctx, ctx.out.response)
|
|
69
|
+
}
|
|
61
70
|
|
|
62
71
|
|
|
63
72
|
// #PreResult-Hook
|
|
64
73
|
|
|
65
|
-
result(ctx)
|
|
74
|
+
ctx.out.result = await result(ctx)
|
|
75
|
+
if (ctx.out.result instanceof Error) {
|
|
76
|
+
return error(ctx, ctx.out.result)
|
|
77
|
+
}
|
|
66
78
|
|
|
67
79
|
|
|
68
|
-
// #
|
|
80
|
+
// #PreDone-Hook
|
|
69
81
|
|
|
70
|
-
if (null != ctx.result
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
if (null != ctx.result) {
|
|
83
|
+
if (null != ctx.result.resmatch) {
|
|
84
|
+
this.#match = ctx.result.resmatch
|
|
85
|
+
}
|
|
73
86
|
|
|
74
|
-
|
|
75
|
-
|
|
87
|
+
if (null != ctx.result.resdata) {
|
|
88
|
+
this.#data = ctx.result.resdata
|
|
89
|
+
}
|
|
76
90
|
}
|
|
77
91
|
|
|
78
92
|
return done(ctx)
|
|
79
93
|
}
|
|
80
94
|
catch (err: any) {
|
|
95
|
+
// #PreUnexpected-Hook
|
|
96
|
+
|
|
81
97
|
err = this.#unexpected(ctx, err)
|
|
82
98
|
|
|
83
99
|
if (err) {
|
|
@@ -91,6 +107,7 @@ class EntityOperation {
|
|
|
91
107
|
|
|
92
108
|
// EJECT-END
|
|
93
109
|
|
|
110
|
+
|
|
94
111
|
#unexpected(this: any, ctx: Context, ctrl: any, err: any): any { return err }
|
|
95
112
|
}
|
|
96
113
|
|
|
@@ -1,82 +1,100 @@
|
|
|
1
1
|
type Context = any
|
|
2
|
-
type Operation = any
|
|
3
2
|
type Control = any
|
|
4
3
|
|
|
5
4
|
class EntityOperation {
|
|
6
5
|
|
|
6
|
+
#match: any
|
|
7
|
+
#data: any
|
|
8
|
+
#utility: any
|
|
9
|
+
|
|
10
|
+
|
|
7
11
|
// EJECT-START
|
|
8
12
|
|
|
9
13
|
async remove(this: any, reqmatch?: any, ctrl?: Control) {
|
|
10
|
-
|
|
11
|
-
let client = this.#client
|
|
14
|
+
|
|
12
15
|
const utility = this.#utility
|
|
16
|
+
|
|
13
17
|
const {
|
|
14
|
-
|
|
18
|
+
makeContext,
|
|
19
|
+
done,
|
|
20
|
+
error,
|
|
21
|
+
featureHook,
|
|
22
|
+
selection,
|
|
23
|
+
request,
|
|
24
|
+
response,
|
|
25
|
+
result,
|
|
26
|
+
spec,
|
|
15
27
|
} = utility
|
|
16
28
|
|
|
17
29
|
let fres: Promise<any> | undefined = undefined
|
|
18
30
|
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
name: 'remove',
|
|
22
|
-
path: 'PATH',
|
|
23
|
-
pathalt: ['PATHALT'],
|
|
24
|
-
params: ['PARAM-LIST'],
|
|
25
|
-
alias: { 'ALIAS': 'MAP' },
|
|
26
|
-
state: {},
|
|
27
|
-
reqform: 'REQFORM',
|
|
28
|
-
resform: 'RESFORM',
|
|
29
|
-
validate: 'VALIDATE',
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
let ctx: Context = contextify({
|
|
31
|
+
let ctx: Context = makeContext({
|
|
32
|
+
opname: 'remove',
|
|
33
33
|
ctrl,
|
|
34
|
-
op,
|
|
35
34
|
match: this.#match,
|
|
36
35
|
data: this.#data,
|
|
37
36
|
reqmatch
|
|
38
|
-
}, this
|
|
37
|
+
}, this._entctx)
|
|
39
38
|
|
|
40
39
|
try {
|
|
41
40
|
|
|
42
41
|
// #PreOperation-Hook
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
ctx.out.selected = selection(ctx)
|
|
44
|
+
if (ctx.out.selected instanceof Error) {
|
|
45
|
+
return error(ctx, ctx.out.selected)
|
|
46
|
+
}
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
// #PreSpec-Hook
|
|
48
50
|
|
|
49
|
-
spec(ctx)
|
|
51
|
+
ctx.out.spec = spec(ctx)
|
|
52
|
+
if (ctx.out.spec instanceof Error) {
|
|
53
|
+
return error(ctx, ctx.out.spec)
|
|
54
|
+
}
|
|
50
55
|
|
|
51
56
|
|
|
52
57
|
// #PreRequest-Hook
|
|
53
58
|
|
|
54
|
-
await request(ctx)
|
|
59
|
+
ctx.out.request = await request(ctx)
|
|
60
|
+
if (ctx.out.request instanceof Error) {
|
|
61
|
+
return error(ctx, ctx.out.request)
|
|
62
|
+
}
|
|
55
63
|
|
|
56
64
|
|
|
57
65
|
// #PreResponse-Hook
|
|
58
66
|
|
|
59
|
-
await response(ctx)
|
|
67
|
+
ctx.out.response = await response(ctx)
|
|
68
|
+
if (ctx.out.response instanceof Error) {
|
|
69
|
+
return error(ctx, ctx.out.response)
|
|
70
|
+
}
|
|
60
71
|
|
|
61
72
|
|
|
62
73
|
// #PreResult-Hook
|
|
63
74
|
|
|
64
|
-
result(ctx)
|
|
75
|
+
ctx.out.result = await result(ctx)
|
|
76
|
+
if (ctx.out.result instanceof Error) {
|
|
77
|
+
return error(ctx, ctx.out.result)
|
|
78
|
+
}
|
|
65
79
|
|
|
66
80
|
|
|
67
|
-
// #
|
|
81
|
+
// #PreDone-Hook
|
|
68
82
|
|
|
69
|
-
if (null != ctx.result
|
|
70
|
-
|
|
71
|
-
|
|
83
|
+
if (null != ctx.result) {
|
|
84
|
+
if (null != ctx.result.resmatch) {
|
|
85
|
+
this.#match = ctx.result.resmatch
|
|
86
|
+
}
|
|
72
87
|
|
|
73
|
-
|
|
74
|
-
|
|
88
|
+
if (null != ctx.result.resdata) {
|
|
89
|
+
this.#data = ctx.result.resdata
|
|
90
|
+
}
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
return done(ctx)
|
|
78
94
|
}
|
|
79
95
|
catch (err: any) {
|
|
96
|
+
// #PreSelection-Hook
|
|
97
|
+
|
|
80
98
|
err = this.#unexpected(ctx, err)
|
|
81
99
|
|
|
82
100
|
if (err) {
|
|
@@ -90,6 +108,7 @@ class EntityOperation {
|
|
|
90
108
|
|
|
91
109
|
// EJECT-END
|
|
92
110
|
|
|
111
|
+
|
|
93
112
|
#unexpected(this: any, ctx: Context, ctrl: any, err: any): any { return err }
|
|
94
113
|
|
|
95
114
|
}
|
|
@@ -1,81 +1,100 @@
|
|
|
1
1
|
type Context = any
|
|
2
|
-
type Operation = any
|
|
3
2
|
type Control = any
|
|
4
3
|
|
|
5
4
|
class EntityOperation {
|
|
6
5
|
|
|
6
|
+
#match: any
|
|
7
|
+
#data: any
|
|
8
|
+
#utility: any
|
|
9
|
+
|
|
10
|
+
|
|
7
11
|
// EJECT-START
|
|
8
12
|
|
|
9
13
|
async update(this: any, reqdata?: any, ctrl?: Control) {
|
|
10
|
-
|
|
11
|
-
let client = this.#client
|
|
14
|
+
|
|
12
15
|
const utility = this.#utility
|
|
16
|
+
|
|
13
17
|
const {
|
|
14
|
-
|
|
18
|
+
makeContext,
|
|
19
|
+
done,
|
|
20
|
+
error,
|
|
21
|
+
featureHook,
|
|
22
|
+
selection,
|
|
23
|
+
request,
|
|
24
|
+
response,
|
|
25
|
+
result,
|
|
26
|
+
spec,
|
|
15
27
|
} = utility
|
|
16
28
|
|
|
17
29
|
let fres: Promise<any> | undefined = undefined
|
|
18
30
|
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
name: 'update',
|
|
22
|
-
path: 'PATH',
|
|
23
|
-
params: ['PARAM-LIST'],
|
|
24
|
-
alias: { 'ALIAS': 'MAP' },
|
|
25
|
-
state: {},
|
|
26
|
-
reqform: 'REQFORM',
|
|
27
|
-
resform: 'RESFORM',
|
|
28
|
-
validate: 'VALIDATE',
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
let ctx: Context = contextify({
|
|
31
|
+
let ctx: Context = makeContext({
|
|
32
|
+
opname: 'update',
|
|
32
33
|
ctrl,
|
|
33
|
-
op,
|
|
34
34
|
match: this.#match,
|
|
35
35
|
data: this.#data,
|
|
36
36
|
reqdata
|
|
37
|
-
}, this
|
|
37
|
+
}, this._entctx)
|
|
38
38
|
|
|
39
39
|
try {
|
|
40
40
|
|
|
41
|
-
// #
|
|
41
|
+
// #PreSelection-Hook
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
ctx.out.selected = selection(ctx)
|
|
44
|
+
if (ctx.out.selected instanceof Error) {
|
|
45
|
+
return error(ctx, ctx.out.selected)
|
|
46
|
+
}
|
|
44
47
|
|
|
45
48
|
|
|
46
49
|
// #PreSpec-Hook
|
|
47
50
|
|
|
48
|
-
spec(ctx)
|
|
51
|
+
ctx.out.spec = spec(ctx)
|
|
52
|
+
if (ctx.out.spec instanceof Error) {
|
|
53
|
+
return error(ctx, ctx.out.spec)
|
|
54
|
+
}
|
|
49
55
|
|
|
50
56
|
|
|
51
57
|
// #PreRequest-Hook
|
|
52
58
|
|
|
53
|
-
await request(ctx)
|
|
59
|
+
ctx.out.request = await request(ctx)
|
|
60
|
+
if (ctx.out.request instanceof Error) {
|
|
61
|
+
return error(ctx, ctx.out.request)
|
|
62
|
+
}
|
|
54
63
|
|
|
55
64
|
|
|
56
65
|
// #PreResponse-Hook
|
|
57
66
|
|
|
58
|
-
await response(ctx)
|
|
67
|
+
ctx.out.response = await response(ctx)
|
|
68
|
+
if (ctx.out.response instanceof Error) {
|
|
69
|
+
return error(ctx, ctx.out.response)
|
|
70
|
+
}
|
|
59
71
|
|
|
60
72
|
|
|
61
73
|
// #PreResult-Hook
|
|
62
74
|
|
|
63
|
-
result(ctx)
|
|
75
|
+
ctx.out.result = await result(ctx)
|
|
76
|
+
if (ctx.out.result instanceof Error) {
|
|
77
|
+
return error(ctx, ctx.out.result)
|
|
78
|
+
}
|
|
64
79
|
|
|
65
80
|
|
|
66
|
-
// #
|
|
81
|
+
// #PreDone-Hook
|
|
67
82
|
|
|
68
|
-
if (null != ctx.result
|
|
69
|
-
|
|
70
|
-
|
|
83
|
+
if (null != ctx.result) {
|
|
84
|
+
if (null != ctx.result.resmatch) {
|
|
85
|
+
this.#match = ctx.result.resmatch
|
|
86
|
+
}
|
|
71
87
|
|
|
72
|
-
|
|
73
|
-
|
|
88
|
+
if (null != ctx.result.resdata) {
|
|
89
|
+
this.#data = ctx.result.resdata
|
|
90
|
+
}
|
|
74
91
|
}
|
|
75
92
|
|
|
76
93
|
return done(ctx)
|
|
77
94
|
}
|
|
78
95
|
catch (err: any) {
|
|
96
|
+
// #PreUnexpected-Hook
|
|
97
|
+
|
|
79
98
|
err = this.#unexpected(ctx, err)
|
|
80
99
|
|
|
81
100
|
if (err) {
|
|
@@ -89,6 +108,7 @@ class EntityOperation {
|
|
|
89
108
|
|
|
90
109
|
// EJECT-END
|
|
91
110
|
|
|
111
|
+
|
|
92
112
|
#unexpected(this: any, ctx: Context, ctrl: any, err: any): any { return err }
|
|
93
113
|
|
|
94
114
|
}
|