@voltro/plugin-progression 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 +478 -2
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +9189 -0
- package/dist/achievementComponents.js +92 -0
- package/dist/achievementStore.js +603 -0
- package/dist/achievementTables.entity.js +98 -0
- package/dist/achievements.d.ts +188 -0
- package/dist/achievements.js +205 -0
- package/dist/capture.js +64 -0
- package/dist/cmsQuests.d.ts +91 -0
- package/dist/cmsQuests.js +83 -0
- package/dist/components.d.ts +172 -0
- package/dist/components.js +4 -0
- package/dist/curve.d.ts +27 -0
- package/dist/curve.js +38 -0
- package/dist/daily.d.ts +152 -0
- package/dist/daily.js +126 -0
- package/dist/dailyStore.js +421 -0
- package/dist/dailySystem.fixture.js +138 -0
- package/dist/dailyTables.entity.js +90 -0
- package/dist/declarationFixtures.js +143 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.js +20 -0
- package/dist/index.d.ts +1833 -0
- package/dist/index.js +19 -0
- package/dist/pass.d.ts +186 -0
- package/dist/pass.js +122 -0
- package/dist/passRules.js +96 -0
- package/dist/passStore.js +485 -0
- package/dist/passTables.entity.js +96 -0
- package/dist/plugin.js +1086 -0
- package/dist/port.js +5 -0
- package/dist/progressionStore.js +706 -0
- package/dist/questComponents.js +163 -0
- package/dist/questPort.d.ts +126 -0
- package/dist/questPort.js +5 -0
- package/dist/questRefresh.js +56 -0
- package/dist/questRefresh.server.js +126 -0
- package/dist/questRerollJournal.js +77 -0
- package/dist/questStore.js +592 -0
- package/dist/questTables.entity.js +117 -0
- package/dist/quests.d.ts +142 -0
- package/dist/quests.js +153 -0
- package/dist/rank-app/schedules/progression.dispatchRankClosures.cron.tsx +19 -0
- package/dist/rank-app/workflows/progression.closeRankSeason.workflow.server.tsx +10 -0
- package/dist/rank-app/workflows/progression.closeRankSeason.workflow.tsx +1 -0
- package/dist/rankClosure.d.ts +69 -0
- package/dist/rankClosure.js +35 -0
- package/dist/rankClosure.server.js +139 -0
- package/dist/rankClosureWorkflow.d.ts +34 -0
- package/dist/rankClosureWorkflow.js +16 -0
- package/dist/rankReader.server.js +57 -0
- package/dist/rankRewardParent.server.js +65 -0
- package/dist/rankSeasons.d.ts +144 -0
- package/dist/rankSeasons.js +91 -0
- package/dist/rankStore.js +521 -0
- package/dist/rankSystem.fixture.js +170 -0
- package/dist/rankTables.entity.js +101 -0
- package/dist/ranks.d.ts +167 -0
- package/dist/ranks.js +219 -0
- package/dist/resourceStore.js +464 -0
- package/dist/resourceTables.entity.js +89 -0
- package/dist/resources.d.ts +105 -0
- package/dist/resources.js +60 -0
- package/dist/reward-app/schedules/progression.dispatchRewards.cron.tsx +19 -0
- package/dist/reward-app/workflows/progression.deliverReward.workflow.server.tsx +10 -0
- package/dist/reward-app/workflows/progression.deliverReward.workflow.tsx +1 -0
- package/dist/reward.d.ts +27 -0
- package/dist/reward.js +39 -0
- package/dist/rewardDelivery.d.ts +163 -0
- package/dist/rewardDelivery.js +38 -0
- package/dist/rewardDelivery.server.js +430 -0
- package/dist/rewardDeliveryRecord.js +48 -0
- package/dist/rewardDeliveryWorkflow.d.ts +36 -0
- package/dist/rewardDeliveryWorkflow.js +16 -0
- package/dist/rpc.d.ts +880 -0
- package/dist/rpc.js +498 -0
- package/dist/server.d.ts +2812 -0
- package/dist/server.js +21 -0
- package/dist/stats.js +45 -0
- package/dist/strategies.d.ts +131 -0
- package/dist/strategies.js +4 -0
- package/dist/systemFixtures.js +474 -0
- package/dist/tables.entity.js +155 -0
- package/dist/testing.d.ts +1566 -0
- package/dist/testing.js +11 -0
- package/dist/track.js +72 -0
- package/dist/tutorial.d.ts +157 -0
- package/dist/tutorial.js +110 -0
- package/dist/tutorialStore.js +496 -0
- package/dist/tutorialSystem.fixture.js +100 -0
- package/dist/tutorialTables.entity.js +91 -0
- package/dist/web.d.ts +363 -0
- package/dist/web.js +7 -0
- package/package.json +167 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { progressionError as e } from "./errors.js";
|
|
2
|
+
import { identifier as t, integer as n, object as r, progressValue as i } from "./capture.js";
|
|
3
|
+
import { Context as a, Duration as o } from "effect";
|
|
4
|
+
//#region src/resources.ts
|
|
5
|
+
var s = (a) => {
|
|
6
|
+
let s = r(a, [
|
|
7
|
+
"id",
|
|
8
|
+
"version",
|
|
9
|
+
"max",
|
|
10
|
+
"initial",
|
|
11
|
+
"regenPer",
|
|
12
|
+
"regenAmount",
|
|
13
|
+
"regenEveryMs",
|
|
14
|
+
"refillOffer"
|
|
15
|
+
]), c = i(s.max), l = i(s.initial ?? c), u = i(s.regenAmount ?? "1");
|
|
16
|
+
if (c === 0n || l > c || u === 0n || typeof s.regenPer != "string" || s.regenPer.length > 120) throw e("invalid_input");
|
|
17
|
+
let d;
|
|
18
|
+
try {
|
|
19
|
+
d = n(o.toMillis(o.fromInputUnsafe(s.regenPer)), 1, 316224e5);
|
|
20
|
+
} catch {
|
|
21
|
+
throw e("invalid_input");
|
|
22
|
+
}
|
|
23
|
+
if (s.regenEveryMs !== void 0 && s.regenEveryMs !== d) throw e("invalid_input");
|
|
24
|
+
return Object.freeze({
|
|
25
|
+
id: t(s.id),
|
|
26
|
+
version: n(s.version ?? 1, 1, 1e6),
|
|
27
|
+
max: String(c),
|
|
28
|
+
initial: String(l),
|
|
29
|
+
regenPer: s.regenPer,
|
|
30
|
+
regenAmount: String(u),
|
|
31
|
+
regenEveryMs: d,
|
|
32
|
+
...s.refillOffer === void 0 ? {} : { refillOffer: t(s.refillOffer) }
|
|
33
|
+
});
|
|
34
|
+
}, c = (e) => {
|
|
35
|
+
let t = s(e.resource), r = l(e.state, t), i = n(e.at, r.anchorAt, 864e13), a = BigInt(i - r.anchorAt) / BigInt(t.regenEveryMs), o = BigInt(r.value) + a * BigInt(t.regenAmount);
|
|
36
|
+
return o >= BigInt(t.max) ? Object.freeze({
|
|
37
|
+
value: t.max,
|
|
38
|
+
anchorAt: i
|
|
39
|
+
}) : Object.freeze({
|
|
40
|
+
value: String(o),
|
|
41
|
+
anchorAt: r.anchorAt + Number(a) * t.regenEveryMs
|
|
42
|
+
});
|
|
43
|
+
}, l = (t, a) => {
|
|
44
|
+
let o = r(t, ["value", "anchorAt"]), s = i(o.value);
|
|
45
|
+
if (s > BigInt(a.max)) throw e("invalid_record");
|
|
46
|
+
return Object.freeze({
|
|
47
|
+
value: String(s),
|
|
48
|
+
anchorAt: n(o.anchorAt, 0, 864e13)
|
|
49
|
+
});
|
|
50
|
+
}, u = (t, r = c) => {
|
|
51
|
+
let i = s(t.resource), a = l(t.state, i), o = n(t.at, a.anchorAt, 864e13), u = l(r(Object.freeze({
|
|
52
|
+
resource: i,
|
|
53
|
+
state: a,
|
|
54
|
+
at: o
|
|
55
|
+
})), i);
|
|
56
|
+
if (BigInt(u.value) < BigInt(a.value) || u.anchorAt < a.anchorAt || u.anchorAt > o) throw e("invalid_input");
|
|
57
|
+
return u;
|
|
58
|
+
}, d = class extends a.Service()("@voltro/RegenResourcePort") {};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { d as RegenResourcePort, l as captureResourceState, c as defaultResourceRegen, s as defineRegenResource, u as resolveResourceRegen };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Effect } from 'effect'
|
|
2
|
+
import { defineSchedule } from '@voltro/runtime'
|
|
3
|
+
import { systemSubject } from '@voltro/protocol'
|
|
4
|
+
import { RewardDeliveryPort, type RewardDispatchCursor } from '@voltro/plugin-progression/delivery'
|
|
5
|
+
import { ProgressionError } from '@voltro/plugin-progression/errors'
|
|
6
|
+
export default defineSchedule({ name: 'progression.dispatchRewards', cron: '* * * * *', timezone: 'UTC', handler: (ctx) => Effect.gen(function* () {
|
|
7
|
+
const service = yield* RewardDeliveryPort, workflows = ctx.app.workflows
|
|
8
|
+
const failure = () => new ProgressionError({ code: 'unavailable' })
|
|
9
|
+
if (!workflows) return yield* Effect.fail(failure())
|
|
10
|
+
let after: RewardDispatchCursor | undefined, failed = false
|
|
11
|
+
for (let page = 0; page < 100; page++) {
|
|
12
|
+
const batch = yield* service.dispatch(systemSubject('progression.reward.dispatch'), { limit: 100, ...(after ? { after } : {}) }, (payload) => workflows.start('progression.deliverReward', payload))
|
|
13
|
+
failed ||= batch.failed.length > 0
|
|
14
|
+
if (batch.next === null) { if (failed) return yield* Effect.fail(failure()); return }
|
|
15
|
+
after = batch.next
|
|
16
|
+
}
|
|
17
|
+
// SQL pending rows remain eligible; exceeding a whole-scan budget reports failure.
|
|
18
|
+
return yield* Effect.fail(failure())
|
|
19
|
+
}) })
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Effect } from 'effect'
|
|
2
|
+
import { step } from '@voltro/workflow'
|
|
3
|
+
import { systemSubject } from '@voltro/protocol'
|
|
4
|
+
import { RewardDeliveryPort, RewardDeliveryReceiptSchema, type RewardDeliveryRequest } from '@voltro/plugin-progression/delivery'
|
|
5
|
+
import { ProgressionError } from '@voltro/plugin-progression/errors'
|
|
6
|
+
export default () => (payload: RewardDeliveryRequest) => Effect.gen(function* () {
|
|
7
|
+
const service = yield* RewardDeliveryPort
|
|
8
|
+
return yield* step({ name: 'deliver-accepted-progression-reward', success: RewardDeliveryReceiptSchema, error: ProgressionError,
|
|
9
|
+
retry: { maxAttempts: 5 }, execute: service.execute(systemSubject('progression.reward.workflow'), payload) })
|
|
10
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProgressionRewardDelivery } from '@voltro/plugin-progression/delivery/workflow'
|
package/dist/reward.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const captureReward: (input: unknown) => ProgressionReward;
|
|
2
|
+
|
|
3
|
+
export declare const captureRewards: (input: unknown, max?: number) => readonly ProgressionReward[];
|
|
4
|
+
|
|
5
|
+
export declare const grant: (currency: string, amount: ProgressValue) => ProgressionReward;
|
|
6
|
+
|
|
7
|
+
export declare const grantItem: (itemId: string, qty?: number) => ProgressionReward;
|
|
8
|
+
|
|
9
|
+
export declare type ProgressionReward = {
|
|
10
|
+
readonly kind: 'currency';
|
|
11
|
+
readonly currency: string;
|
|
12
|
+
readonly amount: string;
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: 'item';
|
|
15
|
+
readonly itemId: string;
|
|
16
|
+
readonly qty: number;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'xp';
|
|
19
|
+
readonly trackId: string;
|
|
20
|
+
readonly amount: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
declare type ProgressValue = string | number | bigint;
|
|
24
|
+
|
|
25
|
+
export declare const xp: (trackId: string, amount: ProgressValue) => ProgressionReward;
|
|
26
|
+
|
|
27
|
+
export { }
|
package/dist/reward.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { progressionError as e } from "./errors.js";
|
|
2
|
+
import { identifier as t, integer as n, list as r, object as i, progressValue as a } from "./capture.js";
|
|
3
|
+
//#region src/reward.ts
|
|
4
|
+
var o = (n, r) => {
|
|
5
|
+
let i = a(r);
|
|
6
|
+
if (i === 0n) throw e("invalid_reward");
|
|
7
|
+
return Object.freeze({
|
|
8
|
+
kind: "currency",
|
|
9
|
+
currency: t(n),
|
|
10
|
+
amount: String(i)
|
|
11
|
+
});
|
|
12
|
+
}, s = (e, r = 1) => Object.freeze({
|
|
13
|
+
kind: "item",
|
|
14
|
+
itemId: t(e),
|
|
15
|
+
qty: n(r, 1, 1e6)
|
|
16
|
+
}), c = (n, r) => {
|
|
17
|
+
let i = a(r);
|
|
18
|
+
if (i === 0n) throw e("invalid_reward");
|
|
19
|
+
return Object.freeze({
|
|
20
|
+
kind: "xp",
|
|
21
|
+
trackId: t(n),
|
|
22
|
+
amount: String(i)
|
|
23
|
+
});
|
|
24
|
+
}, l = (r) => {
|
|
25
|
+
let a = i(r, [
|
|
26
|
+
"kind",
|
|
27
|
+
"currency",
|
|
28
|
+
"itemId",
|
|
29
|
+
"trackId",
|
|
30
|
+
"amount",
|
|
31
|
+
"qty"
|
|
32
|
+
]);
|
|
33
|
+
if (a.kind === "currency" && Object.keys(a).length === 3) return o(t(a.currency), a.amount);
|
|
34
|
+
if (a.kind === "item" && Object.keys(a).length === 3) return s(t(a.itemId), n(a.qty, 1, 1e6));
|
|
35
|
+
if (a.kind === "xp" && Object.keys(a).length === 3) return c(t(a.trackId), a.amount);
|
|
36
|
+
throw e("invalid_reward");
|
|
37
|
+
}, u = (e, t = 256) => Object.freeze(r(e, t).map(l));
|
|
38
|
+
//#endregion
|
|
39
|
+
export { l as captureReward, u as captureRewards, o as grant, s as grantItem, c as xp };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Context } from 'effect';
|
|
2
|
+
import { EconomyService } from '@voltro/plugin-economy';
|
|
3
|
+
import { Effect } from 'effect';
|
|
4
|
+
import { InventoryService } from '@voltro/plugin-inventory';
|
|
5
|
+
import { PluginPrivacyTarget } from '@voltro/protocol';
|
|
6
|
+
import { Schema } from 'effect';
|
|
7
|
+
import { Subject } from '@voltro/protocol';
|
|
8
|
+
import { WorkflowRunHandle } from '@voltro/protocol';
|
|
9
|
+
import { YieldableError } from 'effect/Cause';
|
|
10
|
+
|
|
11
|
+
declare interface ApplyStatInput {
|
|
12
|
+
readonly tenantId: string;
|
|
13
|
+
readonly ownerId: string;
|
|
14
|
+
readonly stat: string;
|
|
15
|
+
readonly period: 'lifetime' | 'season';
|
|
16
|
+
readonly seasonId?: string | null;
|
|
17
|
+
readonly operator: StatOperator;
|
|
18
|
+
readonly operand: ProgressValue;
|
|
19
|
+
readonly requestId: string;
|
|
20
|
+
readonly source: string;
|
|
21
|
+
readonly origin: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare interface ApplyXpInput {
|
|
25
|
+
readonly tenantId: string;
|
|
26
|
+
readonly ownerId: string;
|
|
27
|
+
readonly trackId: string;
|
|
28
|
+
readonly amount: ProgressValue;
|
|
29
|
+
readonly requestId: string;
|
|
30
|
+
readonly source: string;
|
|
31
|
+
readonly origin: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare interface PlayerStat {
|
|
35
|
+
readonly stat: string;
|
|
36
|
+
readonly period: 'lifetime' | 'season';
|
|
37
|
+
readonly seasonId: string | null;
|
|
38
|
+
readonly value: string;
|
|
39
|
+
readonly updatedAt: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare interface PlayerTrack {
|
|
43
|
+
readonly trackId: string;
|
|
44
|
+
readonly xp: string;
|
|
45
|
+
readonly level: number;
|
|
46
|
+
readonly prestige: number;
|
|
47
|
+
readonly updatedAt: number | null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare type ProgressionChange = {
|
|
51
|
+
readonly kind: 'xp';
|
|
52
|
+
readonly trackId: string;
|
|
53
|
+
readonly xp: string;
|
|
54
|
+
readonly delta: string;
|
|
55
|
+
readonly fromLevel: number;
|
|
56
|
+
readonly toLevel: number;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: 'stat';
|
|
59
|
+
readonly stat: string;
|
|
60
|
+
readonly period: 'lifetime' | 'season';
|
|
61
|
+
readonly seasonId: string | null;
|
|
62
|
+
readonly value: string;
|
|
63
|
+
readonly operator: StatOperator;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
declare class ProgressionError extends ProgressionError_base {
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare const ProgressionError_base: Schema.Class<ProgressionError, Schema.TaggedStruct<"ProgressionError", {
|
|
70
|
+
readonly code: Schema.Literals<readonly ["invalid_input", "invalid_record", "invalid_curve", "invalid_reward", "invalid_track", "invalid_stat", "overflow", "insufficient_resource", "forbidden", "conflict", "erased", "not_found", "limit_exceeded", "unavailable"]>;
|
|
71
|
+
}>, YieldableError>;
|
|
72
|
+
|
|
73
|
+
declare interface ProgressionReceipt {
|
|
74
|
+
readonly operationId: string;
|
|
75
|
+
readonly at: number;
|
|
76
|
+
readonly change: ProgressionChange;
|
|
77
|
+
readonly rewardsQueued: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
declare interface ProgressionService {
|
|
81
|
+
readonly applyXp: (subject: Subject, input: ApplyXpInput) => Effect.Effect<ProgressionReceipt, ProgressionError>;
|
|
82
|
+
readonly applyStat: (subject: Subject, input: ApplyStatInput) => Effect.Effect<ProgressionReceipt, ProgressionError>;
|
|
83
|
+
readonly mine: (subject: Subject) => Effect.Effect<readonly PlayerTrack[], ProgressionError>;
|
|
84
|
+
readonly stats: (subject: Subject) => Effect.Effect<readonly PlayerStat[], ProgressionError>;
|
|
85
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, ProgressionError>;
|
|
86
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, ProgressionError>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare type ProgressValue = string | number | bigint;
|
|
90
|
+
|
|
91
|
+
export declare interface RewardDeliveryOptions {
|
|
92
|
+
/** An explicit app-owned funding account; never a balance/price/credential. */
|
|
93
|
+
readonly systemAccount: string;
|
|
94
|
+
readonly economy?: EconomyService | undefined;
|
|
95
|
+
readonly inventory?: InventoryService | undefined;
|
|
96
|
+
readonly progression?: ProgressionService | undefined;
|
|
97
|
+
readonly allowedServices?: readonly string[] | undefined;
|
|
98
|
+
readonly now?: (() => number) | undefined;
|
|
99
|
+
readonly version?: string;
|
|
100
|
+
/** Full replacement must own queue/privacy semantics of its source ports. */
|
|
101
|
+
readonly service?: RewardDeliveryService | undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare class RewardDeliveryPort extends RewardDeliveryPort_base {
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare const RewardDeliveryPort_base: Context.ServiceClass<RewardDeliveryPort, "@voltro/RewardDeliveryPort", RewardDeliveryService>;
|
|
108
|
+
|
|
109
|
+
export declare interface RewardDeliveryReceipt extends RewardDeliveryRequest {
|
|
110
|
+
readonly status: 'delivered' | 'erased';
|
|
111
|
+
readonly outputKind: 'currency' | 'item' | 'xp' | null;
|
|
112
|
+
readonly externalOperationId: string | null;
|
|
113
|
+
readonly at: number;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export declare const RewardDeliveryReceiptSchema: Schema.Struct<{
|
|
117
|
+
readonly kind: Schema.Literals<readonly ["level", "quest", "achievement", "daily", "pass", "tutorial", "rank"]>;
|
|
118
|
+
readonly rewardId: Schema.String;
|
|
119
|
+
readonly status: Schema.Literals<readonly ["delivered", "erased"]>;
|
|
120
|
+
readonly outputKind: Schema.NullOr<Schema.Literals<readonly ["currency", "item", "xp"]>>;
|
|
121
|
+
readonly externalOperationId: Schema.NullOr<Schema.String>;
|
|
122
|
+
readonly at: Schema.Number;
|
|
123
|
+
}>;
|
|
124
|
+
|
|
125
|
+
export declare interface RewardDeliveryRequest {
|
|
126
|
+
readonly kind: RewardSourceKind;
|
|
127
|
+
readonly rewardId: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export declare const RewardDeliveryRequestSchema: Schema.Struct<{
|
|
131
|
+
readonly kind: Schema.Literals<readonly ["level", "quest", "achievement", "daily", "pass", "tutorial", "rank"]>;
|
|
132
|
+
readonly rewardId: Schema.String;
|
|
133
|
+
}>;
|
|
134
|
+
|
|
135
|
+
export declare interface RewardDeliveryService {
|
|
136
|
+
readonly execute: (subject: Subject, input: RewardDeliveryRequest) => Effect.Effect<RewardDeliveryReceipt, ProgressionError>;
|
|
137
|
+
readonly dispatch: (subject: Subject, input: RewardDispatchInput, start: (payload: RewardDeliveryRequest) => Promise<WorkflowRunHandle>) => Effect.Effect<RewardDispatchResult, ProgressionError>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export declare interface RewardDispatchCursor extends RewardDeliveryRequest {
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export declare interface RewardDispatchInput {
|
|
144
|
+
readonly limit: number;
|
|
145
|
+
readonly after?: RewardDispatchCursor;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export declare interface RewardDispatchResult {
|
|
149
|
+
readonly submitted: readonly {
|
|
150
|
+
readonly request: RewardDeliveryRequest;
|
|
151
|
+
readonly status: WorkflowRunHandle['status'];
|
|
152
|
+
}[];
|
|
153
|
+
readonly failed: readonly RewardDeliveryRequest[];
|
|
154
|
+
readonly next: RewardDispatchCursor | null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export declare type RewardSourceKind = 'level' | 'quest' | 'achievement' | 'daily' | 'pass' | 'tutorial' | 'rank';
|
|
158
|
+
|
|
159
|
+
declare const STAT_OPERATORS: readonly ["increment", "max", "min", "set"];
|
|
160
|
+
|
|
161
|
+
declare type StatOperator = typeof STAT_OPERATORS[number];
|
|
162
|
+
|
|
163
|
+
export { }
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Context as e, Schema as t } from "effect";
|
|
2
|
+
//#region src/rewardDelivery.ts
|
|
3
|
+
var n = t.String.pipe(t.check(t.isPattern(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,119}$/))), r = t.Struct({
|
|
4
|
+
kind: t.Literals([
|
|
5
|
+
"level",
|
|
6
|
+
"quest",
|
|
7
|
+
"achievement",
|
|
8
|
+
"daily",
|
|
9
|
+
"pass",
|
|
10
|
+
"tutorial",
|
|
11
|
+
"rank"
|
|
12
|
+
]),
|
|
13
|
+
rewardId: n
|
|
14
|
+
}), i = t.Struct({
|
|
15
|
+
kind: t.Literals([
|
|
16
|
+
"level",
|
|
17
|
+
"quest",
|
|
18
|
+
"achievement",
|
|
19
|
+
"daily",
|
|
20
|
+
"pass",
|
|
21
|
+
"tutorial",
|
|
22
|
+
"rank"
|
|
23
|
+
]),
|
|
24
|
+
rewardId: n,
|
|
25
|
+
status: t.Literals(["delivered", "erased"]),
|
|
26
|
+
outputKind: t.NullOr(t.Literals([
|
|
27
|
+
"currency",
|
|
28
|
+
"item",
|
|
29
|
+
"xp"
|
|
30
|
+
])),
|
|
31
|
+
externalOperationId: t.NullOr(n),
|
|
32
|
+
at: t.Number.pipe(t.check(t.isInt()), t.check(t.isBetween({
|
|
33
|
+
minimum: 0,
|
|
34
|
+
maximum: 864e13
|
|
35
|
+
})))
|
|
36
|
+
}).pipe(t.check(t.makeFilter((e) => e.status === "erased" ? e.outputKind === null && e.externalOperationId === null : e.outputKind !== null && e.externalOperationId !== null))), a = class extends e.Service()("@voltro/RewardDeliveryPort") {};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { a as RewardDeliveryPort, i as RewardDeliveryReceiptSchema, r as RewardDeliveryRequestSchema };
|