@ottochain/sdk 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/apps/contracts/index.js +1 -1
- package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +272 -0
- package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +284 -0
- package/dist/cjs/apps/contracts/state-machines/contract-universal.js +93 -0
- package/dist/cjs/apps/contracts/state-machines/index.js +177 -1
- package/dist/cjs/apps/corporate/state-machines/corp-board.js +1022 -0
- package/dist/cjs/apps/corporate/state-machines/corp-entity.js +671 -0
- package/dist/cjs/apps/corporate/state-machines/corp-securities.js +998 -0
- package/dist/cjs/apps/corporate/state-machines/corp-shareholders.js +1102 -0
- package/dist/cjs/apps/corporate/state-machines/index.js +20 -4440
- package/dist/cjs/apps/governance/index.js +7 -7
- package/dist/cjs/apps/governance/state-machines/dao-multisig.js +467 -0
- package/dist/cjs/apps/governance/state-machines/dao-reputation.js +458 -0
- package/dist/cjs/apps/governance/state-machines/dao-single.js +199 -0
- package/dist/cjs/apps/governance/state-machines/dao-token.js +503 -0
- package/dist/cjs/apps/governance/state-machines/governance-simple.js +482 -0
- package/dist/cjs/apps/governance/state-machines/governance-universal.js +138 -0
- package/dist/cjs/apps/governance/state-machines/index.js +16 -2934
- package/dist/cjs/apps/identity/constants.js +28 -14
- package/dist/cjs/apps/identity/index.js +27 -12
- package/dist/cjs/apps/identity/state-machines/identity-agent.js +256 -0
- package/dist/cjs/apps/identity/state-machines/identity-oracle.js +321 -0
- package/dist/cjs/apps/identity/state-machines/identity-universal.js +106 -0
- package/dist/cjs/apps/identity/state-machines/index.js +15 -784
- package/dist/cjs/apps/markets/index.js +1 -1
- package/dist/cjs/apps/markets/state-machines/index.js +14 -2298
- package/dist/cjs/apps/markets/state-machines/market-auction.js +283 -0
- package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +312 -0
- package/dist/cjs/apps/markets/state-machines/market-group-buy.js +407 -0
- package/dist/cjs/apps/markets/state-machines/market-prediction.js +485 -0
- package/dist/cjs/apps/markets/state-machines/market-universal.js +129 -0
- package/dist/cjs/apps/oracles/index.js +36 -0
- package/dist/cjs/generated/google/protobuf/struct.js +1 -1
- package/dist/cjs/generated/google/protobuf/timestamp.js +1 -1
- package/dist/cjs/generated/index.js +26 -22
- package/dist/cjs/generated/ottochain/apps/contracts/v1/contract.js +1 -1
- package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
- package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +1 -1
- package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +12 -12
- package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +1688 -0
- package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +1 -1
- package/dist/cjs/generated/ottochain/v1/common.js +1 -1
- package/dist/cjs/generated/ottochain/v1/fiber.js +1 -1
- package/dist/cjs/generated/ottochain/v1/messages.js +1 -1
- package/dist/cjs/generated/ottochain/v1/records.js +1 -1
- package/dist/cjs/schema/fiber-app.js +95 -0
- package/dist/cjs/schema/index.js +20 -0
- package/dist/esm/apps/contracts/index.js +3 -3
- package/dist/esm/apps/contracts/state-machines/contract-agreement.js +269 -0
- package/dist/esm/apps/contracts/state-machines/contract-escrow.js +281 -0
- package/dist/esm/apps/contracts/state-machines/contract-universal.js +90 -0
- package/dist/esm/apps/contracts/state-machines/index.js +177 -1
- package/dist/esm/apps/corporate/index.js +3 -3
- package/dist/esm/apps/corporate/state-machines/corp-board.js +1019 -0
- package/dist/esm/apps/corporate/state-machines/corp-entity.js +668 -0
- package/dist/esm/apps/corporate/state-machines/corp-securities.js +995 -0
- package/dist/esm/apps/corporate/state-machines/corp-shareholders.js +1099 -0
- package/dist/esm/apps/corporate/state-machines/index.js +15 -4439
- package/dist/esm/apps/governance/index.js +9 -9
- package/dist/esm/apps/governance/state-machines/dao-multisig.js +464 -0
- package/dist/esm/apps/governance/state-machines/dao-reputation.js +455 -0
- package/dist/esm/apps/governance/state-machines/dao-single.js +196 -0
- package/dist/esm/apps/governance/state-machines/dao-token.js +500 -0
- package/dist/esm/apps/governance/state-machines/governance-simple.js +479 -0
- package/dist/esm/apps/governance/state-machines/governance-universal.js +135 -0
- package/dist/esm/apps/governance/state-machines/index.js +9 -2933
- package/dist/esm/apps/identity/constants.js +28 -14
- package/dist/esm/apps/identity/index.js +7 -5
- package/dist/esm/apps/identity/state-machines/identity-agent.js +253 -0
- package/dist/esm/apps/identity/state-machines/identity-oracle.js +318 -0
- package/dist/esm/apps/identity/state-machines/identity-universal.js +103 -0
- package/dist/esm/apps/identity/state-machines/index.js +11 -783
- package/dist/esm/apps/index.js +5 -5
- package/dist/esm/apps/markets/index.js +3 -3
- package/dist/esm/apps/markets/state-machines/index.js +8 -2297
- package/dist/esm/apps/markets/state-machines/market-auction.js +280 -0
- package/dist/esm/apps/markets/state-machines/market-crowdfund.js +309 -0
- package/dist/esm/apps/markets/state-machines/market-group-buy.js +404 -0
- package/dist/esm/apps/markets/state-machines/market-prediction.js +482 -0
- package/dist/esm/apps/markets/state-machines/market-universal.js +126 -0
- package/dist/esm/apps/oracles/index.js +21 -0
- package/dist/esm/generated/google/protobuf/struct.js +1 -1
- package/dist/esm/generated/google/protobuf/timestamp.js +1 -1
- package/dist/esm/generated/index.js +8 -4
- package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +1 -1
- package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
- package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +1 -1
- package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +2 -2
- package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +1676 -0
- package/dist/esm/generated/ottochain/apps/markets/v1/market.js +1 -1
- package/dist/esm/generated/ottochain/v1/common.js +1 -1
- package/dist/esm/generated/ottochain/v1/fiber.js +1 -1
- package/dist/esm/generated/ottochain/v1/messages.js +1 -1
- package/dist/esm/generated/ottochain/v1/records.js +1 -1
- package/dist/esm/schema/fiber-app.js +86 -0
- package/dist/esm/schema/index.js +4 -0
- package/dist/types/apps/contracts/index.d.ts +151 -2
- package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +462 -0
- package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +511 -0
- package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +147 -0
- package/dist/types/apps/contracts/state-machines/index.d.ts +149 -0
- package/dist/types/apps/corporate/index.d.ts +5263 -3825
- package/dist/types/apps/corporate/state-machines/corp-board.d.ts +1479 -0
- package/dist/types/apps/corporate/state-machines/corp-entity.d.ts +970 -0
- package/dist/types/apps/corporate/state-machines/corp-securities.d.ts +1381 -0
- package/dist/types/apps/corporate/state-machines/corp-shareholders.d.ts +1631 -0
- package/dist/types/apps/corporate/state-machines/index.d.ts +5245 -3802
- package/dist/types/apps/governance/index.d.ts +875 -37
- package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +644 -0
- package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +610 -0
- package/dist/types/apps/governance/state-machines/dao-single.d.ts +276 -0
- package/dist/types/apps/governance/state-machines/dao-token.d.ts +601 -0
- package/dist/types/apps/governance/state-machines/governance-simple.d.ts +652 -0
- package/dist/types/apps/governance/state-machines/governance-universal.d.ts +181 -0
- package/dist/types/apps/governance/state-machines/index.d.ts +9 -2136
- package/dist/types/apps/identity/constants.d.ts +8 -6
- package/dist/types/apps/identity/index.d.ts +1078 -577
- package/dist/types/apps/identity/state-machines/identity-agent.d.ts +401 -0
- package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +550 -0
- package/dist/types/apps/identity/state-machines/identity-universal.d.ts +151 -0
- package/dist/types/apps/identity/state-machines/index.d.ts +1069 -567
- package/dist/types/apps/index.d.ts +5 -5
- package/dist/types/apps/markets/index.d.ts +535 -7
- package/dist/types/apps/markets/state-machines/index.d.ts +8 -1678
- package/dist/types/apps/markets/state-machines/market-auction.d.ts +392 -0
- package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +443 -0
- package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +539 -0
- package/dist/types/apps/markets/state-machines/market-prediction.d.ts +651 -0
- package/dist/types/apps/markets/state-machines/market-universal.d.ts +191 -0
- package/dist/types/apps/oracles/index.d.ts +18 -0
- package/dist/types/generated/index.d.ts +3 -2
- package/dist/types/generated/ottochain/apps/identity/v1/attestation.d.ts +1 -1
- package/dist/types/generated/ottochain/apps/identity/v1/identity.d.ts +187 -0
- package/dist/types/schema/fiber-app.d.ts +172 -0
- package/dist/types/schema/index.d.ts +4 -0
- package/package.json +1 -1
- package/dist/cjs/generated/ottochain/apps/identity/v1/agent.js +0 -619
- package/dist/cjs/generated/ottochain/apps/oracles/v1/oracle.js +0 -1223
- package/dist/esm/generated/ottochain/apps/identity/v1/agent.js +0 -610
- package/dist/esm/generated/ottochain/apps/oracles/v1/oracle.js +0 -1217
- package/dist/types/generated/ottochain/apps/identity/v1/agent.d.ts +0 -94
- package/dist/types/generated/ottochain/apps/oracles/v1/oracle.d.ts +0 -150
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collective purchasing with quantity thresholds and tiered pricing.
|
|
3
|
+
*/
|
|
4
|
+
export declare const marketGroupBuyDef: {
|
|
5
|
+
readonly metadata: {
|
|
6
|
+
readonly name: "MarketGroupBuy";
|
|
7
|
+
readonly app: "markets";
|
|
8
|
+
readonly type: "groupBuy";
|
|
9
|
+
readonly version: "1.0.0";
|
|
10
|
+
readonly description: "Collective purchasing with quantity thresholds and tiered pricing";
|
|
11
|
+
readonly crossReferences: {
|
|
12
|
+
readonly vendorIdentityId: "Links to vendor's IdentityAgent";
|
|
13
|
+
readonly escrowId: "Links to ContractEscrow for payment custody";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
readonly createSchema: {
|
|
17
|
+
readonly required: readonly ["organizer", "minQuantity", "deadline"];
|
|
18
|
+
readonly properties: {
|
|
19
|
+
readonly organizer: {
|
|
20
|
+
readonly type: "address";
|
|
21
|
+
readonly description: "DAG address of group buy organizer";
|
|
22
|
+
readonly immutable: true;
|
|
23
|
+
};
|
|
24
|
+
readonly minQuantity: {
|
|
25
|
+
readonly type: "number";
|
|
26
|
+
readonly minimum: 1;
|
|
27
|
+
readonly description: "Minimum quantity to proceed";
|
|
28
|
+
readonly immutable: true;
|
|
29
|
+
};
|
|
30
|
+
readonly deadline: {
|
|
31
|
+
readonly type: "timestamp";
|
|
32
|
+
readonly description: "Order deadline";
|
|
33
|
+
readonly immutable: true;
|
|
34
|
+
};
|
|
35
|
+
readonly vendor: {
|
|
36
|
+
readonly type: "address";
|
|
37
|
+
readonly description: "DAG address of the vendor";
|
|
38
|
+
};
|
|
39
|
+
readonly maxPerBuyer: {
|
|
40
|
+
readonly type: "number";
|
|
41
|
+
readonly minimum: 1;
|
|
42
|
+
readonly description: "Max quantity per buyer";
|
|
43
|
+
};
|
|
44
|
+
readonly priceTiers: {
|
|
45
|
+
readonly type: "array";
|
|
46
|
+
readonly description: "Quantity-based pricing tiers";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly stateSchema: {
|
|
51
|
+
readonly properties: {
|
|
52
|
+
readonly status: {
|
|
53
|
+
readonly type: "string";
|
|
54
|
+
readonly computed: true;
|
|
55
|
+
};
|
|
56
|
+
readonly organizer: {
|
|
57
|
+
readonly type: "address";
|
|
58
|
+
readonly immutable: true;
|
|
59
|
+
};
|
|
60
|
+
readonly vendor: {
|
|
61
|
+
readonly type: "address";
|
|
62
|
+
};
|
|
63
|
+
readonly minQuantity: {
|
|
64
|
+
readonly type: "number";
|
|
65
|
+
readonly immutable: true;
|
|
66
|
+
};
|
|
67
|
+
readonly maxPerBuyer: {
|
|
68
|
+
readonly type: "number";
|
|
69
|
+
};
|
|
70
|
+
readonly deadline: {
|
|
71
|
+
readonly type: "timestamp";
|
|
72
|
+
readonly immutable: true;
|
|
73
|
+
};
|
|
74
|
+
readonly priceTiers: {
|
|
75
|
+
readonly type: "array";
|
|
76
|
+
};
|
|
77
|
+
readonly orders: {
|
|
78
|
+
readonly type: "array";
|
|
79
|
+
readonly computed: true;
|
|
80
|
+
};
|
|
81
|
+
readonly totalQuantity: {
|
|
82
|
+
readonly type: "number";
|
|
83
|
+
readonly computed: true;
|
|
84
|
+
};
|
|
85
|
+
readonly currentTier: {
|
|
86
|
+
readonly type: "number";
|
|
87
|
+
readonly computed: true;
|
|
88
|
+
};
|
|
89
|
+
readonly refundsClaimed: {
|
|
90
|
+
readonly type: "array";
|
|
91
|
+
readonly computed: true;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
readonly eventSchemas: {
|
|
96
|
+
readonly open: {
|
|
97
|
+
readonly description: "Open the group buy for orders";
|
|
98
|
+
};
|
|
99
|
+
readonly cancel: {
|
|
100
|
+
readonly description: "Cancel the group buy";
|
|
101
|
+
};
|
|
102
|
+
readonly order: {
|
|
103
|
+
readonly description: "Place an order";
|
|
104
|
+
readonly required: readonly ["quantity"];
|
|
105
|
+
readonly properties: {
|
|
106
|
+
readonly quantity: {
|
|
107
|
+
readonly type: "number";
|
|
108
|
+
readonly minimum: 1;
|
|
109
|
+
};
|
|
110
|
+
readonly shippingInfo: {
|
|
111
|
+
readonly type: "object";
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
readonly check_threshold: {
|
|
116
|
+
readonly description: "Check if minimum threshold reached";
|
|
117
|
+
};
|
|
118
|
+
readonly finalize: {
|
|
119
|
+
readonly description: "Finalize after deadline";
|
|
120
|
+
};
|
|
121
|
+
readonly fulfill: {
|
|
122
|
+
readonly description: "Mark group buy as fulfilled by vendor/organizer";
|
|
123
|
+
};
|
|
124
|
+
readonly claim_refund: {
|
|
125
|
+
readonly description: "Claim refund if threshold not met";
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
readonly states: {
|
|
129
|
+
readonly PROPOSED: {
|
|
130
|
+
readonly id: "PROPOSED";
|
|
131
|
+
readonly isFinal: false;
|
|
132
|
+
readonly metadata: {
|
|
133
|
+
readonly description: "Group buy created but not yet open";
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
readonly OPEN: {
|
|
137
|
+
readonly id: "OPEN";
|
|
138
|
+
readonly isFinal: false;
|
|
139
|
+
readonly metadata: {
|
|
140
|
+
readonly description: "Accepting orders";
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
readonly THRESHOLD_MET: {
|
|
144
|
+
readonly id: "THRESHOLD_MET";
|
|
145
|
+
readonly isFinal: false;
|
|
146
|
+
readonly metadata: {
|
|
147
|
+
readonly description: "Minimum quantity reached, continuing for better tier";
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
readonly PROCESSING: {
|
|
151
|
+
readonly id: "PROCESSING";
|
|
152
|
+
readonly isFinal: false;
|
|
153
|
+
readonly metadata: {
|
|
154
|
+
readonly description: "Order placed with vendor, awaiting fulfillment";
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
readonly FULFILLED: {
|
|
158
|
+
readonly id: "FULFILLED";
|
|
159
|
+
readonly isFinal: true;
|
|
160
|
+
readonly metadata: {
|
|
161
|
+
readonly description: "All items delivered to buyers";
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
readonly REFUNDED: {
|
|
165
|
+
readonly id: "REFUNDED";
|
|
166
|
+
readonly isFinal: true;
|
|
167
|
+
readonly metadata: {
|
|
168
|
+
readonly description: "Threshold not met, all orders refunded";
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
readonly CANCELLED: {
|
|
172
|
+
readonly id: "CANCELLED";
|
|
173
|
+
readonly isFinal: true;
|
|
174
|
+
readonly metadata: {
|
|
175
|
+
readonly description: "Group buy cancelled";
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
readonly initialState: "PROPOSED";
|
|
180
|
+
readonly transitions: readonly [{
|
|
181
|
+
readonly from: "PROPOSED";
|
|
182
|
+
readonly to: "OPEN";
|
|
183
|
+
readonly eventName: "open";
|
|
184
|
+
readonly guard: {
|
|
185
|
+
readonly "===": readonly [{
|
|
186
|
+
readonly var: "event.agent";
|
|
187
|
+
}, {
|
|
188
|
+
readonly var: "state.organizer";
|
|
189
|
+
}];
|
|
190
|
+
};
|
|
191
|
+
readonly effect: {
|
|
192
|
+
readonly merge: readonly [{
|
|
193
|
+
readonly var: "state";
|
|
194
|
+
}, {
|
|
195
|
+
readonly status: "OPEN";
|
|
196
|
+
readonly openedAt: {
|
|
197
|
+
readonly var: "$timestamp";
|
|
198
|
+
};
|
|
199
|
+
readonly orders: readonly [];
|
|
200
|
+
readonly totalQuantity: 0;
|
|
201
|
+
readonly currentTier: 0;
|
|
202
|
+
}];
|
|
203
|
+
};
|
|
204
|
+
readonly dependencies: readonly [];
|
|
205
|
+
}, {
|
|
206
|
+
readonly from: "PROPOSED";
|
|
207
|
+
readonly to: "CANCELLED";
|
|
208
|
+
readonly eventName: "cancel";
|
|
209
|
+
readonly guard: {
|
|
210
|
+
readonly "===": readonly [{
|
|
211
|
+
readonly var: "event.agent";
|
|
212
|
+
}, {
|
|
213
|
+
readonly var: "state.organizer";
|
|
214
|
+
}];
|
|
215
|
+
};
|
|
216
|
+
readonly effect: {
|
|
217
|
+
readonly merge: readonly [{
|
|
218
|
+
readonly var: "state";
|
|
219
|
+
}, {
|
|
220
|
+
readonly status: "CANCELLED";
|
|
221
|
+
readonly cancelledAt: {
|
|
222
|
+
readonly var: "$timestamp";
|
|
223
|
+
};
|
|
224
|
+
}];
|
|
225
|
+
};
|
|
226
|
+
readonly dependencies: readonly [];
|
|
227
|
+
}, {
|
|
228
|
+
readonly from: "OPEN";
|
|
229
|
+
readonly to: "OPEN";
|
|
230
|
+
readonly eventName: "order";
|
|
231
|
+
readonly guard: {
|
|
232
|
+
readonly and: readonly [{
|
|
233
|
+
readonly ">": readonly [{
|
|
234
|
+
readonly var: "event.quantity";
|
|
235
|
+
}, 0];
|
|
236
|
+
}, {
|
|
237
|
+
readonly or: readonly [{
|
|
238
|
+
readonly "!": readonly [{
|
|
239
|
+
readonly var: "state.maxPerBuyer";
|
|
240
|
+
}];
|
|
241
|
+
}, {
|
|
242
|
+
readonly "<=": readonly [{
|
|
243
|
+
readonly var: "event.quantity";
|
|
244
|
+
}, {
|
|
245
|
+
readonly var: "state.maxPerBuyer";
|
|
246
|
+
}];
|
|
247
|
+
}];
|
|
248
|
+
}, {
|
|
249
|
+
readonly "<=": readonly [{
|
|
250
|
+
readonly var: "$timestamp";
|
|
251
|
+
}, {
|
|
252
|
+
readonly var: "state.deadline";
|
|
253
|
+
}];
|
|
254
|
+
}];
|
|
255
|
+
};
|
|
256
|
+
readonly effect: {
|
|
257
|
+
readonly merge: readonly [{
|
|
258
|
+
readonly var: "state";
|
|
259
|
+
}, {
|
|
260
|
+
readonly orders: {
|
|
261
|
+
readonly cat: readonly [{
|
|
262
|
+
readonly var: "state.orders";
|
|
263
|
+
}, readonly [{
|
|
264
|
+
readonly buyer: {
|
|
265
|
+
readonly var: "event.agent";
|
|
266
|
+
};
|
|
267
|
+
readonly quantity: {
|
|
268
|
+
readonly var: "event.quantity";
|
|
269
|
+
};
|
|
270
|
+
readonly shippingInfo: {
|
|
271
|
+
readonly var: "event.shippingInfo";
|
|
272
|
+
};
|
|
273
|
+
readonly orderedAt: {
|
|
274
|
+
readonly var: "$timestamp";
|
|
275
|
+
};
|
|
276
|
+
}]];
|
|
277
|
+
};
|
|
278
|
+
readonly totalQuantity: {
|
|
279
|
+
readonly "+": readonly [{
|
|
280
|
+
readonly var: "state.totalQuantity";
|
|
281
|
+
}, {
|
|
282
|
+
readonly var: "event.quantity";
|
|
283
|
+
}];
|
|
284
|
+
};
|
|
285
|
+
}];
|
|
286
|
+
};
|
|
287
|
+
readonly dependencies: readonly [];
|
|
288
|
+
}, {
|
|
289
|
+
readonly from: "OPEN";
|
|
290
|
+
readonly to: "THRESHOLD_MET";
|
|
291
|
+
readonly eventName: "check_threshold";
|
|
292
|
+
readonly guard: {
|
|
293
|
+
readonly ">=": readonly [{
|
|
294
|
+
readonly var: "state.totalQuantity";
|
|
295
|
+
}, {
|
|
296
|
+
readonly var: "state.minQuantity";
|
|
297
|
+
}];
|
|
298
|
+
};
|
|
299
|
+
readonly effect: {
|
|
300
|
+
readonly merge: readonly [{
|
|
301
|
+
readonly var: "state";
|
|
302
|
+
}, {
|
|
303
|
+
readonly status: "THRESHOLD_MET";
|
|
304
|
+
readonly thresholdMetAt: {
|
|
305
|
+
readonly var: "$timestamp";
|
|
306
|
+
};
|
|
307
|
+
readonly currentTier: {
|
|
308
|
+
readonly reduce: readonly [{
|
|
309
|
+
readonly var: "state.priceTiers";
|
|
310
|
+
}, {
|
|
311
|
+
readonly if: readonly [{
|
|
312
|
+
readonly "<=": readonly [{
|
|
313
|
+
readonly var: "current.minQuantity";
|
|
314
|
+
}, {
|
|
315
|
+
readonly var: "state.totalQuantity";
|
|
316
|
+
}];
|
|
317
|
+
}, {
|
|
318
|
+
readonly var: "current.tier";
|
|
319
|
+
}, {
|
|
320
|
+
readonly var: "accumulator";
|
|
321
|
+
}];
|
|
322
|
+
}, 0];
|
|
323
|
+
};
|
|
324
|
+
}];
|
|
325
|
+
};
|
|
326
|
+
readonly dependencies: readonly [];
|
|
327
|
+
}, {
|
|
328
|
+
readonly from: "THRESHOLD_MET";
|
|
329
|
+
readonly to: "THRESHOLD_MET";
|
|
330
|
+
readonly eventName: "order";
|
|
331
|
+
readonly guard: {
|
|
332
|
+
readonly and: readonly [{
|
|
333
|
+
readonly ">": readonly [{
|
|
334
|
+
readonly var: "event.quantity";
|
|
335
|
+
}, 0];
|
|
336
|
+
}, {
|
|
337
|
+
readonly "<=": readonly [{
|
|
338
|
+
readonly var: "$timestamp";
|
|
339
|
+
}, {
|
|
340
|
+
readonly var: "state.deadline";
|
|
341
|
+
}];
|
|
342
|
+
}];
|
|
343
|
+
};
|
|
344
|
+
readonly effect: {
|
|
345
|
+
readonly merge: readonly [{
|
|
346
|
+
readonly var: "state";
|
|
347
|
+
}, {
|
|
348
|
+
readonly orders: {
|
|
349
|
+
readonly cat: readonly [{
|
|
350
|
+
readonly var: "state.orders";
|
|
351
|
+
}, readonly [{
|
|
352
|
+
readonly buyer: {
|
|
353
|
+
readonly var: "event.agent";
|
|
354
|
+
};
|
|
355
|
+
readonly quantity: {
|
|
356
|
+
readonly var: "event.quantity";
|
|
357
|
+
};
|
|
358
|
+
readonly shippingInfo: {
|
|
359
|
+
readonly var: "event.shippingInfo";
|
|
360
|
+
};
|
|
361
|
+
readonly orderedAt: {
|
|
362
|
+
readonly var: "$timestamp";
|
|
363
|
+
};
|
|
364
|
+
}]];
|
|
365
|
+
};
|
|
366
|
+
readonly totalQuantity: {
|
|
367
|
+
readonly "+": readonly [{
|
|
368
|
+
readonly var: "state.totalQuantity";
|
|
369
|
+
}, {
|
|
370
|
+
readonly var: "event.quantity";
|
|
371
|
+
}];
|
|
372
|
+
};
|
|
373
|
+
readonly currentTier: {
|
|
374
|
+
readonly reduce: readonly [{
|
|
375
|
+
readonly var: "state.priceTiers";
|
|
376
|
+
}, {
|
|
377
|
+
readonly if: readonly [{
|
|
378
|
+
readonly "<=": readonly [{
|
|
379
|
+
readonly var: "current.minQuantity";
|
|
380
|
+
}, {
|
|
381
|
+
readonly "+": readonly [{
|
|
382
|
+
readonly var: "state.totalQuantity";
|
|
383
|
+
}, {
|
|
384
|
+
readonly var: "event.quantity";
|
|
385
|
+
}];
|
|
386
|
+
}];
|
|
387
|
+
}, {
|
|
388
|
+
readonly var: "current.tier";
|
|
389
|
+
}, {
|
|
390
|
+
readonly var: "accumulator";
|
|
391
|
+
}];
|
|
392
|
+
}, {
|
|
393
|
+
readonly var: "state.currentTier";
|
|
394
|
+
}];
|
|
395
|
+
};
|
|
396
|
+
}];
|
|
397
|
+
};
|
|
398
|
+
readonly dependencies: readonly [];
|
|
399
|
+
}, {
|
|
400
|
+
readonly from: "THRESHOLD_MET";
|
|
401
|
+
readonly to: "PROCESSING";
|
|
402
|
+
readonly eventName: "finalize";
|
|
403
|
+
readonly guard: {
|
|
404
|
+
readonly ">=": readonly [{
|
|
405
|
+
readonly var: "$timestamp";
|
|
406
|
+
}, {
|
|
407
|
+
readonly var: "state.deadline";
|
|
408
|
+
}];
|
|
409
|
+
};
|
|
410
|
+
readonly effect: {
|
|
411
|
+
readonly merge: readonly [{
|
|
412
|
+
readonly var: "state";
|
|
413
|
+
}, {
|
|
414
|
+
readonly status: "PROCESSING";
|
|
415
|
+
readonly finalizedAt: {
|
|
416
|
+
readonly var: "$timestamp";
|
|
417
|
+
};
|
|
418
|
+
readonly finalTier: {
|
|
419
|
+
readonly var: "state.currentTier";
|
|
420
|
+
};
|
|
421
|
+
readonly finalPricePerUnit: {
|
|
422
|
+
readonly var: {
|
|
423
|
+
readonly cat: readonly ["state.priceTiers.", {
|
|
424
|
+
readonly var: "state.currentTier";
|
|
425
|
+
}, ".pricePerUnit"];
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
}];
|
|
429
|
+
};
|
|
430
|
+
readonly dependencies: readonly [];
|
|
431
|
+
}, {
|
|
432
|
+
readonly from: "PROCESSING";
|
|
433
|
+
readonly to: "FULFILLED";
|
|
434
|
+
readonly eventName: "fulfill";
|
|
435
|
+
readonly guard: {
|
|
436
|
+
readonly or: readonly [{
|
|
437
|
+
readonly "===": readonly [{
|
|
438
|
+
readonly var: "event.agent";
|
|
439
|
+
}, {
|
|
440
|
+
readonly var: "state.vendor";
|
|
441
|
+
}];
|
|
442
|
+
}, {
|
|
443
|
+
readonly "===": readonly [{
|
|
444
|
+
readonly var: "event.agent";
|
|
445
|
+
}, {
|
|
446
|
+
readonly var: "state.organizer";
|
|
447
|
+
}];
|
|
448
|
+
}];
|
|
449
|
+
};
|
|
450
|
+
readonly effect: {
|
|
451
|
+
readonly merge: readonly [{
|
|
452
|
+
readonly var: "state";
|
|
453
|
+
}, {
|
|
454
|
+
readonly status: "FULFILLED";
|
|
455
|
+
readonly fulfilledAt: {
|
|
456
|
+
readonly var: "$timestamp";
|
|
457
|
+
};
|
|
458
|
+
readonly trackingInfo: {
|
|
459
|
+
readonly var: "event.trackingInfo";
|
|
460
|
+
};
|
|
461
|
+
}];
|
|
462
|
+
};
|
|
463
|
+
readonly dependencies: readonly [];
|
|
464
|
+
}, {
|
|
465
|
+
readonly from: "OPEN";
|
|
466
|
+
readonly to: "REFUNDED";
|
|
467
|
+
readonly eventName: "finalize";
|
|
468
|
+
readonly guard: {
|
|
469
|
+
readonly and: readonly [{
|
|
470
|
+
readonly "<": readonly [{
|
|
471
|
+
readonly var: "state.totalQuantity";
|
|
472
|
+
}, {
|
|
473
|
+
readonly var: "state.minQuantity";
|
|
474
|
+
}];
|
|
475
|
+
}, {
|
|
476
|
+
readonly ">=": readonly [{
|
|
477
|
+
readonly var: "$timestamp";
|
|
478
|
+
}, {
|
|
479
|
+
readonly var: "state.deadline";
|
|
480
|
+
}];
|
|
481
|
+
}];
|
|
482
|
+
};
|
|
483
|
+
readonly effect: {
|
|
484
|
+
readonly merge: readonly [{
|
|
485
|
+
readonly var: "state";
|
|
486
|
+
}, {
|
|
487
|
+
readonly status: "REFUNDED";
|
|
488
|
+
readonly refundedAt: {
|
|
489
|
+
readonly var: "$timestamp";
|
|
490
|
+
};
|
|
491
|
+
readonly reason: "threshold_not_met";
|
|
492
|
+
}];
|
|
493
|
+
};
|
|
494
|
+
readonly dependencies: readonly [];
|
|
495
|
+
}, {
|
|
496
|
+
readonly from: "REFUNDED";
|
|
497
|
+
readonly to: "REFUNDED";
|
|
498
|
+
readonly eventName: "claim_refund";
|
|
499
|
+
readonly guard: {
|
|
500
|
+
readonly and: readonly [{
|
|
501
|
+
readonly ">": readonly [{
|
|
502
|
+
readonly size: {
|
|
503
|
+
readonly filter: readonly [{
|
|
504
|
+
readonly var: "state.orders";
|
|
505
|
+
}, {
|
|
506
|
+
readonly "===": readonly [{
|
|
507
|
+
readonly var: "buyer";
|
|
508
|
+
}, {
|
|
509
|
+
readonly var: "event.agent";
|
|
510
|
+
}];
|
|
511
|
+
}];
|
|
512
|
+
};
|
|
513
|
+
}, 0];
|
|
514
|
+
}, {
|
|
515
|
+
readonly "!": readonly [{
|
|
516
|
+
readonly in: readonly [{
|
|
517
|
+
readonly var: "event.agent";
|
|
518
|
+
}, {
|
|
519
|
+
readonly var: "state.refundsClaimed";
|
|
520
|
+
}];
|
|
521
|
+
}];
|
|
522
|
+
}];
|
|
523
|
+
};
|
|
524
|
+
readonly effect: {
|
|
525
|
+
readonly merge: readonly [{
|
|
526
|
+
readonly var: "state";
|
|
527
|
+
}, {
|
|
528
|
+
readonly refundsClaimed: {
|
|
529
|
+
readonly cat: readonly [{
|
|
530
|
+
readonly var: "state.refundsClaimed";
|
|
531
|
+
}, readonly [{
|
|
532
|
+
readonly var: "event.agent";
|
|
533
|
+
}]];
|
|
534
|
+
};
|
|
535
|
+
}];
|
|
536
|
+
};
|
|
537
|
+
readonly dependencies: readonly [];
|
|
538
|
+
}];
|
|
539
|
+
};
|