@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.
Files changed (119) hide show
  1. package/bin/voxgig-sdkgen +12 -4
  2. package/dist/action/action.d.ts +4 -0
  3. package/dist/action/action.js +35 -0
  4. package/dist/action/action.js.map +1 -0
  5. package/dist/action/feature.d.ts +4 -2
  6. package/dist/action/feature.js +57 -38
  7. package/dist/action/feature.js.map +1 -1
  8. package/dist/action/target.d.ts +4 -2
  9. package/dist/action/target.js +136 -45
  10. package/dist/action/target.js.map +1 -1
  11. package/dist/cmp/Entity.js +5 -0
  12. package/dist/cmp/Entity.js.map +1 -1
  13. package/dist/cmp/Feature.js +5 -0
  14. package/dist/cmp/Feature.js.map +1 -1
  15. package/dist/cmp/Main.js +4 -1
  16. package/dist/cmp/Main.js.map +1 -1
  17. package/dist/cmp/Top.d.ts +2 -0
  18. package/dist/cmp/Top.js +23 -0
  19. package/dist/cmp/Top.js.map +1 -0
  20. package/dist/sdkgen.d.ts +10 -3
  21. package/dist/sdkgen.js +53 -8
  22. package/dist/sdkgen.js.map +1 -1
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/dist/types.d.ts +16 -0
  25. package/dist/types.js +3 -0
  26. package/dist/types.js.map +1 -0
  27. package/dist/utility.d.ts +3 -3
  28. package/dist/utility.js +7 -8
  29. package/dist/utility.js.map +1 -1
  30. package/package.json +6 -10
  31. package/project/.sdk/model/feature/README.md +2 -0
  32. package/project/.sdk/model/feature/log.jsonic +7 -4
  33. package/project/.sdk/model/feature/test.jsonic +26 -0
  34. package/project/.sdk/model/target/ts.jsonic +1 -0
  35. package/project/.sdk/src/cmp/ts/Config_ts.ts +7 -2
  36. package/project/.sdk/src/cmp/ts/EntityOperation_ts.ts +67 -0
  37. package/project/.sdk/src/cmp/ts/EntityTest_ts.ts +180 -0
  38. package/project/.sdk/src/cmp/ts/Entity_ts.ts +41 -66
  39. package/project/.sdk/src/cmp/ts/MainEntity_ts.ts +22 -0
  40. package/project/.sdk/src/cmp/ts/Main_ts.ts +52 -53
  41. package/project/.sdk/src/cmp/ts/Package_ts.ts +12 -7
  42. package/project/.sdk/src/cmp/ts/ReadmeInstall_ts.ts +19 -0
  43. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +24 -0
  44. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +13 -0
  45. package/project/.sdk/src/cmp/ts/TestMain_ts.ts +19 -0
  46. package/project/.sdk/src/cmp/ts/Test_ts.ts +20 -0
  47. package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +8 -1
  48. package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.ts +164 -0
  49. package/project/.sdk/src/cmp/ts/fragment/Entity.test.fragment.ts +37 -0
  50. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +91 -0
  51. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +92 -0
  52. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +96 -0
  53. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +96 -0
  54. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +95 -0
  55. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +107 -0
  56. package/project/.sdk/src/cmp/ts/utility_ts.ts +10 -0
  57. package/project/.sdk/tm/ts/src/feature/base/BaseFeature.ts +43 -0
  58. package/project/.sdk/tm/ts/src/feature/log/LogFeature.ts +109 -0
  59. package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +159 -0
  60. package/project/.sdk/tm/ts/src/tsconfig.json +1 -1
  61. package/project/.sdk/tm/ts/src/types.ts +114 -0
  62. package/project/.sdk/tm/ts/src/utility/AddfeatureUtility.ts +47 -0
  63. package/project/.sdk/tm/ts/src/utility/AuthUtility.ts +42 -0
  64. package/project/.sdk/tm/ts/src/utility/BodyUtility.ts +29 -0
  65. package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +50 -0
  66. package/project/.sdk/tm/ts/src/utility/ContextUtility.ts +67 -0
  67. package/project/.sdk/tm/ts/src/utility/DoneUtility.ts +28 -0
  68. package/project/.sdk/tm/ts/src/utility/ErrorUtility.ts +59 -0
  69. package/project/.sdk/tm/ts/src/utility/FeaturehookUtility.ts +26 -0
  70. package/project/.sdk/tm/ts/src/utility/FetcherUtility.ts +17 -0
  71. package/project/.sdk/tm/ts/src/utility/FindparamUtility.ts +54 -0
  72. package/project/.sdk/tm/ts/src/utility/FullurlUtility.ts +46 -0
  73. package/project/.sdk/tm/ts/src/utility/HeadersUtility.ts +24 -0
  74. package/project/.sdk/tm/ts/src/utility/InitfeatureUtility.ts +13 -0
  75. package/project/.sdk/tm/ts/src/utility/JoinurlUtility.ts +15 -0
  76. package/project/.sdk/tm/ts/src/utility/MethodUtility.ts +25 -0
  77. package/project/.sdk/tm/ts/src/utility/OperatorUtility.ts +90 -0
  78. package/project/.sdk/tm/ts/src/utility/OptionsUtility.ts +72 -0
  79. package/project/.sdk/tm/ts/src/utility/ParamsUtility.ts +37 -0
  80. package/project/.sdk/tm/ts/src/utility/QueryUtility.ts +27 -0
  81. package/project/.sdk/tm/ts/src/utility/ReqformUtility.ts +33 -0
  82. package/project/.sdk/tm/ts/src/utility/RequestUtility.ts +66 -0
  83. package/project/.sdk/tm/ts/src/utility/ResbasicUtility.ts +34 -0
  84. package/project/.sdk/tm/ts/src/utility/ResbodyUtility.ts +19 -0
  85. package/project/.sdk/tm/ts/src/utility/ResformUtility.ts +36 -0
  86. package/project/.sdk/tm/ts/src/utility/ResheadersUtility.ts +23 -0
  87. package/project/.sdk/tm/ts/src/utility/ResponseUtility.ts +30 -0
  88. package/project/.sdk/tm/ts/src/utility/ResultUtility.ts +36 -0
  89. package/project/.sdk/tm/ts/src/utility/SpecUtility.ts +61 -0
  90. package/project/.sdk/tm/ts/src/utility/StructUtility.ts +2499 -0
  91. package/project/.sdk/tm/ts/src/utility/Utility.ts +88 -0
  92. package/project/.sdk/tm/ts/test/exists.test.ts +17 -0
  93. package/project/.sdk/tm/ts/test/runner.ts +402 -0
  94. package/project/.sdk/tm/ts/test/tsconfig.json +1 -1
  95. package/project/.sdk/tm/ts/test/utility/Custom.test.ts +62 -0
  96. package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +244 -0
  97. package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +678 -0
  98. package/project/.sdk/tm/ts/test/utility/index.ts +9 -0
  99. package/project/.sdk/tm/ts/test/utility.ts +86 -0
  100. package/src/action/action.ts +54 -0
  101. package/src/action/feature.ts +83 -47
  102. package/src/action/target.ts +173 -53
  103. package/src/cmp/Entity.ts +6 -0
  104. package/src/cmp/Feature.ts +6 -3
  105. package/src/cmp/Main.ts +4 -1
  106. package/src/sdkgen.ts +86 -11
  107. package/src/types.ts +33 -0
  108. package/src/utility.ts +5 -3
  109. package/project/.sdk/model/feature/limit.jsonic +0 -12
  110. package/project/.sdk/model/feature/page.jsonic +0 -9
  111. package/project/.sdk/model/feature/telemetry.jsonic +0 -10
  112. package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.js +0 -79
  113. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.js +0 -61
  114. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.js +0 -57
  115. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.js +0 -61
  116. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.js +0 -61
  117. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.js +0 -61
  118. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.js +0 -67
  119. package/project/.sdk/tm/ts/test/README.md~ +0 -2
