@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
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { EconomyError as e, economyError as t } from "./errors.js";
|
|
2
|
+
import { captureQueryTables as n, dataList as r, dataObject as i, declaredSources as a, identifier as o } from "./capture.js";
|
|
3
|
+
import { defaultPriceResolver as s } from "./price.js";
|
|
4
|
+
import { subscriptionCancelDescriptor as c, subscriptionDailyDescriptor as l, subscriptionReceiptDescriptor as u, subscriptionStartDescriptor as d, subscriptionsActiveDescriptor as f, subscriptionsListDescriptor as p, subscriptionsRpcClientImports as m } from "./rpc.js";
|
|
5
|
+
import { SubscriptionsPort as h, captureSubscriptionReceiptIntent as g, captureSubscriptionsService as _, defaultSubscriptionDailyGrant as v, defaultSubscriptionPeriod as y, defineSubscription as b, subscriptionEntitlementIntent as x, subscriptionRenewIntent as S, subscriptionStartIntent as C } from "./subscriptions.js";
|
|
6
|
+
import { subscriptionTables as w } from "./subscriptionTables.entity.js";
|
|
7
|
+
import { dataStoreSubscriptions as T, resolveSubscriptionsStoreOptions as E } from "./subscriptionStore.server.js";
|
|
8
|
+
import { Effect as D, Layer as O } from "effect";
|
|
9
|
+
//#region src/subscriptionBinding.server.ts
|
|
10
|
+
var k = () => D.fail(t("unavailable")), A = Object.freeze({
|
|
11
|
+
list: k,
|
|
12
|
+
active: k,
|
|
13
|
+
start: k,
|
|
14
|
+
renew: k,
|
|
15
|
+
claimDaily: k,
|
|
16
|
+
cancel: k,
|
|
17
|
+
receipt: k,
|
|
18
|
+
exportSubject: k,
|
|
19
|
+
eraseSubject: k
|
|
20
|
+
}), j = (k, A) => {
|
|
21
|
+
if (k === void 0) return;
|
|
22
|
+
let j = i(k, [
|
|
23
|
+
"subscriptions",
|
|
24
|
+
"inventory",
|
|
25
|
+
"accessSource",
|
|
26
|
+
"version",
|
|
27
|
+
"period",
|
|
28
|
+
"daily",
|
|
29
|
+
"priceResolver",
|
|
30
|
+
"systemAccount",
|
|
31
|
+
"maxHistoryRows",
|
|
32
|
+
"now",
|
|
33
|
+
"service",
|
|
34
|
+
"querySources"
|
|
35
|
+
]), M = j.service === void 0 ? void 0 : _(j.service);
|
|
36
|
+
if (A.replacedWallet && !M || M && [
|
|
37
|
+
"inventory",
|
|
38
|
+
"accessSource",
|
|
39
|
+
"period",
|
|
40
|
+
"daily",
|
|
41
|
+
"priceResolver",
|
|
42
|
+
"systemAccount",
|
|
43
|
+
"maxHistoryRows",
|
|
44
|
+
"now"
|
|
45
|
+
].some((e) => j[e] !== void 0)) throw t("invalid_input");
|
|
46
|
+
let N = j.querySources === void 0 ? void 0 : i(j.querySources, [
|
|
47
|
+
"list",
|
|
48
|
+
"active",
|
|
49
|
+
"receipt"
|
|
50
|
+
]);
|
|
51
|
+
if (M && !N) throw t("invalid_input");
|
|
52
|
+
let P = N ? Object.freeze({
|
|
53
|
+
list: n(N.list),
|
|
54
|
+
active: n(N.active),
|
|
55
|
+
receipt: n(N.receipt)
|
|
56
|
+
}) : void 0, F = M ? void 0 : E({
|
|
57
|
+
currencies: A.currencies,
|
|
58
|
+
realMoney: A.realMoney,
|
|
59
|
+
economy: A.economy,
|
|
60
|
+
subscriptions: j.subscriptions,
|
|
61
|
+
inventory: j.inventory,
|
|
62
|
+
accessSource: j.accessSource,
|
|
63
|
+
version: j.version,
|
|
64
|
+
period: j.period,
|
|
65
|
+
daily: j.daily,
|
|
66
|
+
priceResolver: j.priceResolver ?? A.priceResolver,
|
|
67
|
+
systemAccount: j.systemAccount,
|
|
68
|
+
maxHistoryRows: j.maxHistoryRows,
|
|
69
|
+
now: j.now ?? A.now
|
|
70
|
+
}), I = F?.subscriptions ?? Object.freeze(r(j.subscriptions, 256).map((e) => b(e, A.currencies, A.realMoney)));
|
|
71
|
+
if (!I.length || new Set(I.map((e) => e.id)).size !== I.length) throw t("invalid_input");
|
|
72
|
+
let L = F?.version ?? o(j.version);
|
|
73
|
+
if (L === "default.v1") throw t("invalid_input");
|
|
74
|
+
let R, z = !1, B, V = (e) => D.suspend(() => {
|
|
75
|
+
let n = M ?? R;
|
|
76
|
+
return z && n ? e(n) : D.fail(t("unavailable"));
|
|
77
|
+
}), H = (n) => {
|
|
78
|
+
try {
|
|
79
|
+
return n();
|
|
80
|
+
} catch (n) {
|
|
81
|
+
return D.fail(n instanceof e ? n : t("invalid_input"));
|
|
82
|
+
}
|
|
83
|
+
}, U = (e) => {
|
|
84
|
+
let n = structuredClone(e);
|
|
85
|
+
if (n.type !== "user") throw t("forbidden");
|
|
86
|
+
return o(n.id), o(n.tenantId), n;
|
|
87
|
+
}, W = (e) => {
|
|
88
|
+
let n = structuredClone(e);
|
|
89
|
+
if (o(n.tenantId), o(n.subjectId), n.kind !== "user" && n.kind !== "guest") throw t("invalid_input");
|
|
90
|
+
return n;
|
|
91
|
+
}, G = Object.freeze({
|
|
92
|
+
list: (e) => H(() => {
|
|
93
|
+
let t = U(e);
|
|
94
|
+
return V((e) => e.list(t));
|
|
95
|
+
}),
|
|
96
|
+
active: (e) => H(() => {
|
|
97
|
+
let t = U(e);
|
|
98
|
+
return V((e) => e.active(t));
|
|
99
|
+
}),
|
|
100
|
+
start: (e, t) => H(() => {
|
|
101
|
+
let n = U(e), r = C(t), i = Object.freeze({
|
|
102
|
+
...r,
|
|
103
|
+
currency: r.currency ?? void 0
|
|
104
|
+
});
|
|
105
|
+
return V((e) => e.start(n, i));
|
|
106
|
+
}),
|
|
107
|
+
renew: (e, n) => H(() => {
|
|
108
|
+
let r = structuredClone(e);
|
|
109
|
+
if (r.type !== "system") throw t("forbidden");
|
|
110
|
+
let i = S(n);
|
|
111
|
+
return V((e) => e.renew(r, i));
|
|
112
|
+
}),
|
|
113
|
+
claimDaily: (e, t) => H(() => {
|
|
114
|
+
let n = U(e), r = x(t);
|
|
115
|
+
return V((e) => e.claimDaily(n, r));
|
|
116
|
+
}),
|
|
117
|
+
cancel: (e, t) => H(() => {
|
|
118
|
+
let n = U(e), r = x(t);
|
|
119
|
+
return V((e) => e.cancel(n, r));
|
|
120
|
+
}),
|
|
121
|
+
receipt: (e, t) => H(() => {
|
|
122
|
+
let n = U(e), r = g(t);
|
|
123
|
+
return V((e) => e.receipt(n, r));
|
|
124
|
+
}),
|
|
125
|
+
exportSubject: (e) => H(() => {
|
|
126
|
+
let t = W(e);
|
|
127
|
+
return V((e) => e.exportSubject(t));
|
|
128
|
+
}),
|
|
129
|
+
eraseSubject: (e) => H(() => {
|
|
130
|
+
let t = W(e);
|
|
131
|
+
return V((e) => e.eraseSubject(t));
|
|
132
|
+
})
|
|
133
|
+
}), K = (e, t) => M ? P[e] : [.../* @__PURE__ */ new Set([...t, ...P?.[e] ?? []])], q = [
|
|
134
|
+
{
|
|
135
|
+
...p,
|
|
136
|
+
source: K("list", a(p.source)),
|
|
137
|
+
execute: (e, t) => G.list(t.request.subject)
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
...f,
|
|
141
|
+
source: K("active", a(f.source)),
|
|
142
|
+
execute: (e, t) => G.active(t.request.subject)
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
...d,
|
|
146
|
+
execute: (e, t) => G.start(t.request.subject, e)
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
...l,
|
|
150
|
+
execute: (e, t) => G.claimDaily(t.request.subject, e)
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
...c,
|
|
154
|
+
execute: (e, t) => G.cancel(t.request.subject, e)
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
...u,
|
|
158
|
+
source: K("receipt", a(u.source)),
|
|
159
|
+
execute: (e, t) => G.receipt(t.request.subject, e)
|
|
160
|
+
}
|
|
161
|
+
], J = F ? w : [], Y = Object.freeze({
|
|
162
|
+
backend: M ? "custom" : "sql",
|
|
163
|
+
version: L,
|
|
164
|
+
slots: Object.freeze({
|
|
165
|
+
period: M || F?.period !== y ? "custom" : "default",
|
|
166
|
+
daily: M || F?.daily !== v ? "custom" : "default",
|
|
167
|
+
priceResolver: M || F?.priceResolver !== s ? "custom" : "default"
|
|
168
|
+
}),
|
|
169
|
+
consentSource: M ? "app-owned" : "custom",
|
|
170
|
+
subscriptions: Object.freeze(I.map((e) => Object.freeze({
|
|
171
|
+
id: e.id,
|
|
172
|
+
version: e.version,
|
|
173
|
+
kind: e.price.kind,
|
|
174
|
+
period: e.period,
|
|
175
|
+
graceDays: e.graceDays,
|
|
176
|
+
purchaseItemKinds: e.grants.onPurchase.items.length,
|
|
177
|
+
purchaseCurrencyKinds: e.grants.onPurchase.currencies.length,
|
|
178
|
+
dailyItemKinds: e.grants.daily.items.length,
|
|
179
|
+
dailyCurrencyKinds: e.grants.daily.currencies.length
|
|
180
|
+
}))),
|
|
181
|
+
budgets: M ? null : Object.freeze({ historyRows: F.maxHistoryRows }),
|
|
182
|
+
virtualSettlementInstalled: !0,
|
|
183
|
+
realPaymentInstalled: !1,
|
|
184
|
+
automaticRenewalInstalled: !1,
|
|
185
|
+
clientRecoveryInstalled: !1,
|
|
186
|
+
gmActionsInstalled: !1
|
|
187
|
+
});
|
|
188
|
+
return Object.freeze({
|
|
189
|
+
service: G,
|
|
190
|
+
layer: O.succeed(h, G),
|
|
191
|
+
tables: J,
|
|
192
|
+
routes: q,
|
|
193
|
+
status: Y,
|
|
194
|
+
rpcClientDescriptors: m,
|
|
195
|
+
roles: F ? [
|
|
196
|
+
"subscriptionTenants",
|
|
197
|
+
"subscriptions",
|
|
198
|
+
"subscriptionSubjects",
|
|
199
|
+
"subscriptionEvents"
|
|
200
|
+
] : [],
|
|
201
|
+
bind: (e) => {
|
|
202
|
+
if (B !== void 0 && B !== e) throw Error("Subscription system cannot cross app stores");
|
|
203
|
+
B = e, F && (R = T(e, F)), z = !0;
|
|
204
|
+
},
|
|
205
|
+
deactivate: () => {
|
|
206
|
+
z = !1, R = void 0;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
//#endregion
|
|
211
|
+
export { j as bindSubscriptionsSystem, A as unavailableSubscriptions };
|