wowok_agent 1.2.45 → 1.3.48

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 (70) hide show
  1. package/dist/call/arbitration.d.ts +14 -28
  2. package/dist/call/arbitration.d.ts.map +1 -1
  3. package/dist/call/arbitration.js +158 -145
  4. package/dist/call/arbitration.js.map +1 -1
  5. package/dist/call/base.d.ts +33 -2
  6. package/dist/call/base.d.ts.map +1 -1
  7. package/dist/call/base.js +49 -3
  8. package/dist/call/base.js.map +1 -1
  9. package/dist/call/call.d.ts +6 -0
  10. package/dist/call/call.d.ts.map +1 -1
  11. package/dist/call/call.js.map +1 -1
  12. package/dist/call/demand.d.ts +10 -22
  13. package/dist/call/demand.d.ts.map +1 -1
  14. package/dist/call/demand.js +107 -109
  15. package/dist/call/demand.js.map +1 -1
  16. package/dist/call/machine.d.ts +36 -44
  17. package/dist/call/machine.d.ts.map +1 -1
  18. package/dist/call/machine.js +179 -179
  19. package/dist/call/machine.js.map +1 -1
  20. package/dist/call/object_permission.d.ts.map +1 -1
  21. package/dist/call/object_permission.js.map +1 -1
  22. package/dist/call/permission.d.ts +31 -18
  23. package/dist/call/permission.d.ts.map +1 -1
  24. package/dist/call/permission.js +92 -86
  25. package/dist/call/permission.js.map +1 -1
  26. package/dist/call/personal.d.ts +6 -6
  27. package/dist/call/personal.d.ts.map +1 -1
  28. package/dist/call/personal.js +11 -13
  29. package/dist/call/personal.js.map +1 -1
  30. package/dist/call/repository.d.ts +5 -12
  31. package/dist/call/repository.d.ts.map +1 -1
  32. package/dist/call/repository.js +114 -92
  33. package/dist/call/repository.js.map +1 -1
  34. package/dist/call/service.d.ts +51 -70
  35. package/dist/call/service.d.ts.map +1 -1
  36. package/dist/call/service.js +335 -302
  37. package/dist/call/service.js.map +1 -1
  38. package/dist/call/treasury.d.ts +23 -26
  39. package/dist/call/treasury.d.ts.map +1 -1
  40. package/dist/call/treasury.js +124 -112
  41. package/dist/call/treasury.js.map +1 -1
  42. package/dist/common.d.ts +1 -0
  43. package/dist/common.d.ts.map +1 -1
  44. package/dist/common.js +6 -0
  45. package/dist/common.js.map +1 -1
  46. package/dist/local/local.d.ts +1 -1
  47. package/dist/local/local.d.ts.map +1 -1
  48. package/dist/local/local.js +4 -1
  49. package/dist/local/local.js.map +1 -1
  50. package/dist/query/objects.d.ts +6 -2
  51. package/dist/query/objects.d.ts.map +1 -1
  52. package/dist/query/objects.js +8 -1
  53. package/dist/query/objects.js.map +1 -1
  54. package/package.json +4 -2
  55. package/src/call/arbitration.ts +178 -161
  56. package/src/call/base.ts +84 -10
  57. package/src/call/call.ts +6 -0
  58. package/src/call/demand.ts +120 -121
  59. package/src/call/machine.ts +193 -194
  60. package/src/call/object_permission.ts +1 -1
  61. package/src/call/permission.ts +121 -90
  62. package/src/call/personal.ts +18 -20
  63. package/src/call/repository.ts +120 -101
  64. package/src/call/service.ts +375 -325
  65. package/src/call/treasury.ts +143 -121
  66. package/src/common.ts +7 -1
  67. package/src/local/account.ts +1 -1
  68. package/src/local/local.ts +6 -2
  69. package/src/query/objects.ts +17 -4
  70. package/tsconfig.tsbuildinfo +1 -1