package/src/cmp/Main.ts CHANGED
@@ -6,9 +6,11 @@ import { requirePath } from '../utility'
6
6
 
7
7
  const Main = cmp(function Main(props: any) {
8
8
  const { target, ctx$ } = props
9
- const { model, stdrep } = ctx$
9
+ const { model, stdrep, log } = ctx$
10
10
 
11
11
  Copy({
12
+ // This folder is relative to the .sdk folder in the project, as that is where
13
+ // the sdk is generated from.
12
14
  from: 'tm/' + target.name,
13
15
  replace: {
14
16
  ...stdrep,
@@ -19,6 +21,7 @@ const Main = cmp(function Main(props: any) {
19
21
 
20
22
  Main_sdk['Main']({ model, target, stdrep })
21
23
 
24
+ log.info({ point: 'generate-main', target, note: 'target:' + target.name })
22
25
  })
23
26
 
24
27
 
package/src/sdkgen.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /* Copyright (c) 2024 Richard Rodger, MIT License */
2
2
 
3
- import * as Fs from 'node:fs'
3
+ import Fs from 'node:fs'
4
+ import Path from 'node:path'
4
5
 
5
6
  import { prettyPino, Pino } from '@voxgig/util'
6
7
 
@@ -8,6 +9,16 @@ import { Jsonic } from 'jsonic'
8
9
  import * as JostracaModule from 'jostraca'
9
10
  import { Aontu, Context } from 'aontu'
10
11
 
12
+ import {
13
+ showChanges,
14
+ getdlog,
15
+ } from '@voxgig/util'
16
+
17
+ import type {
18
+ ActionContext,
19
+ ActionResult,
20
+ } from './types'
21
+
11
22
  import { SdkGenError, requirePath } from './utility'
12
23
 
13
24
  import { Main } from './cmp/Main'
@@ -19,8 +30,17 @@ import { ReadmeOptions } from './cmp/ReadmeOptions'
19
30
  import { ReadmeEntity } from './cmp/ReadmeEntity'
20
31
  import { FeatureHook } from './cmp/FeatureHook'
21
32
 
22
- import { action_target } from './action/target'
23
- import { action_feature } from './action/feature'
33
+
34
+ import {
35
+ action_target,
36
+ target_add,
37
+ } from './action/target'
38
+
39
+ import {
40
+ action_feature,
41
+ feature_add,
42
+ } from './action/feature'
43
+
24
44
 
25
45
 
26
46
  // TODO: use shape
@@ -37,7 +57,7 @@ type SdkGenOptions = {
37
57
  name: string
38
58
  }
39
59
  debug?: boolean | string
40
- pino?: ReturnType<typeof Pino>
60
+ pino?: any, // ReturnType<typeof Pino>
41
61
  now?: () => number
42
62
 
43
63
  // TODO: match Jostraca
@@ -45,6 +65,8 @@ type SdkGenOptions = {
45
65
  txt?: any
46
66
  bin?: any
47
67
  }
68
+
69
+ dryrun?: boolean
48
70
  }
49
71
 
50
72
 
@@ -57,12 +79,27 @@ const ACTION_MAP: any = {
57
79
  }
58
80
 
59
81
 
82
+ const dlog = getdlog('sdkgen', __filename)
83
+
84
+
60
85
  function SdkGen(opts: SdkGenOptions) {
61
86
  const fs = opts.fs || Fs
62
87
  const folder = opts.folder || '../'
63
88
  const now = opts.now || (() => Date.now())
64
89
 
65
- const jostraca = Jostraca({ now })
90
+ const jopts = {
91
+ now,
92
+ control: {
93
+ dryrun: opts.dryrun
94
+ },
95
+ existing: {
96
+ txt: {
97
+ merge: true
98
+ }
99
+ }
100
+ }
101
+
102
+ const jostraca = Jostraca(jopts)
66
103
 
67
104
  const pino = prettyPino('sdkgen', opts)
68
105
  const log = pino.child({ cmp: 'sdkgen' })
@@ -72,7 +109,7 @@ function SdkGen(opts: SdkGenOptions) {
72
109
  const start = Date.now()
73
110
  const { model, config } = spec
74
111
 
75
- log.info({ point: 'generate-start', start })
112
+ log.info({ point: 'generate-start', start, note: opts.dryrun ? '** DRY RUN **' : '' })
76
113
  log.debug({ point: 'generate-spec', spec })
77
114
 
78
115
  let Root = spec.root
@@ -89,10 +126,19 @@ function SdkGen(opts: SdkGenOptions) {
89
126
  log: log.child({ cmp: 'jostraca' }),
90
127
  meta: { spec },
91
128
  debug: opts.debug,
92
- existing: opts.existing
129
+ existing: opts.existing,
93
130
  }
94
131
 
95
- await jostraca.generate(jopts, () => Root({ model }))
132
+ const jres = await jostraca.generate(jopts, () => Root({ model }))
133
+
134
+ showChanges(jopts.log, 'generate-result', jres, Path.dirname(process.cwd()))
135
+
136
+ const dlogs = dlog.log()
137
+ if (0 < dlogs.length) {
138
+ for (let dlogentry of dlogs) {
139
+ log.debug({ point: 'generate-warning', dlogentry, note: String(dlogentry) })
140
+ }
141
+ }
96
142
 
97
143
  log.info({ point: 'generate-end' })
98
144
 
@@ -110,17 +156,28 @@ function SdkGen(opts: SdkGenOptions) {
110
156
  throw new SdkGenError('Unknown action: ' + actname)
111
157
  }
112
158
 
159
+ const ctx = resolveActionContext()
160
+
161
+ await action(pargs, ctx)
162
+ }
163
+
164
+
165
+ function resolveActionContext(): ActionContext {
166
+
167
+ // TODO: use AsyncLocalStorage to avoid reloading model
113
168
  const { model, tree } = resolveModel()
114
169
 
115
- const ctx = {
170
+ const ctx: ActionContext = {
116
171
  fs: () => fs,
117
172
  log,
118
173
  folder: '.', // The `generate` folder,
119
174
  model,
120
175
  tree,
176
+ jostraca,
177
+ opts,
121
178
  }
122
179
 
123
- await action(pargs, ctx)
180
+ return ctx
124
181
  }
125
182
 
126
183
 
@@ -179,10 +236,28 @@ function SdkGen(opts: SdkGenOptions) {
179
236
  }
180
237
 
181
238
 
239
+ const target = {
240
+ add: async (targets: string[]): Promise<ActionResult> => {
241
+ const ctx = resolveActionContext()
242
+ return target_add(targets, ctx)
243
+ }
244
+ }
245
+
246
+ const feature = {
247
+ add: async (features: string[]): Promise<ActionResult> => {
248
+ const ctx = resolveActionContext()
249
+ return feature_add(features, ctx)
250
+ }
251
+ }
252
+
253
+
254
+
182
255
  return {
183
- pino,
256
+ pino: pino as any,
184
257
  generate,
185
258
  action,
259
+ target,
260
+ feature,
186
261
  }
187
262
 
188
263
  }
package/src/types.ts ADDED
@@ -0,0 +1,33 @@
1
+
2
+ import Fs from 'node:fs'
3
+
4
+ import type {
5
+ JostracaResult
6
+ } from 'jostraca'
7
+
8
+
9
+ type FsUtil = typeof Fs
10
+
11
+
12
+ type ActionContext = {
13
+ fs: () => FsUtil,
14
+ log: any,
15
+ folder: string,
16
+ model: any,
17
+ tree: any,
18
+ opts: any,
19
+ jostraca: any
20
+ }
21
+
22
+
23
+ type ActionResult = {
24
+ jres: JostracaResult
25
+ }
26
+
27
+
28
+
29
+ export type {
30
+ ActionContext,
31
+ ActionResult,
32
+ }
33
+
package/src/utility.ts CHANGED
@@ -1,15 +1,17 @@
1
1
 
2
2
  import Path from 'node:path'
3
3
 
4
- // TODO: move to @voxgig/util as duplicated with @voxgig/sdkgen
4
+ import { JostracaResult } from 'jostraca'
5
5
 
6
- const resolvePath = (ctx$: any, path: string): any => {
6
+
7
+
8
+ function resolvePath(ctx$: any, path: string): any {
7
9
  const fullpath = Path.join(ctx$.folder, '.sdk', 'dist', path)
8
10
  return fullpath
9
11
  }
10
12
 
11
13
 
12
- const requirePath = (ctx$: any, path: string, flags?: { ignore?: boolean }): any => {
14
+ function requirePath(ctx$: any, path: string, flags?: { ignore?: boolean }): any {
13
15
  const fullpath = resolvePath(ctx$, path)
14
16
  const ignore = null == flags?.ignore ? false : flags.ignore
15
17
 
@@ -1,12 +0,0 @@
1
-
2
- title: Limiter
3
- active: true
4
-
5
-
6
- hook: {
7
- PreFetch: {
8
- active: true
9
- await: true
10
- }
11
- }
12
-
@@ -1,9 +0,0 @@
1
-
2
- title: Paging
3
- active: true
4
-
5
-
6
- hook: {
7
- PreFetch: active: true
8
- }
9
-
@@ -1,10 +0,0 @@
1
-
2
- title: Telemetry
3
- active: true
4
-
5
- hook: {
6
- PostConstruct: active: true
7
- PreFetch: active: true
8
- PostFetch: active: true
9
- }
10
-
@@ -1,79 +0,0 @@
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
- }
@@ -1,61 +0,0 @@
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
@@ -1,57 +0,0 @@
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
@@ -1,61 +0,0 @@
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
@@ -1,61 +0,0 @@
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
@@ -1,61 +0,0 @@
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