wowok_agent 0.1.5 → 0.1.6
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/package.json +1 -1
- package/src/call/arbitration.ts +1 -1
- package/src/call/base.ts +1 -1
- package/src/call/demand.ts +1 -8
- package/src/call/{permission.ts → entity_permission.ts} +29 -28
- package/src/call/machine.ts +1 -8
- package/src/call/object_permission.ts +60 -0
- package/src/call/personal.ts +2 -2
- package/src/call/repository.ts +1 -8
- package/src/call/service.ts +1 -8
- package/src/call/treasury.ts +1 -8
- package/src/call.ts +9 -6
- package/src/index.ts +2 -2
- package/src/objects.ts +14 -15
package/package.json
CHANGED
package/src/call/arbitration.ts
CHANGED
|
@@ -100,7 +100,7 @@ export class CallArbitration extends CallBase {
|
|
|
100
100
|
|
|
101
101
|
return await this.check_permission_and_call(this.data.permission, perms, guards, checkOwner, undefined, account)
|
|
102
102
|
}
|
|
103
|
-
return this.exec(account);
|
|
103
|
+
return await this.exec(account);
|
|
104
104
|
}
|
|
105
105
|
protected async operate(txb:TransactionBlock, passport?:PassportObject, account?:string) {
|
|
106
106
|
let obj : Arbitration | undefined ; let permission: any; let withdraw_treasury:any;
|
package/src/call/base.ts
CHANGED
|
@@ -120,7 +120,7 @@ export class CallBase {
|
|
|
120
120
|
|
|
121
121
|
return {guard:[...guards], witness:p!.future_fills()};
|
|
122
122
|
} else { // no passport needed
|
|
123
|
-
return this.exec()
|
|
123
|
+
return await this.exec()
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
protected async exec (account?:string) : Promise<CallResponse> {
|
package/src/call/demand.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { Account } from '../account';
|
|
|
8
8
|
export interface CallDemand_Data {
|
|
9
9
|
object?: string; // undefined for creating a new object
|
|
10
10
|
permission?: string;
|
|
11
|
-
permission_new?: string;
|
|
12
11
|
type_parameter?: string;
|
|
13
12
|
guard?: {address:string; service_id_in_guard?:number};
|
|
14
13
|
description?: string;
|
|
@@ -36,9 +35,6 @@ export class CallDemand extends CallBase {
|
|
|
36
35
|
if (!this.data?.object) {
|
|
37
36
|
perms.push(PermissionIndex.demand)
|
|
38
37
|
}
|
|
39
|
-
if (this.data?.permission_new !== undefined) {
|
|
40
|
-
checkOwner = true;
|
|
41
|
-
}
|
|
42
38
|
if (this.data?.description !== undefined && this.data.object) {
|
|
43
39
|
perms.push(PermissionIndex.demand_description)
|
|
44
40
|
}
|
|
@@ -75,7 +71,7 @@ export class CallDemand extends CallBase {
|
|
|
75
71
|
}
|
|
76
72
|
return await this.check_permission_and_call(this.data.permission, perms, guards, checkOwner, undefined, account)
|
|
77
73
|
}
|
|
78
|
-
return this.exec(account);
|
|
74
|
+
return await this.exec(account);
|
|
79
75
|
}
|
|
80
76
|
protected async operate(txb:TransactionBlock, passport?:PassportObject, account?:string) {
|
|
81
77
|
let obj : Demand | undefined ; let permission: any;
|
|
@@ -131,9 +127,6 @@ export class CallDemand extends CallBase {
|
|
|
131
127
|
if (this.data?.guard !== undefined) {
|
|
132
128
|
obj?.set_guard(this.data.guard.address, this.data.guard?.service_id_in_guard ?? undefined, passport)
|
|
133
129
|
}
|
|
134
|
-
if (this.data?.permission_new !== undefined ) {
|
|
135
|
-
obj?.change_permission(this.data.permission_new);
|
|
136
|
-
}
|
|
137
130
|
if (permission) {
|
|
138
131
|
permission.launch();
|
|
139
132
|
}
|
|
@@ -4,19 +4,19 @@ import { PassportObject, IsValidAddress, Errors, ERROR, Permission, Permission_E
|
|
|
4
4
|
PermissionIndexType, WitnessFill
|
|
5
5
|
} from 'wowok';
|
|
6
6
|
|
|
7
|
-
export interface
|
|
7
|
+
export interface CallEntityPermission_Data {
|
|
8
8
|
object?: string; // undefined for creating a new object
|
|
9
9
|
builder?: string;
|
|
10
10
|
admin?: {op:'add' | 'remove' | 'set', admins:string[]};
|
|
11
11
|
description?: string;
|
|
12
|
-
|
|
12
|
+
permission?: {op:'add entity'; entities:Permission_Entity[]} | {op:'add permission'; permissions:Permission_Index[]}
|
|
13
13
|
| {op:'remove entity'; addresses:string[]} | {op:'remove permission'; address:string; index:PermissionIndexType[]}
|
|
14
14
|
| {op:'transfer permission', from_address: string; to_address: string};
|
|
15
15
|
biz_permission?: {op:'add'; data: UserDefinedIndex[]} | {op:'remove'; permissions: PermissionIndexType[]};
|
|
16
16
|
}
|
|
17
|
-
export class
|
|
18
|
-
data:
|
|
19
|
-
constructor(data:
|
|
17
|
+
export class CallEntityPermission extends CallBase {
|
|
18
|
+
data: CallEntityPermission_Data;
|
|
19
|
+
constructor(data:CallEntityPermission_Data) {
|
|
20
20
|
super();
|
|
21
21
|
this.data = data;
|
|
22
22
|
}
|
|
@@ -27,7 +27,7 @@ export class CallPermission extends CallBase {
|
|
|
27
27
|
if (this.data?.builder !== undefined || this.data?.admin !== undefined) {
|
|
28
28
|
checkOwner = true;
|
|
29
29
|
}
|
|
30
|
-
if (this.data?.
|
|
30
|
+
if (this.data?.permission !== undefined || this.data?.biz_permission !== undefined) {
|
|
31
31
|
checkAdmin = true;
|
|
32
32
|
}
|
|
33
33
|
if (this.data?.description !== undefined) {
|
|
@@ -35,7 +35,7 @@ export class CallPermission extends CallBase {
|
|
|
35
35
|
}
|
|
36
36
|
return await this.check_permission_and_call(this.data.object, [], [], checkOwner, checkAdmin, account)
|
|
37
37
|
}
|
|
38
|
-
return this.exec(account)
|
|
38
|
+
return await this.exec(account)
|
|
39
39
|
}
|
|
40
40
|
protected async operate (txb:TransactionBlock, passport?:PassportObject) {
|
|
41
41
|
let obj : Permission | undefined ;
|
|
@@ -62,42 +62,43 @@ export class CallPermission extends CallBase {
|
|
|
62
62
|
break
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
if (this.data?.biz_permission !== undefined) { // High priority operate
|
|
66
|
+
switch(this.data.biz_permission.op) {
|
|
67
|
+
case 'add':
|
|
68
|
+
this.data.biz_permission.data.forEach(v => {
|
|
69
|
+
obj?.add_userdefine(v.index, v.name);
|
|
70
|
+
})
|
|
71
|
+
break;
|
|
72
|
+
case 'remove':
|
|
73
|
+
this.data.biz_permission.permissions.forEach(v => {
|
|
74
|
+
obj?.remove_userdefine(v);
|
|
75
|
+
})
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
65
79
|
if (this.data?.description !== undefined && this.data.object) {
|
|
66
80
|
obj?.set_description(this.data.description)
|
|
67
81
|
}
|
|
68
|
-
if (this.data?.
|
|
69
|
-
switch (this.data.
|
|
82
|
+
if (this.data?.permission !== undefined) {
|
|
83
|
+
switch (this.data.permission.op) {
|
|
70
84
|
case 'add entity':
|
|
71
|
-
obj?.add_entity(this.data.
|
|
85
|
+
obj?.add_entity(this.data.permission.entities);
|
|
72
86
|
break;
|
|
73
87
|
case 'add permission':
|
|
74
|
-
obj?.add_entity3(this.data.
|
|
88
|
+
obj?.add_entity3(this.data.permission.permissions);
|
|
75
89
|
break;
|
|
76
90
|
case 'remove entity':
|
|
77
|
-
obj?.remove_entity(this.data.
|
|
91
|
+
obj?.remove_entity(this.data.permission.addresses);
|
|
78
92
|
break;
|
|
79
93
|
case 'remove permission':
|
|
80
|
-
obj?.remove_index(this.data.
|
|
94
|
+
obj?.remove_index(this.data.permission.address, this.data.permission.index);
|
|
81
95
|
break;
|
|
82
96
|
case 'transfer permission':
|
|
83
|
-
obj?.transfer_permission(this.data.
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (this.data?.biz_permission !== undefined) {
|
|
88
|
-
switch(this.data.biz_permission.op) {
|
|
89
|
-
case 'add':
|
|
90
|
-
this.data.biz_permission.data.forEach(v => {
|
|
91
|
-
obj?.add_userdefine(v.index, v.name);
|
|
92
|
-
})
|
|
93
|
-
break;
|
|
94
|
-
case 'remove':
|
|
95
|
-
this.data.biz_permission.permissions.forEach(v => {
|
|
96
|
-
obj?.remove_userdefine(v);
|
|
97
|
-
})
|
|
97
|
+
obj?.transfer_permission(this.data.permission.from_address, this.data.permission.to_address);
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
|
|
101
102
|
if (this.data?.builder !== undefined ) {
|
|
102
103
|
obj?.change_owner(this.data.builder);
|
|
103
104
|
}
|
package/src/call/machine.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { Account } from '../account';
|
|
|
7
7
|
export interface CallMachine_Data {
|
|
8
8
|
object?: string; // undefined for creating a new object
|
|
9
9
|
permission?: string;
|
|
10
|
-
permission_new?: string;
|
|
11
10
|
bPaused?: boolean;
|
|
12
11
|
bPublished?: boolean;
|
|
13
12
|
consensus_repository?: {op:'set' | 'add' | 'remove' ; repositories:string[]} | {op:'removeall'};
|
|
@@ -41,9 +40,6 @@ export class CallMachine extends CallBase { //@ todo self-owned node operate
|
|
|
41
40
|
if (!this.data?.object) {
|
|
42
41
|
perms.push(PermissionIndex.machine)
|
|
43
42
|
}
|
|
44
|
-
if (this.data?.permission_new !== undefined) {
|
|
45
|
-
checkOwner = true;
|
|
46
|
-
}
|
|
47
43
|
if (this.data?.description !== undefined && this.data.object) {
|
|
48
44
|
perms.push(PermissionIndex.machine_description)
|
|
49
45
|
}
|
|
@@ -100,7 +96,7 @@ export class CallMachine extends CallBase { //@ todo self-owned node operate
|
|
|
100
96
|
|
|
101
97
|
return await this.check_permission_and_call(this.data.permission, perms, guards, checkOwner, undefined, account)
|
|
102
98
|
}
|
|
103
|
-
return this.exec(account);
|
|
99
|
+
return await this.exec(account);
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
protected async operate(txb:TransactionBlock, passport?:PassportObject) {
|
|
@@ -202,9 +198,6 @@ export class CallMachine extends CallBase { //@ todo self-owned node operate
|
|
|
202
198
|
if (this.data?.progress_next !== undefined) {
|
|
203
199
|
Progress.From(txb, obj?.get_object(), permission??this.data?.permission, this.data?.progress_next.progress).next(this.data.progress_next.data, this.data.progress_next.deliverable, passport)
|
|
204
200
|
}
|
|
205
|
-
if (this.data?.permission_new !== undefined ) {
|
|
206
|
-
obj?.change_permission(this.data.permission_new);
|
|
207
|
-
}
|
|
208
201
|
if (permission) {
|
|
209
202
|
permission.launch();
|
|
210
203
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CallBase, CallResult } from "./base";
|
|
2
|
+
import { TransactionBlock, CallResponse, Protocol, Demand, DemandObject, Machine, Service, Treasury, Arbitration, Repository} from 'wowok';
|
|
3
|
+
import { PassportObject, IsValidAddress, Errors, ERROR, Permission, Permission_Entity, Permission_Index, UserDefinedIndex,
|
|
4
|
+
PermissionIndexType, WitnessFill
|
|
5
|
+
} from 'wowok';
|
|
6
|
+
import { ObjectArbitration, ObjectDemand, ObjectMachine, ObjectRepository, ObjectService, ObjectTreasury, query_objects } from "../objects";
|
|
7
|
+
|
|
8
|
+
export interface CallObjectPermission_Data {
|
|
9
|
+
objects: string[];
|
|
10
|
+
new_permission: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class CallObjectPermission extends CallBase {
|
|
14
|
+
data: CallObjectPermission_Data;
|
|
15
|
+
constructor(data:CallObjectPermission_Data) {
|
|
16
|
+
super();
|
|
17
|
+
this.data = data;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async call(account?:string) : Promise<CallResult> {
|
|
21
|
+
if (!IsValidAddress(this.data.new_permission)) {
|
|
22
|
+
ERROR(Errors.InvalidParam, 'CallObjectPermission_Data.new_permission' + this.data.new_permission)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (this.data?.objects.length > 0) {
|
|
26
|
+
return await this.exec(account)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
protected async operate (txb:TransactionBlock, passport?:PassportObject) {
|
|
30
|
+
const r = await query_objects({objects:this.data.objects, showContent:true});
|
|
31
|
+
r.objects?.forEach(v => {
|
|
32
|
+
switch(v.type) {
|
|
33
|
+
case 'Demand':
|
|
34
|
+
const demand = v as ObjectDemand;
|
|
35
|
+
Demand.From(txb, Demand.parseObjectType(demand.type_raw), demand.permission, demand.object).change_permission(this.data.new_permission);
|
|
36
|
+
break;
|
|
37
|
+
case 'Machine':
|
|
38
|
+
const machine = v as ObjectMachine;
|
|
39
|
+
Machine.From(txb, machine.permission, machine.object).change_permission(this.data.new_permission);
|
|
40
|
+
break;
|
|
41
|
+
case 'Service':
|
|
42
|
+
const service = v as ObjectService;
|
|
43
|
+
Service.From(txb, Service.parseObjectType(service.type_raw), service.permission, service.object).change_permission(this.data.new_permission);
|
|
44
|
+
break;
|
|
45
|
+
case 'Treasury':
|
|
46
|
+
const treasury = v as ObjectTreasury;
|
|
47
|
+
Treasury.From(txb, Treasury.parseObjectType(treasury.type_raw), treasury.permission, treasury.object).change_permission(this.data.new_permission);
|
|
48
|
+
break;
|
|
49
|
+
case 'Arbitration':
|
|
50
|
+
const arbitraion = v as ObjectArbitration;
|
|
51
|
+
Arbitration.From(txb, Arbitration.parseObjectType(arbitraion.type_raw), arbitraion.permission, arbitraion.object).change_permission(this.data.new_permission);
|
|
52
|
+
break;
|
|
53
|
+
case 'Repository':
|
|
54
|
+
const repository = v as ObjectRepository;
|
|
55
|
+
Repository.From(txb, repository.permission, repository.object).change_permission(this.data.new_permission);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
}
|
package/src/call/personal.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface CallPersonal_Data {
|
|
|
11
11
|
| {op:'clear group'; group_name:string | GroupName}
|
|
12
12
|
| {op:'add address'; data:{address:string; group_name:(string | GroupName)[]}}
|
|
13
13
|
| {op:'remove address'; data:{address:string; group_name:(string | GroupName)[]}};
|
|
14
|
-
tag?: {op:'add'; data:{address:string; nick_name
|
|
14
|
+
tag?: {op:'add'; data:{address:string; nick_name?:string; tags?:string[]}}
|
|
15
15
|
| {op:'remove'; address:string};
|
|
16
16
|
close?: boolean; // close a personal resource
|
|
17
17
|
}
|
|
@@ -23,7 +23,7 @@ export class CallPersonal extends CallBase {
|
|
|
23
23
|
this.data = data;
|
|
24
24
|
}
|
|
25
25
|
async call(account?:string) : Promise<CallResult> {
|
|
26
|
-
return this.exec(account)
|
|
26
|
+
return await this.exec(account)
|
|
27
27
|
}
|
|
28
28
|
protected async operate (txb:TransactionBlock, passport?:PassportObject) {
|
|
29
29
|
let obj : Resource | undefined ; let entity: Entity = Entity.From(txb);
|
package/src/call/repository.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { CallBase, CallResult} from "./base";
|
|
|
8
8
|
export interface CallRepository_Data {
|
|
9
9
|
object?: string; // undefined for creating a new object
|
|
10
10
|
permission?: string;
|
|
11
|
-
permission_new?: string; // change permission
|
|
12
11
|
description?: string;
|
|
13
12
|
mode?: Repository_Policy_Mode; // default: 'Relax' (POLICY_MODE_FREE)
|
|
14
13
|
reference?: {op:'set' | 'add' | 'remove' ; addresses:string[]} | {op:'removeall'};
|
|
@@ -30,9 +29,6 @@ export class CallRepository extends CallBase {
|
|
|
30
29
|
if (!this.data?.object) {
|
|
31
30
|
perms.push(PermissionIndex.repository)
|
|
32
31
|
}
|
|
33
|
-
if (this.data?.permission_new !== undefined) {
|
|
34
|
-
checkOwner = true;
|
|
35
|
-
}
|
|
36
32
|
if (this.data?.description !== undefined && this.data?.object) {
|
|
37
33
|
perms.push(PermissionIndex.repository_description)
|
|
38
34
|
}
|
|
@@ -47,7 +43,7 @@ export class CallRepository extends CallBase {
|
|
|
47
43
|
}
|
|
48
44
|
return await this.check_permission_and_call(this.data.permission, perms, [], checkOwner, undefined, account)
|
|
49
45
|
}
|
|
50
|
-
return this.exec(account);
|
|
46
|
+
return await this.exec(account);
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
protected async operate(txb:TransactionBlock, passport?:PassportObject) {
|
|
@@ -124,9 +120,6 @@ export class CallRepository extends CallBase {
|
|
|
124
120
|
break;
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
|
-
if (this.data?.permission_new !== undefined ) {
|
|
128
|
-
obj?.change_permission(this.data.permission_new);
|
|
129
|
-
}
|
|
130
123
|
if (permission) {
|
|
131
124
|
permission.launch();
|
|
132
125
|
}
|
package/src/call/service.ts
CHANGED
|
@@ -11,7 +11,6 @@ export interface CallService_Data {
|
|
|
11
11
|
object?: string; // undefined for creating a new object
|
|
12
12
|
permission?: string;
|
|
13
13
|
type_parameter?: string;
|
|
14
|
-
permission_new?: string;
|
|
15
14
|
bPaused?: boolean;
|
|
16
15
|
bPublished?: boolean;
|
|
17
16
|
description?: string;
|
|
@@ -57,9 +56,6 @@ export class CallService extends CallBase {
|
|
|
57
56
|
if (!this.data?.object) {
|
|
58
57
|
perms.push(PermissionIndex.service)
|
|
59
58
|
}
|
|
60
|
-
if (this.data?.permission_new !== undefined) {
|
|
61
|
-
checkOwner = true;
|
|
62
|
-
}
|
|
63
59
|
if (this.data?.description !== undefined && this.data.object) {
|
|
64
60
|
perms.push(PermissionIndex.service_description)
|
|
65
61
|
}
|
|
@@ -145,7 +141,7 @@ export class CallService extends CallBase {
|
|
|
145
141
|
|
|
146
142
|
return await this.check_permission_and_call(this.data.permission, perms, guards, checkOwner, undefined, account)
|
|
147
143
|
}
|
|
148
|
-
return this.exec(account);
|
|
144
|
+
return await this.exec(account);
|
|
149
145
|
}
|
|
150
146
|
protected async operate (txb:TransactionBlock, passport?:PassportObject, account?:string) {
|
|
151
147
|
let obj : Service | undefined ; let permission: any; let payee: any;
|
|
@@ -328,9 +324,6 @@ export class CallService extends CallBase {
|
|
|
328
324
|
if (this.data?.order_withdrawl !== undefined && passport) { //@ need withdrawal passport
|
|
329
325
|
obj?.withdraw(this.data.order_withdrawl.order, this.data.order_withdrawl.data, passport)
|
|
330
326
|
}
|
|
331
|
-
if (this.data?.permission_new !== undefined) {
|
|
332
|
-
obj?.change_permission(this.data.permission_new);
|
|
333
|
-
}
|
|
334
327
|
if (permission) {
|
|
335
328
|
permission.launch();
|
|
336
329
|
}
|
package/src/call/treasury.ts
CHANGED
|
@@ -10,7 +10,6 @@ export interface CallTreasury_Data {
|
|
|
10
10
|
object?: string; // undefined for creating a new object
|
|
11
11
|
permission?: string;
|
|
12
12
|
type_parameter?: string;
|
|
13
|
-
permission_new?: string;
|
|
14
13
|
description?: string;
|
|
15
14
|
withdraw_mode?: Treasury_WithdrawMode;
|
|
16
15
|
withdraw_guard?: {op:'add' | 'set'; data:{guard:string, amount:string}[]} | {op:'remove', guards:string[]} | {op:'removeall'};
|
|
@@ -38,9 +37,6 @@ export class CallTreasury extends CallBase {
|
|
|
38
37
|
if (!this.data?.object) {
|
|
39
38
|
perms.push(PermissionIndex.treasury)
|
|
40
39
|
}
|
|
41
|
-
if (this.data?.permission_new !== undefined) {
|
|
42
|
-
checkOwner = true;
|
|
43
|
-
}
|
|
44
40
|
if (this.data?.description !== undefined && this.data.object) {
|
|
45
41
|
perms.push(PermissionIndex.treasury_descritption)
|
|
46
42
|
}
|
|
@@ -101,7 +97,7 @@ export class CallTreasury extends CallBase {
|
|
|
101
97
|
|
|
102
98
|
return await this.check_permission_and_call(this.data.permission, perms, guards, checkOwner, undefined, account)
|
|
103
99
|
}
|
|
104
|
-
return this.exec(account);
|
|
100
|
+
return await this.exec(account);
|
|
105
101
|
}
|
|
106
102
|
protected async operate (txb:TransactionBlock, passport?:PassportObject, account?:string) {
|
|
107
103
|
let obj : Treasury | undefined ; let permission: any;
|
|
@@ -159,9 +155,6 @@ export class CallTreasury extends CallBase {
|
|
|
159
155
|
})
|
|
160
156
|
}
|
|
161
157
|
}
|
|
162
|
-
if (this.data?.permission_new !== undefined) {
|
|
163
|
-
obj?.change_permission(this.data.permission_new);
|
|
164
|
-
}
|
|
165
158
|
if (permission) {
|
|
166
159
|
permission.launch();
|
|
167
160
|
}
|
package/src/call.ts
CHANGED
|
@@ -8,19 +8,20 @@
|
|
|
8
8
|
import { CallArbitration, CallArbitration_Data } from "./call/arbitration";
|
|
9
9
|
import { CallDemand, CallDemand_Data } from "./call/demand";
|
|
10
10
|
import { CallMachine, CallMachine_Data } from "./call/machine";
|
|
11
|
-
import {
|
|
11
|
+
import { CallEntityPermission, CallEntityPermission_Data } from "./call/entity_permission";
|
|
12
12
|
import { CallPersonal, CallPersonal_Data } from "./call/personal";
|
|
13
13
|
import { CallRepository, CallRepository_Data } from "./call/repository";
|
|
14
14
|
import { CallService, CallService_Data } from "./call/service";
|
|
15
15
|
import { CallTreasury, CallTreasury_Data } from "./call/treasury";
|
|
16
16
|
import { CallBase, CallResult, CallWithWitnessParam } from "./call/base";
|
|
17
17
|
import { CallGuard, CallGuard_Data } from "./call/guard";
|
|
18
|
+
import { CallObjectPermission, CallObjectPermission_Data } from "./call/object_permission";
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
export interface CallObjectData {
|
|
21
|
-
type: 'Demand' | 'Service' | 'Machine' | 'Treasury' | 'Arbitration' | 'Guard' | 'Repository' | 'Personal' | '
|
|
22
|
-
data: CallDemand_Data | CallMachine_Data | CallArbitration_Data |
|
|
23
|
-
| CallTreasury_Data | CallService_Data
|
|
22
|
+
type: 'Demand' | 'Service' | 'Machine' | 'Treasury' | 'Arbitration' | 'Guard' | 'Repository' | 'Personal' | 'EntityPermission' | 'ObjectPermission';
|
|
23
|
+
data: CallDemand_Data | CallMachine_Data | CallArbitration_Data | CallEntityPermission_Data | CallObjectPermission_Data
|
|
24
|
+
| CallTreasury_Data | CallService_Data | CallRepository_Data;
|
|
24
25
|
account?: string;
|
|
25
26
|
witness?: CallWithWitnessParam;
|
|
26
27
|
}
|
|
@@ -64,7 +65,9 @@ function call_object_new (call: CallObjectData) : CallBase | undefined {
|
|
|
64
65
|
return new CallRepository(call.data as CallRepository_Data);
|
|
65
66
|
case 'Personal':
|
|
66
67
|
return new CallPersonal(call.data as CallPersonal_Data);
|
|
67
|
-
case '
|
|
68
|
-
return new
|
|
68
|
+
case 'EntityPermission':
|
|
69
|
+
return new CallEntityPermission(call.data as CallEntityPermission_Data);
|
|
70
|
+
case 'ObjectPermission':
|
|
71
|
+
return new CallObjectPermission(call.data as CallObjectPermission_Data);
|
|
69
72
|
}
|
|
70
73
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,10 +3,10 @@ export * from './permission'
|
|
|
3
3
|
export * from './events'
|
|
4
4
|
export * from './cache'
|
|
5
5
|
export * from './call/base'
|
|
6
|
-
export * from './call/
|
|
6
|
+
export * from './call/entity_permission'
|
|
7
7
|
export * from './call/arbitration'
|
|
8
8
|
export * from './call/treasury'
|
|
9
|
-
export * from './call/
|
|
9
|
+
export * from './call/entity_permission'
|
|
10
10
|
export * from './call/demand'
|
|
11
11
|
export * from './call/machine'
|
|
12
12
|
export * from './call/repository'
|
package/src/objects.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { Protocol, Machine_Node, Machine, Treasury_WithdrawMode, Treasury_Operation,
|
|
7
7
|
Repository_Type, Repository_Policy_Mode, Repository_Policy, Service_Discount_Type, Service_Sale,
|
|
8
8
|
Progress, History, ERROR, Errors, IsValidAddress, Bcs,
|
|
9
|
-
Entity_Info,
|
|
9
|
+
Entity_Info, Tags
|
|
10
10
|
} from 'wowok';
|
|
11
11
|
import {WowokCache, OBJECT_KEY, CacheExpire, CacheName, CachedData} from './cache'
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ export interface ObjectBase {
|
|
|
15
15
|
type?: string | 'Demand' | 'Progress' | 'Service' | 'Machine' | 'Order' | 'Treasury' | 'Arbitration' | 'Arb' | 'Payment' | 'Guard' |
|
|
16
16
|
'Entity' | 'Permission' | 'Mark' | 'Repository' | 'TableItem_ProgressHistory' | 'TableItem_PermissionEntity' |
|
|
17
17
|
'TableItem_DemandPresenter' | 'TableItem_MachineNode' | 'TableItem_ServiceSale' | 'TableItem_TreasuryHistory' | 'TableItem_ArbVote' |
|
|
18
|
-
'TableItem_RepositoryData' | 'TableItem_MarkGroup';
|
|
18
|
+
'TableItem_RepositoryData' | 'TableItem_MarkGroup' | 'TableItem_MarkTag';
|
|
19
19
|
type_raw?: string;
|
|
20
20
|
owner?: any;
|
|
21
21
|
version?: string;
|
|
@@ -226,20 +226,17 @@ export interface ObjectEntity extends ObjectBase {
|
|
|
226
226
|
lastActive_digest?: string;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
export interface ObjectMark_Tag {
|
|
230
|
-
object: string;
|
|
231
|
-
nick_name: string;
|
|
232
|
-
tags: string[];
|
|
233
|
-
}
|
|
234
|
-
|
|
235
229
|
export interface ObjectMark extends ObjectBase {
|
|
236
230
|
group_count: number;
|
|
237
|
-
|
|
231
|
+
tag_count: number;
|
|
238
232
|
}
|
|
239
233
|
|
|
240
234
|
export interface TableItem_MarkGroup extends ObjectBase {
|
|
241
235
|
group_name: string;
|
|
242
|
-
|
|
236
|
+
address: string[];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export interface TableItem_MarkTag extends ObjectBase, Tags {
|
|
243
240
|
}
|
|
244
241
|
|
|
245
242
|
export enum CacheType {
|
|
@@ -571,9 +568,7 @@ export function data2object(data?:any) : ObjectBase {
|
|
|
571
568
|
return {
|
|
572
569
|
object:id, type:type, type_raw:type_raw, owner:owner, version:version,
|
|
573
570
|
group_count:parseInt(content?.marks?.fields?.size),
|
|
574
|
-
|
|
575
|
-
return {object:v?.fields?.object, nick_name:v?.fields?.nick, tags:v?.fields?.tags}
|
|
576
|
-
})
|
|
571
|
+
tag_count:parseInt(content?.tags?.fields?.size)
|
|
577
572
|
} as ObjectMark;
|
|
578
573
|
}
|
|
579
574
|
}
|
|
@@ -639,9 +634,13 @@ export function data2object(data?:any) : ObjectBase {
|
|
|
639
634
|
} as ObjectEntity;
|
|
640
635
|
} else if (end.includes('::resource::Addresses>')) {
|
|
641
636
|
return {
|
|
642
|
-
object:id, type:'
|
|
643
|
-
group_name:content?.name,
|
|
637
|
+
object:id, type:'TableItem_MarkGroup', type_raw:type_raw, owner:owner, version:version,
|
|
638
|
+
group_name:content?.name, address:content?.value?.fields?.addresses
|
|
644
639
|
} as TableItem_MarkGroup;
|
|
640
|
+
} else if (end.includes('::resource::Tags>')) {
|
|
641
|
+
return {object:id, type:'TableItem_MarkTag', type_raw:type_raw, owner:owner, version:version,
|
|
642
|
+
address:content?.name, nick:content?.value?.fields?.nick, tags:content?.value?.fields?.tags
|
|
643
|
+
} as TableItem_MarkTag;
|
|
645
644
|
}
|
|
646
645
|
}
|
|
647
646
|
}
|