@@ -1,16 +1,23 @@
1
- import { PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIndex, TransactionBlock, TxbAddress,
1
+ import { PassportObject, Errors, ERROR, Permission, PermissionIndex, TransactionBlock, TxbAddress,
2
2
  PermissionIndexType, Machine, Machine_Forward, Machine_Node, Deliverable, ParentProgress, Progress, ProgressNext,
3
- ProgressObject,
3
+ PermissionObject,
4
4
  } from 'wowok';
5
- import { CallBase, CallResult, Namedbject } from "./base.js";
6
- import { Account } from '../local/account.js';
5
+ import { CallBase, CallResult, GetObjectExisted, GetObjectMain, GetObjectParam, Namedbject, ObjectMain, TypeNamedObjectWithPermission } from "./base.js";
7
6
  import { ObjectMachine } from '../query/objects.js';
8
7
  import { LocalMark } from '../local/local.js';
8
+ import { Account } from '../local/account.js';
9
9
 
10
10
  /// The execution priority is determined by the order in which the object attributes are arranged
11
11
  export interface CallMachine_Data {
12
- object?: {address:string} | {namedNew?: Namedbject}; // undefined or {named_new...} for creating a new object
13
- permission?: {address:string} | {namedNew?: Namedbject, description?:string};
12
+ object?: ObjectMain;
13
+ progress_new?: {task_address?:string, namedNew?: Namedbject};
14
+ progress_context_repository?: {progress?:string; repository?:string};
15
+ progress_namedOperator?: {progress?:string; data:{name:string, operators:string[]}[]};
16
+ progress_parent?: {progress?:string, parent?:ParentProgress};
17
+ progress_hold?: {progress?:string; operation:ProgressNext; bHold:boolean; adminUnhold?:boolean};
18
+ progress_task?: {progress:string; task_address:string};
19
+ progress_next?: {progress:string; operation:ProgressNext; deliverable:Deliverable};
20
+
14
21
  description?: string;
15
22
  endpoint?: string;
16
23
  consensus_repository?: {op:'set' | 'add' | 'remove' ; repositories:string[]} | {op:'removeall'};
@@ -20,47 +27,46 @@ export interface CallMachine_Data {
20
27
  | {op:'add forward'; data: {prior_node_name:string; node_name:string; forward:Machine_Forward; threshold?:number; remove_forward?:string}[]}
21
28
  | {op:'remove forward'; data:{prior_node_name:string; node_name:string; forward_name:string}[]}
22
29
  bPublished?: boolean;
23
- progress_new?: {task_address?:string; namedNew?: Namedbject};
24
- progress_context_repository?: {progress?:string; repository?:string};
25
- progress_namedOperator?: {progress?:string; data:{name:string, operators:string[]}[]};
26
- progress_parent?: {progress?:string, parent?:ParentProgress};
27
- progress_task?: {progress?:string; task:string};
28
- progress_hold?: {progress?:string; operation:ProgressNext; bHold:boolean; adminUnhold?:boolean};
29
- progress_next?: {progress:string; operation:ProgressNext; deliverable:Deliverable; guard?:string};
30
30
  bPaused?: boolean;
31
31
  clone_new?: {namedNew?: Namedbject/*, description?:string*/};
32
32
  }
33
33
  export class CallMachine extends CallBase { //@ todo self-owned node operate
34
34
  data: CallMachine_Data;
35
+ object_address: string | undefined = undefined;
36
+ permission_address: string | undefined = undefined;
37
+
35
38
  constructor(data:CallMachine_Data) {
36
39
  super();
37
40
  this.data = data;
38
41
  }
39
- async call(account?:string) : Promise<CallResult> {
40
- var checkOwner = false; const guards : string[] = [];
41
- const perms : PermissionIndexType[] = [];
42
- var [permission_address, object_address] =
43
- await LocalMark.Instance().get_many_address(
44
- [(this.data?.permission as any)?.address,
45
- (this.data?.object as any)?.address]);
42
+ protected async prepare() {
43
+ if (!this.object_address) {
44
+ this.object_address = (await LocalMark.Instance().get_address(GetObjectExisted(this.data?.object)));
46
45
 
47
- if (object_address) {
48
- if (!permission_address) {
49
- await this.update_content(object_address, 'Machine');
50
- if (this.content) {
51
- permission_address = (this.content as ObjectMachine).permission;
52
- }
46
+ if (this.object_address) {
47
+ await this.update_content('Machine', this.object_address);
48
+ if (!this.content) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.object:' + this.object_address);
49
+ this.permission_address = (this.content as ObjectMachine).permission;
50
+ } else {
51
+ const n = GetObjectMain(this.data?.object) as TypeNamedObjectWithPermission;
52
+ this.permission_address = (await LocalMark.Instance().get_address(GetObjectExisted(n?.permission)));
53
53
  }
54
- }
54
+ }
55
+ }
55
56
 
56
- if (permission_address) {
57
+ async call(account?:string) : Promise<CallResult> {
58
+ var checkOwner = false; const guards : string[] = [];
59
+ const perms : PermissionIndexType[] = [];
60
+
61
+ await this.prepare();
62
+ if (this.permission_address) {
57
63
  if (!this.data?.object) {
58
64
  perms.push(PermissionIndex.machine)
59
65
  }
60
- if (this.data?.description !== undefined && object_address) {
66
+ if (this.data?.description !== undefined && this.object_address) {
61
67
  perms.push(PermissionIndex.machine_description)
62
68
  }
63
- if (this.data?.endpoint !== undefined && object_address) {
69
+ if (this.data?.endpoint !== undefined && this.object_address) {
64
70
  perms.push(PermissionIndex.machine_endpoint)
65
71
  }
66
72
  if (this.data?.consensus_repository !== undefined) {
@@ -95,196 +101,189 @@ export class CallMachine extends CallBase { //@ todo self-owned node operate
95
101
  if (this.data?.bPaused !== undefined) {
96
102
  perms.push(PermissionIndex.machine_pause)
97
103
  }
104
+ if (this.data?.clone_new!== undefined) {
105
+ perms.push(PermissionIndex.machine_clone)
106
+ }
107
+
98
108
  if (this.data?.progress_next !== undefined) {
99
- if (this.data?.progress_next?.guard) {
100
- const guard = await LocalMark.Instance().get_address(this.data?.progress_next?.guard);
109
+ if (this.object_address) { // fetch guard
110
+ const [p, acc] = await Promise.all([
111
+ LocalMark.Instance().get_address(this.data?.progress_next.progress),
112
+ Account.Instance().get(account)]);
113
+
114
+ if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_next.progress');
115
+ if (!acc) ERROR(Errors.InvalidParam, 'CallMachine_Data.account');
116
+
117
+ const guard = await Progress.QueryForwardGuard(p, this.object_address, acc.address,
118
+ this.data.progress_next.operation.next_node_name, this.data.progress_next.operation.forward);
101
119
  if (guard) {
102
120
  guards.push(guard);
103
- }
104
- } else if (object_address) { // fetch guard
105
- const p = await LocalMark.Instance().get_address(this.data?.progress_next.progress);
106
- if (p) {
107
- const guard = await Progress.QueryForwardGuard(this.data?.progress_next.progress, object_address,
108
- (await Account.Instance().default())?.address ?? '0xe386bb9e01b3528b75f3751ad8a1e418b207ad979fea364087deef5250a73d3f',
109
- this.data.progress_next.operation.next_node_name, this.data.progress_next.operation.forward);
110
- if (guard) {
111
- guards.push(guard);
112
- }
113
- }
121
+ }
114
122
  }
115
123
  }
116
124
 
117
- return await this.check_permission_and_call(permission_address, perms, guards, checkOwner, undefined, account)
125
+ return await this.check_permission_and_call(this.permission_address, perms, guards, checkOwner, undefined, account)
118
126
  }
119
127
  return await this.exec(account);
120
128
  }
121
129
 
122
130
  protected async operate(txb:TransactionBlock, passport?:PassportObject, account?:string) {
123
- let obj : Machine | undefined ; let permission: any;
124
- var [permission_address, object_address] = this?.content ?
125
- [(this.content as ObjectMachine).permission, this.content.object] :
126
- await LocalMark.Instance().get_many_address(
127
- [(this.data?.permission as any)?.address,
128
- (this.data?.object as any)?.address]);
129
-
130
- if (!object_address) {
131
- if (!permission_address) {
132
- const d = (this.data?.permission as any)?.description ?? '';
133
- permission = Permission.New(txb, d);
134
- }
135
- obj = Machine.New(txb, permission ? permission.get_object() : permission_address, this.data?.description??'', this.data?.endpoint ?? '', permission?undefined:passport);
131
+ let obj : Machine | undefined ; let perm: Permission | undefined;
132
+ let permission : PermissionObject | undefined;
133
+
134
+ if (this.object_address) {
135
+ obj = Machine.From(txb, this.permission_address!, this.object_address);
136
+ permission = this.permission_address;
136
137
  } else {
137
- if (permission_address) {
138
- obj = Machine.From(txb, permission_address, object_address)
139
- } else {
140
- ERROR(Errors.InvalidParam, 'CallMachine_Data.data.permission')
138
+ const n = GetObjectMain(this.data?.object) as TypeNamedObjectWithPermission;
139
+ permission = await LocalMark.Instance().get_address(GetObjectExisted(n?.permission));
140
+ if (!permission) {
141
+ perm = Permission.New(txb, GetObjectParam(n?.permission)?.description ?? '');
142
+ permission = perm.get_object();
141
143
  }
144
+
145
+ obj = Machine.New(txb, permission, this.data?.description??'',
146
+ this.data?.endpoint, permission?undefined:passport);
142
147
  }
143
148
 
144
- if (obj) {
145
- const perm = permission ? permission.get_object() : permission_address;
146
- const pst = permission?undefined:passport;
149
+ if (!obj) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.object');
150
+ if (!permission) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.object.permission');
147
151
 
148
- if (this.data?.description !== undefined && object_address) {
149
- obj?.set_description(this.data.description, pst);
150
- }
151
- if (this.data?.endpoint !== undefined && object_address) {
152
- obj?.set_endpoint(this.data.endpoint, pst)
153
- }
152
+ const pst = perm?undefined:passport;
153
+ var new_progress : Progress | undefined;
154
+ if (this.data?.progress_new !== undefined) {
155
+ const task = await LocalMark.Instance().get_address(this.data?.progress_new?.task_address);
156
+ new_progress = Progress?.New(txb, obj?.get_object(), permission, task, pst);
157
+ }
158
+ if (this.data?.progress_context_repository !== undefined) {
159
+ const p = this.data?.progress_context_repository.progress
160
+ ? await LocalMark.Instance().get_address(this.data?.progress_context_repository.progress)
161
+ : new_progress?.get_object();
162
+ if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_context_repository.progress');
163
+ const rep = await LocalMark.Instance().get_address(this.data?.progress_context_repository.repository);
164
+ Progress.From(txb, obj?.get_object(), permission, p!).set_context_repository(rep, pst)
165
+ }
166
+ if (this.data?.progress_namedOperator !== undefined) {
167
+ const p = this.data?.progress_namedOperator.progress
168
+ ? await LocalMark.Instance().get_address(this.data?.progress_namedOperator.progress)
169
+ : new_progress?.get_object();
170
+ if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_namedOperator.progress');
154
171
 
155
- if (this.data?.consensus_repository !== undefined) {
156
- switch (this.data.consensus_repository.op) {
157
- case 'add':
158
- case 'set':
159
- if (this.data.consensus_repository.op === 'set') {
160
- obj?.remove_repository([], true, pst);
161
- }
162
- var reps = await LocalMark.Instance().get_many_address2(this.data.consensus_repository.repositories);
163
- reps.forEach(v=>obj?.add_repository(v, pst)) ;
164
- break;
165
- case 'remove':
166
- var reps = await LocalMark.Instance().get_many_address2(this.data.consensus_repository.repositories);
167
- if (reps.length > 0) {
168
- obj?.remove_repository(reps, false, pst);
169
- }
170
- break;
171
- case 'removeall':
172
- obj?.remove_repository([], true, pst);
173
- break;
172
+ let pp = Progress.From(txb, obj?.get_object(), permission, p!);
173
+ this.data.progress_namedOperator.data.forEach(v => pp.set_namedOperator(v.name, v.operators, pst));
174
+ }
175
+ if (this.data?.progress_parent !== undefined) {
176
+ const p = this.data?.progress_parent.progress
177
+ ? await LocalMark.Instance().get_address(this.data?.progress_parent.progress)
178
+ : new_progress?.get_object();
179
+ if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_parent.progress');
180
+
181
+ if (this.data.progress_parent.parent) {
182
+ const parent = await LocalMark.Instance().get_address(this.data.progress_parent.parent.parent_id);
183
+ if (parent) {
184
+ this.data.progress_parent.parent.parent_id = parent;
185
+ Progress.From(txb, obj?.get_object(), permission, p!).parent(this.data.progress_parent.parent);
174
186
  }
187
+ } else {
188
+ Progress.From(txb, obj?.get_object(), permission, p!).parent_none();
175
189
  }
176
- if (this.data?.nodes !== undefined) {
177
- switch (this.data?.nodes?.op) {
178
- case 'add':
179
- obj?.add_node(this.data.nodes.data, pst)
180
- break;
181
- case 'remove':
182
- obj?.remove_node(this.data.nodes.names, this.data.nodes?.bTransferMyself, pst)
183
- break;
184
- case 'rename node':
185
- this.data.nodes.data.forEach(v => obj?.rename_node(v.old, v.new, pst));
186
- break;
187
- case 'add from myself':
188
- obj?.add_node2(this.data.nodes.addresses, pst);
189
- break;
190
- case 'add forward':
191
- this.data.nodes.data.forEach(v => obj?.add_forward(v.prior_node_name, v.node_name, v.forward, v.threshold, v.remove_forward, pst))
192
- break;
193
- case 'remove forward':
194
- this.data.nodes.data.forEach(v => obj?.remove_forward(v.prior_node_name, v.node_name, v.forward_name, pst))
195
- break;
196
- case 'remove pair':
197
- this.data.nodes.pairs.forEach(v => obj?.remove_pair(v.prior_node_name, v.node_name, pst));
198
- break;
199
- }
200
- }
201
- if (this.data?.bPublished ) {
202
- obj?.publish(passport)
203
- }
204
- var new_progress : Progress | undefined;
205
- if (this.data?.progress_new !== undefined) {
206
- const task = await LocalMark.Instance().get_address(this.data?.progress_new.task_address);
207
- new_progress = Progress?.New(txb, obj?.get_object(), perm, task, pst);
208
- }
209
- if (this.data?.progress_context_repository !== undefined) {
210
- const p = this.data?.progress_context_repository.progress
211
- ? await LocalMark.Instance().get_address(this.data?.progress_context_repository.progress)
212
- : new_progress?.get_object();
213
- if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_context_repository.progress');
214
- const rep = await LocalMark.Instance().get_address(this.data?.progress_context_repository.repository);
215
- Progress.From(txb, obj?.get_object(), perm, p!).set_context_repository(rep, pst)
216
- }
217
- if (this.data?.progress_namedOperator !== undefined) {
218
- const p = this.data?.progress_namedOperator.progress
219
- ? await LocalMark.Instance().get_address(this.data?.progress_namedOperator.progress)
220
- : new_progress?.get_object();
221
- if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_namedOperator.progress');
190
+ }
191
+ if (this.data?.progress_hold !== undefined) {
192
+ const p = this.data?.progress_hold.progress
193
+ ? await LocalMark.Instance().get_address(this.data?.progress_hold.progress)
194
+ : new_progress?.get_object();
195
+ if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_hold.progress');
222
196
 
223
- let pp = Progress.From(txb, obj?.get_object(), perm, p!);
224
- this.data.progress_namedOperator.data.forEach(v => pp.set_namedOperator(v.name, v.operators, pst));
197
+ if (this.data?.progress_hold.adminUnhold) {
198
+ Progress.From(txb, obj?.get_object(), permission, p!).unhold(this.data.progress_hold.operation, pst)
199
+ } else {
200
+ Progress.From(txb, obj?.get_object(), permission, p!).hold(this.data.progress_hold.operation, this.data.progress_hold.bHold)
225
201
  }
226
- if (this.data?.progress_parent !== undefined) {
227
- const p = this.data?.progress_parent.progress
228
- ? await LocalMark.Instance().get_address(this.data?.progress_parent.progress)
229
- : new_progress?.get_object();
230
- if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_parent.progress');
202
+ }
203
+ if (this.data?.progress_task !== undefined) {
204
+ const [p, task] = await LocalMark.Instance().get_many_address([this.data?.progress_task.progress, this.data?.progress_task.task_address]);
205
+ if (p && task) Progress.From(txb, obj?.get_object(), permission, p).bind_task(task, pst);
206
+ }
207
+ if (this.data?.progress_next !== undefined) {
208
+ const p = await LocalMark.Instance().get_address(this.data?.progress_next.progress);
209
+ if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_next.progress');
210
+ Progress.From(txb, obj?.get_object(), permission, p!).next(this.data.progress_next.operation, this.data.progress_next.deliverable, pst)
211
+ }
231
212
 
232
- if (this.data.progress_parent.parent) {
233
- const parent = await LocalMark.Instance().get_address(this.data.progress_parent.parent.parent_id);
234
- if (parent) {
235
- this.data.progress_parent.parent.parent_id = parent;
236
- Progress.From(txb, obj?.get_object(), perm, p!).parent(this.data.progress_parent.parent);
237
- }
238
- } else {
239
- Progress.From(txb, obj?.get_object(), perm, p!).parent_none();
240
- }
241
- }
242
- if (this.data?.progress_task !== undefined) {
243
- const p = this.data?.progress_task.progress
244
- ? await LocalMark.Instance().get_address(this.data?.progress_task.progress)
245
- : new_progress?.get_object();
246
- if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_task.progress');
247
- const task = await LocalMark.Instance().get_address(this.data.progress_task.task);
248
- if (task) Progress.From(txb, obj?.get_object(), perm, p!).bind_task(task, pst);
249
- }
250
- if (this.data?.progress_hold !== undefined) {
251
- const p = this.data?.progress_hold.progress
252
- ? await LocalMark.Instance().get_address(this.data?.progress_hold.progress)
253
- : new_progress?.get_object();
254
- if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_hold.progress');
213
+ const addr = new_progress?.launch();
214
+ if (addr) {
215
+ await this.new_with_mark('Progress', txb, addr, this.data?.progress_new?.namedNew, account);
216
+ }
255
217
 
256
- if (this.data?.progress_hold.adminUnhold) {
257
- Progress.From(txb, obj?.get_object(), perm, p!).unhold(this.data.progress_hold.operation, pst)
258
- } else {
259
- Progress.From(txb, obj?.get_object(), perm, p!).hold(this.data.progress_hold.operation, this.data.progress_hold.bHold)
260
- }
261
- }
262
-
263
- if (this.data?.progress_next !== undefined) {
264
- const p = this.data?.progress_next.progress
265
- ? await LocalMark.Instance().get_address(this.data?.progress_next.progress)
266
- : new_progress?.get_object();
267
- if (!p) ERROR(Errors.InvalidParam, 'CallMachine_Data.data.progress_next.progress');
268
- Progress.From(txb, obj?.get_object(), perm, p!).next(this.data.progress_next.operation, this.data.progress_next.deliverable, pst)
269
- }
218
+ if (this.data?.description !== undefined && this.object_address) {
219
+ obj?.set_description(this.data.description, pst);
220
+ }
221
+ if (this.data?.endpoint !== undefined && this.object_address) {
222
+ obj?.set_endpoint(this.data.endpoint, pst)
223
+ }
270
224
 
271
- const addr = new_progress?.launch();
272
- if (addr) {
273
- await this.new_with_mark('Progress', txb, addr, this.data?.progress_new?.namedNew, account);
225
+ if (this.data?.consensus_repository !== undefined) {
226
+ switch (this.data.consensus_repository.op) {
227
+ case 'add':
228
+ case 'set':
229
+ if (this.data.consensus_repository.op === 'set') {
230
+ obj?.remove_repository([], true, pst);
231
+ }
232
+ var reps = await LocalMark.Instance().get_many_address2(this.data.consensus_repository.repositories);
233
+ reps.forEach(v=>obj?.add_repository(v, pst)) ;
234
+ break;
235
+ case 'remove':
236
+ var reps = await LocalMark.Instance().get_many_address2(this.data.consensus_repository.repositories);
237
+ if (reps.length > 0) {
238
+ obj?.remove_repository(reps, false, pst);
239
+ }
240
+ break;
241
+ case 'removeall':
242
+ obj?.remove_repository([], true, pst);
243
+ break;
274
244
  }
245
+ }
246
+ if (this.data?.nodes !== undefined) {
247
+ switch (this.data?.nodes?.op) {
248
+ case 'add':
249
+ obj?.add_node(this.data.nodes.data, pst)
250
+ break;
251
+ case 'remove':
252
+ obj?.remove_node(this.data.nodes.names, this.data.nodes?.bTransferMyself, pst)
253
+ break;
254
+ case 'rename node':
255
+ this.data.nodes.data.forEach(v => obj?.rename_node(v.old, v.new, pst));
256
+ break;
257
+ case 'add from myself':
258
+ obj?.add_node2(this.data.nodes.addresses, pst);
259
+ break;
260
+ case 'add forward':
261
+ this.data.nodes.data.forEach(v => obj?.add_forward(v.prior_node_name, v.node_name, v.forward, v.threshold, v.remove_forward, pst))
262
+ break;
263
+ case 'remove forward':
264
+ this.data.nodes.data.forEach(v => obj?.remove_forward(v.prior_node_name, v.node_name, v.forward_name, pst))
265
+ break;
266
+ case 'remove pair':
267
+ this.data.nodes.pairs.forEach(v => obj?.remove_pair(v.prior_node_name, v.node_name, pst));
268
+ break;
269
+ }
270
+ }
271
+ if (this.data?.bPublished ) {
272
+ obj?.publish(passport)
273
+ }
275
274
 
276
- if (this.data?.bPaused !== undefined) {
277
- obj?.pause(this.data.bPaused, pst)
278
- }
279
- if (this.data?.clone_new !== undefined && object_address) {
280
- await this.new_with_mark('Machine', txb, obj?.clone(true, pst) as TxbAddress, (this.data?.clone_new as any)?.namedNew, account);
281
- }
282
- if (permission) {
283
- await this.new_with_mark('Permission', txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
284
- }
285
- if (!object_address) {
286
- await this.new_with_mark('Machine', txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
287
- }
275
+ if (this.data?.bPaused !== undefined) {
276
+ obj?.pause(this.data.bPaused, pst)
277
+ }
278
+ if (this.data?.clone_new !== undefined && this.object_address) {
279
+ await this.new_with_mark('Machine', txb, obj?.clone(true, pst) as TxbAddress, (this.data?.clone_new as any)?.namedNew, account);
280
+ }
281
+ if (perm) {
282
+ const n = GetObjectMain(this.data?.object) as TypeNamedObjectWithPermission;
283
+ await this.new_with_mark('Permission', txb, perm.launch(), GetObjectParam(n?.permission), account);
284
+ }
285
+ if (!this.object_address) {
286
+ await this.new_with_mark('Machine', txb, obj.launch(), GetObjectMain(this.data?.object), account);
288
287
  }
289
288
  }
290
289
  }
@@ -1,5 +1,5 @@
1
1
  import { CallBase, CallResult } from "./base.js";
2
- import { TransactionBlock, PassportObject, IsValidAddress, Errors, ERROR, Demand, Machine, Service, Treasury, Arbitration, Repository} from 'wowok';
2
+ import { TransactionBlock, PassportObject, Errors, ERROR, Demand, Machine, Service, Treasury, Arbitration, Repository} from 'wowok';
3
3
  import { ObjectArbitration, ObjectDemand, ObjectMachine, ObjectRepository, ObjectService, ObjectTreasury, query_objects } from "../query/objects.js";
4
4
  import { LocalMark } from "../local/local.js";
5
5