@voltro/plugin-economy 0.0.0-stage → 0.87.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/CHANGELOG.md +24329 -0
- package/LICENSE +61 -0
- package/README.md +2719 -2
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +9189 -0
- package/dist/amount.js +21 -0
- package/dist/appleIap.server.js +263 -0
- package/dist/appleIapNotifications.server.js +163 -0
- package/dist/appleIapTrust.server.js +31 -0
- package/dist/bundleValue.server.js +113 -0
- package/dist/canonicalDataJson.js +11 -0
- package/dist/capture.js +54 -0
- package/dist/codePort.fixture.js +124 -0
- package/dist/codeStore.server.js +440 -0
- package/dist/codeTables.entity.js +44 -0
- package/dist/codes.d.ts +150 -0
- package/dist/codes.js +83 -0
- package/dist/components.d.ts +397 -0
- package/dist/components.js +284 -0
- package/dist/consistency.server.js +116 -0
- package/dist/containerStore.server.js +688 -0
- package/dist/containerStore.testFixtures.js +76 -0
- package/dist/containerTables.entity.js +46 -0
- package/dist/containers.d.ts +311 -0
- package/dist/containers.fixture.js +129 -0
- package/dist/containers.js +215 -0
- package/dist/containers.server.js +40 -0
- package/dist/containersPort.fixture.js +75 -0
- package/dist/currency.js +33 -0
- package/dist/declarationFixtures.js +62 -0
- package/dist/economy-app/events/economy.refundReversed.event.ts +1 -0
- package/dist/economy-app/events/economy.refunded.event.ts +1 -0
- package/dist/economyPort.fixture.js +125 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +22 -0
- package/dist/events.d.ts +46 -0
- package/dist/events.js +1 -0
- package/dist/googleIap.server.js +392 -0
- package/dist/googleIapNotifications.server.js +131 -0
- package/dist/googleIapSubscription.server.js +184 -0
- package/dist/iap.d.ts +309 -0
- package/dist/iap.js +304 -0
- package/dist/iap.testFixtures.js +145 -0
- package/dist/iapAccountTables.entity.js +40 -0
- package/dist/iapAccounts.server.js +201 -0
- package/dist/iapBinding.server.js +524 -0
- package/dist/iapCheckout.server.js +98 -0
- package/dist/iapCompletion.server.js +56 -0
- package/dist/iapCurrentState.server.js +108 -0
- package/dist/iapCurrentState.testFixtures.js +23 -0
- package/dist/iapCurrentStatePort.fixture.js +64 -0
- package/dist/iapEntitlements.d.ts +79 -0
- package/dist/iapEntitlements.js +58 -0
- package/dist/iapEntitlements.server.js +49 -0
- package/dist/iapEntitlementsBinding.server.js +106 -0
- package/dist/iapEntitlementsPort.fixture.js +81 -0
- package/dist/iapInstalledEntitlements.testFixtures.js +76 -0
- package/dist/iapInstalledNotifications.testFixtures.js +94 -0
- package/dist/iapInventoryRefunds.server.js +262 -0
- package/dist/iapNotificationCustodyPort.fixture.js +68 -0
- package/dist/iapNotificationPort.fixture.js +74 -0
- package/dist/iapNotificationProcessor.server.js +135 -0
- package/dist/iapNotificationProcessor.testFixtures.js +64 -0
- package/dist/iapNotificationProcessorPort.fixture.js +56 -0
- package/dist/iapNotificationSchedule.server.js +70 -0
- package/dist/iapNotificationStore.server.js +353 -0
- package/dist/iapNotificationStore.testFixtures.js +32 -0
- package/dist/iapNotificationTables.entity.js +49 -0
- package/dist/iapNotificationTarget.server.js +37 -0
- package/dist/iapNotificationTarget.testFixtures.js +30 -0
- package/dist/iapNotifications.d.ts +644 -0
- package/dist/iapNotifications.js +6 -0
- package/dist/iapNotifications.server.js +96 -0
- package/dist/iapNotificationsBinding.server.js +233 -0
- package/dist/iapNotificationsSystemPort.fixture.js +51 -0
- package/dist/iapPlugin.testFixtures.js +60 -0
- package/dist/iapPort.fixture.js +75 -0
- package/dist/iapProviderCapture.server.js +18 -0
- package/dist/iapRecovery.d.ts +146 -0
- package/dist/iapRecovery.js +90 -0
- package/dist/iapRefundEventDelivery.server.js +83 -0
- package/dist/iapRefundEvents.js +45 -0
- package/dist/iapRefundEventsPort.fixture.js +60 -0
- package/dist/iapRefundPort.fixture.js +55 -0
- package/dist/iapRefundTables.entity.js +56 -0
- package/dist/iapRefunds.d.ts +755 -0
- package/dist/iapRefunds.js +6 -0
- package/dist/iapRefunds.server.js +554 -0
- package/dist/iapRefunds.testFixtures.js +65 -0
- package/dist/iapSpendAdmission.server.js +99 -0
- package/dist/iapStore.server.js +741 -0
- package/dist/iapStore.testFixtures.js +128 -0
- package/dist/iapTables.entity.js +81 -0
- package/dist/iapVerification.server.js +121 -0
- package/dist/index.d.ts +2984 -0
- package/dist/index.js +15 -0
- package/dist/intentionRecovery.js +134 -0
- package/dist/ledger.js +78 -0
- package/dist/loyalty.d.ts +274 -0
- package/dist/loyalty.fixture.js +93 -0
- package/dist/loyalty.js +312 -0
- package/dist/loyaltyBinding.server.js +204 -0
- package/dist/loyaltyPort.fixture.js +87 -0
- package/dist/loyaltyShopSource.server.js +91 -0
- package/dist/loyaltyStore.server.js +553 -0
- package/dist/loyaltyStore.testFixtures.js +83 -0
- package/dist/loyaltyTables.entity.js +50 -0
- package/dist/offerMerchandising.fixture.js +115 -0
- package/dist/offerMerchandising.js +283 -0
- package/dist/offerPolicies.d.ts +441 -0
- package/dist/offerPolicies.fixture.js +54 -0
- package/dist/offerPolicies.js +268 -0
- package/dist/piggyBanks.d.ts +272 -0
- package/dist/piggyBanks.fixture.js +71 -0
- package/dist/piggyBanks.js +201 -0
- package/dist/piggyBinding.server.js +205 -0
- package/dist/piggyPort.fixture.js +73 -0
- package/dist/piggyStore.server.js +611 -0
- package/dist/piggyStore.testFixtures.js +98 -0
- package/dist/piggyTables.entity.js +41 -0
- package/dist/plugin.js +1048 -0
- package/dist/port.js +13 -0
- package/dist/price.d.ts +99 -0
- package/dist/price.js +144 -0
- package/dist/purchaseRecovery.js +56 -0
- package/dist/reports.server.js +115 -0
- package/dist/rpc.d.ts +3201 -0
- package/dist/rpc.js +1201 -0
- package/dist/sanctionsTradeAuthority.server.js +80 -0
- package/dist/server.d.ts +3856 -0
- package/dist/server.js +43 -0
- package/dist/shop.d.ts +279 -0
- package/dist/shop.js +196 -0
- package/dist/shop.testFixtures.js +114 -0
- package/dist/shopPort.fixture.js +72 -0
- package/dist/shopPresentation.js +68 -0
- package/dist/shopStore.server.js +624 -0
- package/dist/shopTables.entity.js +63 -0
- package/dist/shopUiCopy.js +57 -0
- package/dist/spendLimits.d.ts +140 -0
- package/dist/spendLimits.fixture.js +53 -0
- package/dist/spendLimits.js +155 -0
- package/dist/spendLimitsPort.fixture.js +120 -0
- package/dist/subscriptionBinding.server.js +211 -0
- package/dist/subscriptionStore.server.js +643 -0
- package/dist/subscriptionStore.testFixtures.js +72 -0
- package/dist/subscriptionTables.entity.js +37 -0
- package/dist/subscriptions.d.ts +394 -0
- package/dist/subscriptions.fixture.js +97 -0
- package/dist/subscriptions.js +213 -0
- package/dist/subscriptionsPort.fixture.js +76 -0
- package/dist/systemFixtures.js +89 -0
- package/dist/tables.entity.js +83 -0
- package/dist/testing.d.ts +4615 -0
- package/dist/testing.js +29 -0
- package/dist/tradeAuthority.server.js +172 -0
- package/dist/tradeBinding.server.js +201 -0
- package/dist/tradeComponents.js +342 -0
- package/dist/tradeEscrow.server.js +232 -0
- package/dist/tradeEscrow.testFixtures.js +133 -0
- package/dist/tradeExpiry.server.js +43 -0
- package/dist/tradeRecovery.js +48 -0
- package/dist/tradeStore.server.js +750 -0
- package/dist/tradeStore.testFixtures.js +73 -0
- package/dist/tradeTables.entity.js +66 -0
- package/dist/tradeUiCopy.js +79 -0
- package/dist/trades.d.ts +246 -0
- package/dist/trades.fixture.js +103 -0
- package/dist/trades.js +289 -0
- package/dist/tradesPort.fixture.js +94 -0
- package/dist/walletEscrow.js +106 -0
- package/dist/walletEscrow.server.js +376 -0
- package/dist/walletKeys.server.js +5 -0
- package/dist/walletStore.js +571 -0
- package/dist/web.d.ts +2257 -0
- package/dist/web.js +9 -0
- package/package.json +161 -4
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,3856 @@
|
|
|
1
|
+
import { AggregateDefinition } from '@voltro/runtime';
|
|
2
|
+
import { BrandedScheduleDefinition } from '@voltro/runtime';
|
|
3
|
+
import { ColumnBuilder } from '@voltro/database';
|
|
4
|
+
import { Context } from 'effect';
|
|
5
|
+
import { DataStore } from '@voltro/database';
|
|
6
|
+
import { Effect } from 'effect';
|
|
7
|
+
import { FieldCipher } from '@voltro/database';
|
|
8
|
+
import { FieldDefinitions } from '@voltro/database';
|
|
9
|
+
import { InventoryError } from '@voltro/plugin-inventory/errors';
|
|
10
|
+
import { InventoryGrant } from '@voltro/plugin-inventory';
|
|
11
|
+
import { InventoryReceipt } from '@voltro/plugin-inventory';
|
|
12
|
+
import { InventoryReservationTransferReceipt } from '@voltro/plugin-inventory/server';
|
|
13
|
+
import { InventorySqlService } from '@voltro/plugin-inventory/server';
|
|
14
|
+
import { ItemDefinition } from '@voltro/plugin-inventory/items';
|
|
15
|
+
import { Layer } from 'effect';
|
|
16
|
+
import { PluginPrivacyTarget } from '@voltro/protocol';
|
|
17
|
+
import { PreparedSqlMutation } from '@voltro/database/sql';
|
|
18
|
+
import { SanctionsSqlAdmissionService } from '@voltro/plugin-sanctions/server';
|
|
19
|
+
import { Schema } from 'effect';
|
|
20
|
+
import { Subject } from '@voltro/protocol';
|
|
21
|
+
import { Table } from '@voltro/database';
|
|
22
|
+
import { YieldableError } from 'effect/Cause';
|
|
23
|
+
|
|
24
|
+
declare const acceptedCompletion: unique symbol;
|
|
25
|
+
|
|
26
|
+
/** SQL-issued capability. A player reference or serialized object cannot authorize provider completion. */
|
|
27
|
+
export declare interface AcceptedIapCompletion {
|
|
28
|
+
readonly [acceptedCompletion]: true;
|
|
29
|
+
readonly orderId: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Read-only SQL custody capability, never current provider state or refund authority. */
|
|
33
|
+
export declare interface AcceptedIapNotificationTarget {
|
|
34
|
+
readonly [acceptedNotificationTarget]: true;
|
|
35
|
+
readonly orderId: string;
|
|
36
|
+
readonly noticeId: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare const acceptedNotificationTarget: unique symbol;
|
|
40
|
+
|
|
41
|
+
export declare interface AppleIapCredentials {
|
|
42
|
+
readonly signingKey: string;
|
|
43
|
+
readonly keyId: string;
|
|
44
|
+
readonly issuerId: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export declare interface AppleIapCredentialSource {
|
|
48
|
+
/** App Store Connect credentials supplied by the operator; rotation is observed per verification. */
|
|
49
|
+
readonly read: () => Effect.Effect<AppleIapCredentials, EconomyError>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export declare interface AppleIapCurrentStateOptions extends Omit<IapCurrentStateOptions, 'channel'> {
|
|
53
|
+
readonly appleRootCertificates: readonly Uint8Array[];
|
|
54
|
+
readonly appAppleId?: number | undefined;
|
|
55
|
+
readonly credentials: AppleIapCredentialSource;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Fresh App Store Server API response + SDK signature verification, SQL/account evidence; no writes. */
|
|
59
|
+
export declare const appleIapCurrentStatePort: (input: AppleIapCurrentStateOptions) => IapCurrentStateService;
|
|
60
|
+
|
|
61
|
+
export declare interface AppleIapNotificationOptions extends AppleIapTrustOptions {
|
|
62
|
+
readonly maxBodyBytes?: number;
|
|
63
|
+
readonly now?: (() => number) | undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** App Store Notifications v2. Actual SDK trust/online checks, no shared webhook secret or unsigned mode. */
|
|
67
|
+
export declare const appleIapNotificationPort: (input: AppleIapNotificationOptions) => IapNotificationService;
|
|
68
|
+
|
|
69
|
+
/** Installed Apple verifier declaration. StoreKit transaction finishing remains native-client-owned. */
|
|
70
|
+
export declare const appleIapProvider: (input: AppleIapProviderOptions) => IapProviderDefinition;
|
|
71
|
+
|
|
72
|
+
export declare type AppleIapProviderOptions = Pick<AppleIapVerificationOptions, 'environment' | 'applicationId' | 'appleRootCertificates' | 'appAppleId' | 'credentials'>;
|
|
73
|
+
|
|
74
|
+
declare type AppleIapTrustOptions = Pick<AppleIapVerificationOptions, 'realMoney' | 'environment' | 'applicationId' | 'appleRootCertificates' | 'appAppleId'>;
|
|
75
|
+
|
|
76
|
+
export declare interface AppleIapVerificationOptions extends Omit<IapVerificationOptions, 'channel'> {
|
|
77
|
+
/** DER Apple root certificates from the operator's trusted deployment, never from a receipt. */
|
|
78
|
+
readonly appleRootCertificates: readonly Uint8Array[];
|
|
79
|
+
readonly appAppleId?: number | undefined;
|
|
80
|
+
readonly credentials: AppleIapCredentialSource;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Real StoreKit 2 JWS and fresh App Store Server API status. No Xcode/unsigned mode. */
|
|
84
|
+
export declare const appleIapVerificationPort: (input: AppleIapVerificationOptions) => IapVerificationService;
|
|
85
|
+
|
|
86
|
+
declare interface Bundle {
|
|
87
|
+
readonly offer: ShopOffer;
|
|
88
|
+
readonly parts: readonly {
|
|
89
|
+
readonly offer: ShopOffer;
|
|
90
|
+
readonly qty: number;
|
|
91
|
+
}[];
|
|
92
|
+
readonly showValue: 'sumOfParts';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Existing owning read-only Shop receipt is the unit-price authority. Only
|
|
96
|
+
* accepted single-unit virtual/free purchases, with matching full content/rule
|
|
97
|
+
* identity, qualify. No current store price, provider/refund verification,
|
|
98
|
+
* quote guarantee, new SQL table or automatic bundle purchase is implied. */
|
|
99
|
+
export declare const bundleValueFromShopReceipts: (options: ShopBundleValueOptions) => Readonly<{
|
|
100
|
+
read: (subject: Subject, input: ShopBundleValueInput) => Effect.Effect<Readonly<{
|
|
101
|
+
offerId: string;
|
|
102
|
+
offerVersion: string;
|
|
103
|
+
comparison: "sumOfParts";
|
|
104
|
+
capturedAt: number;
|
|
105
|
+
sources: readonly Readonly<{
|
|
106
|
+
offerId: string;
|
|
107
|
+
offerVersion: string;
|
|
108
|
+
referenceId: string;
|
|
109
|
+
observedAt: number;
|
|
110
|
+
}>[];
|
|
111
|
+
comparisons: readonly {
|
|
112
|
+
readonly kind: "virtual" | "real";
|
|
113
|
+
readonly currency: string;
|
|
114
|
+
readonly partsValue: string;
|
|
115
|
+
readonly bundleAmount: string;
|
|
116
|
+
readonly saving: string;
|
|
117
|
+
}[];
|
|
118
|
+
}>, EconomyError, never>;
|
|
119
|
+
}>;
|
|
120
|
+
|
|
121
|
+
export declare const captureIapAccountBindingService: (input: IapAccountBindingService) => IapAccountBindingService;
|
|
122
|
+
|
|
123
|
+
export declare const captureIapCheckoutService: (input: IapCheckoutService) => IapCheckoutService;
|
|
124
|
+
|
|
125
|
+
export declare const captureIapCompletionService: (input: IapCompletionService) => IapCompletionService;
|
|
126
|
+
|
|
127
|
+
export declare const captureIapCurrentStateService: (service: IapCurrentStateService) => IapCurrentStateService;
|
|
128
|
+
|
|
129
|
+
export declare const captureIapDeliveryService: (input: IapDeliveryService) => IapDeliveryService;
|
|
130
|
+
|
|
131
|
+
export declare const captureIapManagementService: (input: IapManagementService) => IapManagementService;
|
|
132
|
+
|
|
133
|
+
export declare const captureIapNotificationService: (input: IapNotificationService) => IapNotificationService;
|
|
134
|
+
|
|
135
|
+
export declare const captureIapSystemService: (input: IapSystemService) => IapSystemService;
|
|
136
|
+
|
|
137
|
+
/** Detached original admission. Never retain author-owned participant arrays. */
|
|
138
|
+
export declare const captureTradeAuthorityAdmission: (input: TradeAuthorityAdmission) => TradeAuthorityAdmission;
|
|
139
|
+
|
|
140
|
+
export declare const captureTradeExpiryInput: (input: TradeExpiryInput) => Readonly<{
|
|
141
|
+
tenantId: string;
|
|
142
|
+
maxTrades: number;
|
|
143
|
+
}>;
|
|
144
|
+
|
|
145
|
+
/** Default SQL ownership only. Union financial history with materialization so deleted wallets are still audited. */
|
|
146
|
+
export declare const checkSqlEconomyConsistency: (store: DataStore, service: EconomyService, currencies: readonly string[], subject: Subject, input: EconomyConsistencyInput) => Effect.Effect<EconomyConsistencyResult, EconomyError>;
|
|
147
|
+
|
|
148
|
+
export declare const codeClaimsTable: Table<"_voltro_eco_code_claims", FieldDefinitions<{
|
|
149
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
150
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
151
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
152
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
153
|
+
readonly codeKey: ColumnBuilder<string, "text", boolean>;
|
|
154
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
155
|
+
readonly accepted: ColumnBuilder<boolean, "boolean", boolean>;
|
|
156
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
157
|
+
readonly intent: ColumnBuilder<unknown, "json", boolean>;
|
|
158
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
159
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
160
|
+
readonly fulfilledAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
161
|
+
}>, true, never>;
|
|
162
|
+
|
|
163
|
+
declare interface CodeDefinition {
|
|
164
|
+
readonly id: string;
|
|
165
|
+
readonly version?: string | undefined;
|
|
166
|
+
readonly campaign: string;
|
|
167
|
+
readonly items?: readonly {
|
|
168
|
+
readonly itemId: string | undefined;
|
|
169
|
+
readonly qty: number;
|
|
170
|
+
}[];
|
|
171
|
+
readonly currencies?: readonly {
|
|
172
|
+
readonly currency: string | undefined;
|
|
173
|
+
readonly amount: EconomyAmountInput;
|
|
174
|
+
}[];
|
|
175
|
+
readonly from?: number | null;
|
|
176
|
+
readonly until?: number | null;
|
|
177
|
+
readonly limits: {
|
|
178
|
+
readonly global: number;
|
|
179
|
+
readonly perPlayer: number;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
declare type CodeEligibility = (input: CodeEligibilityContext) => boolean;
|
|
184
|
+
|
|
185
|
+
declare interface CodeEligibilityContext {
|
|
186
|
+
readonly definition: PromoCode;
|
|
187
|
+
readonly at: number;
|
|
188
|
+
readonly claims: number;
|
|
189
|
+
readonly playerClaims: number;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
declare type CodeObservation = {
|
|
193
|
+
readonly requestId: string;
|
|
194
|
+
readonly state: 'not-observed' | 'pending';
|
|
195
|
+
} | {
|
|
196
|
+
readonly requestId: string;
|
|
197
|
+
readonly state: 'fulfilled';
|
|
198
|
+
readonly receipt: CodeReceipt;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
declare interface CodeReceipt {
|
|
202
|
+
readonly operationId: string;
|
|
203
|
+
readonly codeId: string;
|
|
204
|
+
readonly version: string;
|
|
205
|
+
readonly campaign: string;
|
|
206
|
+
readonly at: number;
|
|
207
|
+
readonly transfers: readonly {
|
|
208
|
+
readonly txId: string;
|
|
209
|
+
readonly currency: string;
|
|
210
|
+
readonly amount: string;
|
|
211
|
+
readonly at: number;
|
|
212
|
+
}[];
|
|
213
|
+
readonly grants: readonly {
|
|
214
|
+
readonly operationId: string;
|
|
215
|
+
readonly kind: 'grant';
|
|
216
|
+
readonly changes: readonly {
|
|
217
|
+
readonly instanceId: string;
|
|
218
|
+
readonly delta: number;
|
|
219
|
+
}[];
|
|
220
|
+
readonly at: number;
|
|
221
|
+
}[];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
declare interface CodeService {
|
|
225
|
+
readonly create: (subject: Subject, input: CreateCodeInput) => Effect.Effect<void, EconomyError>;
|
|
226
|
+
readonly redeem: (subject: Subject, input: RedeemCodeInput) => Effect.Effect<CodeReceipt, EconomyError>;
|
|
227
|
+
readonly receipt: (subject: Subject, input: RedeemCodeInput) => Effect.Effect<CodeObservation, EconomyError>;
|
|
228
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
229
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export declare const codesTable: Table<"_voltro_eco_codes", FieldDefinitions<{
|
|
233
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
234
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
235
|
+
readonly codeDigest: ColumnBuilder<string, "text", boolean>;
|
|
236
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
237
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
238
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
239
|
+
}>, true, never>;
|
|
240
|
+
|
|
241
|
+
export declare interface CodeStoreOptions {
|
|
242
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
243
|
+
readonly economy: Pick<EconomySqlService, 'prepareTransfer'>;
|
|
244
|
+
readonly inventory?: Pick<InventorySqlService, 'prepareGrant'> | undefined;
|
|
245
|
+
readonly systemAccount?: string | undefined;
|
|
246
|
+
readonly allowedServices?: readonly string[] | undefined;
|
|
247
|
+
readonly maxHistoryRows?: number | undefined;
|
|
248
|
+
readonly now?: (() => number) | undefined;
|
|
249
|
+
readonly eligibility?: CodeEligibility | undefined;
|
|
250
|
+
readonly version?: string | undefined;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export declare const codeSubjectsTable: Table<"_voltro_eco_code_subjects", FieldDefinitions<{
|
|
254
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
255
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
256
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
257
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
258
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
259
|
+
}>, true, never>;
|
|
260
|
+
|
|
261
|
+
export declare const codeTables: readonly [ Table<"_voltro_eco_code_tenants", FieldDefinitions<{
|
|
262
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
263
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
264
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
265
|
+
}>, true, never>, Table<"_voltro_eco_codes", FieldDefinitions<{
|
|
266
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
267
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
268
|
+
readonly codeDigest: ColumnBuilder<string, "text", boolean>;
|
|
269
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
270
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
271
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
272
|
+
}>, true, never>, Table<"_voltro_eco_code_subjects", FieldDefinitions<{
|
|
273
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
274
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
275
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
276
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
277
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
278
|
+
}>, true, never>, Table<"_voltro_eco_code_claims", FieldDefinitions<{
|
|
279
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
280
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
281
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
282
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
283
|
+
readonly codeKey: ColumnBuilder<string, "text", boolean>;
|
|
284
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
285
|
+
readonly accepted: ColumnBuilder<boolean, "boolean", boolean>;
|
|
286
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
287
|
+
readonly intent: ColumnBuilder<unknown, "json", boolean>;
|
|
288
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
289
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
290
|
+
readonly fulfilledAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
291
|
+
}>, true, never>];
|
|
292
|
+
|
|
293
|
+
export declare const codeTenantsTable: Table<"_voltro_eco_code_tenants", FieldDefinitions<{
|
|
294
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
295
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
296
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
297
|
+
}>, true, never>;
|
|
298
|
+
|
|
299
|
+
declare interface Container {
|
|
300
|
+
readonly id: string;
|
|
301
|
+
readonly version: string;
|
|
302
|
+
readonly group: string;
|
|
303
|
+
readonly price: Price;
|
|
304
|
+
readonly drops: readonly ContainerDrop[];
|
|
305
|
+
readonly pity: Readonly<{
|
|
306
|
+
guaranteed: string;
|
|
307
|
+
after: number;
|
|
308
|
+
softFrom: number | null;
|
|
309
|
+
softRampBps: number;
|
|
310
|
+
}> | null;
|
|
311
|
+
readonly countries: readonly string[];
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
declare interface ContainerAccessContext {
|
|
315
|
+
readonly container: Container;
|
|
316
|
+
readonly at: number;
|
|
317
|
+
readonly isMinor: boolean;
|
|
318
|
+
readonly country: string;
|
|
319
|
+
readonly eligible: boolean;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export declare interface ContainerAccessSource {
|
|
323
|
+
readonly read: (input: {
|
|
324
|
+
readonly tenantId: string;
|
|
325
|
+
readonly ownerId: string;
|
|
326
|
+
readonly container: Container;
|
|
327
|
+
readonly at: number;
|
|
328
|
+
}) => Effect.Effect<{
|
|
329
|
+
readonly isMinor: boolean;
|
|
330
|
+
readonly country: string;
|
|
331
|
+
readonly eligible: boolean;
|
|
332
|
+
readonly adjustments: readonly VirtualPriceAdjustment[];
|
|
333
|
+
}, EconomyError>;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
declare interface ContainerDefinition {
|
|
337
|
+
readonly id: string;
|
|
338
|
+
readonly version?: string | undefined;
|
|
339
|
+
readonly group?: string;
|
|
340
|
+
readonly price: PriceDefinition;
|
|
341
|
+
readonly drops: readonly ContainerDropDefinition[];
|
|
342
|
+
readonly pity?: {
|
|
343
|
+
readonly guaranteed: string;
|
|
344
|
+
readonly after: number;
|
|
345
|
+
readonly softFrom?: number;
|
|
346
|
+
readonly softRampBps?: number;
|
|
347
|
+
};
|
|
348
|
+
readonly countries?: readonly string[];
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** Normalized captured content/rules, never a player-authorizing local digest. */
|
|
352
|
+
export declare const containerDefinitionDigest: (container: Container, rulesVersion: string) => string;
|
|
353
|
+
|
|
354
|
+
export declare const containerDefinitionsTable: Table<"_voltro_eco_containers", FieldDefinitions<{
|
|
355
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
356
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
357
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
358
|
+
readonly currencies: ColumnBuilder<unknown, "json", boolean>;
|
|
359
|
+
readonly realMoney: ColumnBuilder<boolean, "boolean", boolean>;
|
|
360
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
361
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
362
|
+
}>, true, never>;
|
|
363
|
+
|
|
364
|
+
declare interface ContainerDistribution {
|
|
365
|
+
readonly entries: readonly ContainerProbabilityWeight[];
|
|
366
|
+
readonly total: string;
|
|
367
|
+
readonly guaranteed: boolean;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
declare interface ContainerDrop {
|
|
371
|
+
readonly id: string;
|
|
372
|
+
readonly rarity: string;
|
|
373
|
+
readonly weight: string;
|
|
374
|
+
readonly items: readonly {
|
|
375
|
+
readonly itemId: string;
|
|
376
|
+
readonly qty: number;
|
|
377
|
+
}[];
|
|
378
|
+
readonly currencies: readonly {
|
|
379
|
+
readonly currency: string;
|
|
380
|
+
readonly amount: string;
|
|
381
|
+
}[];
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
declare interface ContainerDropDefinition {
|
|
385
|
+
readonly id: string;
|
|
386
|
+
readonly rarity: string;
|
|
387
|
+
readonly weight: EconomyAmountInput;
|
|
388
|
+
readonly items?: readonly {
|
|
389
|
+
readonly itemId: string | undefined;
|
|
390
|
+
readonly qty: number;
|
|
391
|
+
}[];
|
|
392
|
+
readonly currencies?: readonly {
|
|
393
|
+
readonly currency: string | undefined;
|
|
394
|
+
readonly amount: EconomyAmountInput;
|
|
395
|
+
}[];
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
declare type ContainerEligibility = (input: ContainerAccessContext) => boolean;
|
|
399
|
+
|
|
400
|
+
declare type ContainerObservation = {
|
|
401
|
+
readonly requestId: string;
|
|
402
|
+
readonly state: 'not-observed' | 'pending';
|
|
403
|
+
} | {
|
|
404
|
+
readonly requestId: string;
|
|
405
|
+
readonly state: 'fulfilled';
|
|
406
|
+
readonly receipt: ContainerReceipt;
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
export declare const containerOpeningsTable: Table<"_voltro_eco_container_openings", FieldDefinitions<{
|
|
410
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
411
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
412
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
413
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
414
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
415
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
416
|
+
readonly intent: ColumnBuilder<unknown, "json", boolean>;
|
|
417
|
+
readonly selection: ColumnBuilder<unknown, "json", boolean>;
|
|
418
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
419
|
+
readonly sequence: ColumnBuilder<number | null, "integer", boolean>;
|
|
420
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
421
|
+
readonly fulfilledAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
422
|
+
}>, true, never>;
|
|
423
|
+
|
|
424
|
+
declare interface ContainerOpenInput {
|
|
425
|
+
readonly containerId: string;
|
|
426
|
+
readonly containerVersion: string;
|
|
427
|
+
readonly containerDigest: string;
|
|
428
|
+
readonly disclosureDigest: string;
|
|
429
|
+
readonly requestId: string;
|
|
430
|
+
readonly currency?: string | undefined;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
declare interface ContainerProbabilityContext {
|
|
434
|
+
readonly container: Container;
|
|
435
|
+
readonly misses: number;
|
|
436
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
437
|
+
readonly realMoney?: boolean;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
declare type ContainerProbabilityResolver = (input: ContainerProbabilityContext) => readonly ContainerProbabilityWeight[];
|
|
441
|
+
|
|
442
|
+
declare interface ContainerProbabilityWeight {
|
|
443
|
+
readonly dropId: string;
|
|
444
|
+
readonly weight: string;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/** Server authority only: no player draw/seed/state is accepted by any route. */
|
|
448
|
+
declare class ContainerRandomPort extends ContainerRandomPort_base {
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
declare const ContainerRandomPort_base: Context.ServiceClass<ContainerRandomPort, "@voltro/ContainerRandomPort", ContainerRandomService>;
|
|
452
|
+
|
|
453
|
+
declare interface ContainerRandomService {
|
|
454
|
+
readonly draw: (exclusiveMaximum: string) => Effect.Effect<string, EconomyError>;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
declare interface ContainerReceipt {
|
|
458
|
+
readonly operationId: string;
|
|
459
|
+
readonly containerId: string;
|
|
460
|
+
readonly containerVersion: string;
|
|
461
|
+
readonly containerDigest: string;
|
|
462
|
+
readonly dropId: string;
|
|
463
|
+
readonly rarity: string;
|
|
464
|
+
readonly previousMisses: number;
|
|
465
|
+
readonly misses: number;
|
|
466
|
+
readonly sequence: number;
|
|
467
|
+
readonly at: number;
|
|
468
|
+
readonly distribution: ContainerDistribution;
|
|
469
|
+
readonly pricePaid: ShopOrderReceipt['pricePaid'];
|
|
470
|
+
readonly transfers: ShopOrderReceipt['transfers'];
|
|
471
|
+
readonly grants: ShopOrderReceipt['grants'];
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
declare interface ContainerRollContext {
|
|
475
|
+
readonly distribution: ContainerDistribution;
|
|
476
|
+
readonly draw: string;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
declare type ContainerRollResolver = (input: ContainerRollContext) => string;
|
|
480
|
+
|
|
481
|
+
declare interface ContainersService {
|
|
482
|
+
readonly list: (subject: Subject) => Effect.Effect<readonly ContainerView[], EconomyError>;
|
|
483
|
+
readonly open: (subject: Subject, input: ContainerOpenInput) => Effect.Effect<ContainerReceipt, EconomyError>;
|
|
484
|
+
readonly receipt: (subject: Subject, input: ContainerOpenInput) => Effect.Effect<ContainerObservation, EconomyError>;
|
|
485
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
486
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export declare interface ContainersStoreOptions {
|
|
490
|
+
readonly containers: readonly (ContainerDefinition | Container)[];
|
|
491
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
492
|
+
readonly realMoney?: boolean;
|
|
493
|
+
readonly economy: Pick<EconomySqlService, 'prepareTransfer'>;
|
|
494
|
+
readonly inventory?: Pick<InventorySqlService, 'prepareGrant'> | undefined;
|
|
495
|
+
/** App-owned trusted age/country authority. No adult/allowed fallback. */
|
|
496
|
+
readonly accessSource: ContainerAccessSource;
|
|
497
|
+
readonly version: string;
|
|
498
|
+
readonly probability?: ContainerProbabilityResolver | undefined;
|
|
499
|
+
readonly roll?: ContainerRollResolver | undefined;
|
|
500
|
+
readonly random?: ContainerRandomService | undefined;
|
|
501
|
+
readonly eligibility?: ContainerEligibility | undefined;
|
|
502
|
+
readonly priceResolver?: PriceResolver | undefined;
|
|
503
|
+
readonly systemAccount?: string | undefined;
|
|
504
|
+
readonly maxHistoryRows?: number | undefined;
|
|
505
|
+
readonly now?: (() => number) | undefined;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export declare const containerSubjectsTable: Table<"_voltro_eco_container_subjects", FieldDefinitions<{
|
|
509
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
510
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
511
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
512
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
513
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
514
|
+
readonly pendingId: ColumnBuilder<string | null, "text", boolean>;
|
|
515
|
+
}>, true, never>;
|
|
516
|
+
|
|
517
|
+
export declare const containerTables: readonly [ Table<"_voltro_eco_container_tenants", FieldDefinitions<{
|
|
518
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
519
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
520
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
521
|
+
}>, true, never>, Table<"_voltro_eco_containers", FieldDefinitions<{
|
|
522
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
523
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
524
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
525
|
+
readonly currencies: ColumnBuilder<unknown, "json", boolean>;
|
|
526
|
+
readonly realMoney: ColumnBuilder<boolean, "boolean", boolean>;
|
|
527
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
528
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
529
|
+
}>, true, never>, Table<"_voltro_eco_container_subjects", FieldDefinitions<{
|
|
530
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
531
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
532
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
533
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
534
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
535
|
+
readonly pendingId: ColumnBuilder<string | null, "text", boolean>;
|
|
536
|
+
}>, true, never>, Table<"_voltro_eco_container_openings", FieldDefinitions<{
|
|
537
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
538
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
539
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
540
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
541
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
542
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
543
|
+
readonly intent: ColumnBuilder<unknown, "json", boolean>;
|
|
544
|
+
readonly selection: ColumnBuilder<unknown, "json", boolean>;
|
|
545
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
546
|
+
readonly sequence: ColumnBuilder<number | null, "integer", boolean>;
|
|
547
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
548
|
+
readonly fulfilledAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
549
|
+
}>, true, never>];
|
|
550
|
+
|
|
551
|
+
export declare const containerTenantsTable: Table<"_voltro_eco_container_tenants", FieldDefinitions<{
|
|
552
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
553
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
554
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
555
|
+
}>, true, never>;
|
|
556
|
+
|
|
557
|
+
declare interface ContainerView {
|
|
558
|
+
readonly container: Container;
|
|
559
|
+
readonly containerDigest: string;
|
|
560
|
+
readonly disclosureDigest: string;
|
|
561
|
+
readonly misses: number;
|
|
562
|
+
readonly price: Price;
|
|
563
|
+
readonly disclosure: ReturnType<typeof discloseContainer>;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
declare interface CreateCodeInput {
|
|
567
|
+
readonly tenantId: string;
|
|
568
|
+
readonly code: string;
|
|
569
|
+
readonly definition: CodeDefinition | PromoCode;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/** Native cryptographic rejection sampling, never modulo-biased or Math.random.
|
|
573
|
+
* A bounded failure refuses instead of silently changing randomness sources. */
|
|
574
|
+
export declare const cryptoContainerRandom: Readonly<ContainerRandomService>;
|
|
575
|
+
|
|
576
|
+
export declare const cryptoContainerRandomLayer: Layer.Layer<ContainerRandomPort, never, never>;
|
|
577
|
+
|
|
578
|
+
declare interface CurrencyDefinition {
|
|
579
|
+
readonly id: string;
|
|
580
|
+
readonly kind: 'soft' | 'hard';
|
|
581
|
+
readonly cap?: EconomyAmountInput;
|
|
582
|
+
readonly premium?: boolean;
|
|
583
|
+
readonly display?: {
|
|
584
|
+
readonly nameKey: string;
|
|
585
|
+
} | null;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export declare const dataStoreCodes: (store: DataStore, input: CodeStoreOptions) => CodeService;
|
|
589
|
+
|
|
590
|
+
/** Ordinary cold SQL authority. All custom callbacks/RNG/preparations are outside
|
|
591
|
+
* replayable transaction callbacks; actual writers share one exact-store group.
|
|
592
|
+
* One unresolved original request per owner prevents reroll/Pity races. */
|
|
593
|
+
export declare const dataStoreContainers: (store: DataStore, input: ContainersStoreOptions) => ContainersService;
|
|
594
|
+
|
|
595
|
+
/** Borrowed SQL owner; no timers, clients, hot-state cache or process-local locks. */
|
|
596
|
+
export declare const dataStoreEconomy: (store: DataStore, input: EconomyStoreOptions) => EconomySqlService;
|
|
597
|
+
|
|
598
|
+
/** One SQL owner and the actual existing prepared asset writers, never tick I/O. */
|
|
599
|
+
export declare const dataStoreIap: (store: DataStore, input: IapStoreOptions) => IapSqlService;
|
|
600
|
+
|
|
601
|
+
export declare const dataStoreIapAccountOwners: (store: DataStore, input: IapAccountStoreOptions) => IapAccountOwners;
|
|
602
|
+
|
|
603
|
+
/** Public pseudonymous account tokens are minted at runtime, not credentials or shared placeholders. */
|
|
604
|
+
export declare const dataStoreIapAccounts: (store: DataStore, input: IapAccountStoreOptions) => IapAccountBindingService;
|
|
605
|
+
|
|
606
|
+
/** Five ordinary borrowed SQL roles. Complete accepted ordered rows plus the
|
|
607
|
+
* subject's durable tail count are the sole points/rebuild truth. There is no
|
|
608
|
+
* materialized points cache, tick read/write, hot backend or second ledger. */
|
|
609
|
+
export declare const dataStoreLoyalty: (store: DataStore, input: LoyaltyStoreOptions) => LoyaltyService;
|
|
610
|
+
|
|
611
|
+
/** Accepted fills/unlocks and durable end count are bank truth. Unlock payment,
|
|
612
|
+
* actual wallet grant, reset event and receipt share one exact-store SQL group.
|
|
613
|
+
* One existing wallet writer; no points cache or Tick/hot/native connection. */
|
|
614
|
+
export declare const dataStorePiggyBanks: (store: DataStore, input: PiggyStoreOptions) => PiggyBanksService;
|
|
615
|
+
|
|
616
|
+
/** Actual server SQL owner; caller supplies exact-store prepared participants. No provider, tick or native client. */
|
|
617
|
+
export declare const dataStoreShop: (store: DataStore, input: ShopStoreOptions) => ShopSqlService;
|
|
618
|
+
|
|
619
|
+
/** Complete ordered accepted events are entitlement/day truth and rebuild
|
|
620
|
+
* source. No materialized entitlement or daily counter, Tick or HotStore I/O.
|
|
621
|
+
* All strategies, facts, clocks and participant preparation precede SQL replay. */
|
|
622
|
+
export declare const dataStoreSubscriptions: (store: DataStore, input: SubscriptionsStoreOptions) => SubscriptionsService;
|
|
623
|
+
|
|
624
|
+
export declare const dataStoreTrades: (store: DataStore, input: TradeStoreOptions) => TradesSqlService;
|
|
625
|
+
|
|
626
|
+
/** Public disclosure uses the exact same captured distribution as the draw. */
|
|
627
|
+
declare const discloseContainer: (input: ContainerProbabilityContext, slot?: ContainerProbabilityResolver) => Readonly<{
|
|
628
|
+
guaranteed: boolean;
|
|
629
|
+
probabilities: readonly Readonly<{
|
|
630
|
+
dropId: string;
|
|
631
|
+
numerator: string;
|
|
632
|
+
denominator: string;
|
|
633
|
+
}>[];
|
|
634
|
+
}>;
|
|
635
|
+
|
|
636
|
+
declare type EconomyAccount = {
|
|
637
|
+
readonly kind: 'wallet';
|
|
638
|
+
readonly ownerId: string;
|
|
639
|
+
readonly ownerKind: WalletOwnerKind;
|
|
640
|
+
} | {
|
|
641
|
+
readonly kind: 'system';
|
|
642
|
+
readonly id: string;
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
declare type EconomyAmountInput = string | number | bigint;
|
|
646
|
+
|
|
647
|
+
declare type EconomyChannel = 'web' | 'ios' | 'android' | 'steam';
|
|
648
|
+
|
|
649
|
+
export declare interface EconomyConsistencyInput {
|
|
650
|
+
readonly tenantId: string;
|
|
651
|
+
readonly maxLedgerRows?: number | undefined;
|
|
652
|
+
readonly maxWallets?: number;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
export declare interface EconomyConsistencyResult {
|
|
656
|
+
readonly checked: number;
|
|
657
|
+
readonly mismatches: number;
|
|
658
|
+
readonly matches: boolean;
|
|
659
|
+
readonly ledgerRows: number;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export declare interface EconomyConsistencyRunner {
|
|
663
|
+
readonly checkConsistency: (subject: Subject, input: EconomyConsistencyInput) => Effect.Effect<EconomyConsistencyResult, EconomyError>;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
/** Ordinary app-owned cron lifecycle; divergence makes the firing fail. Never auto-repair. */
|
|
667
|
+
export declare const economyConsistencySchedule: (input: EconomyConsistencyScheduleOptions) => BrandedScheduleDefinition;
|
|
668
|
+
|
|
669
|
+
export declare interface EconomyConsistencyScheduleOptions extends EconomyConsistencyInput {
|
|
670
|
+
readonly runner: EconomyConsistencyRunner;
|
|
671
|
+
readonly name?: string;
|
|
672
|
+
readonly cron?: string;
|
|
673
|
+
readonly timezone?: string;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
export declare const economyCurrenciesTable: Table<"_voltro_eco_currencies", FieldDefinitions<{
|
|
677
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
678
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
679
|
+
readonly currency: ColumnBuilder<string, "text", boolean>;
|
|
680
|
+
readonly config: ColumnBuilder<unknown, "json", boolean>;
|
|
681
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
682
|
+
}>, true, never>;
|
|
683
|
+
|
|
684
|
+
/** Redacted codes; never carries owners, amounts or provider payloads. */
|
|
685
|
+
declare class EconomyError extends EconomyError_base {
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
declare const EconomyError_base: Schema.Class<EconomyError, Schema.TaggedStruct<"EconomyError", {
|
|
689
|
+
readonly code: Schema.Literals<readonly ["invalid_currency", "invalid_amount", "overflow", "invalid_price", "real_money_disabled", "invalid_input", "invalid_record", "currency_cap_reached", "insufficient_funds", "conflict", "forbidden", "unavailable", "not_found", "erased", "limit_exceeded", "already_redeemed"]>;
|
|
690
|
+
}>, YieldableError>;
|
|
691
|
+
|
|
692
|
+
export declare interface EconomyFlowAggregateOptions extends EconomyReportOptions {
|
|
693
|
+
readonly name?: string;
|
|
694
|
+
readonly refresh?: string;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
export declare interface EconomyFlowRow {
|
|
698
|
+
readonly day: string;
|
|
699
|
+
readonly currency: string;
|
|
700
|
+
readonly reason: string;
|
|
701
|
+
readonly sources: string;
|
|
702
|
+
readonly sinks: string;
|
|
703
|
+
readonly playerTransfers: string;
|
|
704
|
+
readonly transactions: number;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
export declare const EconomyFlowRowSchema: Schema.Struct<{
|
|
708
|
+
readonly day: Schema.String;
|
|
709
|
+
readonly currency: Schema.String;
|
|
710
|
+
readonly reason: Schema.String;
|
|
711
|
+
readonly sources: Schema.String;
|
|
712
|
+
readonly sinks: Schema.String;
|
|
713
|
+
readonly playerTransfers: Schema.String;
|
|
714
|
+
readonly transactions: Schema.Number;
|
|
715
|
+
}>;
|
|
716
|
+
|
|
717
|
+
/** Write this explicit factory as the default export of an app-owned .aggregate.ts file. */
|
|
718
|
+
export declare const economyFlowsAggregate: (input: EconomyFlowAggregateOptions) => AggregateDefinition<EconomyFlowRow>;
|
|
719
|
+
|
|
720
|
+
export declare const economyLedgerTable: Table<"_voltro_eco_ledger", FieldDefinitions<{
|
|
721
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
722
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
723
|
+
readonly txId: ColumnBuilder<string, "text", boolean>;
|
|
724
|
+
readonly currency: ColumnBuilder<string, "text", boolean>;
|
|
725
|
+
readonly accountKind: ColumnBuilder<"system" | "wallet", "text", boolean>;
|
|
726
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
727
|
+
readonly ownerKind: ColumnBuilder<"player" | "guild" | null, "text", boolean>;
|
|
728
|
+
readonly walletKey: ColumnBuilder<string | null, "text", boolean>;
|
|
729
|
+
readonly systemAccount: ColumnBuilder<string | null, "text", boolean>;
|
|
730
|
+
readonly ownerSequence: ColumnBuilder<number | null, "integer", boolean>;
|
|
731
|
+
readonly debtPolicy: ColumnBuilder<"allowNegative" | "blockSpend" | null, "text", boolean>;
|
|
732
|
+
readonly debit: ColumnBuilder<string, "bigint", boolean>;
|
|
733
|
+
readonly credit: ColumnBuilder<string, "bigint", boolean>;
|
|
734
|
+
readonly reason: ColumnBuilder<string, "text", boolean>;
|
|
735
|
+
readonly refKind: ColumnBuilder<string | null, "text", boolean>;
|
|
736
|
+
readonly refId: ColumnBuilder<string | null, "text", boolean>;
|
|
737
|
+
readonly actor: ColumnBuilder<string | null, "text", boolean>;
|
|
738
|
+
readonly at: ColumnBuilder<Date, "timestamp", boolean>;
|
|
739
|
+
}>, true, never>;
|
|
740
|
+
|
|
741
|
+
declare interface EconomyReceipt {
|
|
742
|
+
readonly txId: string;
|
|
743
|
+
readonly currency: string;
|
|
744
|
+
readonly amount: string;
|
|
745
|
+
readonly at: number;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
declare interface EconomyReference {
|
|
749
|
+
readonly kind: string;
|
|
750
|
+
readonly id: string;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
export declare interface EconomyReportOptions {
|
|
754
|
+
readonly tenantId: string;
|
|
755
|
+
readonly maxRows?: number;
|
|
756
|
+
readonly maxGroups?: number;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
declare interface EconomyService {
|
|
760
|
+
/** Trusted server transfer, never a player-authored value mutation. */
|
|
761
|
+
readonly transfer: (subject: Subject, input: LedgerTransferInput) => Effect.Effect<EconomyReceipt, EconomyError>;
|
|
762
|
+
readonly mine: (subject: Subject) => Effect.Effect<readonly EconomyWallet[], EconomyError>;
|
|
763
|
+
readonly auditWallet: (subject: Subject, tenantId: string, account: EconomyAccount, currency: string) => Effect.Effect<EconomyWalletAudit, EconomyError>;
|
|
764
|
+
readonly rebuildWallet: (subject: Subject, tenantId: string, account: EconomyAccount, currency: string) => Effect.Effect<EconomyWalletAudit, EconomyError>;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
export declare interface EconomySqlService extends EconomySystemService, WalletEscrowParticipant {
|
|
768
|
+
/** Trusted original purchase evidence required; no player price, owner or state authority. */
|
|
769
|
+
readonly prepareIapRefund: (subject: Subject, proof: VerifiedIapCurrentState, input: IapWalletRefundInput) => Effect.Effect<PreparedSqlMutation<EconomyReceipt>, EconomyError>;
|
|
770
|
+
readonly prepareTransfer: (subject: Subject, input: LedgerTransferInput) => Effect.Effect<PreparedSqlMutation<EconomyReceipt>, EconomyError>;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
export declare interface EconomyStoreOptions {
|
|
774
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
775
|
+
readonly allowedServices?: readonly string[] | undefined;
|
|
776
|
+
/** Whole-work bounds; excess refuses rather than returning a prefix. */
|
|
777
|
+
readonly maxLedgerRows?: number | undefined;
|
|
778
|
+
readonly maxExportRows?: number | undefined;
|
|
779
|
+
readonly now?: (() => number) | undefined;
|
|
780
|
+
readonly spendLimits?: SpendLimitsOptions | undefined;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
export declare const economySubjectsTable: Table<"_voltro_eco_subjects", FieldDefinitions<{
|
|
784
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
785
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
786
|
+
readonly ownerKind: ColumnBuilder<"player" | "guild", "text", boolean>;
|
|
787
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
788
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
789
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
790
|
+
readonly entriesCount: ColumnBuilder<number, "integer", boolean>;
|
|
791
|
+
}>, true, never>;
|
|
792
|
+
|
|
793
|
+
/** Full installed replacement adds both privacy hooks; the dependent port stays four methods. */
|
|
794
|
+
declare interface EconomySystemService extends EconomyService {
|
|
795
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
796
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
export declare const economyTables: readonly [ Table<"_voltro_eco_currencies", FieldDefinitions<{
|
|
800
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
801
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
802
|
+
readonly currency: ColumnBuilder<string, "text", boolean>;
|
|
803
|
+
readonly config: ColumnBuilder<unknown, "json", boolean>;
|
|
804
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
805
|
+
}>, true, never>, Table<"_voltro_eco_wallets", FieldDefinitions<{
|
|
806
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
807
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
808
|
+
readonly ownerId: ColumnBuilder<string, "text", boolean>;
|
|
809
|
+
readonly ownerKind: ColumnBuilder<"player" | "guild", "text", boolean>;
|
|
810
|
+
readonly currency: ColumnBuilder<string, "text", boolean>;
|
|
811
|
+
readonly balance: ColumnBuilder<string, "bigint", boolean>;
|
|
812
|
+
readonly updatedAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
813
|
+
readonly debtPolicy: ColumnBuilder<"allowNegative" | "blockSpend" | null, "text", boolean>;
|
|
814
|
+
}>, true, never>, Table<"_voltro_eco_ledger", FieldDefinitions<{
|
|
815
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
816
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
817
|
+
readonly txId: ColumnBuilder<string, "text", boolean>;
|
|
818
|
+
readonly currency: ColumnBuilder<string, "text", boolean>;
|
|
819
|
+
readonly accountKind: ColumnBuilder<"system" | "wallet", "text", boolean>;
|
|
820
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
821
|
+
readonly ownerKind: ColumnBuilder<"player" | "guild" | null, "text", boolean>;
|
|
822
|
+
readonly walletKey: ColumnBuilder<string | null, "text", boolean>;
|
|
823
|
+
readonly systemAccount: ColumnBuilder<string | null, "text", boolean>;
|
|
824
|
+
readonly ownerSequence: ColumnBuilder<number | null, "integer", boolean>;
|
|
825
|
+
readonly debtPolicy: ColumnBuilder<"allowNegative" | "blockSpend" | null, "text", boolean>;
|
|
826
|
+
readonly debit: ColumnBuilder<string, "bigint", boolean>;
|
|
827
|
+
readonly credit: ColumnBuilder<string, "bigint", boolean>;
|
|
828
|
+
readonly reason: ColumnBuilder<string, "text", boolean>;
|
|
829
|
+
readonly refKind: ColumnBuilder<string | null, "text", boolean>;
|
|
830
|
+
readonly refId: ColumnBuilder<string | null, "text", boolean>;
|
|
831
|
+
readonly actor: ColumnBuilder<string | null, "text", boolean>;
|
|
832
|
+
readonly at: ColumnBuilder<Date, "timestamp", boolean>;
|
|
833
|
+
}>, true, never>, Table<"_voltro_eco_tx", FieldDefinitions<{
|
|
834
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
835
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
836
|
+
readonly state: ColumnBuilder<"erased" | "pending" | "committed", "text", boolean>;
|
|
837
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
838
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
839
|
+
readonly escrow: ColumnBuilder<unknown, "json", boolean>;
|
|
840
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
841
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
842
|
+
}>, true, never>, Table<"_voltro_eco_subjects", FieldDefinitions<{
|
|
843
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
844
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
845
|
+
readonly ownerKind: ColumnBuilder<"player" | "guild", "text", boolean>;
|
|
846
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
847
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
848
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
849
|
+
readonly entriesCount: ColumnBuilder<number, "integer", boolean>;
|
|
850
|
+
}>, true, never>];
|
|
851
|
+
|
|
852
|
+
export declare const economyTransactionsTable: Table<"_voltro_eco_tx", FieldDefinitions<{
|
|
853
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
854
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
855
|
+
readonly state: ColumnBuilder<"erased" | "pending" | "committed", "text", boolean>;
|
|
856
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
857
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
858
|
+
readonly escrow: ColumnBuilder<unknown, "json", boolean>;
|
|
859
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
860
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
861
|
+
}>, true, never>;
|
|
862
|
+
|
|
863
|
+
declare interface EconomyWallet {
|
|
864
|
+
readonly currency: string;
|
|
865
|
+
readonly balance: string;
|
|
866
|
+
readonly updatedAt: number | null;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
declare interface EconomyWalletAudit {
|
|
870
|
+
readonly currency: string;
|
|
871
|
+
readonly balance: string;
|
|
872
|
+
readonly ledgerBalance: string;
|
|
873
|
+
readonly ledgerRows: number;
|
|
874
|
+
readonly matches: boolean;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
export declare const economyWalletsTable: Table<"_voltro_eco_wallets", FieldDefinitions<{
|
|
878
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
879
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
880
|
+
readonly ownerId: ColumnBuilder<string, "text", boolean>;
|
|
881
|
+
readonly ownerKind: ColumnBuilder<"player" | "guild", "text", boolean>;
|
|
882
|
+
readonly currency: ColumnBuilder<string, "text", boolean>;
|
|
883
|
+
readonly balance: ColumnBuilder<string, "bigint", boolean>;
|
|
884
|
+
readonly updatedAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
885
|
+
readonly debtPolicy: ColumnBuilder<"allowNegative" | "blockSpend" | null, "text", boolean>;
|
|
886
|
+
}>, true, never>;
|
|
887
|
+
|
|
888
|
+
export declare type EscrowWallet = Extract<EconomyAccount, {
|
|
889
|
+
readonly kind: 'wallet';
|
|
890
|
+
}>;
|
|
891
|
+
|
|
892
|
+
export declare interface GoogleIapAccessTokenSource {
|
|
893
|
+
/** Server-side service-account OAuth authority with androidpublisher scope. Never player input. */
|
|
894
|
+
readonly read: () => Effect.Effect<string, EconomyError>;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/** Explicit completion only after accepted SQL capability. Never grants, refunds or infers POST success. */
|
|
898
|
+
export declare const googleIapCompletionPort: (input: GoogleIapVerificationOptions) => IapCompletionService;
|
|
899
|
+
|
|
900
|
+
export declare interface GoogleIapCurrentStateOptions extends Omit<IapCurrentStateOptions, 'channel'> {
|
|
901
|
+
readonly accessTokens: GoogleIapAccessTokenSource;
|
|
902
|
+
readonly subscriptionPlans?: readonly GoogleIapSubscriptionPlan[];
|
|
903
|
+
readonly timeoutMs?: number;
|
|
904
|
+
readonly maxResponseBytes?: number;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
/** Fresh authenticated product or pinned subscription-order GET, actual SQL/account revalidation and bounded evidence; no writes. */
|
|
908
|
+
export declare const googleIapCurrentStatePort: (input: GoogleIapCurrentStateOptions) => IapCurrentStateService;
|
|
909
|
+
|
|
910
|
+
export declare interface GoogleIapNotificationOptions {
|
|
911
|
+
readonly realMoney: boolean;
|
|
912
|
+
readonly applicationId: string;
|
|
913
|
+
readonly audience: string;
|
|
914
|
+
readonly serviceAccountEmail: string;
|
|
915
|
+
readonly subscription: string;
|
|
916
|
+
/** Input work budget, not measured delivery capacity. */
|
|
917
|
+
readonly maxBodyBytes?: number;
|
|
918
|
+
readonly now?: (() => number) | undefined;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/** Authenticated Pub/Sub RTDN, using the shared JWKS verifier. Payload is a hint, never current state. */
|
|
922
|
+
export declare const googleIapNotificationPort: (input: GoogleIapNotificationOptions) => IapNotificationService;
|
|
923
|
+
|
|
924
|
+
/** One installed Play declaration with real verification and explicit completion. Construction performs no I/O. */
|
|
925
|
+
export declare const googleIapProvider: (input: GoogleIapProviderOptions) => IapProviderDefinition;
|
|
926
|
+
|
|
927
|
+
export declare type GoogleIapProviderOptions = Pick<GoogleIapVerificationOptions, 'environment' | 'applicationId' | 'accessTokens' | 'timeoutMs' | 'maxResponseBytes' | 'subscriptionPlans'> & {
|
|
928
|
+
readonly notifications?: Pick<GoogleIapNotificationOptions, 'audience' | 'serviceAccountEmail' | 'subscription' | 'maxBodyBytes'> | undefined;
|
|
929
|
+
};
|
|
930
|
+
|
|
931
|
+
export declare interface GoogleIapSubscriptionPlan {
|
|
932
|
+
readonly offerId: string;
|
|
933
|
+
readonly offerVersion: string;
|
|
934
|
+
readonly basePlanId: string;
|
|
935
|
+
readonly storeOfferId: string | null;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
export declare interface GoogleIapVerificationOptions extends Omit<IapVerificationOptions, 'channel'> {
|
|
939
|
+
readonly accessTokens: GoogleIapAccessTokenSource;
|
|
940
|
+
readonly subscriptionPlans?: readonly GoogleIapSubscriptionPlan[];
|
|
941
|
+
/** Work budgets, not measured provider latency or response capacity. */
|
|
942
|
+
readonly timeoutMs?: number;
|
|
943
|
+
readonly maxResponseBytes?: number;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/** Authenticated Products v2 or Subscription v2 plus pinned Orders lookup. No grant or provider write occurs here. */
|
|
947
|
+
export declare const googleIapVerificationPort: (input: GoogleIapVerificationOptions) => IapVerificationService;
|
|
948
|
+
|
|
949
|
+
declare interface IapAcceptedCompletionContext {
|
|
950
|
+
readonly orderId: string;
|
|
951
|
+
readonly scope: IapScope;
|
|
952
|
+
readonly intent: IapReceiptIntent;
|
|
953
|
+
readonly product: IapProduct;
|
|
954
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
955
|
+
readonly facts: IapTransactionFacts;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/** Internal provider consumers only; private push material is never an RPC/inspect projection. */
|
|
959
|
+
declare interface IapAcceptedNotificationContext extends IapAcceptedNotificationObservation {
|
|
960
|
+
readonly notification: VerifiedIapNotification;
|
|
961
|
+
readonly scope: IapScope;
|
|
962
|
+
readonly product: IapProduct;
|
|
963
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
964
|
+
readonly facts: IapTransactionFacts;
|
|
965
|
+
readonly fingerprint: string;
|
|
966
|
+
readonly material: Readonly<Record<string, unknown>>;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
export declare interface IapAcceptedNotificationObservation {
|
|
970
|
+
readonly orderId: string;
|
|
971
|
+
readonly notice: IapNotificationNotice;
|
|
972
|
+
readonly receipt: IapOrderReceipt;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
export declare interface IapAccountBindingService {
|
|
976
|
+
/** Observe existing SQL binding only; no mint, seed, fence update or ownership write. */
|
|
977
|
+
readonly observe: (scope: IapScope, channel: EconomyChannel, environment: IapEnvironment) => Effect.Effect<string, EconomyError>;
|
|
978
|
+
readonly read: (scope: IapScope, channel: EconomyChannel, environment: IapEnvironment) => Effect.Effect<string, EconomyError>;
|
|
979
|
+
readonly prepareBinding: (scope: IapScope, channel: EconomyChannel, environment: IapEnvironment, token: string) => Effect.Effect<PreparedSqlMutation<unknown>, EconomyError>;
|
|
980
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
981
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/** Which owner a provider-held account token belongs to. A provider that delivers purchases on its
|
|
985
|
+
* own (a renewal webhook) knows only the token it was given at checkout; `null` when the token is
|
|
986
|
+
* unknown or its owner was erased. Read-only: no seed, no fence, no token is minted. */
|
|
987
|
+
export declare interface IapAccountOwners {
|
|
988
|
+
readonly owner: (token: string) => Effect.Effect<IapScope | null, EconomyError>;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
export declare type IapAccountSource = Pick<IapAccountBindingService, 'read' | 'prepareBinding'>;
|
|
992
|
+
|
|
993
|
+
export declare class IapAccountsPort extends IapAccountsPort_base {
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
declare const IapAccountsPort_base: Context.ServiceClass<IapAccountsPort, "@voltro/IapAccountsPort", IapAccountBindingService>;
|
|
997
|
+
|
|
998
|
+
export declare const iapAccountsTable: Table<"_voltro_eco_iap_accounts", FieldDefinitions<{
|
|
999
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1000
|
+
readonly applicationId: ColumnBuilder<string, "text", boolean>;
|
|
1001
|
+
readonly channel: ColumnBuilder<"web" | "ios" | "android" | "steam", "text", boolean>;
|
|
1002
|
+
readonly environment: ColumnBuilder<"production" | "sandbox", "text", boolean>;
|
|
1003
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1004
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
1005
|
+
readonly token: ColumnBuilder<string | null, "text", boolean>;
|
|
1006
|
+
readonly tokenKey: ColumnBuilder<string | null, "text", boolean>;
|
|
1007
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
1008
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
1009
|
+
}>, true, "voltro_eco_iap_accounts_owner_idx">;
|
|
1010
|
+
|
|
1011
|
+
export declare interface IapAccountStoreOptions {
|
|
1012
|
+
readonly realMoney: boolean;
|
|
1013
|
+
readonly applicationId: string;
|
|
1014
|
+
readonly channel: EconomyChannel;
|
|
1015
|
+
readonly environment: IapEnvironment;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
export declare const iapAccountTables: readonly [ Table<"_voltro_eco_iap_accounts", FieldDefinitions<{
|
|
1019
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1020
|
+
readonly applicationId: ColumnBuilder<string, "text", boolean>;
|
|
1021
|
+
readonly channel: ColumnBuilder<"web" | "ios" | "android" | "steam", "text", boolean>;
|
|
1022
|
+
readonly environment: ColumnBuilder<"production" | "sandbox", "text", boolean>;
|
|
1023
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1024
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
1025
|
+
readonly token: ColumnBuilder<string | null, "text", boolean>;
|
|
1026
|
+
readonly tokenKey: ColumnBuilder<string | null, "text", boolean>;
|
|
1027
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
1028
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
1029
|
+
}>, true, "voltro_eco_iap_accounts_owner_idx">, Table<"_voltro_eco_iap_account_tokens", FieldDefinitions<{
|
|
1030
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1031
|
+
readonly applicationId: ColumnBuilder<string, "text", boolean>;
|
|
1032
|
+
readonly channel: ColumnBuilder<"web" | "ios" | "android" | "steam", "text", boolean>;
|
|
1033
|
+
readonly environment: ColumnBuilder<"production" | "sandbox", "text", boolean>;
|
|
1034
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1035
|
+
readonly accountKey: ColumnBuilder<string, "text", boolean>;
|
|
1036
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
1037
|
+
}>, true, "voltro_eco_iap_account_tokens_scope_idx">];
|
|
1038
|
+
|
|
1039
|
+
/** Permanent uniqueness custody survives removal of the public account-binding token. */
|
|
1040
|
+
export declare const iapAccountTokensTable: Table<"_voltro_eco_iap_account_tokens", FieldDefinitions<{
|
|
1041
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1042
|
+
readonly applicationId: ColumnBuilder<string, "text", boolean>;
|
|
1043
|
+
readonly channel: ColumnBuilder<"web" | "ios" | "android" | "steam", "text", boolean>;
|
|
1044
|
+
readonly environment: ColumnBuilder<"production" | "sandbox", "text", boolean>;
|
|
1045
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1046
|
+
readonly accountKey: ColumnBuilder<string, "text", boolean>;
|
|
1047
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
1048
|
+
}>, true, "voltro_eco_iap_account_tokens_scope_idx">;
|
|
1049
|
+
|
|
1050
|
+
/** A web checkout about to start: nothing is paid or verified yet. */
|
|
1051
|
+
export declare interface IapCheckoutAdmission {
|
|
1052
|
+
readonly scope: IapScope;
|
|
1053
|
+
readonly product: IapProduct;
|
|
1054
|
+
readonly at: number;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/** One purchase a provider is asked to start: the owner, the selected offer and where the
|
|
1058
|
+
* player returns afterwards. The account token binds the later receipt to this owner. */
|
|
1059
|
+
export declare interface IapCheckoutContext {
|
|
1060
|
+
readonly scope: IapScope;
|
|
1061
|
+
readonly product: IapProduct;
|
|
1062
|
+
readonly requestId: string;
|
|
1063
|
+
readonly accountToken: string;
|
|
1064
|
+
readonly returnUrl: string;
|
|
1065
|
+
readonly at: number;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
export declare interface IapCheckoutIntent {
|
|
1069
|
+
readonly channel: string;
|
|
1070
|
+
readonly offerId: string;
|
|
1071
|
+
readonly offerVersion: string;
|
|
1072
|
+
readonly requestId: string;
|
|
1073
|
+
readonly returnUrl: string;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/** Provider-owned web checkout (Stripe, Paddle, an app's own PSP, ...). Construction does no
|
|
1077
|
+
* I/O; `initialize` checks credentials. Verification of the paid checkout stays with the same
|
|
1078
|
+
* provider's `IapVerificationAuthority`, which must check the bound account token. */
|
|
1079
|
+
export declare interface IapCheckoutService {
|
|
1080
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1081
|
+
readonly start: (context: IapCheckoutContext) => Effect.Effect<IapCheckoutSession, EconomyError>;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/** A started provider checkout. `checkoutId` is the receipt the player redeems afterwards. */
|
|
1085
|
+
export declare interface IapCheckoutSession {
|
|
1086
|
+
readonly checkoutId: string;
|
|
1087
|
+
readonly redirectUrl: string;
|
|
1088
|
+
readonly expiresAt: number;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
export declare interface IapCompletionAuthority {
|
|
1092
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1093
|
+
/** Actual fresh provider state must confirm completion, not only an accepted POST. */
|
|
1094
|
+
readonly complete: (context: IapCompletionContext) => Effect.Effect<IapCompletionReceipt, EconomyError>;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
export declare interface IapCompletionContext extends IapAcceptedCompletionContext {
|
|
1098
|
+
readonly accountToken: string;
|
|
1099
|
+
readonly at: number;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
export declare class IapCompletionPort extends IapCompletionPort_base {
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
/** Deliberate trusted server authority, with actual SQL capability and account/declaration admission. */
|
|
1106
|
+
export declare const iapCompletionPort: (input: IapVerificationOptions, authorityInput: IapCompletionAuthority) => IapCompletionService;
|
|
1107
|
+
|
|
1108
|
+
declare const IapCompletionPort_base: Context.ServiceClass<IapCompletionPort, "@voltro/IapCompletionPort", IapCompletionService>;
|
|
1109
|
+
|
|
1110
|
+
export declare interface IapCompletionReceipt {
|
|
1111
|
+
readonly orderId: string;
|
|
1112
|
+
readonly channel: EconomyChannel;
|
|
1113
|
+
readonly operation: 'acknowledge' | 'consume' | 'finalize' | 'finish';
|
|
1114
|
+
readonly observedAt: number;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
export declare interface IapCompletionService {
|
|
1118
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1119
|
+
readonly complete: (evidence: AcceptedIapCompletion) => Effect.Effect<IapCompletionReceipt, EconomyError>;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
export declare interface IapCurrentPurchaseState {
|
|
1123
|
+
readonly orderId: string;
|
|
1124
|
+
readonly channel: IapRefundChannel;
|
|
1125
|
+
readonly state: 'active' | 'partially-refunded' | 'revoked';
|
|
1126
|
+
/** Exact cumulative provider refund share; never floating point or money sent by a player. */
|
|
1127
|
+
readonly refundNumerator: number;
|
|
1128
|
+
readonly refundDenominator: number;
|
|
1129
|
+
readonly observedAt: number;
|
|
1130
|
+
readonly revokedAt: number | null;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
/** Trusted server read projection; opaque state cannot be reconstructed from this result. */
|
|
1134
|
+
export declare const iapCurrentPurchaseState: (proof: VerifiedIapCurrentState) => Effect.Effect<IapCurrentPurchaseState, EconomyError>;
|
|
1135
|
+
|
|
1136
|
+
export declare interface IapCurrentStateAuthority {
|
|
1137
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1138
|
+
readonly read: (context: IapCurrentStateContext) => Effect.Effect<IapCurrentPurchaseState, EconomyError>;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
export declare interface IapCurrentStateContext extends IapAcceptedNotificationContext {
|
|
1142
|
+
readonly accountToken: string;
|
|
1143
|
+
readonly at: number;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
export declare interface IapCurrentStateOptions extends IapNotificationTargetOptions {
|
|
1147
|
+
readonly accounts: Pick<IapAccountBindingService, 'observe' | 'prepareBinding'>;
|
|
1148
|
+
/** Evidence lifetime budget, not an external provider consistency guarantee. */
|
|
1149
|
+
readonly maxAgeMs?: number;
|
|
1150
|
+
readonly now?: (() => number) | undefined;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
export declare class IapCurrentStatePort extends IapCurrentStatePort_base {
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
/** The provider receives accepted history only after actual SQL and account admission; I/O never writes assets. */
|
|
1157
|
+
export declare const iapCurrentStatePort: (input: IapCurrentStateOptions, authorityInput: IapCurrentStateAuthority) => IapCurrentStateService;
|
|
1158
|
+
|
|
1159
|
+
declare const IapCurrentStatePort_base: Context.ServiceClass<IapCurrentStatePort, "@voltro/IapCurrentStatePort", IapCurrentStateService>;
|
|
1160
|
+
|
|
1161
|
+
export declare interface IapCurrentStateService {
|
|
1162
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1163
|
+
readonly read: (target: AcceptedIapNotificationTarget) => Effect.Effect<VerifiedIapCurrentState, EconomyError>;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
export declare type IapDebtPolicy = 'allowNegative' | 'blockSpend';
|
|
1167
|
+
|
|
1168
|
+
/** A purchase or subscription renewal the provider reports on its own (a webhook), for the
|
|
1169
|
+
* owner it once received as account token at checkout. Redeemed through the same pipeline as a
|
|
1170
|
+
* player's redeem: the same `requestId` + `receipt` converge on one order. */
|
|
1171
|
+
export declare interface IapDelivery {
|
|
1172
|
+
readonly accountToken: string;
|
|
1173
|
+
readonly offerId: string;
|
|
1174
|
+
readonly offerVersion: string;
|
|
1175
|
+
readonly requestId: string;
|
|
1176
|
+
readonly receipt: string;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
/** Provider-owned delivery reader on the channel's notification route. `read` authenticates the
|
|
1180
|
+
* request and returns `null` when it carries nothing to deliver; the request then continues to
|
|
1181
|
+
* the notification pipeline (refunds, disputes). */
|
|
1182
|
+
export declare interface IapDeliveryService {
|
|
1183
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1184
|
+
readonly read: (input: IapNotificationInput) => Effect.Effect<IapDelivery | null, EconomyError>;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
declare interface IapEntitlementObservation {
|
|
1188
|
+
readonly offerId: string;
|
|
1189
|
+
readonly entitled: boolean;
|
|
1190
|
+
readonly expiresAt: number | null;
|
|
1191
|
+
readonly observedAt: number;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
declare type IapEntitlementPolicy = (context: IapEntitlementPolicyContext) => boolean;
|
|
1195
|
+
|
|
1196
|
+
declare interface IapEntitlementPolicyContext {
|
|
1197
|
+
readonly period: IapSubscriptionPeriod;
|
|
1198
|
+
readonly at: number;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
export declare interface IapEntitlementsOptions {
|
|
1202
|
+
readonly realMoney: boolean;
|
|
1203
|
+
readonly version: string;
|
|
1204
|
+
/** Actual default SQL adapter, or a source owning the same complete accepted-history/privacy contract. */
|
|
1205
|
+
readonly orders: Pick<IapSqlService, 'subscriptionPeriods' | 'exportSubject' | 'eraseSubject'>;
|
|
1206
|
+
readonly policy?: IapEntitlementPolicy;
|
|
1207
|
+
readonly now?: (() => number) | undefined;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
export declare interface IapEntitlementsPluginOptions {
|
|
1211
|
+
readonly version: string;
|
|
1212
|
+
readonly policy?: IapEntitlementPolicy;
|
|
1213
|
+
readonly service?: IapEntitlementsService;
|
|
1214
|
+
readonly querySources?: readonly string[] | undefined;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
/** Actual accepted SQL period observation. This read is not a prepared value-write authority. */
|
|
1218
|
+
export declare const iapEntitlementsPort: (input: IapEntitlementsOptions) => IapEntitlementsService;
|
|
1219
|
+
|
|
1220
|
+
declare interface IapEntitlementsService {
|
|
1221
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1222
|
+
readonly entitled: (subject: Subject, offerId: string) => Effect.Effect<IapEntitlementObservation, EconomyError>;
|
|
1223
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
1224
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
declare type IapEnvironment = 'sandbox' | 'production';
|
|
1228
|
+
|
|
1229
|
+
/** Where an owner manages what they pay for (cancel a subscription, change the card). */
|
|
1230
|
+
export declare interface IapManagementContext {
|
|
1231
|
+
readonly accountToken: string;
|
|
1232
|
+
/** The provider's original transaction IDs (subscriptions) of the owner's accepted orders on
|
|
1233
|
+
* this channel, newest first; empty when the owner holds none. */
|
|
1234
|
+
readonly originals: readonly string[];
|
|
1235
|
+
readonly returnUrl: string;
|
|
1236
|
+
readonly at: number;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
export declare interface IapManagementService {
|
|
1240
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1241
|
+
/** A provider page for this owner; `not_found` when the owner has nothing to manage there. */
|
|
1242
|
+
readonly open: (context: IapManagementContext) => Effect.Effect<{
|
|
1243
|
+
readonly url: string;
|
|
1244
|
+
}, EconomyError>;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
export declare const iapNamespacesTable: Table<"_voltro_eco_iap_namespaces", FieldDefinitions<{
|
|
1248
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1249
|
+
readonly namespace: ColumnBuilder<string, "text", boolean>;
|
|
1250
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
1251
|
+
readonly ordersCount: ColumnBuilder<number, "integer", boolean>;
|
|
1252
|
+
readonly receiptsCount: ColumnBuilder<number, "integer", boolean>;
|
|
1253
|
+
}>, true, never>;
|
|
1254
|
+
|
|
1255
|
+
declare interface IapNotificationCipherSource {
|
|
1256
|
+
/** Default is the registered framework FieldCipher. Explicit sources use that same codec/row binding contract. */
|
|
1257
|
+
readonly read: () => FieldCipher | undefined;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
declare interface IapNotificationCustodyReceipt {
|
|
1261
|
+
readonly id: string;
|
|
1262
|
+
readonly orderId: string;
|
|
1263
|
+
readonly state: 'pending' | 'processed' | 'expired' | 'erased';
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
export declare interface IapNotificationInput {
|
|
1267
|
+
readonly body: string;
|
|
1268
|
+
/** Actual HTTP Authorization header for authenticated Pub/Sub push; never query/body authority. */
|
|
1269
|
+
readonly authorization?: string;
|
|
1270
|
+
/** The request's other headers, lowercased and bounded, for providers that sign in a header
|
|
1271
|
+
* (Stripe: `stripe-signature`). Never authority by themselves. */
|
|
1272
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
export declare interface IapNotificationNotice {
|
|
1276
|
+
readonly channel: IapRefundChannel;
|
|
1277
|
+
readonly applicationId: string;
|
|
1278
|
+
/** RTDN itself does not identify sandbox/production. Fresh lookup must establish it. */
|
|
1279
|
+
readonly environment: IapEnvironment | null;
|
|
1280
|
+
readonly noticeId: string;
|
|
1281
|
+
readonly sourceType: string;
|
|
1282
|
+
readonly kind: 'one-time' | 'subscription' | 'voided' | 'review' | 'test';
|
|
1283
|
+
readonly occurredAt: number;
|
|
1284
|
+
readonly transactionId: string | null;
|
|
1285
|
+
readonly originalTransactionId: string | null;
|
|
1286
|
+
readonly storeProductId: string | null;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
export declare const iapNotificationNotice: (input: VerifiedIapNotification) => IapNotificationNotice;
|
|
1290
|
+
|
|
1291
|
+
export declare class IapNotificationPort extends IapNotificationPort_base {
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
declare const IapNotificationPort_base: Context.ServiceClass<IapNotificationPort, "@voltro/IapNotificationPort", IapNotificationService>;
|
|
1295
|
+
|
|
1296
|
+
declare interface IapNotificationProcessorService {
|
|
1297
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1298
|
+
/** `null`: an authenticated test notice (a store's TEST message, a provider event with no
|
|
1299
|
+
* purchase in it) is acknowledged and not retained; no retry could ever process it. */
|
|
1300
|
+
readonly ingest: (input: IapNotificationInput) => Effect.Effect<IapNotificationCustodyReceipt | null, EconomyError>;
|
|
1301
|
+
readonly process: (id: string) => Effect.Effect<IapNotificationCustodyReceipt, EconomyError>;
|
|
1302
|
+
readonly pending: () => Effect.Effect<readonly IapNotificationCustodyReceipt[], EconomyError>;
|
|
1303
|
+
readonly prune: () => Effect.Effect<number, EconomyError>;
|
|
1304
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
1305
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
export declare interface IapNotificationService {
|
|
1309
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1310
|
+
readonly verify: (input: IapNotificationInput) => Effect.Effect<VerifiedIapNotification, EconomyError>;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
declare interface IapNotificationsPluginOptions {
|
|
1314
|
+
readonly version: string;
|
|
1315
|
+
readonly pathPrefix?: string;
|
|
1316
|
+
readonly maxBodyBytes?: number;
|
|
1317
|
+
readonly bodyRetentionMs?: number | undefined;
|
|
1318
|
+
readonly debtPolicy?: IapDebtPolicy | undefined;
|
|
1319
|
+
readonly assets?: IapRefundAssetParticipant | undefined;
|
|
1320
|
+
readonly assetsVersion?: string | undefined;
|
|
1321
|
+
readonly maxNoticeRows?: number;
|
|
1322
|
+
readonly maxRefundRows?: number;
|
|
1323
|
+
readonly cipher?: IapNotificationCipherSource | undefined;
|
|
1324
|
+
/** Complete replacement owns authentication/current state/financial authority, queue and privacy. */
|
|
1325
|
+
readonly service?: IapNotificationsSystemService;
|
|
1326
|
+
/** Complete notification replacements may expose their own three-method event queue. */
|
|
1327
|
+
readonly refundEvents?: IapRefundEventsService;
|
|
1328
|
+
/** Custom borrowed-transaction SQL read. Omit when the custom system exposes no own order disposition. */
|
|
1329
|
+
readonly refundDisposition?: IapRefundDispositionSource | undefined;
|
|
1330
|
+
/** Runs after a notice changed a purchase (a refund, a revocation), e.g. to end game time at once:
|
|
1331
|
+
* `rooms.moderation.recheckAccess({ tenantId, subjectId: ownerId })`. Best effort: a failure is
|
|
1332
|
+
* ignored and the notice stays processed. Not with a complete replacement `service`. */
|
|
1333
|
+
readonly onChange?: ((change: IapPurchaseChange) => Effect.Effect<void, unknown>) | undefined;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
declare interface IapNotificationsSystemService {
|
|
1337
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1338
|
+
readonly processor: (channel: EconomyChannel) => Effect.Effect<IapNotificationProcessorService, EconomyError>;
|
|
1339
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
1340
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
export declare interface IapNotificationTargetOptions {
|
|
1344
|
+
readonly realMoney: boolean;
|
|
1345
|
+
readonly channel: IapRefundChannel;
|
|
1346
|
+
readonly applicationId: string;
|
|
1347
|
+
readonly environment: IapEnvironment;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
declare type IapOrderObservation = {
|
|
1351
|
+
readonly requestId: string;
|
|
1352
|
+
readonly state: 'not-observed' | 'pending';
|
|
1353
|
+
} | {
|
|
1354
|
+
readonly requestId: string;
|
|
1355
|
+
readonly state: 'fulfilled';
|
|
1356
|
+
readonly receipt: IapOrderReceipt;
|
|
1357
|
+
readonly refund?: IapRefundDisposition;
|
|
1358
|
+
} | {
|
|
1359
|
+
readonly requestId: string;
|
|
1360
|
+
readonly state: 'partially-refunded' | 'refunded';
|
|
1361
|
+
readonly receipt: IapOrderReceipt;
|
|
1362
|
+
readonly refund: IapRefundDisposition;
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
declare interface IapOrderReceipt {
|
|
1366
|
+
readonly orderId: string;
|
|
1367
|
+
readonly offerId: string;
|
|
1368
|
+
readonly offerVersion: string;
|
|
1369
|
+
readonly quantity: number;
|
|
1370
|
+
readonly at: number;
|
|
1371
|
+
readonly pricePaid: IapPaidAmount | null;
|
|
1372
|
+
readonly transfers: readonly {
|
|
1373
|
+
readonly txId: string;
|
|
1374
|
+
readonly currency: string;
|
|
1375
|
+
readonly amount: string;
|
|
1376
|
+
readonly at: number;
|
|
1377
|
+
}[];
|
|
1378
|
+
readonly grants: readonly {
|
|
1379
|
+
readonly operationId: string;
|
|
1380
|
+
readonly kind: 'grant';
|
|
1381
|
+
readonly changes: readonly {
|
|
1382
|
+
readonly instanceId: string;
|
|
1383
|
+
readonly delta: number;
|
|
1384
|
+
}[];
|
|
1385
|
+
readonly at: number;
|
|
1386
|
+
}[];
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
export declare const iapOrdersTable: Table<"_voltro_eco_iap_orders", FieldDefinitions<{
|
|
1390
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1391
|
+
readonly namespace: ColumnBuilder<string, "text", boolean>;
|
|
1392
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1393
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
1394
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
1395
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
1396
|
+
readonly accepted: ColumnBuilder<boolean, "boolean", boolean>;
|
|
1397
|
+
readonly offerId: ColumnBuilder<string, "text", boolean>;
|
|
1398
|
+
readonly acceptedQuantity: ColumnBuilder<number | null, "integer", boolean>;
|
|
1399
|
+
readonly acceptedDay: ColumnBuilder<number | null, "integer", boolean>;
|
|
1400
|
+
readonly offerVersion: ColumnBuilder<string, "text", boolean>;
|
|
1401
|
+
readonly channel: ColumnBuilder<"web" | "ios" | "android" | "steam", "text", boolean>;
|
|
1402
|
+
readonly configurationDigest: ColumnBuilder<string, "text", boolean>;
|
|
1403
|
+
readonly intentDigest: ColumnBuilder<string | null, "text", boolean>;
|
|
1404
|
+
readonly receiptKey: ColumnBuilder<string | null, "text", boolean>;
|
|
1405
|
+
readonly snapshot: ColumnBuilder<unknown, "json", boolean>;
|
|
1406
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
1407
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
1408
|
+
readonly fulfilledAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
1409
|
+
}>, true, never>;
|
|
1410
|
+
|
|
1411
|
+
/** Provider units retain their own decimal scale. Reference prices are never substituted. */
|
|
1412
|
+
declare interface IapPaidAmount {
|
|
1413
|
+
readonly currency: string;
|
|
1414
|
+
readonly units: string;
|
|
1415
|
+
readonly scale: number;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
export declare interface IapPluginOptions {
|
|
1419
|
+
readonly version: string;
|
|
1420
|
+
readonly products: readonly IapProductDefinition[];
|
|
1421
|
+
readonly providers?: readonly IapProviderDefinition[];
|
|
1422
|
+
readonly namespace?: string;
|
|
1423
|
+
readonly admission?: IapStoreOptions['admission'] | undefined;
|
|
1424
|
+
readonly inventory?: IapStoreOptions['inventory'] | undefined;
|
|
1425
|
+
readonly systemAccount?: string | undefined;
|
|
1426
|
+
readonly maxHistoryRows?: number | undefined;
|
|
1427
|
+
readonly now?: (() => number) | undefined;
|
|
1428
|
+
readonly notifications?: IapNotificationsPluginOptions | undefined;
|
|
1429
|
+
readonly entitlements?: IapEntitlementsPluginOptions;
|
|
1430
|
+
readonly service?: IapSystemService;
|
|
1431
|
+
readonly querySources?: {
|
|
1432
|
+
readonly receipt: readonly string[];
|
|
1433
|
+
} | undefined;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
declare interface IapProduct {
|
|
1437
|
+
readonly offer: ShopOffer;
|
|
1438
|
+
readonly channel: EconomyChannel;
|
|
1439
|
+
readonly kind: IapProductKind;
|
|
1440
|
+
readonly storeProductId: string;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
declare interface IapProductDefinition {
|
|
1444
|
+
readonly offer: ShopOfferDefinition | ShopOffer;
|
|
1445
|
+
readonly channel: EconomyChannel;
|
|
1446
|
+
readonly kind: IapProductKind;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
declare type IapProductKind = 'consumable' | 'non-consumable' | 'subscription';
|
|
1450
|
+
|
|
1451
|
+
export declare interface IapProviderContext {
|
|
1452
|
+
readonly realMoney: true;
|
|
1453
|
+
readonly channel: EconomyChannel;
|
|
1454
|
+
readonly environment: IapEnvironment;
|
|
1455
|
+
readonly applicationId: string;
|
|
1456
|
+
readonly products: readonly IapProductDefinition[];
|
|
1457
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
1458
|
+
readonly accounts: IapAccountBindingService;
|
|
1459
|
+
readonly now: () => number;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
export declare interface IapProviderDefinition {
|
|
1463
|
+
readonly channel: EconomyChannel;
|
|
1464
|
+
readonly environment: IapEnvironment;
|
|
1465
|
+
readonly applicationId: string;
|
|
1466
|
+
/** Server-owned verifier factory. Construction does no I/O; initialize is awaited at activation. */
|
|
1467
|
+
readonly create: (context: IapProviderContext) => IapVerificationService;
|
|
1468
|
+
/** Optional authenticated notification authority, initialized only when configured. */
|
|
1469
|
+
readonly createNotifications?: ((context: IapProviderContext) => IapNotificationService) | undefined;
|
|
1470
|
+
readonly createCurrentState?: ((context: IapProviderContext) => IapCurrentStateService) | undefined;
|
|
1471
|
+
/** Optional server completion authority, initialized before this IAP system activates. */
|
|
1472
|
+
readonly createCompletion?: ((context: IapProviderContext) => IapCompletionService) | undefined;
|
|
1473
|
+
/** Optional web checkout (`economy.iap.checkout`): the provider starts a hosted payment and
|
|
1474
|
+
* the player redeems its `checkoutId` as the receipt. Any payment provider fits. */
|
|
1475
|
+
readonly createCheckout?: ((context: IapProviderContext) => IapCheckoutService) | undefined;
|
|
1476
|
+
/** Origins a checkout may return to (`https://game.example`); required with `createCheckout`. */
|
|
1477
|
+
readonly checkoutReturnOrigins?: readonly string[] | undefined;
|
|
1478
|
+
/** Optional provider-delivered purchases and subscription renewals, read on the channel's
|
|
1479
|
+
* notification route (needs `notifications`). Each is redeemed for the owner of its account token. */
|
|
1480
|
+
readonly createDeliveries?: ((context: IapProviderContext) => IapDeliveryService) | undefined;
|
|
1481
|
+
/** Optional provider page where the owner manages subscriptions (`economy.iap.manage`). */
|
|
1482
|
+
readonly createManagement?: ((context: IapProviderContext) => IapManagementService) | undefined;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
export declare interface IapPurchaseAdmission {
|
|
1486
|
+
readonly scope: IapScope;
|
|
1487
|
+
readonly product: IapProduct;
|
|
1488
|
+
readonly facts: IapTransactionFacts;
|
|
1489
|
+
readonly at: number;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
/** Required real SQL age/consent/spend eligibility authority. No permissive default. */
|
|
1493
|
+
export declare interface IapPurchaseAdmissionSource {
|
|
1494
|
+
readonly prepare: (input: IapPurchaseAdmission) => Effect.Effect<PreparedSqlMutation<unknown>, EconomyError>;
|
|
1495
|
+
/** Optional check before a web checkout starts. Refuse what `prepare` would certainly
|
|
1496
|
+
* refuse, so the player is never charged for a purchase that cannot be redeemed;
|
|
1497
|
+
* `prepare` stays the authority. */
|
|
1498
|
+
readonly checkout?: (input: IapCheckoutAdmission) => Effect.Effect<void, EconomyError>;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
/** A store or provider notice changed a purchase: a refund, a revocation. `ownerId` is the player. */
|
|
1502
|
+
declare interface IapPurchaseChange {
|
|
1503
|
+
readonly tenantId: string;
|
|
1504
|
+
readonly ownerId: string;
|
|
1505
|
+
readonly orderId: string;
|
|
1506
|
+
readonly offerId: string;
|
|
1507
|
+
readonly offerVersion: string;
|
|
1508
|
+
readonly state: IapRefundReceipt['state'];
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
declare interface IapReceiptIntent {
|
|
1512
|
+
readonly channel: EconomyChannel;
|
|
1513
|
+
readonly offerId: string;
|
|
1514
|
+
readonly offerVersion: string;
|
|
1515
|
+
readonly requestId: string;
|
|
1516
|
+
/** Opaque store evidence. Never log or persist this in player receipts. */
|
|
1517
|
+
readonly receipt: string;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
/** Read-only original-intention reference. Never send raw receipts in query parameters. */
|
|
1521
|
+
declare interface IapReceiptReference {
|
|
1522
|
+
readonly channel: EconomyChannel;
|
|
1523
|
+
readonly offerId: string;
|
|
1524
|
+
readonly offerVersion: string;
|
|
1525
|
+
readonly requestId: string;
|
|
1526
|
+
readonly receiptDigest: string;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
/** Primary identity is application/environment/channel/transaction, independent of namespace and tenant. */
|
|
1530
|
+
export declare const iapReceiptsTable: Table<"_voltro_eco_iap_receipts", FieldDefinitions<{
|
|
1531
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1532
|
+
readonly namespace: ColumnBuilder<string, "text", boolean>;
|
|
1533
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1534
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
1535
|
+
readonly orderKey: ColumnBuilder<string, "text", boolean>;
|
|
1536
|
+
readonly identity: ColumnBuilder<string, "text", boolean>;
|
|
1537
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
1538
|
+
readonly accepted: ColumnBuilder<boolean, "boolean", boolean>;
|
|
1539
|
+
readonly factsDigest: ColumnBuilder<string, "text", boolean>;
|
|
1540
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
1541
|
+
readonly fulfilledAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
1542
|
+
}>, true, never>;
|
|
1543
|
+
|
|
1544
|
+
declare interface IapRefundAssetContext {
|
|
1545
|
+
readonly original: IapSqlOriginalPurchase;
|
|
1546
|
+
readonly state: IapCurrentPurchaseState;
|
|
1547
|
+
readonly previous: IapRefundReceipt | null;
|
|
1548
|
+
readonly sequence: number;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
/** Mandatory for orders with item grants. It must use the same real store and original grant custody. */
|
|
1552
|
+
declare interface IapRefundAssetParticipant {
|
|
1553
|
+
readonly prepare: (input: IapRefundAssetContext) => Effect.Effect<PreparedSqlMutation<unknown>, EconomyError>;
|
|
1554
|
+
readonly validate: (input: IapRefundAssetContext, receipt: unknown) => unknown;
|
|
1555
|
+
/** SQL-only audit of accepted movement receipts; no provider/application callbacks. */
|
|
1556
|
+
readonly audit: (tx: DataStore, input: IapRefundAssetContext, receipt: unknown) => Promise<void>;
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
/** Channels whose providers report refunds and revocations to the economy. */
|
|
1560
|
+
export declare type IapRefundChannel = 'ios' | 'android' | 'web';
|
|
1561
|
+
|
|
1562
|
+
declare interface IapRefundCurrency {
|
|
1563
|
+
readonly currency: string;
|
|
1564
|
+
readonly original: string;
|
|
1565
|
+
readonly refunded: string;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
/** Accepted SQL refund history only. This projection never authorizes a grant or completion. */
|
|
1569
|
+
declare interface IapRefundDisposition {
|
|
1570
|
+
readonly sequence: number;
|
|
1571
|
+
readonly state: 'active' | 'partially-refunded' | 'revoked';
|
|
1572
|
+
readonly refundNumerator: number;
|
|
1573
|
+
readonly refundDenominator: number;
|
|
1574
|
+
readonly observedAt: number;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/** Borrowed transaction read only: no provider, nested transaction, seed, clock or mutation. */
|
|
1578
|
+
export declare interface IapRefundDispositionSource {
|
|
1579
|
+
readonly read: (tx: DataStore, original: IapSqlOriginalPurchase) => Promise<IapRefundDisposition | null>;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
declare interface IapRefundEventContext {
|
|
1583
|
+
readonly namespace: string;
|
|
1584
|
+
readonly tenantId: string;
|
|
1585
|
+
readonly subjectId: string;
|
|
1586
|
+
readonly payload: IapRefundEventPayload;
|
|
1587
|
+
/** Complete bounded accepted history; these are observations, never a fraud verdict. */
|
|
1588
|
+
readonly refundedOrders: number;
|
|
1589
|
+
readonly observedOrders: number;
|
|
1590
|
+
readonly refundAdjustments: number;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
declare type IapRefundEventPayload = typeof IapRefundEventPayloadSchema.Type;
|
|
1594
|
+
|
|
1595
|
+
declare const IapRefundEventPayloadSchema: Schema.Struct<{
|
|
1596
|
+
readonly eventId: Schema.String;
|
|
1597
|
+
readonly orderId: Schema.String;
|
|
1598
|
+
readonly sequence: Schema.Number;
|
|
1599
|
+
readonly state: Schema.Literals<readonly ["active", "partially-refunded", "revoked"]>;
|
|
1600
|
+
readonly refundNumerator: Schema.Number;
|
|
1601
|
+
readonly refundDenominator: Schema.Number;
|
|
1602
|
+
readonly observedAt: Schema.Number;
|
|
1603
|
+
}>;
|
|
1604
|
+
|
|
1605
|
+
declare interface IapRefundEventsService {
|
|
1606
|
+
readonly pending: (subject: Subject) => Effect.Effect<readonly PendingIapRefundEvent[], EconomyError>;
|
|
1607
|
+
readonly read: (subject: Subject, event: PendingIapRefundEvent) => Effect.Effect<IapRefundEventContext, EconomyError>;
|
|
1608
|
+
readonly acknowledge: (subject: Subject, event: PendingIapRefundEvent, deliveryVersion: string) => Effect.Effect<void, EconomyError>;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
declare interface IapRefundReceipt {
|
|
1612
|
+
readonly orderId: string;
|
|
1613
|
+
readonly sequence: number;
|
|
1614
|
+
readonly state: IapCurrentPurchaseState['state'];
|
|
1615
|
+
readonly refundNumerator: number;
|
|
1616
|
+
readonly refundDenominator: number;
|
|
1617
|
+
readonly observedAt: number;
|
|
1618
|
+
readonly noticeId: string;
|
|
1619
|
+
readonly fingerprint: string;
|
|
1620
|
+
readonly debtPolicy: IapDebtPolicy;
|
|
1621
|
+
readonly currencies: readonly IapRefundCurrency[];
|
|
1622
|
+
readonly transfers: readonly EconomyReceipt[];
|
|
1623
|
+
/** Opaque actual asset participant receipt, validated by its captured participant. */
|
|
1624
|
+
readonly assets: unknown;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
declare interface IapScope {
|
|
1628
|
+
readonly tenantId: string;
|
|
1629
|
+
readonly ownerId: string;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
declare interface IapService {
|
|
1633
|
+
readonly redeem: (subject: Subject, input: IapReceiptIntent) => Effect.Effect<IapOrderReceipt, EconomyError>;
|
|
1634
|
+
readonly receipt: (subject: Subject, input: IapReceiptReference) => Effect.Effect<IapOrderObservation, EconomyError>;
|
|
1635
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
1636
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
/** A real-money admission: app eligibility plus a monthly spend limit per owner over the
|
|
1640
|
+
* owner's accepted orders, checked in the purchase's own transaction. */
|
|
1641
|
+
export declare const iapSpendAdmission: (store: DataStore, input: IapSpendAdmissionOptions) => IapPurchaseAdmissionSource;
|
|
1642
|
+
|
|
1643
|
+
export declare interface IapSpendAdmissionOptions {
|
|
1644
|
+
/** The IAP system's `namespace`: whose accepted orders count towards the limit. */
|
|
1645
|
+
readonly namespace: string;
|
|
1646
|
+
/** Real money one owner may pay per UTC calendar month, per currency, in that currency's
|
|
1647
|
+
* provider units (`{ EUR: { units: '5000', scale: 2 } }` = 50.00 EUR). A purchase in a
|
|
1648
|
+
* currency without a limit, or without a paid amount, is refused. A later period of a
|
|
1649
|
+
* subscription the owner already holds is not limited (it still counts for other purchases). */
|
|
1650
|
+
readonly monthlyLimits: Readonly<Record<string, {
|
|
1651
|
+
readonly units: string;
|
|
1652
|
+
readonly scale: number;
|
|
1653
|
+
}>>;
|
|
1654
|
+
/** App eligibility (age gate, upgraded account, consent...), inside the purchase transaction
|
|
1655
|
+
* and once more before a web checkout starts. `false` refuses the purchase. */
|
|
1656
|
+
readonly eligible: (tx: DataStore, input: IapCheckoutAdmission) => Promise<boolean>;
|
|
1657
|
+
/** Accepted orders read per check; more refuses as the limit cannot be proven. Default 1000. */
|
|
1658
|
+
readonly maxOrdersPerMonth?: number;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
/** SQL original after the owning adapter has validated its immutable custody and receipt. */
|
|
1662
|
+
export declare interface IapSqlOriginalPurchase {
|
|
1663
|
+
readonly orderId: string;
|
|
1664
|
+
readonly scope: IapScope;
|
|
1665
|
+
readonly receipt: IapOrderReceipt;
|
|
1666
|
+
readonly product: IapProduct;
|
|
1667
|
+
readonly facts: IapTransactionFacts;
|
|
1668
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
export declare interface IapSqlService extends IapService {
|
|
1672
|
+
/** Complete owned accepted subscription periods. SQL reads only; never current provider status. */
|
|
1673
|
+
readonly subscriptionPeriods: (subject: Subject) => Effect.Effect<readonly IapSubscriptionPeriod[], EconomyError>;
|
|
1674
|
+
/** Server only: the provider's original transaction IDs (a Stripe subscription) of the owner's
|
|
1675
|
+
* accepted subscription orders on `channel`, newest period first. Never a player projection. */
|
|
1676
|
+
readonly subscriptionOriginals: (subject: Subject, channel: EconomyChannel) => Effect.Effect<readonly string[], EconomyError>;
|
|
1677
|
+
/** Actual original IAP/account/retained-notice SQL fences; joins the same-store financial mutation group. */
|
|
1678
|
+
readonly prepareCurrentState: (evidence: VerifiedIapCurrentState) => Effect.Effect<PreparedSqlMutation<IapCurrentPurchaseState>, EconomyError>;
|
|
1679
|
+
/** Trusted server declaration + authenticated notice; read accepted SQL, never seed or fulfill. */
|
|
1680
|
+
readonly prepareNotification: (options: IapNotificationTargetOptions, notice: VerifiedIapNotification) => Effect.Effect<AcceptedIapNotificationTarget, EconomyError>;
|
|
1681
|
+
/** Read accepted SQL original and issue a revalidated capability; no grant, clock or provider call. */
|
|
1682
|
+
readonly prepareCompletion: (subject: Subject, intent: Parameters<IapService['redeem']>[1]) => Effect.Effect<AcceptedIapCompletion, EconomyError>;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
export declare interface IapStoreOptions {
|
|
1686
|
+
readonly realMoney: boolean;
|
|
1687
|
+
/** Operator-owned immutable work/privacy namespace, never an RPC input. */
|
|
1688
|
+
readonly namespace: string;
|
|
1689
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
1690
|
+
readonly verification: Pick<IapVerificationService, 'verify'>;
|
|
1691
|
+
readonly admission: IapPurchaseAdmissionSource;
|
|
1692
|
+
readonly economy: Pick<EconomySqlService, 'prepareTransfer'>;
|
|
1693
|
+
readonly inventory?: Pick<InventorySqlService, 'prepareGrant'> | undefined;
|
|
1694
|
+
readonly refundDisposition?: IapRefundDispositionSource | undefined;
|
|
1695
|
+
readonly systemAccount: string;
|
|
1696
|
+
readonly maxHistoryRows?: number | undefined;
|
|
1697
|
+
readonly now?: (() => number) | undefined;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
export declare const iapSubjectsTable: Table<"_voltro_eco_iap_subjects", FieldDefinitions<{
|
|
1701
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1702
|
+
readonly namespace: ColumnBuilder<string, "text", boolean>;
|
|
1703
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1704
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
1705
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
1706
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
1707
|
+
readonly ordersCount: ColumnBuilder<number, "integer", boolean>;
|
|
1708
|
+
}>, true, never>;
|
|
1709
|
+
|
|
1710
|
+
/** An accepted store period, not a fresh provider observation or financial capability. */
|
|
1711
|
+
declare interface IapSubscriptionPeriod {
|
|
1712
|
+
readonly orderId: string;
|
|
1713
|
+
readonly offerId: string;
|
|
1714
|
+
readonly offerVersion: string;
|
|
1715
|
+
readonly channel: EconomyChannel;
|
|
1716
|
+
readonly startsAt: number;
|
|
1717
|
+
readonly expiresAt: number;
|
|
1718
|
+
readonly refund: IapRefundDisposition | null;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
export declare class IapSystemPort extends IapSystemPort_base {
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
declare const IapSystemPort_base: Context.ServiceClass<IapSystemPort, "@voltro/IapSystemPort", IapSystemService>;
|
|
1725
|
+
|
|
1726
|
+
/** Complete system replacement owns provider readiness, accounts, financial authority and privacy. */
|
|
1727
|
+
export declare interface IapSystemService extends IapService {
|
|
1728
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1729
|
+
readonly account: (subject: Subject, channel: EconomyChannel) => Effect.Effect<string, EconomyError>;
|
|
1730
|
+
/** Explicit retry of the same accepted original intent. Never redeems or grants. */
|
|
1731
|
+
readonly complete: (subject: Subject, intent: Parameters<IapService['redeem']>[1]) => Effect.Effect<IapCompletionReceipt, EconomyError>;
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
export declare const iapTables: readonly [ Table<"_voltro_eco_iap_namespaces", FieldDefinitions<{
|
|
1735
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1736
|
+
readonly namespace: ColumnBuilder<string, "text", boolean>;
|
|
1737
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
1738
|
+
readonly ordersCount: ColumnBuilder<number, "integer", boolean>;
|
|
1739
|
+
readonly receiptsCount: ColumnBuilder<number, "integer", boolean>;
|
|
1740
|
+
}>, true, never>, Table<"_voltro_eco_iap_subjects", FieldDefinitions<{
|
|
1741
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1742
|
+
readonly namespace: ColumnBuilder<string, "text", boolean>;
|
|
1743
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1744
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
1745
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
1746
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
1747
|
+
readonly ordersCount: ColumnBuilder<number, "integer", boolean>;
|
|
1748
|
+
}>, true, never>, Table<"_voltro_eco_iap_orders", FieldDefinitions<{
|
|
1749
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1750
|
+
readonly namespace: ColumnBuilder<string, "text", boolean>;
|
|
1751
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1752
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
1753
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
1754
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
1755
|
+
readonly accepted: ColumnBuilder<boolean, "boolean", boolean>;
|
|
1756
|
+
readonly offerId: ColumnBuilder<string, "text", boolean>;
|
|
1757
|
+
readonly acceptedQuantity: ColumnBuilder<number | null, "integer", boolean>;
|
|
1758
|
+
readonly acceptedDay: ColumnBuilder<number | null, "integer", boolean>;
|
|
1759
|
+
readonly offerVersion: ColumnBuilder<string, "text", boolean>;
|
|
1760
|
+
readonly channel: ColumnBuilder<"web" | "ios" | "android" | "steam", "text", boolean>;
|
|
1761
|
+
readonly configurationDigest: ColumnBuilder<string, "text", boolean>;
|
|
1762
|
+
readonly intentDigest: ColumnBuilder<string | null, "text", boolean>;
|
|
1763
|
+
readonly receiptKey: ColumnBuilder<string | null, "text", boolean>;
|
|
1764
|
+
readonly snapshot: ColumnBuilder<unknown, "json", boolean>;
|
|
1765
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
1766
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
1767
|
+
readonly fulfilledAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
1768
|
+
}>, true, never>, Table<"_voltro_eco_iap_receipts", FieldDefinitions<{
|
|
1769
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1770
|
+
readonly namespace: ColumnBuilder<string, "text", boolean>;
|
|
1771
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1772
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
1773
|
+
readonly orderKey: ColumnBuilder<string, "text", boolean>;
|
|
1774
|
+
readonly identity: ColumnBuilder<string, "text", boolean>;
|
|
1775
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
1776
|
+
readonly accepted: ColumnBuilder<boolean, "boolean", boolean>;
|
|
1777
|
+
readonly factsDigest: ColumnBuilder<string, "text", boolean>;
|
|
1778
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
1779
|
+
readonly fulfilledAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
1780
|
+
}>, true, never>];
|
|
1781
|
+
|
|
1782
|
+
declare interface IapTransactionFacts {
|
|
1783
|
+
readonly channel: EconomyChannel;
|
|
1784
|
+
readonly environment: IapEnvironment;
|
|
1785
|
+
readonly applicationId: string;
|
|
1786
|
+
readonly transactionId: string;
|
|
1787
|
+
readonly originalTransactionId: string | null;
|
|
1788
|
+
readonly storeProductId: string;
|
|
1789
|
+
readonly kind: IapProductKind;
|
|
1790
|
+
readonly quantity: number;
|
|
1791
|
+
readonly purchasedAt: number;
|
|
1792
|
+
readonly expiresAt: number | null;
|
|
1793
|
+
readonly paid: IapPaidAmount | null;
|
|
1794
|
+
readonly acknowledgement: 'none' | 'pending' | 'acknowledged';
|
|
1795
|
+
readonly consumption: 'none' | 'available' | 'consumed';
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
/** Trusted server replacement. It owns provider authenticity, fresh status and account binding. */
|
|
1799
|
+
export declare interface IapVerificationAuthority {
|
|
1800
|
+
/** Required provider setup/credential readiness; no permissive initialization fallback. */
|
|
1801
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1802
|
+
readonly verify: (context: IapVerificationContext) => Effect.Effect<IapTransactionFacts, EconomyError>;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
export declare interface IapVerificationContext {
|
|
1806
|
+
readonly scope: IapScope;
|
|
1807
|
+
readonly intent: IapReceiptIntent;
|
|
1808
|
+
readonly product: IapProduct;
|
|
1809
|
+
readonly accountToken: string;
|
|
1810
|
+
readonly at: number;
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
export declare interface IapVerificationOptions {
|
|
1814
|
+
readonly realMoney: boolean;
|
|
1815
|
+
readonly channel: EconomyChannel;
|
|
1816
|
+
readonly environment: IapEnvironment;
|
|
1817
|
+
readonly applicationId: string;
|
|
1818
|
+
readonly products: readonly IapProductDefinition[];
|
|
1819
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
1820
|
+
readonly accounts: IapAccountSource;
|
|
1821
|
+
readonly now?: (() => number) | undefined;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
export declare class IapVerificationPort extends IapVerificationPort_base {
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
/** Captures one deliberately trusted server authority; never call with player data. */
|
|
1828
|
+
export declare const iapVerificationPort: (input: IapVerificationOptions, authorityInput: IapVerificationAuthority) => IapVerificationService;
|
|
1829
|
+
|
|
1830
|
+
declare const IapVerificationPort_base: Context.ServiceClass<IapVerificationPort, "@voltro/IapVerificationPort", IapVerificationService>;
|
|
1831
|
+
|
|
1832
|
+
export declare interface IapVerificationService {
|
|
1833
|
+
readonly initialize: () => Effect.Effect<void, EconomyError>;
|
|
1834
|
+
readonly verify: (scope: IapScope, input: IapReceiptIntent) => Effect.Effect<VerifiedIapPurchase, EconomyError>;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
export declare interface IapWalletRefundInput {
|
|
1838
|
+
readonly requestId: string;
|
|
1839
|
+
readonly currency: string;
|
|
1840
|
+
readonly amount: string;
|
|
1841
|
+
readonly debtPolicy: IapDebtPolicy;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
export declare interface InventoryTradeAuthorityOptions {
|
|
1845
|
+
readonly permissions: TradePermissionSource;
|
|
1846
|
+
readonly inventory: Pick<InventorySqlService, 'mine' | 'reservationEvidence'>;
|
|
1847
|
+
readonly items: readonly ItemDefinition[];
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
/** Actual Inventory ownership and original reservation evidence plus mandatory
|
|
1851
|
+
* application policy. Asset writers still revalidate fresh stock and expiry in
|
|
1852
|
+
* the same SQL group. This installs no sanctions, consent records or new tables. */
|
|
1853
|
+
export declare const inventoryTradeAuthoritySource: (store: DataStore, input: InventoryTradeAuthorityOptions) => TradeAuthoritySource;
|
|
1854
|
+
|
|
1855
|
+
export declare const isIapRefundChannel: (value: unknown) => value is IapRefundChannel;
|
|
1856
|
+
|
|
1857
|
+
/** Internal authenticated adapters or validated encrypted SQL custody only. Deliberately absent from the public server entry. */
|
|
1858
|
+
export declare const issueVerifiedIapNotification: (notice: IapNotificationNotice, material: Readonly<Record<string, unknown>>, validate?: () => Effect.Effect<void, EconomyError>, prepare?: () => Effect.Effect<PreparedSqlMutation<unknown>, EconomyError>) => VerifiedIapNotification;
|
|
1859
|
+
|
|
1860
|
+
declare interface LedgerTransferInput {
|
|
1861
|
+
readonly tenantId: string;
|
|
1862
|
+
readonly requestId: string;
|
|
1863
|
+
readonly currency: string;
|
|
1864
|
+
readonly from: EconomyAccount;
|
|
1865
|
+
readonly to: EconomyAccount;
|
|
1866
|
+
readonly amount: EconomyAmountInput;
|
|
1867
|
+
readonly reason: string;
|
|
1868
|
+
readonly ref: EconomyReference;
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
declare interface Loyalty {
|
|
1872
|
+
readonly id: string;
|
|
1873
|
+
readonly version: string;
|
|
1874
|
+
readonly titleKey: string;
|
|
1875
|
+
readonly pointsFrom: readonly {
|
|
1876
|
+
readonly id: string;
|
|
1877
|
+
readonly kind: 'purchase.real' | 'purchase.virtual';
|
|
1878
|
+
readonly currency: string;
|
|
1879
|
+
readonly numerator: string;
|
|
1880
|
+
readonly denominator: string;
|
|
1881
|
+
}[];
|
|
1882
|
+
readonly tiers: readonly {
|
|
1883
|
+
readonly id: string;
|
|
1884
|
+
readonly at: string;
|
|
1885
|
+
readonly perks: readonly LoyaltyPerk[];
|
|
1886
|
+
}[];
|
|
1887
|
+
readonly decay: 'none' | 'seasonal';
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
/** Only trusted server callers name receipts. Amounts, weights, points, tiers
|
|
1891
|
+
* and seasons are never request fields. No player credit/reverse action. */
|
|
1892
|
+
declare interface LoyaltyCreditInput {
|
|
1893
|
+
readonly tenantId: string;
|
|
1894
|
+
readonly ownerId: string;
|
|
1895
|
+
readonly loyaltyId: string;
|
|
1896
|
+
readonly sourceId: string;
|
|
1897
|
+
readonly purchaseId: string;
|
|
1898
|
+
readonly requestId: string;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
declare interface LoyaltyDefinition {
|
|
1902
|
+
readonly id: string;
|
|
1903
|
+
readonly version?: string | undefined;
|
|
1904
|
+
readonly titleKey: string;
|
|
1905
|
+
readonly pointsFrom: readonly {
|
|
1906
|
+
readonly id: string;
|
|
1907
|
+
readonly kind: 'purchase.real' | 'purchase.virtual';
|
|
1908
|
+
readonly currency: string;
|
|
1909
|
+
readonly numerator: EconomyAmountInput;
|
|
1910
|
+
readonly denominator: EconomyAmountInput;
|
|
1911
|
+
}[];
|
|
1912
|
+
readonly tiers: readonly {
|
|
1913
|
+
readonly id: string;
|
|
1914
|
+
readonly at: EconomyAmountInput;
|
|
1915
|
+
readonly perks: readonly LoyaltyPerkDefinition[];
|
|
1916
|
+
}[];
|
|
1917
|
+
readonly decay?: 'none' | 'seasonal';
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
export declare const loyaltyDefinitionsTable: Table<"_voltro_eco_loyalty_definitions", FieldDefinitions<{
|
|
1921
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1922
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1923
|
+
readonly loyaltyId: ColumnBuilder<string, "text", boolean>;
|
|
1924
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
1925
|
+
readonly currencies: ColumnBuilder<unknown, "json", boolean>;
|
|
1926
|
+
readonly realMoney: ColumnBuilder<boolean, "boolean", boolean>;
|
|
1927
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
1928
|
+
}>, true, never>;
|
|
1929
|
+
|
|
1930
|
+
export declare const loyaltyEntriesTable: Table<"_voltro_eco_loyalty_entries", FieldDefinitions<{
|
|
1931
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
1932
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
1933
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
1934
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
1935
|
+
readonly loyaltyId: ColumnBuilder<string, "text", boolean>;
|
|
1936
|
+
readonly sequence: ColumnBuilder<number, "integer", boolean>;
|
|
1937
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled", "text", boolean>;
|
|
1938
|
+
readonly purchaseKey: ColumnBuilder<string, "text", boolean>;
|
|
1939
|
+
readonly refundKey: ColumnBuilder<string | null, "text", boolean>;
|
|
1940
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
1941
|
+
readonly body: ColumnBuilder<unknown, "json", boolean>;
|
|
1942
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
1943
|
+
}>, true, never>;
|
|
1944
|
+
|
|
1945
|
+
declare interface LoyaltyMineInput {
|
|
1946
|
+
readonly loyaltyId: string;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
declare type LoyaltyObservation = {
|
|
1950
|
+
readonly requestId: string;
|
|
1951
|
+
readonly state: 'not-observed';
|
|
1952
|
+
} | {
|
|
1953
|
+
readonly requestId: string;
|
|
1954
|
+
readonly state: 'fulfilled';
|
|
1955
|
+
readonly receipt: LoyaltyReceipt;
|
|
1956
|
+
};
|
|
1957
|
+
|
|
1958
|
+
declare type LoyaltyPerk = Exclude<LoyaltyPerkDefinition, {
|
|
1959
|
+
readonly kind: 'inboxGift';
|
|
1960
|
+
}> | {
|
|
1961
|
+
readonly id: string;
|
|
1962
|
+
readonly kind: 'inboxGift';
|
|
1963
|
+
readonly items: readonly ShopItemGrant[];
|
|
1964
|
+
readonly currencies: readonly {
|
|
1965
|
+
readonly currency: string;
|
|
1966
|
+
readonly amount: string;
|
|
1967
|
+
}[];
|
|
1968
|
+
};
|
|
1969
|
+
|
|
1970
|
+
declare type LoyaltyPerkDefinition = {
|
|
1971
|
+
readonly id: string;
|
|
1972
|
+
readonly kind: 'xpMultiplier';
|
|
1973
|
+
readonly bps: number;
|
|
1974
|
+
} | {
|
|
1975
|
+
readonly id: string;
|
|
1976
|
+
readonly kind: 'discount';
|
|
1977
|
+
readonly bps: number;
|
|
1978
|
+
} | {
|
|
1979
|
+
readonly id: string;
|
|
1980
|
+
readonly kind: 'chatBadge';
|
|
1981
|
+
readonly badgeId: string;
|
|
1982
|
+
} | {
|
|
1983
|
+
readonly id: string;
|
|
1984
|
+
readonly kind: 'inboxGift';
|
|
1985
|
+
readonly items?: readonly ShopItemGrant[] | undefined;
|
|
1986
|
+
readonly currencies?: readonly ShopCurrencyGrant[] | undefined;
|
|
1987
|
+
};
|
|
1988
|
+
|
|
1989
|
+
declare interface LoyaltyPerksContext extends LoyaltyTierContext {
|
|
1990
|
+
readonly tierId: string;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
declare type LoyaltyPerksResolver = (input: LoyaltyPerksContext) => readonly LoyaltyPerk[];
|
|
1994
|
+
|
|
1995
|
+
declare type LoyaltyPointEntry = {
|
|
1996
|
+
readonly id: string;
|
|
1997
|
+
readonly sequence: number;
|
|
1998
|
+
readonly kind: 'credit';
|
|
1999
|
+
readonly at: number;
|
|
2000
|
+
readonly sourceId: string;
|
|
2001
|
+
readonly purchaseId: string;
|
|
2002
|
+
readonly seasonId: string | null;
|
|
2003
|
+
readonly purchaseAmount: string;
|
|
2004
|
+
readonly numerator: string;
|
|
2005
|
+
readonly denominator: string;
|
|
2006
|
+
readonly delta: string;
|
|
2007
|
+
} | {
|
|
2008
|
+
readonly id: string;
|
|
2009
|
+
readonly sequence: number;
|
|
2010
|
+
readonly kind: 'reverse';
|
|
2011
|
+
readonly at: number;
|
|
2012
|
+
readonly originalId: string;
|
|
2013
|
+
readonly refundId: string;
|
|
2014
|
+
readonly seasonId: string | null;
|
|
2015
|
+
readonly totalRefunded: string;
|
|
2016
|
+
readonly delta: string;
|
|
2017
|
+
};
|
|
2018
|
+
|
|
2019
|
+
declare interface LoyaltyPointProjection {
|
|
2020
|
+
readonly entries: readonly LoyaltyPointEntry[];
|
|
2021
|
+
readonly balances: readonly {
|
|
2022
|
+
readonly seasonId: string | null;
|
|
2023
|
+
readonly points: string;
|
|
2024
|
+
}[];
|
|
2025
|
+
readonly credits: readonly {
|
|
2026
|
+
readonly id: string;
|
|
2027
|
+
readonly refundedAmount: string;
|
|
2028
|
+
readonly remainingPoints: string;
|
|
2029
|
+
}[];
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/** Receipt authority must use immutable accepted SQL/provider evidence, verify
|
|
2033
|
+
* ownership and canonical purchase identity independently of source aliases,
|
|
2034
|
+
* and refuse revoked/unsettled/already-refunded purchases. No player evidence. */
|
|
2035
|
+
export declare interface LoyaltyPurchaseEvidence {
|
|
2036
|
+
readonly tenantId: string;
|
|
2037
|
+
readonly ownerId: string;
|
|
2038
|
+
readonly authorityId: string;
|
|
2039
|
+
readonly purchaseId: string;
|
|
2040
|
+
readonly kind: 'purchase.real' | 'purchase.virtual';
|
|
2041
|
+
readonly currency: string;
|
|
2042
|
+
readonly amount: string;
|
|
2043
|
+
readonly settledAt: number;
|
|
2044
|
+
readonly refundedAmount: '0';
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
declare interface LoyaltyRebuildInput extends LoyaltyMineInput {
|
|
2048
|
+
readonly tenantId: string;
|
|
2049
|
+
readonly ownerId: string;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
declare interface LoyaltyReceipt {
|
|
2053
|
+
readonly operationId: string;
|
|
2054
|
+
readonly requestId: string;
|
|
2055
|
+
readonly loyaltyId: string;
|
|
2056
|
+
readonly entry: LoyaltyPointEntry;
|
|
2057
|
+
readonly points: string;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
declare interface LoyaltyReceiptInput {
|
|
2061
|
+
readonly requestId: string;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
export declare interface LoyaltyReceiptSource {
|
|
2065
|
+
readonly purchase: (input: {
|
|
2066
|
+
readonly tenantId: string;
|
|
2067
|
+
readonly ownerId: string;
|
|
2068
|
+
readonly source: Loyalty['pointsFrom'][number];
|
|
2069
|
+
readonly purchaseId: string;
|
|
2070
|
+
}) => Effect.Effect<LoyaltyPurchaseEvidence, EconomyError>;
|
|
2071
|
+
readonly refund: (input: {
|
|
2072
|
+
readonly tenantId: string;
|
|
2073
|
+
readonly ownerId: string;
|
|
2074
|
+
readonly purchase: LoyaltyPurchaseEvidence;
|
|
2075
|
+
readonly refundId: string;
|
|
2076
|
+
}) => Effect.Effect<LoyaltyRefundEvidence, EconomyError>;
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
export declare interface LoyaltyRefundEvidence {
|
|
2080
|
+
readonly tenantId: string;
|
|
2081
|
+
readonly ownerId: string;
|
|
2082
|
+
readonly authorityId: string;
|
|
2083
|
+
readonly purchaseId: string;
|
|
2084
|
+
readonly refundId: string;
|
|
2085
|
+
readonly totalRefunded: string;
|
|
2086
|
+
readonly refundedAt: number;
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
declare interface LoyaltyReverseInput {
|
|
2090
|
+
readonly tenantId: string;
|
|
2091
|
+
readonly ownerId: string;
|
|
2092
|
+
readonly loyaltyId: string;
|
|
2093
|
+
readonly originalId: string;
|
|
2094
|
+
readonly refundId: string;
|
|
2095
|
+
readonly requestId: string;
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
export declare interface LoyaltySeason {
|
|
2099
|
+
readonly id: string;
|
|
2100
|
+
readonly startsAt: number;
|
|
2101
|
+
readonly endsAt: number;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
export declare interface LoyaltySeasonSource {
|
|
2105
|
+
readonly read: (input: {
|
|
2106
|
+
readonly tenantId: string;
|
|
2107
|
+
readonly loyaltyId: string;
|
|
2108
|
+
readonly at: number;
|
|
2109
|
+
}) => Effect.Effect<LoyaltySeason, EconomyError>;
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
export declare const loyaltySeasonsTable: Table<"_voltro_eco_loyalty_seasons", FieldDefinitions<{
|
|
2113
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2114
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2115
|
+
readonly loyaltyId: ColumnBuilder<string, "text", boolean>;
|
|
2116
|
+
readonly seasonId: ColumnBuilder<string, "text", boolean>;
|
|
2117
|
+
readonly startsAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
2118
|
+
readonly endsAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
2119
|
+
}>, true, never>;
|
|
2120
|
+
|
|
2121
|
+
declare interface LoyaltyService {
|
|
2122
|
+
readonly list: (subject: Subject) => Effect.Effect<readonly Loyalty[], EconomyError>;
|
|
2123
|
+
readonly mine: (subject: Subject, input: LoyaltyMineInput) => Effect.Effect<LoyaltyState, EconomyError>;
|
|
2124
|
+
readonly credit: (subject: Subject, input: LoyaltyCreditInput) => Effect.Effect<LoyaltyReceipt, EconomyError>;
|
|
2125
|
+
readonly reverse: (subject: Subject, input: LoyaltyReverseInput) => Effect.Effect<LoyaltyReceipt, EconomyError>;
|
|
2126
|
+
readonly receipt: (subject: Subject, input: LoyaltyReceiptInput) => Effect.Effect<LoyaltyObservation, EconomyError>;
|
|
2127
|
+
readonly rebuild: (subject: Subject, input: LoyaltyRebuildInput) => Effect.Effect<LoyaltyPointProjection, EconomyError>;
|
|
2128
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
2129
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
declare interface LoyaltyState {
|
|
2133
|
+
readonly loyalty: Loyalty;
|
|
2134
|
+
readonly rulesVersion: string;
|
|
2135
|
+
readonly seasonId: string | null;
|
|
2136
|
+
readonly points: string;
|
|
2137
|
+
readonly tierId: string;
|
|
2138
|
+
readonly perks: readonly LoyaltyPerk[];
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
export declare interface LoyaltyStoreOptions {
|
|
2142
|
+
readonly loyalty: readonly (LoyaltyDefinition | Loyalty)[];
|
|
2143
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
2144
|
+
readonly realMoney?: boolean;
|
|
2145
|
+
readonly receiptSource: LoyaltyReceiptSource;
|
|
2146
|
+
readonly seasonSource?: LoyaltySeasonSource | undefined;
|
|
2147
|
+
readonly version: string;
|
|
2148
|
+
readonly tier?: LoyaltyTierResolver | undefined;
|
|
2149
|
+
readonly perks?: LoyaltyPerksResolver | undefined;
|
|
2150
|
+
readonly allowedServices?: readonly string[] | undefined;
|
|
2151
|
+
readonly maxHistoryRows?: number | undefined;
|
|
2152
|
+
readonly maxDefinitionRows?: number | undefined;
|
|
2153
|
+
readonly maxSeasonRows?: number | undefined;
|
|
2154
|
+
readonly now?: (() => number) | undefined;
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
export declare const loyaltySubjectsTable: Table<"_voltro_eco_loyalty_subjects", FieldDefinitions<{
|
|
2158
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2159
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2160
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
2161
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
2162
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2163
|
+
readonly entriesCount: ColumnBuilder<number, "integer", boolean>;
|
|
2164
|
+
}>, true, never>;
|
|
2165
|
+
|
|
2166
|
+
/** Shared immutable definitions/seasons survive subject erasure. */
|
|
2167
|
+
export declare const loyaltyTables: readonly [ Table<"_voltro_eco_loyalty_tenants", FieldDefinitions<{
|
|
2168
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2169
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2170
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2171
|
+
}>, true, never>, Table<"_voltro_eco_loyalty_definitions", FieldDefinitions<{
|
|
2172
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2173
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2174
|
+
readonly loyaltyId: ColumnBuilder<string, "text", boolean>;
|
|
2175
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
2176
|
+
readonly currencies: ColumnBuilder<unknown, "json", boolean>;
|
|
2177
|
+
readonly realMoney: ColumnBuilder<boolean, "boolean", boolean>;
|
|
2178
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
2179
|
+
}>, true, never>, Table<"_voltro_eco_loyalty_subjects", FieldDefinitions<{
|
|
2180
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2181
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2182
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
2183
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
2184
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2185
|
+
readonly entriesCount: ColumnBuilder<number, "integer", boolean>;
|
|
2186
|
+
}>, true, never>, Table<"_voltro_eco_loyalty_entries", FieldDefinitions<{
|
|
2187
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2188
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2189
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
2190
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
2191
|
+
readonly loyaltyId: ColumnBuilder<string, "text", boolean>;
|
|
2192
|
+
readonly sequence: ColumnBuilder<number, "integer", boolean>;
|
|
2193
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled", "text", boolean>;
|
|
2194
|
+
readonly purchaseKey: ColumnBuilder<string, "text", boolean>;
|
|
2195
|
+
readonly refundKey: ColumnBuilder<string | null, "text", boolean>;
|
|
2196
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
2197
|
+
readonly body: ColumnBuilder<unknown, "json", boolean>;
|
|
2198
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
2199
|
+
}>, true, never>, Table<"_voltro_eco_loyalty_seasons", FieldDefinitions<{
|
|
2200
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2201
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2202
|
+
readonly loyaltyId: ColumnBuilder<string, "text", boolean>;
|
|
2203
|
+
readonly seasonId: ColumnBuilder<string, "text", boolean>;
|
|
2204
|
+
readonly startsAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
2205
|
+
readonly endsAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
2206
|
+
}>, true, never>];
|
|
2207
|
+
|
|
2208
|
+
export declare const loyaltyTenantsTable: Table<"_voltro_eco_loyalty_tenants", FieldDefinitions<{
|
|
2209
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2210
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2211
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2212
|
+
}>, true, never>;
|
|
2213
|
+
|
|
2214
|
+
declare interface LoyaltyTierContext {
|
|
2215
|
+
readonly loyalty: Loyalty;
|
|
2216
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
2217
|
+
readonly realMoney?: boolean;
|
|
2218
|
+
readonly points: EconomyAmountInput;
|
|
2219
|
+
readonly rulesVersion?: string;
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
declare type LoyaltyTierResolver = (context: LoyaltyTierContext) => string;
|
|
2223
|
+
|
|
2224
|
+
/** Trusted server observation. No owner/raw push material, writes, grant or refund from this helper. */
|
|
2225
|
+
export declare const observeAcceptedIapNotificationTarget: (target: AcceptedIapNotificationTarget) => Effect.Effect<IapAcceptedNotificationObservation, EconomyError>;
|
|
2226
|
+
|
|
2227
|
+
/** Actual pending SQL event authority. Copies and serialized payloads cannot authorize delivery acknowledgement. */
|
|
2228
|
+
declare interface PendingIapRefundEvent {
|
|
2229
|
+
readonly [refundEvent]: true;
|
|
2230
|
+
readonly eventId: string;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
declare interface PiggyBank {
|
|
2234
|
+
readonly id: string;
|
|
2235
|
+
readonly version: string;
|
|
2236
|
+
readonly titleKey: string;
|
|
2237
|
+
readonly currency: string;
|
|
2238
|
+
readonly cap: string;
|
|
2239
|
+
readonly unlock: Price;
|
|
2240
|
+
readonly fillFrom: readonly string[];
|
|
2241
|
+
readonly reset: 'onUnlock';
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
declare interface PiggyBankDefinition {
|
|
2245
|
+
readonly id: string;
|
|
2246
|
+
readonly version?: string | undefined;
|
|
2247
|
+
readonly titleKey: string;
|
|
2248
|
+
readonly currency: string;
|
|
2249
|
+
readonly cap: EconomyAmountInput;
|
|
2250
|
+
readonly unlock: PriceDefinition;
|
|
2251
|
+
readonly fillFrom: readonly string[];
|
|
2252
|
+
readonly reset?: 'onUnlock' | undefined;
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
export declare const piggyBankDigest: (bank: PiggyBank, version: string) => string;
|
|
2256
|
+
|
|
2257
|
+
declare interface PiggyBanksService {
|
|
2258
|
+
readonly list: (subject: Subject) => Effect.Effect<readonly PiggyView[], EconomyError>;
|
|
2259
|
+
readonly fill: (subject: Subject, input: PiggyFillInput) => Effect.Effect<PiggyReceipt, EconomyError>;
|
|
2260
|
+
readonly unlock: (subject: Subject, input: PiggyUnlockInput) => Effect.Effect<PiggyReceipt, EconomyError>;
|
|
2261
|
+
readonly receipt: (subject: Subject, input: {
|
|
2262
|
+
readonly requestId: string;
|
|
2263
|
+
}) => Effect.Effect<PiggyObservation, EconomyError>;
|
|
2264
|
+
readonly rebuild: (subject: Subject, input: {
|
|
2265
|
+
readonly tenantId: string;
|
|
2266
|
+
readonly ownerId: string;
|
|
2267
|
+
readonly bankId: string;
|
|
2268
|
+
}) => Effect.Effect<PiggyProjection, EconomyError>;
|
|
2269
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
2270
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
export declare const piggyDefinitionsTable: Table<"_voltro_eco_piggy_definitions", FieldDefinitions<{
|
|
2274
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2275
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2276
|
+
readonly bankId: ColumnBuilder<string, "text", boolean>;
|
|
2277
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
2278
|
+
readonly currencies: ColumnBuilder<unknown, "json", boolean>;
|
|
2279
|
+
readonly realMoney: ColumnBuilder<boolean, "boolean", boolean>;
|
|
2280
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
2281
|
+
}>, true, never>;
|
|
2282
|
+
|
|
2283
|
+
declare type PiggyEvent = {
|
|
2284
|
+
readonly id: string;
|
|
2285
|
+
readonly sequence: number;
|
|
2286
|
+
readonly kind: 'fill';
|
|
2287
|
+
readonly at: number;
|
|
2288
|
+
readonly authorityId: string;
|
|
2289
|
+
readonly eventId: string;
|
|
2290
|
+
readonly sourceId: string;
|
|
2291
|
+
readonly acceptedAmount: string;
|
|
2292
|
+
readonly delta: string;
|
|
2293
|
+
} | {
|
|
2294
|
+
readonly id: string;
|
|
2295
|
+
readonly sequence: number;
|
|
2296
|
+
readonly kind: 'unlock';
|
|
2297
|
+
readonly at: number;
|
|
2298
|
+
readonly amount: string;
|
|
2299
|
+
readonly remaining: string;
|
|
2300
|
+
};
|
|
2301
|
+
|
|
2302
|
+
export declare const piggyEventsTable: Table<"_voltro_eco_piggy_events", FieldDefinitions<{
|
|
2303
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2304
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2305
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
2306
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
2307
|
+
readonly sequence: ColumnBuilder<number, "integer", boolean>;
|
|
2308
|
+
readonly bankId: ColumnBuilder<string, "text", boolean>;
|
|
2309
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled", "text", boolean>;
|
|
2310
|
+
readonly eventKey: ColumnBuilder<string | null, "text", boolean>;
|
|
2311
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
2312
|
+
readonly body: ColumnBuilder<unknown, "json", boolean>;
|
|
2313
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
2314
|
+
}>, true, never>;
|
|
2315
|
+
|
|
2316
|
+
declare interface PiggyFillContext extends PiggyRuleContext {
|
|
2317
|
+
readonly acceptedAmount: EconomyAmountInput;
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
export declare interface PiggyFillEvidence {
|
|
2321
|
+
readonly tenantId: string;
|
|
2322
|
+
readonly ownerId: string;
|
|
2323
|
+
readonly authorityId: string;
|
|
2324
|
+
readonly eventId: string;
|
|
2325
|
+
readonly sourceId: string;
|
|
2326
|
+
readonly amount: string;
|
|
2327
|
+
readonly acceptedAt: number;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
declare interface PiggyFillInput {
|
|
2331
|
+
readonly tenantId: string;
|
|
2332
|
+
readonly ownerId: string;
|
|
2333
|
+
readonly bankId: string;
|
|
2334
|
+
readonly sourceId: string;
|
|
2335
|
+
readonly eventId: string;
|
|
2336
|
+
readonly requestId: string;
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
declare type PiggyFillPolicy = (context: PiggyFillContext) => EconomyAmountInput;
|
|
2340
|
+
|
|
2341
|
+
/** Actual accepted server events only. Canonical authority/event identity must
|
|
2342
|
+
* stay independent of aliases and be scoped/verified by the application's
|
|
2343
|
+
* authoritative event source. No player match result or amount is accepted. */
|
|
2344
|
+
export declare interface PiggyFillSource {
|
|
2345
|
+
readonly read: (input: {
|
|
2346
|
+
readonly tenantId: string;
|
|
2347
|
+
readonly ownerId: string;
|
|
2348
|
+
readonly bank: PiggyBank;
|
|
2349
|
+
readonly sourceId: string;
|
|
2350
|
+
readonly eventId: string;
|
|
2351
|
+
}) => Effect.Effect<PiggyFillEvidence, EconomyError>;
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
declare type PiggyObservation = {
|
|
2355
|
+
readonly requestId: string;
|
|
2356
|
+
readonly state: 'not-observed';
|
|
2357
|
+
} | {
|
|
2358
|
+
readonly requestId: string;
|
|
2359
|
+
readonly state: 'fulfilled';
|
|
2360
|
+
readonly receipt: PiggyReceipt;
|
|
2361
|
+
};
|
|
2362
|
+
|
|
2363
|
+
declare interface PiggyProjection {
|
|
2364
|
+
readonly events: readonly PiggyEvent[];
|
|
2365
|
+
readonly available: string;
|
|
2366
|
+
readonly cycles: number;
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
declare type PiggyReceipt = {
|
|
2370
|
+
readonly operationId: string;
|
|
2371
|
+
readonly requestId: string;
|
|
2372
|
+
readonly bankId: string;
|
|
2373
|
+
readonly event: Extract<PiggyEvent, {
|
|
2374
|
+
kind: 'fill';
|
|
2375
|
+
}>;
|
|
2376
|
+
readonly available: string;
|
|
2377
|
+
} | {
|
|
2378
|
+
readonly operationId: string;
|
|
2379
|
+
readonly requestId: string;
|
|
2380
|
+
readonly bankId: string;
|
|
2381
|
+
readonly event: Extract<PiggyEvent, {
|
|
2382
|
+
kind: 'unlock';
|
|
2383
|
+
}>;
|
|
2384
|
+
readonly available: string;
|
|
2385
|
+
readonly value: ShopOrderReceipt;
|
|
2386
|
+
};
|
|
2387
|
+
|
|
2388
|
+
declare type PiggyResetPolicy = (context: PiggyRuleContext) => EconomyAmountInput;
|
|
2389
|
+
|
|
2390
|
+
declare interface PiggyRuleContext {
|
|
2391
|
+
readonly bank: PiggyBank;
|
|
2392
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
2393
|
+
readonly realMoney?: boolean;
|
|
2394
|
+
readonly available: EconomyAmountInput;
|
|
2395
|
+
readonly rulesVersion?: string;
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
export declare interface PiggyStoreOptions {
|
|
2399
|
+
readonly banks: readonly (PiggyBankDefinition | PiggyBank)[];
|
|
2400
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
2401
|
+
readonly realMoney?: boolean;
|
|
2402
|
+
readonly economy: Pick<EconomySqlService, 'prepareTransfer'>;
|
|
2403
|
+
readonly fillSource: PiggyFillSource;
|
|
2404
|
+
readonly unlockSource: PiggyUnlockSource;
|
|
2405
|
+
readonly version: string;
|
|
2406
|
+
readonly fill?: PiggyFillPolicy | undefined;
|
|
2407
|
+
readonly reset?: PiggyResetPolicy | undefined;
|
|
2408
|
+
readonly priceResolver?: PriceResolver | undefined;
|
|
2409
|
+
readonly systemAccount?: string | undefined;
|
|
2410
|
+
readonly allowedServices?: readonly string[] | undefined;
|
|
2411
|
+
readonly maxHistoryRows?: number | undefined;
|
|
2412
|
+
readonly now?: (() => number) | undefined;
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
export declare const piggySubjectsTable: Table<"_voltro_eco_piggy_subjects", FieldDefinitions<{
|
|
2416
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2417
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2418
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
2419
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
2420
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2421
|
+
readonly entriesCount: ColumnBuilder<number, "integer", boolean>;
|
|
2422
|
+
}>, true, never>;
|
|
2423
|
+
|
|
2424
|
+
export declare const piggyTables: readonly [ Table<"_voltro_eco_piggy_tenants", FieldDefinitions<{
|
|
2425
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2426
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2427
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2428
|
+
}>, true, never>, Table<"_voltro_eco_piggy_definitions", FieldDefinitions<{
|
|
2429
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2430
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2431
|
+
readonly bankId: ColumnBuilder<string, "text", boolean>;
|
|
2432
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
2433
|
+
readonly currencies: ColumnBuilder<unknown, "json", boolean>;
|
|
2434
|
+
readonly realMoney: ColumnBuilder<boolean, "boolean", boolean>;
|
|
2435
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
2436
|
+
}>, true, never>, Table<"_voltro_eco_piggy_subjects", FieldDefinitions<{
|
|
2437
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2438
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2439
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
2440
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
2441
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2442
|
+
readonly entriesCount: ColumnBuilder<number, "integer", boolean>;
|
|
2443
|
+
}>, true, never>, Table<"_voltro_eco_piggy_events", FieldDefinitions<{
|
|
2444
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2445
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2446
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
2447
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
2448
|
+
readonly sequence: ColumnBuilder<number, "integer", boolean>;
|
|
2449
|
+
readonly bankId: ColumnBuilder<string, "text", boolean>;
|
|
2450
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled", "text", boolean>;
|
|
2451
|
+
readonly eventKey: ColumnBuilder<string | null, "text", boolean>;
|
|
2452
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
2453
|
+
readonly body: ColumnBuilder<unknown, "json", boolean>;
|
|
2454
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
2455
|
+
}>, true, never>];
|
|
2456
|
+
|
|
2457
|
+
export declare const piggyTenantsTable: Table<"_voltro_eco_piggy_tenants", FieldDefinitions<{
|
|
2458
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2459
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2460
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2461
|
+
}>, true, never>;
|
|
2462
|
+
|
|
2463
|
+
declare interface PiggyUnlockInput {
|
|
2464
|
+
readonly bankId: string;
|
|
2465
|
+
readonly bankVersion: string;
|
|
2466
|
+
readonly bankDigest: string;
|
|
2467
|
+
readonly requestId: string;
|
|
2468
|
+
readonly currency?: string | undefined;
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
export declare interface PiggyUnlockSource {
|
|
2472
|
+
readonly read: (input: {
|
|
2473
|
+
readonly subject: Subject;
|
|
2474
|
+
readonly bank: PiggyBank;
|
|
2475
|
+
readonly at: number;
|
|
2476
|
+
}) => Effect.Effect<{
|
|
2477
|
+
readonly eligible: boolean;
|
|
2478
|
+
readonly adjustments: readonly VirtualPriceAdjustment[];
|
|
2479
|
+
}, EconomyError>;
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
declare interface PiggyView {
|
|
2483
|
+
readonly bank: PiggyBank;
|
|
2484
|
+
readonly bankDigest: string;
|
|
2485
|
+
readonly available: string;
|
|
2486
|
+
readonly cycles: number;
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
declare type Price = {
|
|
2490
|
+
readonly kind: 'virtual';
|
|
2491
|
+
readonly options: readonly ResolvedVirtualPriceOption[];
|
|
2492
|
+
} | ({
|
|
2493
|
+
readonly kind: 'real';
|
|
2494
|
+
} & RealPriceDefinition) | {
|
|
2495
|
+
readonly kind: 'mixed';
|
|
2496
|
+
readonly real: RealPriceDefinition;
|
|
2497
|
+
readonly virtual: readonly ResolvedVirtualPriceOption[];
|
|
2498
|
+
} | {
|
|
2499
|
+
readonly kind: 'free';
|
|
2500
|
+
};
|
|
2501
|
+
|
|
2502
|
+
declare type PriceDefinition = {
|
|
2503
|
+
readonly kind: 'virtual';
|
|
2504
|
+
readonly options: readonly VirtualPriceOption[];
|
|
2505
|
+
} | ({
|
|
2506
|
+
readonly kind: 'real';
|
|
2507
|
+
} & RealPriceDefinition) | {
|
|
2508
|
+
readonly kind: 'mixed';
|
|
2509
|
+
readonly real: RealPriceDefinition;
|
|
2510
|
+
readonly virtual: readonly VirtualPriceOption[];
|
|
2511
|
+
} | {
|
|
2512
|
+
readonly kind: 'free';
|
|
2513
|
+
};
|
|
2514
|
+
|
|
2515
|
+
declare type PriceResolver = (context: PriceResolverContext) => Price;
|
|
2516
|
+
|
|
2517
|
+
declare interface PriceResolverContext {
|
|
2518
|
+
readonly price: Price;
|
|
2519
|
+
readonly currencies: readonly ResolvedCurrency[];
|
|
2520
|
+
readonly realMoney: boolean;
|
|
2521
|
+
readonly adjustments: readonly Readonly<{
|
|
2522
|
+
currency: string;
|
|
2523
|
+
discountBps: number;
|
|
2524
|
+
minimum: string;
|
|
2525
|
+
}>[];
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
declare interface PromoCode {
|
|
2529
|
+
readonly id: string;
|
|
2530
|
+
readonly version: string;
|
|
2531
|
+
readonly campaign: string;
|
|
2532
|
+
readonly items: readonly {
|
|
2533
|
+
readonly itemId: string;
|
|
2534
|
+
readonly qty: number;
|
|
2535
|
+
}[];
|
|
2536
|
+
readonly currencies: readonly {
|
|
2537
|
+
readonly currency: string;
|
|
2538
|
+
readonly amount: string;
|
|
2539
|
+
}[];
|
|
2540
|
+
readonly from: number | null;
|
|
2541
|
+
readonly until: number | null;
|
|
2542
|
+
readonly limits: {
|
|
2543
|
+
readonly global: number;
|
|
2544
|
+
readonly perPlayer: number;
|
|
2545
|
+
};
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
/** SQL is the only input. Bounded whole work refuses a prefix; no repair, backend fallback or timer. */
|
|
2549
|
+
export declare const readEconomyFlows: (store: DataStore, input: EconomyReportOptions) => Effect.Effect<readonly EconomyFlowRow[], EconomyError>;
|
|
2550
|
+
|
|
2551
|
+
declare interface RealPriceDefinition {
|
|
2552
|
+
/** Integer minor-unit references; verified store receipts remain authoritative. */
|
|
2553
|
+
readonly prices: Readonly<Record<string, number>>;
|
|
2554
|
+
readonly storeProductIds: Partial<Readonly<Record<EconomyChannel, string>>>;
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
declare interface RedeemCodeInput {
|
|
2558
|
+
readonly code: string;
|
|
2559
|
+
readonly requestId: string;
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
declare const refundEvent: unique symbol;
|
|
2563
|
+
|
|
2564
|
+
/** Ordinary authoritative SQL only. Prepared wallet/item units are the actual
|
|
2565
|
+
* existing writers, combined into one exact-store commit; never a Room tick. */
|
|
2566
|
+
export declare const resolveCodeStoreOptions: (input: CodeStoreOptions) => Readonly<{
|
|
2567
|
+
currencies: readonly ResolvedCurrency[];
|
|
2568
|
+
economy: Pick<EconomySqlService, "prepareTransfer">;
|
|
2569
|
+
inventory: Pick<InventorySqlService, "prepareGrant"> | undefined;
|
|
2570
|
+
systemAccount: string;
|
|
2571
|
+
allowedServices: readonly string[];
|
|
2572
|
+
maxHistoryRows: number;
|
|
2573
|
+
now: () => number;
|
|
2574
|
+
eligibility: CodeEligibility;
|
|
2575
|
+
version: string;
|
|
2576
|
+
}>;
|
|
2577
|
+
|
|
2578
|
+
export declare const resolveContainersStoreOptions: (input: ContainersStoreOptions) => Readonly<{
|
|
2579
|
+
containers: readonly Container[];
|
|
2580
|
+
currencies: readonly ResolvedCurrency[];
|
|
2581
|
+
realMoney: boolean;
|
|
2582
|
+
economy: Pick<EconomySqlService, "prepareTransfer">;
|
|
2583
|
+
inventory: Pick<InventorySqlService, "prepareGrant"> | undefined;
|
|
2584
|
+
accessSource: ContainerAccessSource;
|
|
2585
|
+
random: ContainerRandomService;
|
|
2586
|
+
version: string;
|
|
2587
|
+
probability: ContainerProbabilityResolver;
|
|
2588
|
+
roll: ContainerRollResolver;
|
|
2589
|
+
eligibility: ContainerEligibility;
|
|
2590
|
+
priceResolver: PriceResolver;
|
|
2591
|
+
systemAccount: string;
|
|
2592
|
+
maxHistoryRows: number;
|
|
2593
|
+
now: () => number;
|
|
2594
|
+
}>;
|
|
2595
|
+
|
|
2596
|
+
declare interface ResolvedCurrency {
|
|
2597
|
+
readonly id: string;
|
|
2598
|
+
readonly kind: 'soft' | 'hard';
|
|
2599
|
+
readonly cap: string;
|
|
2600
|
+
readonly premium: boolean;
|
|
2601
|
+
readonly display: {
|
|
2602
|
+
readonly nameKey: string;
|
|
2603
|
+
} | null;
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
declare interface ResolvedVirtualPriceOption {
|
|
2607
|
+
readonly currency: string;
|
|
2608
|
+
readonly amount: string;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
export declare const resolveEconomyStoreOptions: (input: EconomyStoreOptions) => Readonly<{
|
|
2612
|
+
currencies: readonly ResolvedCurrency[];
|
|
2613
|
+
allowedServices: readonly string[];
|
|
2614
|
+
maxLedgerRows: number;
|
|
2615
|
+
maxExportRows: number;
|
|
2616
|
+
now: () => number;
|
|
2617
|
+
spendLimits: Readonly<{
|
|
2618
|
+
limits: readonly SpendLimit[];
|
|
2619
|
+
source: SpendFactsSource;
|
|
2620
|
+
version: string;
|
|
2621
|
+
policy: SpendLimitPolicy;
|
|
2622
|
+
}> | undefined;
|
|
2623
|
+
}>;
|
|
2624
|
+
|
|
2625
|
+
export declare const resolveIapStoreOptions: (input: IapStoreOptions) => Readonly<{
|
|
2626
|
+
namespace: string;
|
|
2627
|
+
currencies: readonly ResolvedCurrency[];
|
|
2628
|
+
verification: Pick<IapVerificationService, "verify">;
|
|
2629
|
+
admission: IapPurchaseAdmissionSource;
|
|
2630
|
+
economy: Pick<EconomySqlService, "prepareTransfer">;
|
|
2631
|
+
inventory: Pick<InventorySqlService, "prepareGrant"> | undefined;
|
|
2632
|
+
refundDisposition: IapRefundDispositionSource | undefined;
|
|
2633
|
+
systemAccount: string;
|
|
2634
|
+
maxHistoryRows: number;
|
|
2635
|
+
now: () => number;
|
|
2636
|
+
}>;
|
|
2637
|
+
|
|
2638
|
+
export declare const resolveLoyaltyStoreOptions: (input: LoyaltyStoreOptions) => Readonly<{
|
|
2639
|
+
loyalty: readonly Loyalty[];
|
|
2640
|
+
currencies: readonly ResolvedCurrency[];
|
|
2641
|
+
realMoney: boolean;
|
|
2642
|
+
receiptSource: LoyaltyReceiptSource;
|
|
2643
|
+
seasonSource: LoyaltySeasonSource | undefined;
|
|
2644
|
+
version: string;
|
|
2645
|
+
tier: LoyaltyTierResolver;
|
|
2646
|
+
perks: LoyaltyPerksResolver;
|
|
2647
|
+
now: () => number;
|
|
2648
|
+
allowedServices: readonly string[];
|
|
2649
|
+
maxHistoryRows: number;
|
|
2650
|
+
maxDefinitionRows: number;
|
|
2651
|
+
maxSeasonRows: number;
|
|
2652
|
+
}>;
|
|
2653
|
+
|
|
2654
|
+
export declare const resolvePiggyStoreOptions: (input: PiggyStoreOptions) => Readonly<{
|
|
2655
|
+
banks: readonly PiggyBank[];
|
|
2656
|
+
currencies: readonly ResolvedCurrency[];
|
|
2657
|
+
realMoney: boolean;
|
|
2658
|
+
economy: Pick<EconomySqlService, "prepareTransfer">;
|
|
2659
|
+
fillSource: PiggyFillSource;
|
|
2660
|
+
unlockSource: PiggyUnlockSource;
|
|
2661
|
+
version: string;
|
|
2662
|
+
fill: PiggyFillPolicy;
|
|
2663
|
+
reset: PiggyResetPolicy;
|
|
2664
|
+
priceResolver: PriceResolver;
|
|
2665
|
+
now: () => number;
|
|
2666
|
+
allowedServices: readonly string[];
|
|
2667
|
+
systemAccount: string;
|
|
2668
|
+
maxHistoryRows: number;
|
|
2669
|
+
}>;
|
|
2670
|
+
|
|
2671
|
+
export declare const resolveShopStoreOptions: (input: ShopStoreOptions) => Readonly<{
|
|
2672
|
+
offers: readonly ShopOffer[];
|
|
2673
|
+
currencies: readonly ResolvedCurrency[];
|
|
2674
|
+
realMoney: boolean;
|
|
2675
|
+
priceResolver: PriceResolver;
|
|
2676
|
+
version: string;
|
|
2677
|
+
contextSource: ShopContextSource | undefined;
|
|
2678
|
+
economy: Readonly<{
|
|
2679
|
+
prepareTransfer: (subject: Subject, input: LedgerTransferInput) => Effect.Effect<PreparedSqlMutation< EconomyReceipt>, EconomyError>;
|
|
2680
|
+
}>;
|
|
2681
|
+
inventory: Readonly<{
|
|
2682
|
+
prepareGrant: (subject: Subject, input: InventoryGrant) => Effect.Effect<PreparedSqlMutation< InventoryReceipt>, InventoryError>;
|
|
2683
|
+
}> | undefined;
|
|
2684
|
+
systemAccount: string;
|
|
2685
|
+
maxOrders: number;
|
|
2686
|
+
maxAuditRows: number;
|
|
2687
|
+
now: () => number;
|
|
2688
|
+
}>;
|
|
2689
|
+
|
|
2690
|
+
export declare const resolveSubscriptionsStoreOptions: (input: SubscriptionsStoreOptions) => Readonly<{
|
|
2691
|
+
subscriptions: readonly Subscription[];
|
|
2692
|
+
currencies: readonly ResolvedCurrency[];
|
|
2693
|
+
realMoney: boolean;
|
|
2694
|
+
economy: Pick<EconomySqlService, "prepareTransfer">;
|
|
2695
|
+
inventory: Pick<InventorySqlService, "prepareGrant"> | undefined;
|
|
2696
|
+
accessSource: SubscriptionAccessSource;
|
|
2697
|
+
version: string;
|
|
2698
|
+
period: SubscriptionPeriodResolver;
|
|
2699
|
+
daily: SubscriptionDailyGrantPolicy;
|
|
2700
|
+
priceResolver: PriceResolver;
|
|
2701
|
+
now: () => number;
|
|
2702
|
+
systemAccount: string;
|
|
2703
|
+
maxHistoryRows: number;
|
|
2704
|
+
}>;
|
|
2705
|
+
|
|
2706
|
+
/** Sampling only, ordinary server boundary. No payment, grant, persisted pity or
|
|
2707
|
+
* player route; caller must atomically accept this result in its owned journal. */
|
|
2708
|
+
export declare const sampleContainer: (input: ContainerProbabilityContext, probability?: ContainerProbabilityResolver, roll?: ContainerRollResolver) => Effect.Effect<Readonly<{
|
|
2709
|
+
drop: ContainerDrop;
|
|
2710
|
+
misses: number;
|
|
2711
|
+
distribution: ContainerDistribution;
|
|
2712
|
+
}>, EconomyError, ContainerRandomPort>;
|
|
2713
|
+
|
|
2714
|
+
/** Uses the actual server-only Sanctions capability, never separate sanction
|
|
2715
|
+
* table reads or synthesized trust. Additional app consent gates must compose
|
|
2716
|
+
* their own prepared SQL unit; this adapter establishes sanctions alone. */
|
|
2717
|
+
export declare const sanctionsTradePermissionSource: (store: DataStore, input: SanctionsSqlAdmissionService) => TradePermissionSource;
|
|
2718
|
+
|
|
2719
|
+
export declare interface ShopAudit {
|
|
2720
|
+
readonly matches: boolean;
|
|
2721
|
+
readonly acceptedOrders: number;
|
|
2722
|
+
readonly counters: number;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
export declare interface ShopBundleValueInput {
|
|
2726
|
+
readonly at: number;
|
|
2727
|
+
readonly bundlePrice: Price;
|
|
2728
|
+
readonly originals: readonly ShopBuyInput[];
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
export declare interface ShopBundleValueOptions {
|
|
2732
|
+
readonly shop: Pick<ShopService, 'receipt'>;
|
|
2733
|
+
readonly bundle: Bundle;
|
|
2734
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
2735
|
+
readonly realMoney?: boolean;
|
|
2736
|
+
readonly version: string;
|
|
2737
|
+
readonly maxPriceAgeMs: number;
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
declare interface ShopBuyInput {
|
|
2741
|
+
readonly offerId: string;
|
|
2742
|
+
readonly offerVersion: string;
|
|
2743
|
+
readonly offerDigest: string;
|
|
2744
|
+
readonly requestId: string;
|
|
2745
|
+
readonly currency?: string | undefined;
|
|
2746
|
+
readonly qty?: number | undefined;
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
declare interface ShopContextInput {
|
|
2750
|
+
readonly subject: Subject;
|
|
2751
|
+
readonly offer: ShopOffer;
|
|
2752
|
+
readonly at: number;
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
declare interface ShopContextSnapshot {
|
|
2756
|
+
readonly eligible: boolean;
|
|
2757
|
+
readonly adjustments: readonly VirtualPriceAdjustment[];
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
/** Trusted external profile/segment/flag facts; never inside a replayable SQL callback. */
|
|
2761
|
+
declare interface ShopContextSource {
|
|
2762
|
+
readonly read: (input: ShopContextInput) => Effect.Effect<ShopContextSnapshot, EconomyError>;
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
export declare const shopCountersTable: Table<"_voltro_eco_shop_counters", FieldDefinitions<{
|
|
2766
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2767
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2768
|
+
readonly offerId: ColumnBuilder<string, "text", boolean>;
|
|
2769
|
+
readonly scope: ColumnBuilder<"day" | "global" | "player", "text", boolean>;
|
|
2770
|
+
readonly ownerKey: ColumnBuilder<string | null, "text", boolean>;
|
|
2771
|
+
readonly day: ColumnBuilder<number | null, "integer", boolean>;
|
|
2772
|
+
readonly units: ColumnBuilder<number, "integer", boolean>;
|
|
2773
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2774
|
+
}>, true, never>;
|
|
2775
|
+
|
|
2776
|
+
declare interface ShopCurrencyGrant {
|
|
2777
|
+
readonly currency: string;
|
|
2778
|
+
readonly amount: EconomyAmountInput;
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
declare interface ShopItemGrant {
|
|
2782
|
+
readonly itemId: string;
|
|
2783
|
+
readonly qty: number;
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
/** Default SQL Shop receipt authority. Reads the real historical original through
|
|
2787
|
+
* its owning service; never trusts a submitted amount or a configured price.
|
|
2788
|
+
* Shop has no refund writer here: callers must supply an actual verified refund
|
|
2789
|
+
* source to enable reversals. Omission refuses, never invents a refund. This is
|
|
2790
|
+
* not a cross-system transaction or an automatic purchase event consumer. */
|
|
2791
|
+
export declare const shopLoyaltyReceiptSource: (store: DataStore, input: {
|
|
2792
|
+
readonly shop: Pick<ShopService, "receipt">;
|
|
2793
|
+
readonly refunds?: {
|
|
2794
|
+
readonly read: LoyaltyReceiptSource["refund"];
|
|
2795
|
+
};
|
|
2796
|
+
}) => LoyaltyReceiptSource;
|
|
2797
|
+
|
|
2798
|
+
declare interface ShopOffer {
|
|
2799
|
+
readonly id: string;
|
|
2800
|
+
readonly version: string;
|
|
2801
|
+
readonly titleKey: string;
|
|
2802
|
+
readonly price: Price;
|
|
2803
|
+
readonly items: readonly ShopItemGrant[];
|
|
2804
|
+
readonly currencies: readonly {
|
|
2805
|
+
readonly currency: string;
|
|
2806
|
+
readonly amount: string;
|
|
2807
|
+
}[];
|
|
2808
|
+
readonly from: number | null;
|
|
2809
|
+
readonly until: number | null;
|
|
2810
|
+
readonly segment: string | null;
|
|
2811
|
+
readonly flag: string | null;
|
|
2812
|
+
readonly countries: readonly string[];
|
|
2813
|
+
readonly limits: {
|
|
2814
|
+
readonly perPlayer: number | null;
|
|
2815
|
+
readonly perDay: number | null;
|
|
2816
|
+
readonly global: number | null;
|
|
2817
|
+
};
|
|
2818
|
+
readonly oneTime: boolean;
|
|
2819
|
+
readonly maxQuantity: number;
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2822
|
+
declare interface ShopOfferDefinition {
|
|
2823
|
+
readonly id: string;
|
|
2824
|
+
readonly version?: string | undefined;
|
|
2825
|
+
readonly titleKey: string;
|
|
2826
|
+
readonly price: PriceDefinition;
|
|
2827
|
+
readonly items?: readonly ShopItemGrant[] | undefined;
|
|
2828
|
+
readonly currencies?: readonly ShopCurrencyGrant[] | undefined;
|
|
2829
|
+
readonly from?: number | null | undefined;
|
|
2830
|
+
readonly until?: number | null | undefined;
|
|
2831
|
+
readonly segment?: string | null | undefined;
|
|
2832
|
+
readonly flag?: string | null | undefined;
|
|
2833
|
+
readonly countries?: readonly string[] | undefined;
|
|
2834
|
+
readonly limits?: {
|
|
2835
|
+
readonly perPlayer?: number | null | undefined;
|
|
2836
|
+
readonly perDay?: number | null | undefined;
|
|
2837
|
+
readonly global?: number | null | undefined;
|
|
2838
|
+
} | undefined;
|
|
2839
|
+
readonly oneTime?: boolean | undefined;
|
|
2840
|
+
readonly maxQuantity?: number | undefined;
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
/** Server-owned immutable declaration/rule identity, reused by query, buy and fixtures. */
|
|
2844
|
+
export declare const shopOfferDigest: (offer: ShopOffer, rulesVersion: string) => string;
|
|
2845
|
+
|
|
2846
|
+
export declare const shopOffersTable: Table<"_voltro_eco_offers", FieldDefinitions<{
|
|
2847
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2848
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2849
|
+
readonly offerId: ColumnBuilder<string, "text", boolean>;
|
|
2850
|
+
readonly version: ColumnBuilder<string, "text", boolean>;
|
|
2851
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
2852
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
2853
|
+
}>, true, never>;
|
|
2854
|
+
|
|
2855
|
+
declare interface ShopOfferView {
|
|
2856
|
+
readonly offerDigest: string;
|
|
2857
|
+
readonly offer: ShopOffer;
|
|
2858
|
+
readonly price: Price;
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
declare interface ShopOrderReceipt {
|
|
2862
|
+
readonly orderId: string;
|
|
2863
|
+
readonly offerId: string;
|
|
2864
|
+
readonly offerVersion: string;
|
|
2865
|
+
readonly offerDigest: string;
|
|
2866
|
+
readonly quantity: number;
|
|
2867
|
+
readonly at: number;
|
|
2868
|
+
readonly pricePaid: {
|
|
2869
|
+
readonly kind: 'free';
|
|
2870
|
+
} | {
|
|
2871
|
+
readonly kind: 'virtual';
|
|
2872
|
+
readonly currency: string;
|
|
2873
|
+
readonly amount: string;
|
|
2874
|
+
};
|
|
2875
|
+
readonly transfers: readonly {
|
|
2876
|
+
readonly txId: string;
|
|
2877
|
+
readonly currency: string;
|
|
2878
|
+
readonly amount: string;
|
|
2879
|
+
readonly at: number;
|
|
2880
|
+
}[];
|
|
2881
|
+
readonly grants: readonly {
|
|
2882
|
+
readonly operationId: string;
|
|
2883
|
+
readonly kind: 'grant';
|
|
2884
|
+
readonly changes: readonly {
|
|
2885
|
+
readonly instanceId: string;
|
|
2886
|
+
readonly delta: number;
|
|
2887
|
+
}[];
|
|
2888
|
+
readonly at: number;
|
|
2889
|
+
}[];
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
export declare const shopOrdersTable: Table<"_voltro_eco_orders", FieldDefinitions<{
|
|
2893
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2894
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2895
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
2896
|
+
readonly ownerKey: ColumnBuilder<string | null, "text", boolean>;
|
|
2897
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
2898
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
2899
|
+
readonly intent: ColumnBuilder<unknown, "json", boolean>;
|
|
2900
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
2901
|
+
readonly acceptedQty: ColumnBuilder<number | null, "integer", boolean>;
|
|
2902
|
+
readonly counterKeys: ColumnBuilder<unknown, "json", boolean>;
|
|
2903
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2904
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
2905
|
+
readonly fulfilledAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
2906
|
+
}>, true, never>;
|
|
2907
|
+
|
|
2908
|
+
/** Nonterminal observations never authorize a new request identity or prove that no purchase can commit. */
|
|
2909
|
+
declare type ShopPurchaseObservation = {
|
|
2910
|
+
readonly requestId: string;
|
|
2911
|
+
readonly state: 'not-observed' | 'pending';
|
|
2912
|
+
} | {
|
|
2913
|
+
readonly requestId: string;
|
|
2914
|
+
readonly state: 'fulfilled';
|
|
2915
|
+
readonly receipt: ShopOrderReceipt;
|
|
2916
|
+
};
|
|
2917
|
+
|
|
2918
|
+
declare interface ShopRules {
|
|
2919
|
+
readonly offers: readonly (ShopOfferDefinition | ShopOffer)[];
|
|
2920
|
+
readonly priceResolver?: PriceResolver | undefined;
|
|
2921
|
+
readonly contextSource?: ShopContextSource | undefined;
|
|
2922
|
+
readonly version?: string | undefined;
|
|
2923
|
+
readonly systemAccount?: string | undefined;
|
|
2924
|
+
readonly maxOrders?: number | undefined;
|
|
2925
|
+
readonly maxAuditRows?: number | undefined;
|
|
2926
|
+
readonly now?: (() => number) | undefined;
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
declare interface ShopService {
|
|
2930
|
+
readonly offers: (subject: Subject) => Effect.Effect<readonly ShopOfferView[], EconomyError>;
|
|
2931
|
+
readonly buy: (subject: Subject, input: ShopBuyInput) => Effect.Effect<ShopOrderReceipt, EconomyError>;
|
|
2932
|
+
readonly receipt: (subject: Subject, input: ShopBuyInput) => Effect.Effect<ShopPurchaseObservation, EconomyError>;
|
|
2933
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
2934
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
export declare interface ShopSqlService extends ShopService {
|
|
2938
|
+
readonly auditShop: (subject: Subject, tenantId: string) => Effect.Effect<ShopAudit, EconomyError>;
|
|
2939
|
+
readonly rebuildShop: (subject: Subject, tenantId: string) => Effect.Effect<ShopAudit, EconomyError>;
|
|
2940
|
+
}
|
|
2941
|
+
|
|
2942
|
+
export declare interface ShopStoreOptions extends ShopRules {
|
|
2943
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
2944
|
+
readonly realMoney?: boolean;
|
|
2945
|
+
readonly economy: Pick<EconomySqlService, 'prepareTransfer'>;
|
|
2946
|
+
readonly inventory?: Pick<InventorySqlService, 'prepareGrant'> | undefined;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
export declare const shopSubjectsTable: Table<"_voltro_eco_shop_subjects", FieldDefinitions<{
|
|
2950
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2951
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2952
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
2953
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
2954
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2955
|
+
}>, true, never>;
|
|
2956
|
+
|
|
2957
|
+
export declare const shopTables: readonly [ Table<"_voltro_eco_shop_tenants", FieldDefinitions<{
|
|
2958
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2959
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2960
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2961
|
+
}>, true, never>, Table<"_voltro_eco_shop_subjects", FieldDefinitions<{
|
|
2962
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2963
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2964
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
2965
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
2966
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2967
|
+
}>, true, never>, Table<"_voltro_eco_offers", FieldDefinitions<{
|
|
2968
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2969
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2970
|
+
readonly offerId: ColumnBuilder<string, "text", boolean>;
|
|
2971
|
+
readonly version: ColumnBuilder<string, "text", boolean>;
|
|
2972
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
2973
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
2974
|
+
}>, true, never>, Table<"_voltro_eco_orders", FieldDefinitions<{
|
|
2975
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2976
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2977
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
2978
|
+
readonly ownerKey: ColumnBuilder<string | null, "text", boolean>;
|
|
2979
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
2980
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
2981
|
+
readonly intent: ColumnBuilder<unknown, "json", boolean>;
|
|
2982
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
2983
|
+
readonly acceptedQty: ColumnBuilder<number | null, "integer", boolean>;
|
|
2984
|
+
readonly counterKeys: ColumnBuilder<unknown, "json", boolean>;
|
|
2985
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2986
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
2987
|
+
readonly fulfilledAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
2988
|
+
}>, true, never>, Table<"_voltro_eco_shop_counters", FieldDefinitions<{
|
|
2989
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
2990
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
2991
|
+
readonly offerId: ColumnBuilder<string, "text", boolean>;
|
|
2992
|
+
readonly scope: ColumnBuilder<"day" | "global" | "player", "text", boolean>;
|
|
2993
|
+
readonly ownerKey: ColumnBuilder<string | null, "text", boolean>;
|
|
2994
|
+
readonly day: ColumnBuilder<number | null, "integer", boolean>;
|
|
2995
|
+
readonly units: ColumnBuilder<number, "integer", boolean>;
|
|
2996
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
2997
|
+
}>, true, never>];
|
|
2998
|
+
|
|
2999
|
+
export declare const shopTenantsTable: Table<"_voltro_eco_shop_tenants", FieldDefinitions<{
|
|
3000
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3001
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3002
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3003
|
+
}>, true, never>;
|
|
3004
|
+
|
|
3005
|
+
declare interface SpendBudget {
|
|
3006
|
+
readonly daily: string | null;
|
|
3007
|
+
readonly monthly: string | null;
|
|
3008
|
+
readonly allowed: boolean;
|
|
3009
|
+
}
|
|
3010
|
+
|
|
3011
|
+
declare interface SpendFacts extends SpendFactsInput {
|
|
3012
|
+
readonly allowed: boolean;
|
|
3013
|
+
readonly minor: boolean;
|
|
3014
|
+
readonly observedAt: number;
|
|
3015
|
+
readonly daily?: EconomyAmountInput | null | undefined;
|
|
3016
|
+
readonly monthly?: EconomyAmountInput | null;
|
|
3017
|
+
readonly blockedUntil?: number | null;
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
declare interface SpendFactsInput {
|
|
3021
|
+
readonly tenantId: string;
|
|
3022
|
+
readonly ownerId: string;
|
|
3023
|
+
readonly ownerKind: 'player' | 'guild';
|
|
3024
|
+
readonly currency: string;
|
|
3025
|
+
readonly at: number;
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
declare interface SpendFactsSource {
|
|
3029
|
+
readonly read: (input: SpendFactsInput) => Effect.Effect<SpendFacts, EconomyError>;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
declare interface SpendLimit {
|
|
3033
|
+
readonly currency: string;
|
|
3034
|
+
readonly daily: string | null;
|
|
3035
|
+
readonly monthly: string | null;
|
|
3036
|
+
readonly minors: {
|
|
3037
|
+
readonly daily: string | null;
|
|
3038
|
+
readonly monthly: string | null;
|
|
3039
|
+
} | null;
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
declare interface SpendLimitContext {
|
|
3043
|
+
readonly limit: SpendLimit;
|
|
3044
|
+
readonly facts: SpendFacts;
|
|
3045
|
+
readonly version: string;
|
|
3046
|
+
}
|
|
3047
|
+
|
|
3048
|
+
declare interface SpendLimitDefinition {
|
|
3049
|
+
readonly currency: string;
|
|
3050
|
+
readonly daily?: EconomyAmountInput | null | undefined;
|
|
3051
|
+
readonly monthly?: EconomyAmountInput | null;
|
|
3052
|
+
readonly minors?: {
|
|
3053
|
+
readonly daily?: EconomyAmountInput | null | undefined;
|
|
3054
|
+
readonly monthly?: EconomyAmountInput | null;
|
|
3055
|
+
};
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
declare type SpendLimitPolicy = (input: SpendLimitContext) => SpendBudget;
|
|
3059
|
+
|
|
3060
|
+
declare interface SpendLimitsOptions {
|
|
3061
|
+
readonly limits: readonly (SpendLimitDefinition | SpendLimit)[];
|
|
3062
|
+
readonly source: SpendFactsSource;
|
|
3063
|
+
readonly version: string;
|
|
3064
|
+
readonly policy?: SpendLimitPolicy;
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
declare interface Subscription {
|
|
3068
|
+
readonly id: string;
|
|
3069
|
+
readonly version: string;
|
|
3070
|
+
readonly titleKey: string;
|
|
3071
|
+
readonly price: Price;
|
|
3072
|
+
readonly period: Readonly<{
|
|
3073
|
+
unit: 'day' | 'week' | 'month';
|
|
3074
|
+
count: number;
|
|
3075
|
+
}>;
|
|
3076
|
+
readonly grants: Readonly<{
|
|
3077
|
+
onPurchase: SubscriptionGift;
|
|
3078
|
+
daily: SubscriptionGift;
|
|
3079
|
+
}>;
|
|
3080
|
+
readonly graceDays: number;
|
|
3081
|
+
readonly coolingOff: Readonly<{
|
|
3082
|
+
days: number;
|
|
3083
|
+
overrideReason: string | null;
|
|
3084
|
+
}>;
|
|
3085
|
+
readonly disclosure: Readonly<{
|
|
3086
|
+
durationKey: string;
|
|
3087
|
+
renewalKey: string;
|
|
3088
|
+
cancellationPath: string;
|
|
3089
|
+
}>;
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
/** Consent and eligibility are application authority, never inferred from a
|
|
3093
|
+
* price declaration or a player boolean. No automatic provider acquisition. */
|
|
3094
|
+
export declare interface SubscriptionAccessSource {
|
|
3095
|
+
readonly read: (input: {
|
|
3096
|
+
readonly tenantId: string;
|
|
3097
|
+
readonly ownerId: string;
|
|
3098
|
+
readonly subscription: Subscription;
|
|
3099
|
+
readonly at: number;
|
|
3100
|
+
readonly kind: 'start' | 'renew';
|
|
3101
|
+
}) => Effect.Effect<{
|
|
3102
|
+
readonly eligible: boolean;
|
|
3103
|
+
readonly renewalConsent: boolean;
|
|
3104
|
+
readonly adjustments: readonly VirtualPriceAdjustment[];
|
|
3105
|
+
}, EconomyError>;
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
declare interface SubscriptionActiveView {
|
|
3109
|
+
readonly entitlementId: string;
|
|
3110
|
+
readonly subscription: Subscription;
|
|
3111
|
+
readonly subscriptionDigest: string;
|
|
3112
|
+
readonly originAt: number;
|
|
3113
|
+
readonly periodIndex: number;
|
|
3114
|
+
readonly window: SubscriptionEntitlement;
|
|
3115
|
+
readonly currency: string | null;
|
|
3116
|
+
readonly renews: boolean;
|
|
3117
|
+
readonly cancelledAt: number | null;
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
declare interface SubscriptionCancelInput {
|
|
3121
|
+
readonly entitlementId: string;
|
|
3122
|
+
readonly requestId: string;
|
|
3123
|
+
}
|
|
3124
|
+
|
|
3125
|
+
declare interface SubscriptionCancellationReceipt {
|
|
3126
|
+
readonly operationId: string;
|
|
3127
|
+
readonly entitlementId: string;
|
|
3128
|
+
readonly at: number;
|
|
3129
|
+
readonly renews: false;
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
declare interface SubscriptionDailyContext {
|
|
3133
|
+
readonly entitlement: SubscriptionEntitlement;
|
|
3134
|
+
readonly at: number;
|
|
3135
|
+
readonly claimedDays: readonly number[];
|
|
3136
|
+
readonly rulesVersion?: string;
|
|
3137
|
+
}
|
|
3138
|
+
|
|
3139
|
+
declare type SubscriptionDailyGrantPolicy = (input: SubscriptionDailyContext) => boolean;
|
|
3140
|
+
|
|
3141
|
+
declare interface SubscriptionDailyInput {
|
|
3142
|
+
readonly entitlementId: string;
|
|
3143
|
+
readonly requestId: string;
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
declare interface SubscriptionDefinition {
|
|
3147
|
+
readonly id: string;
|
|
3148
|
+
readonly version?: string | undefined;
|
|
3149
|
+
readonly titleKey: string;
|
|
3150
|
+
readonly price: PriceDefinition;
|
|
3151
|
+
readonly period: {
|
|
3152
|
+
readonly unit: 'day' | 'week' | 'month';
|
|
3153
|
+
readonly count: number;
|
|
3154
|
+
};
|
|
3155
|
+
readonly grants: {
|
|
3156
|
+
readonly onPurchase?: SubscriptionGiftDefinition;
|
|
3157
|
+
readonly daily?: SubscriptionGiftDefinition | undefined;
|
|
3158
|
+
};
|
|
3159
|
+
readonly graceDays?: number;
|
|
3160
|
+
readonly coolingOff?: {
|
|
3161
|
+
readonly days: number;
|
|
3162
|
+
readonly overrideReason?: string | null;
|
|
3163
|
+
};
|
|
3164
|
+
readonly disclosure: {
|
|
3165
|
+
readonly durationKey: string;
|
|
3166
|
+
readonly renewalKey: string;
|
|
3167
|
+
readonly cancellationPath: string;
|
|
3168
|
+
};
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
export declare const subscriptionDefinitionDigest: (subscription: Subscription, version: string) => string;
|
|
3172
|
+
|
|
3173
|
+
export declare const subscriptionDefinitionsTable: Table<"_voltro_eco_subscriptions", FieldDefinitions<{
|
|
3174
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3175
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3176
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
3177
|
+
readonly currencies: ColumnBuilder<unknown, "json", boolean>;
|
|
3178
|
+
readonly realMoney: ColumnBuilder<boolean, "boolean", boolean>;
|
|
3179
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
3180
|
+
}>, true, never>;
|
|
3181
|
+
|
|
3182
|
+
declare interface SubscriptionEntitlement {
|
|
3183
|
+
readonly startsAt: number;
|
|
3184
|
+
readonly expiresAt: number;
|
|
3185
|
+
readonly graceUntil: number;
|
|
3186
|
+
readonly state: 'active' | 'grace' | 'expired';
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3189
|
+
export declare const subscriptionEventsTable: Table<"_voltro_eco_subscription_events", FieldDefinitions<{
|
|
3190
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3191
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3192
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
3193
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
3194
|
+
readonly sequence: ColumnBuilder<number, "integer", boolean>;
|
|
3195
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled", "text", boolean>;
|
|
3196
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
3197
|
+
readonly body: ColumnBuilder<unknown, "json", boolean>;
|
|
3198
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
3199
|
+
}>, true, never>;
|
|
3200
|
+
|
|
3201
|
+
declare interface SubscriptionGift {
|
|
3202
|
+
readonly items: ShopOffer['items'];
|
|
3203
|
+
readonly currencies: ShopOffer['currencies'];
|
|
3204
|
+
}
|
|
3205
|
+
|
|
3206
|
+
declare interface SubscriptionGiftDefinition {
|
|
3207
|
+
readonly items?: ShopOfferDefinition['items'] | undefined;
|
|
3208
|
+
readonly currencies?: ShopOfferDefinition['currencies'] | undefined;
|
|
3209
|
+
}
|
|
3210
|
+
|
|
3211
|
+
declare type SubscriptionObservation = {
|
|
3212
|
+
readonly requestId: string;
|
|
3213
|
+
readonly state: 'not-observed';
|
|
3214
|
+
} | {
|
|
3215
|
+
readonly requestId: string;
|
|
3216
|
+
readonly state: 'fulfilled';
|
|
3217
|
+
readonly receipt: SubscriptionValueReceipt | SubscriptionCancellationReceipt;
|
|
3218
|
+
};
|
|
3219
|
+
|
|
3220
|
+
declare interface SubscriptionPeriodContext {
|
|
3221
|
+
readonly subscription: Subscription;
|
|
3222
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
3223
|
+
readonly realMoney?: boolean;
|
|
3224
|
+
readonly originAt: number;
|
|
3225
|
+
readonly index: number;
|
|
3226
|
+
readonly rulesVersion?: string;
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
declare type SubscriptionPeriodResolver = (input: SubscriptionPeriodContext) => SubscriptionWindow;
|
|
3230
|
+
|
|
3231
|
+
declare type SubscriptionReceiptInput = {
|
|
3232
|
+
readonly kind: 'start';
|
|
3233
|
+
readonly intent: SubscriptionStartInput;
|
|
3234
|
+
} | {
|
|
3235
|
+
readonly kind: 'renew' | 'daily' | 'cancel';
|
|
3236
|
+
readonly intent: SubscriptionDailyInput;
|
|
3237
|
+
};
|
|
3238
|
+
|
|
3239
|
+
declare interface SubscriptionRenewInput {
|
|
3240
|
+
readonly tenantId: string;
|
|
3241
|
+
readonly ownerId: string;
|
|
3242
|
+
readonly entitlementId: string;
|
|
3243
|
+
readonly requestId: string;
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
/** Renew is a trusted server intention. Implementations must deny players and
|
|
3247
|
+
* enforce one accepted renewal per entitlement/period independently of nonce.
|
|
3248
|
+
* Calendar/daily strategies alone cannot establish durable idempotency. */
|
|
3249
|
+
declare interface SubscriptionsService {
|
|
3250
|
+
readonly list: (subject: Subject) => Effect.Effect<readonly SubscriptionView[], EconomyError>;
|
|
3251
|
+
readonly active: (subject: Subject) => Effect.Effect<readonly SubscriptionActiveView[], EconomyError>;
|
|
3252
|
+
readonly start: (subject: Subject, input: SubscriptionStartInput) => Effect.Effect<SubscriptionValueReceipt, EconomyError>;
|
|
3253
|
+
readonly renew: (subject: Subject, input: SubscriptionRenewInput) => Effect.Effect<SubscriptionValueReceipt, EconomyError>;
|
|
3254
|
+
readonly claimDaily: (subject: Subject, input: SubscriptionDailyInput) => Effect.Effect<SubscriptionValueReceipt, EconomyError>;
|
|
3255
|
+
readonly cancel: (subject: Subject, input: SubscriptionCancelInput) => Effect.Effect<SubscriptionCancellationReceipt, EconomyError>;
|
|
3256
|
+
readonly receipt: (subject: Subject, input: SubscriptionReceiptInput) => Effect.Effect<SubscriptionObservation, EconomyError>;
|
|
3257
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
3258
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3261
|
+
export declare interface SubscriptionsStoreOptions {
|
|
3262
|
+
readonly subscriptions: readonly (SubscriptionDefinition | Subscription)[];
|
|
3263
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
3264
|
+
readonly realMoney?: boolean;
|
|
3265
|
+
readonly economy: Pick<EconomySqlService, 'prepareTransfer'>;
|
|
3266
|
+
readonly inventory?: Pick<InventorySqlService, 'prepareGrant'> | undefined;
|
|
3267
|
+
readonly accessSource: SubscriptionAccessSource;
|
|
3268
|
+
readonly version: string;
|
|
3269
|
+
readonly period?: SubscriptionPeriodResolver | undefined;
|
|
3270
|
+
readonly daily?: SubscriptionDailyGrantPolicy | undefined;
|
|
3271
|
+
readonly priceResolver?: PriceResolver | undefined;
|
|
3272
|
+
readonly systemAccount?: string | undefined;
|
|
3273
|
+
readonly maxHistoryRows?: number | undefined;
|
|
3274
|
+
readonly now?: (() => number) | undefined;
|
|
3275
|
+
}
|
|
3276
|
+
|
|
3277
|
+
/** Player intentions contain observed identities, never charge amounts, dates,
|
|
3278
|
+
* provider receipts, claimed days, entitlement state or renewal authority. */
|
|
3279
|
+
declare interface SubscriptionStartInput {
|
|
3280
|
+
readonly subscriptionId: string;
|
|
3281
|
+
readonly subscriptionVersion: string;
|
|
3282
|
+
readonly subscriptionDigest: string;
|
|
3283
|
+
readonly requestId: string;
|
|
3284
|
+
readonly currency?: string | undefined;
|
|
3285
|
+
}
|
|
3286
|
+
|
|
3287
|
+
export declare const subscriptionSubjectsTable: Table<"_voltro_eco_subscription_subjects", FieldDefinitions<{
|
|
3288
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3289
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3290
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
3291
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
3292
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3293
|
+
}>, true, never>;
|
|
3294
|
+
|
|
3295
|
+
export declare const subscriptionTables: readonly [ Table<"_voltro_eco_subscription_tenants", FieldDefinitions<{
|
|
3296
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3297
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3298
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3299
|
+
}>, true, never>, Table<"_voltro_eco_subscriptions", FieldDefinitions<{
|
|
3300
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3301
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3302
|
+
readonly definition: ColumnBuilder<unknown, "json", boolean>;
|
|
3303
|
+
readonly currencies: ColumnBuilder<unknown, "json", boolean>;
|
|
3304
|
+
readonly realMoney: ColumnBuilder<boolean, "boolean", boolean>;
|
|
3305
|
+
readonly rulesVersion: ColumnBuilder<string, "text", boolean>;
|
|
3306
|
+
}>, true, never>, Table<"_voltro_eco_subscription_subjects", FieldDefinitions<{
|
|
3307
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3308
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3309
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
3310
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
3311
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3312
|
+
}>, true, never>, Table<"_voltro_eco_subscription_events", FieldDefinitions<{
|
|
3313
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3314
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3315
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
3316
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
3317
|
+
readonly sequence: ColumnBuilder<number, "integer", boolean>;
|
|
3318
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled", "text", boolean>;
|
|
3319
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
3320
|
+
readonly body: ColumnBuilder<unknown, "json", boolean>;
|
|
3321
|
+
readonly createdAt: ColumnBuilder<Date, "timestamp", boolean>;
|
|
3322
|
+
}>, true, never>];
|
|
3323
|
+
|
|
3324
|
+
export declare const subscriptionTenantsTable: Table<"_voltro_eco_subscription_tenants", FieldDefinitions<{
|
|
3325
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3326
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3327
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3328
|
+
}>, true, never>;
|
|
3329
|
+
|
|
3330
|
+
declare interface SubscriptionValueReceipt {
|
|
3331
|
+
readonly operationId: string;
|
|
3332
|
+
readonly entitlementId: string;
|
|
3333
|
+
readonly kind: 'start' | 'renew' | 'daily';
|
|
3334
|
+
readonly at: number;
|
|
3335
|
+
readonly periodIndex: number;
|
|
3336
|
+
readonly day: number | null;
|
|
3337
|
+
readonly window: SubscriptionEntitlement;
|
|
3338
|
+
readonly value: ShopOrderReceipt;
|
|
3339
|
+
}
|
|
3340
|
+
|
|
3341
|
+
declare interface SubscriptionView {
|
|
3342
|
+
readonly subscription: Subscription;
|
|
3343
|
+
readonly subscriptionDigest: string;
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3346
|
+
declare interface SubscriptionWindow {
|
|
3347
|
+
readonly startsAt: number;
|
|
3348
|
+
readonly expiresAt: number;
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
declare interface TradeAcceptInput {
|
|
3352
|
+
readonly tradeId: string;
|
|
3353
|
+
readonly tradeDigest: string;
|
|
3354
|
+
readonly requestId: string;
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
export declare interface TradeAuthorityAdmission {
|
|
3358
|
+
readonly tenantId: string;
|
|
3359
|
+
readonly tradeId: string;
|
|
3360
|
+
readonly phase: 'propose' | 'accept';
|
|
3361
|
+
readonly at: number;
|
|
3362
|
+
readonly expiresAt: number;
|
|
3363
|
+
readonly participants: readonly TradeParticipantAuthority[];
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
export declare interface TradeAuthorityReadInput {
|
|
3367
|
+
readonly tenantId: string;
|
|
3368
|
+
readonly ownerId: string;
|
|
3369
|
+
readonly tradeId: string;
|
|
3370
|
+
readonly at: number;
|
|
3371
|
+
}
|
|
3372
|
+
|
|
3373
|
+
/** Required real trust/sanctions facts plus an exact-store SQL revalidation unit.
|
|
3374
|
+
* Read/prepare execute outside replayable SQL. The unit owns admission fences;
|
|
3375
|
+
* no default permission, trust score or revoked-consent behavior is fabricated. */
|
|
3376
|
+
export declare interface TradeAuthoritySource {
|
|
3377
|
+
readonly read: (input: {
|
|
3378
|
+
readonly tenantId: string;
|
|
3379
|
+
readonly ownerId: string;
|
|
3380
|
+
readonly tradeId: string;
|
|
3381
|
+
readonly at: number;
|
|
3382
|
+
}) => Effect.Effect<TradeParticipantAuthority, EconomyError>;
|
|
3383
|
+
readonly prepare: (input: TradeAuthorityAdmission) => Effect.Effect<PreparedSqlMutation<void>, EconomyError>;
|
|
3384
|
+
}
|
|
3385
|
+
|
|
3386
|
+
declare interface TradeCurrencyIntention {
|
|
3387
|
+
readonly currency: string;
|
|
3388
|
+
readonly amount: EconomyAmountInput;
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
declare interface TradeEligibilityContext {
|
|
3392
|
+
readonly tenantId: string;
|
|
3393
|
+
readonly proposerId: string;
|
|
3394
|
+
readonly accepterId: string;
|
|
3395
|
+
readonly tradeId: string;
|
|
3396
|
+
readonly proposedToId: string | null;
|
|
3397
|
+
readonly createdAt: number;
|
|
3398
|
+
readonly at: number;
|
|
3399
|
+
readonly expiresAt: number;
|
|
3400
|
+
readonly rules: TradeRules;
|
|
3401
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
3402
|
+
readonly offered: TradeLeg;
|
|
3403
|
+
readonly requested: TradeLeg;
|
|
3404
|
+
readonly proposer: TradeParticipantAuthority;
|
|
3405
|
+
readonly accepter: TradeParticipantAuthority;
|
|
3406
|
+
}
|
|
3407
|
+
|
|
3408
|
+
declare type TradeEligibilityPolicy = (input: TradeEligibilityContext) => boolean;
|
|
3409
|
+
|
|
3410
|
+
export declare interface TradeEscrowExchangeInput extends TradeEscrowTerms {
|
|
3411
|
+
readonly accepterId: string;
|
|
3412
|
+
}
|
|
3413
|
+
|
|
3414
|
+
export declare interface TradeEscrowExchangeReceipt {
|
|
3415
|
+
readonly tradeId: string;
|
|
3416
|
+
readonly offered: TradeEscrowLegReceipt;
|
|
3417
|
+
readonly requested: TradeEscrowLegReceipt;
|
|
3418
|
+
}
|
|
3419
|
+
|
|
3420
|
+
export declare interface TradeEscrowLegReceipt {
|
|
3421
|
+
readonly inventory: InventoryReservationTransferReceipt | null;
|
|
3422
|
+
readonly currencies: readonly {
|
|
3423
|
+
readonly reserve: EconomyReceipt;
|
|
3424
|
+
readonly settlement: WalletEscrowSettlementReceipt;
|
|
3425
|
+
}[];
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
export declare interface TradeEscrowOptions {
|
|
3429
|
+
readonly currencies: readonly CurrencyDefinition[];
|
|
3430
|
+
readonly rules: TradeRulesDefinition;
|
|
3431
|
+
readonly taxPolicy?: TradeTaxPolicy | undefined;
|
|
3432
|
+
readonly economy: Pick<WalletEscrowParticipant, 'prepareEscrowReserve' | 'prepareEscrowRelease' | 'prepareEscrowTaxSettle' | 'prepareEscrowReserveTaxSettle' | 'escrow'>;
|
|
3433
|
+
readonly inventory?: Pick<InventorySqlService, 'prepareReserve' | 'prepareRelease' | 'prepareReservationTransfer' | 'prepareReserveTransfer' | 'reservation'> | undefined;
|
|
3434
|
+
readonly allowedServices?: readonly string[] | undefined;
|
|
3435
|
+
}
|
|
3436
|
+
|
|
3437
|
+
/** Server composition only. The mandatory exact-store admission belongs to the
|
|
3438
|
+
* durable Trade writer and actual eligibility authority. This does not install
|
|
3439
|
+
* player routes, infer consent/sanctions or replace durable Trade custody. */
|
|
3440
|
+
export declare interface TradeEscrowParticipant {
|
|
3441
|
+
readonly prepareReserve: (subject: Subject, input: TradeEscrowTerms, admission: PreparedSqlMutation<void>) => Effect.Effect<PreparedSqlMutation<TradeEscrowReserveReceipt>, EconomyError>;
|
|
3442
|
+
readonly prepareRelease: (subject: Subject, input: TradeEscrowTerms, admission: PreparedSqlMutation<void>) => Effect.Effect<PreparedSqlMutation<TradeEscrowReserveReceipt>, EconomyError>;
|
|
3443
|
+
readonly prepareExchange: (subject: Subject, input: TradeEscrowExchangeInput, admission: PreparedSqlMutation<void>) => Effect.Effect<PreparedSqlMutation<TradeEscrowExchangeReceipt>, EconomyError>;
|
|
3444
|
+
}
|
|
3445
|
+
|
|
3446
|
+
export declare const tradeEscrowParticipant: (store: DataStore, input: TradeEscrowOptions) => TradeEscrowParticipant;
|
|
3447
|
+
|
|
3448
|
+
export declare interface TradeEscrowReserveReceipt {
|
|
3449
|
+
readonly tradeId: string;
|
|
3450
|
+
readonly inventory: InventoryReceipt | null;
|
|
3451
|
+
readonly currencies: readonly EconomyReceipt[];
|
|
3452
|
+
}
|
|
3453
|
+
|
|
3454
|
+
export declare interface TradeEscrowTerms {
|
|
3455
|
+
readonly tenantId: string;
|
|
3456
|
+
readonly tradeId: string;
|
|
3457
|
+
readonly proposerId: string;
|
|
3458
|
+
readonly offered: TradeLegDefinition;
|
|
3459
|
+
readonly requested: TradeLegDefinition;
|
|
3460
|
+
}
|
|
3461
|
+
|
|
3462
|
+
export declare interface TradeExpiryInput {
|
|
3463
|
+
readonly tenantId: string;
|
|
3464
|
+
readonly maxTrades?: number | undefined;
|
|
3465
|
+
}
|
|
3466
|
+
|
|
3467
|
+
export declare interface TradeExpiryResult {
|
|
3468
|
+
readonly capturedAt: number;
|
|
3469
|
+
readonly scannedRows: number;
|
|
3470
|
+
readonly dueTrades: number;
|
|
3471
|
+
/** Matching original expiry receipts observed by this call, not newly committed closes. */
|
|
3472
|
+
readonly expiredTrades: number;
|
|
3473
|
+
readonly alreadyClosedTrades: number;
|
|
3474
|
+
}
|
|
3475
|
+
|
|
3476
|
+
export declare interface TradeExpiryRunner {
|
|
3477
|
+
readonly expireDueTrades: (subject: Subject, input: TradeExpiryInput) => Effect.Effect<TradeExpiryResult, EconomyError>;
|
|
3478
|
+
}
|
|
3479
|
+
|
|
3480
|
+
/** Explicit app-owned registration; no plugin-wide automatic scheduler or new writer. */
|
|
3481
|
+
export declare const tradeExpirySchedule: (input: TradeExpiryScheduleOptions) => BrandedScheduleDefinition;
|
|
3482
|
+
|
|
3483
|
+
export declare interface TradeExpiryScheduleOptions extends TradeExpiryInput {
|
|
3484
|
+
readonly runner: TradeExpiryRunner;
|
|
3485
|
+
readonly name?: string;
|
|
3486
|
+
readonly cron?: string;
|
|
3487
|
+
readonly timezone?: string;
|
|
3488
|
+
}
|
|
3489
|
+
|
|
3490
|
+
declare interface TradeItemAuthority {
|
|
3491
|
+
readonly instanceId: string;
|
|
3492
|
+
readonly itemId: string;
|
|
3493
|
+
readonly qty: number;
|
|
3494
|
+
readonly tradable: boolean;
|
|
3495
|
+
readonly locked: boolean;
|
|
3496
|
+
readonly reservationId: string | null;
|
|
3497
|
+
readonly expiresAt: number | null;
|
|
3498
|
+
}
|
|
3499
|
+
|
|
3500
|
+
declare interface TradeItemIntention {
|
|
3501
|
+
readonly instanceId: string;
|
|
3502
|
+
readonly qty: number;
|
|
3503
|
+
}
|
|
3504
|
+
|
|
3505
|
+
declare interface TradeLeg {
|
|
3506
|
+
readonly items: readonly TradeItemIntention[];
|
|
3507
|
+
readonly currencies: readonly {
|
|
3508
|
+
readonly currency: string;
|
|
3509
|
+
readonly amount: string;
|
|
3510
|
+
}[];
|
|
3511
|
+
}
|
|
3512
|
+
|
|
3513
|
+
declare interface TradeLegDefinition {
|
|
3514
|
+
readonly items: readonly TradeItemIntention[];
|
|
3515
|
+
readonly currencies: readonly TradeCurrencyIntention[];
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3518
|
+
declare type TradeObservation = {
|
|
3519
|
+
readonly requestId: string;
|
|
3520
|
+
readonly state: 'not-observed';
|
|
3521
|
+
} | {
|
|
3522
|
+
readonly requestId: string;
|
|
3523
|
+
readonly state: 'fulfilled';
|
|
3524
|
+
readonly receipt: TradeReceipt;
|
|
3525
|
+
};
|
|
3526
|
+
|
|
3527
|
+
export declare const tradeOperationsTable: Table<"_voltro_eco_trade_operations", FieldDefinitions<{
|
|
3528
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3529
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3530
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
3531
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
3532
|
+
readonly tradeId: ColumnBuilder<string | null, "text", boolean>;
|
|
3533
|
+
readonly kind: ColumnBuilder<"expire" | "cancel" | "accept" | "propose", "text", boolean>;
|
|
3534
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
3535
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3536
|
+
readonly sequence: ColumnBuilder<number | null, "integer", boolean>;
|
|
3537
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
3538
|
+
readonly request: ColumnBuilder<unknown, "json", boolean>;
|
|
3539
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
3540
|
+
readonly at: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
3541
|
+
}>, true, never>;
|
|
3542
|
+
|
|
3543
|
+
declare interface TradeParticipantAuthority {
|
|
3544
|
+
readonly tenantId: string;
|
|
3545
|
+
readonly ownerId: string;
|
|
3546
|
+
readonly allowed: boolean;
|
|
3547
|
+
readonly trustScore: number;
|
|
3548
|
+
readonly items: readonly TradeItemAuthority[];
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
export declare interface TradePermissionAdmission {
|
|
3552
|
+
readonly tenantId: string;
|
|
3553
|
+
readonly tradeId: string;
|
|
3554
|
+
readonly phase: 'propose' | 'accept';
|
|
3555
|
+
readonly at: number;
|
|
3556
|
+
readonly expiresAt: number;
|
|
3557
|
+
readonly participants: readonly TradePermissionFacts[];
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
export declare interface TradePermissionFacts {
|
|
3561
|
+
readonly tenantId: string;
|
|
3562
|
+
readonly ownerId: string;
|
|
3563
|
+
readonly allowed: boolean;
|
|
3564
|
+
readonly trustScore: number;
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3567
|
+
/** The owning sanctions/consent implementation must lock its actual SQL admission
|
|
3568
|
+
* rows and revalidate these facts in the returned exact-store unit. A read-only
|
|
3569
|
+
* sanctions port cannot provide this capability. No allow or trust default. */
|
|
3570
|
+
export declare interface TradePermissionSource {
|
|
3571
|
+
readonly read: (input: TradeAuthorityReadInput) => Effect.Effect<TradePermissionFacts, EconomyError>;
|
|
3572
|
+
readonly prepare: (input: TradePermissionAdmission) => Effect.Effect<PreparedSqlMutation<void>, EconomyError>;
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3575
|
+
declare interface TradeProposeInput {
|
|
3576
|
+
readonly toId: string | null;
|
|
3577
|
+
readonly offered: TradeLegDefinition;
|
|
3578
|
+
readonly requested: TradeLegDefinition;
|
|
3579
|
+
readonly durationMs: number;
|
|
3580
|
+
readonly requestId: string;
|
|
3581
|
+
}
|
|
3582
|
+
|
|
3583
|
+
declare interface TradeReceipt {
|
|
3584
|
+
readonly operationId: string;
|
|
3585
|
+
readonly requestId: string;
|
|
3586
|
+
readonly trade: TradeView;
|
|
3587
|
+
}
|
|
3588
|
+
|
|
3589
|
+
declare interface TradeRules {
|
|
3590
|
+
readonly version: string;
|
|
3591
|
+
readonly taxBps: number;
|
|
3592
|
+
readonly maxDurationMs: number;
|
|
3593
|
+
readonly minTrustScore: number;
|
|
3594
|
+
}
|
|
3595
|
+
|
|
3596
|
+
declare interface TradeRulesDefinition {
|
|
3597
|
+
readonly version: string;
|
|
3598
|
+
readonly taxBps?: number;
|
|
3599
|
+
readonly maxDurationMs?: number;
|
|
3600
|
+
readonly minTrustScore?: number;
|
|
3601
|
+
}
|
|
3602
|
+
|
|
3603
|
+
/** Full owning service; no default implementation or escrow installation is
|
|
3604
|
+
* inferred from a Tag. SQL reservation/transfer/expiry/privacy own acceptance. */
|
|
3605
|
+
declare interface TradesService {
|
|
3606
|
+
readonly propose: (subject: Subject, input: TradeProposeInput) => Effect.Effect<TradeReceipt, EconomyError>;
|
|
3607
|
+
readonly accept: (subject: Subject, input: TradeAcceptInput) => Effect.Effect<TradeReceipt, EconomyError>;
|
|
3608
|
+
readonly cancel: (subject: Subject, input: {
|
|
3609
|
+
readonly tradeId: string;
|
|
3610
|
+
readonly requestId: string;
|
|
3611
|
+
}) => Effect.Effect<TradeReceipt, EconomyError>;
|
|
3612
|
+
readonly mine: (subject: Subject) => Effect.Effect<readonly TradeView[], EconomyError>;
|
|
3613
|
+
readonly receipt: (subject: Subject, input: {
|
|
3614
|
+
readonly requestId: string;
|
|
3615
|
+
}) => Effect.Effect<TradeObservation, EconomyError>;
|
|
3616
|
+
readonly rebuild: (subject: Subject, input: {
|
|
3617
|
+
readonly tenantId: string;
|
|
3618
|
+
readonly tradeId: string;
|
|
3619
|
+
}) => Effect.Effect<TradeView, EconomyError>;
|
|
3620
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
3621
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
export declare interface TradesSqlService extends TradesService {
|
|
3625
|
+
readonly expireDue: (subject: Subject, input: TradeExpiryInput) => Effect.Effect<TradeExpiryResult, EconomyError>;
|
|
3626
|
+
readonly expire: (subject: Subject, input: {
|
|
3627
|
+
readonly tenantId: string;
|
|
3628
|
+
readonly tradeId: string;
|
|
3629
|
+
}) => Effect.Effect<TradeReceipt, EconomyError>;
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3632
|
+
export declare const tradesTable: Table<"_voltro_eco_trades", FieldDefinitions<{
|
|
3633
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3634
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3635
|
+
readonly proposerKey: ColumnBuilder<string, "text", boolean>;
|
|
3636
|
+
readonly targetKey: ColumnBuilder<string | null, "text", boolean>;
|
|
3637
|
+
readonly accepterKey: ColumnBuilder<string | null, "text", boolean>;
|
|
3638
|
+
readonly accepted: ColumnBuilder<boolean, "boolean", boolean>;
|
|
3639
|
+
readonly state: ColumnBuilder<"erased" | "expired" | "pending" | "cancelled" | "accepted" | "proposed", "text", boolean>;
|
|
3640
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3641
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
3642
|
+
readonly proposal: ColumnBuilder<unknown, "json", boolean>;
|
|
3643
|
+
readonly closing: ColumnBuilder<unknown, "json", boolean>;
|
|
3644
|
+
readonly createdAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
3645
|
+
readonly expiresAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
3646
|
+
}>, true, never>;
|
|
3647
|
+
|
|
3648
|
+
export declare interface TradeStoreOptions extends TradeEscrowOptions {
|
|
3649
|
+
readonly authority: TradeAuthoritySource;
|
|
3650
|
+
readonly inventory?: NonNullable<TradeEscrowOptions['inventory']> & Pick<InventorySqlService, 'reservationEvidence'> | undefined;
|
|
3651
|
+
readonly eligibility?: TradeEligibilityPolicy | undefined;
|
|
3652
|
+
readonly maxHistoryRows?: number | undefined;
|
|
3653
|
+
readonly now?: (() => number) | undefined;
|
|
3654
|
+
}
|
|
3655
|
+
|
|
3656
|
+
export declare const tradeSubjectsTable: Table<"_voltro_eco_trade_subjects", FieldDefinitions<{
|
|
3657
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3658
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3659
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
3660
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
3661
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3662
|
+
readonly operationsCount: ColumnBuilder<number, "integer", boolean>;
|
|
3663
|
+
}>, true, never>;
|
|
3664
|
+
|
|
3665
|
+
export declare const tradeTables: readonly [ Table<"_voltro_eco_trade_tenants", FieldDefinitions<{
|
|
3666
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3667
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3668
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3669
|
+
readonly tradesCount: ColumnBuilder<number, "integer", boolean>;
|
|
3670
|
+
}>, true, never>, Table<"_voltro_eco_trade_subjects", FieldDefinitions<{
|
|
3671
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3672
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3673
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
3674
|
+
readonly erased: ColumnBuilder<boolean, "boolean", boolean>;
|
|
3675
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3676
|
+
readonly operationsCount: ColumnBuilder<number, "integer", boolean>;
|
|
3677
|
+
}>, true, never>, Table<"_voltro_eco_trades", FieldDefinitions<{
|
|
3678
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3679
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3680
|
+
readonly proposerKey: ColumnBuilder<string, "text", boolean>;
|
|
3681
|
+
readonly targetKey: ColumnBuilder<string | null, "text", boolean>;
|
|
3682
|
+
readonly accepterKey: ColumnBuilder<string | null, "text", boolean>;
|
|
3683
|
+
readonly accepted: ColumnBuilder<boolean, "boolean", boolean>;
|
|
3684
|
+
readonly state: ColumnBuilder<"erased" | "expired" | "pending" | "cancelled" | "accepted" | "proposed", "text", boolean>;
|
|
3685
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3686
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
3687
|
+
readonly proposal: ColumnBuilder<unknown, "json", boolean>;
|
|
3688
|
+
readonly closing: ColumnBuilder<unknown, "json", boolean>;
|
|
3689
|
+
readonly createdAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
3690
|
+
readonly expiresAt: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
3691
|
+
}>, true, never>, Table<"_voltro_eco_trade_operations", FieldDefinitions<{
|
|
3692
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3693
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3694
|
+
readonly ownerKey: ColumnBuilder<string, "text", boolean>;
|
|
3695
|
+
readonly ownerId: ColumnBuilder<string | null, "text", boolean>;
|
|
3696
|
+
readonly tradeId: ColumnBuilder<string | null, "text", boolean>;
|
|
3697
|
+
readonly kind: ColumnBuilder<"expire" | "cancel" | "accept" | "propose", "text", boolean>;
|
|
3698
|
+
readonly state: ColumnBuilder<"erased" | "fulfilled" | "pending", "text", boolean>;
|
|
3699
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3700
|
+
readonly sequence: ColumnBuilder<number | null, "integer", boolean>;
|
|
3701
|
+
readonly digest: ColumnBuilder<string | null, "text", boolean>;
|
|
3702
|
+
readonly request: ColumnBuilder<unknown, "json", boolean>;
|
|
3703
|
+
readonly receipt: ColumnBuilder<unknown, "json", boolean>;
|
|
3704
|
+
readonly at: ColumnBuilder<Date | null, "timestamp", boolean>;
|
|
3705
|
+
}>, true, never>];
|
|
3706
|
+
|
|
3707
|
+
declare interface TradeTaxContext {
|
|
3708
|
+
readonly currency: string;
|
|
3709
|
+
readonly amount: EconomyAmountInput;
|
|
3710
|
+
readonly rules: TradeRules;
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3713
|
+
declare type TradeTaxPolicy = (input: TradeTaxContext) => EconomyAmountInput;
|
|
3714
|
+
|
|
3715
|
+
declare interface TradeTaxView {
|
|
3716
|
+
readonly leg: 'offered' | 'requested';
|
|
3717
|
+
readonly currency: string;
|
|
3718
|
+
readonly gross: string;
|
|
3719
|
+
readonly net: string;
|
|
3720
|
+
readonly tax: string;
|
|
3721
|
+
}
|
|
3722
|
+
|
|
3723
|
+
export declare const tradeTenantsTable: Table<"_voltro_eco_trade_tenants", FieldDefinitions<{
|
|
3724
|
+
readonly id: ColumnBuilder<string, "id", boolean>;
|
|
3725
|
+
readonly tenantId: ColumnBuilder<string, "text", boolean>;
|
|
3726
|
+
readonly admission: ColumnBuilder<number, "integer", boolean>;
|
|
3727
|
+
readonly tradesCount: ColumnBuilder<number, "integer", boolean>;
|
|
3728
|
+
}>, true, never>;
|
|
3729
|
+
|
|
3730
|
+
declare interface TradeView {
|
|
3731
|
+
readonly tradeId: string;
|
|
3732
|
+
readonly tradeDigest: string;
|
|
3733
|
+
readonly proposerId: string;
|
|
3734
|
+
readonly toId: string | null;
|
|
3735
|
+
readonly offered: TradeLeg;
|
|
3736
|
+
readonly requested: TradeLeg;
|
|
3737
|
+
readonly createdAt: number;
|
|
3738
|
+
readonly expiresAt: number;
|
|
3739
|
+
readonly state: 'proposed' | 'accepted' | 'cancelled' | 'expired';
|
|
3740
|
+
readonly accepterId: string | null;
|
|
3741
|
+
readonly rulesVersion: string;
|
|
3742
|
+
readonly taxes: readonly TradeTaxView[];
|
|
3743
|
+
}
|
|
3744
|
+
|
|
3745
|
+
declare const verifiedCurrentState: unique symbol;
|
|
3746
|
+
|
|
3747
|
+
/** Fresh provider observation bound to revalidated original SQL. Never copied player refund authority. */
|
|
3748
|
+
export declare interface VerifiedIapCurrentState {
|
|
3749
|
+
readonly [verifiedCurrentState]: true;
|
|
3750
|
+
readonly orderId: string;
|
|
3751
|
+
}
|
|
3752
|
+
|
|
3753
|
+
/** Authenticated notice, never current purchase state or grant/refund authority. */
|
|
3754
|
+
export declare interface VerifiedIapNotification {
|
|
3755
|
+
readonly [verifiedNotification]: true;
|
|
3756
|
+
readonly noticeId: string;
|
|
3757
|
+
readonly channel: IapRefundChannel;
|
|
3758
|
+
}
|
|
3759
|
+
|
|
3760
|
+
/** Process-local opaque evidence. A serialized object is never a verification capability. */
|
|
3761
|
+
export declare interface VerifiedIapPurchase {
|
|
3762
|
+
readonly [verifiedPurchase]: true;
|
|
3763
|
+
readonly scope: IapScope;
|
|
3764
|
+
readonly offerId: string;
|
|
3765
|
+
readonly offerVersion: string;
|
|
3766
|
+
readonly requestId: string;
|
|
3767
|
+
readonly verifiedAt: number;
|
|
3768
|
+
readonly identity: string;
|
|
3769
|
+
readonly facts: IapTransactionFacts;
|
|
3770
|
+
}
|
|
3771
|
+
|
|
3772
|
+
declare const verifiedNotification: unique symbol;
|
|
3773
|
+
|
|
3774
|
+
declare const verifiedPurchase: unique symbol;
|
|
3775
|
+
|
|
3776
|
+
declare interface VirtualPriceAdjustment {
|
|
3777
|
+
readonly currency: string;
|
|
3778
|
+
/** Inclusive integer 0..10000. */
|
|
3779
|
+
readonly discountBps: number;
|
|
3780
|
+
/** A trusted floor, enforced independently of a custom resolver. */
|
|
3781
|
+
readonly minimum: EconomyAmountInput;
|
|
3782
|
+
}
|
|
3783
|
+
|
|
3784
|
+
declare interface VirtualPriceOption {
|
|
3785
|
+
readonly currency: string;
|
|
3786
|
+
readonly amount: EconomyAmountInput;
|
|
3787
|
+
}
|
|
3788
|
+
|
|
3789
|
+
export declare interface WalletEscrowFundedSettlementReceipt {
|
|
3790
|
+
readonly reserve: EconomyReceipt;
|
|
3791
|
+
readonly settlement: WalletEscrowSettlementReceipt;
|
|
3792
|
+
}
|
|
3793
|
+
|
|
3794
|
+
export declare interface WalletEscrowInput {
|
|
3795
|
+
readonly tenantId: string;
|
|
3796
|
+
readonly owner: EscrowWallet;
|
|
3797
|
+
readonly reservationId: string;
|
|
3798
|
+
readonly currency: string;
|
|
3799
|
+
}
|
|
3800
|
+
|
|
3801
|
+
export declare type WalletEscrowObservation = {
|
|
3802
|
+
readonly reservationId: string;
|
|
3803
|
+
readonly currency: string;
|
|
3804
|
+
readonly state: 'not-observed';
|
|
3805
|
+
} | {
|
|
3806
|
+
readonly reservationId: string;
|
|
3807
|
+
readonly currency: string;
|
|
3808
|
+
readonly amount: string;
|
|
3809
|
+
readonly state: 'held' | 'released' | 'settled';
|
|
3810
|
+
readonly receipt: EconomyReceipt;
|
|
3811
|
+
readonly closingReceipt: EconomyReceipt | null;
|
|
3812
|
+
readonly taxReceipt: EconomyReceipt | null;
|
|
3813
|
+
};
|
|
3814
|
+
|
|
3815
|
+
export declare interface WalletEscrowParticipant {
|
|
3816
|
+
readonly prepareEscrowReserve: (subject: Subject, input: WalletEscrowReserveInput) => Effect.Effect<PreparedSqlMutation<EconomyReceipt>, EconomyError>;
|
|
3817
|
+
readonly prepareEscrowRelease: (subject: Subject, input: WalletEscrowInput) => Effect.Effect<PreparedSqlMutation<EconomyReceipt>, EconomyError>;
|
|
3818
|
+
/** Whole gross payout; use prepareEscrowTaxSettle for an exact net/sink split. */
|
|
3819
|
+
readonly prepareEscrowSettle: (subject: Subject, input: WalletEscrowSettleInput) => Effect.Effect<PreparedSqlMutation<EconomyReceipt>, EconomyError>;
|
|
3820
|
+
readonly prepareEscrowTaxSettle: (subject: Subject, input: WalletEscrowTaxSettleInput) => Effect.Effect<PreparedSqlMutation<WalletEscrowSettlementReceipt>, EconomyError>;
|
|
3821
|
+
readonly prepareEscrowReserveTaxSettle: (subject: Subject, input: WalletEscrowReserveTaxSettleInput) => Effect.Effect<PreparedSqlMutation<WalletEscrowFundedSettlementReceipt>, EconomyError>;
|
|
3822
|
+
readonly escrow: (subject: Subject, input: WalletEscrowInput) => Effect.Effect<WalletEscrowObservation, EconomyError>;
|
|
3823
|
+
}
|
|
3824
|
+
|
|
3825
|
+
export declare interface WalletEscrowReserveInput extends WalletEscrowInput {
|
|
3826
|
+
readonly amount: EconomyAmountInput;
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
export declare interface WalletEscrowReserveTaxSettleInput extends WalletEscrowReserveInput {
|
|
3830
|
+
readonly to: EscrowWallet;
|
|
3831
|
+
readonly taxAmount: EconomyAmountInput;
|
|
3832
|
+
readonly taxAccountId?: string | undefined;
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
export declare interface WalletEscrowSettleInput extends WalletEscrowInput {
|
|
3836
|
+
readonly to: EscrowWallet;
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
export declare interface WalletEscrowSettlementReceipt {
|
|
3840
|
+
readonly reservationId: string;
|
|
3841
|
+
readonly currency: string;
|
|
3842
|
+
readonly gross: string;
|
|
3843
|
+
readonly net: string;
|
|
3844
|
+
readonly tax: string;
|
|
3845
|
+
readonly payout: EconomyReceipt | null;
|
|
3846
|
+
readonly taxReceipt: EconomyReceipt | null;
|
|
3847
|
+
}
|
|
3848
|
+
|
|
3849
|
+
export declare interface WalletEscrowTaxSettleInput extends WalletEscrowSettleInput {
|
|
3850
|
+
readonly taxAmount: EconomyAmountInput;
|
|
3851
|
+
readonly taxAccountId?: string | undefined;
|
|
3852
|
+
}
|
|
3853
|
+
|
|
3854
|
+
declare type WalletOwnerKind = 'player' | 'guild';
|
|
3855
|
+
|
|
3856
|
+
export { }
|