@voltro/game-stack 0.0.0-stage → 0.88.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 +24492 -0
- package/LICENSE +61 -0
- package/README.md +224 -2
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +17507 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.js +12 -0
- package/dist/fight.d.ts +239 -0
- package/dist/fight.js +5 -0
- package/dist/fightRoom.js +43 -0
- package/dist/fightRules.js +65 -0
- package/dist/fightSchema.js +80 -0
- package/dist/fightSimulation.js +219 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.js +91 -0
- package/dist/resourceBindings.js +74 -0
- package/dist/systems.d.ts +44 -0
- package/dist/systems.js +161 -0
- package/package.json +72 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { chatPlugin } from '@voltro/plugin-chat';
|
|
2
|
+
import { economyPlugin } from '@voltro/plugin-economy';
|
|
3
|
+
import { guestAuthPlugin } from '@voltro/plugin-auth';
|
|
4
|
+
import { guildsPlugin } from '@voltro/plugin-guilds';
|
|
5
|
+
import { inventoryPlugin } from '@voltro/plugin-inventory';
|
|
6
|
+
import { leaderboardsPlugin } from '@voltro/plugin-leaderboards';
|
|
7
|
+
import { liveOpsPlugin } from '@voltro/plugin-liveops';
|
|
8
|
+
import { matchmakingPlugin } from '@voltro/plugin-matchmaking';
|
|
9
|
+
import { playersPlugin } from '@voltro/plugin-players';
|
|
10
|
+
import { progressionPlugin } from '@voltro/plugin-progression';
|
|
11
|
+
import { roomsPlugin } from '@voltro/plugin-rooms';
|
|
12
|
+
import { sanctionsPlugin } from '@voltro/plugin-sanctions';
|
|
13
|
+
import { savesPlugin } from '@voltro/plugin-saves';
|
|
14
|
+
import { Schema } from 'effect';
|
|
15
|
+
import { socialPlugin } from '@voltro/plugin-social';
|
|
16
|
+
import { VoltroPlugin } from '@voltro/protocol';
|
|
17
|
+
import { YieldableError } from 'effect/Cause';
|
|
18
|
+
|
|
19
|
+
declare type Configuration<F> = F extends (options: infer O) => unknown ? NonNullable<O> : never;
|
|
20
|
+
|
|
21
|
+
declare type Configured<T> = false | T;
|
|
22
|
+
|
|
23
|
+
declare type Defaultable<T> = Configured<T> | true;
|
|
24
|
+
|
|
25
|
+
export declare const describeGameStack: (input: GameStackOptions) => GameStackSelection;
|
|
26
|
+
|
|
27
|
+
/** Exact selection and deterministic dependency diagnostics, no service probes. */
|
|
28
|
+
export declare const describeGameSystems: (preset: GamePreset, systems: ReadonlyArray<GameSystemId>, configured: ReadonlyArray<GameSystemId>) => GameStackSelection;
|
|
29
|
+
|
|
30
|
+
export declare const GAME_PRESET_IDS: readonly ["arena", "cards", "quiz", "world", "fight", "minimal"];
|
|
31
|
+
|
|
32
|
+
/** Composition catalogue, not a runtime/capacity or completed-template claim. */
|
|
33
|
+
export declare const GAME_SYSTEM_IDS: readonly ["auth", "players", "sanctions", "social", "chat", "guilds", "inventory", "economy", "progression", "liveops", "saves", "rooms", "matchmaking", "leaderboards"];
|
|
34
|
+
|
|
35
|
+
export declare const GAME_SYSTEMS: ReadonlyArray<GameSystemDefinition>;
|
|
36
|
+
|
|
37
|
+
export declare type GamePreset = typeof GAME_PRESET_IDS[number];
|
|
38
|
+
|
|
39
|
+
export declare const GamePreset: Schema.Literals<readonly ["arena", "cards", "quiz", "world", "fight", "minimal"]>;
|
|
40
|
+
|
|
41
|
+
/** Thin composition of the real factories, with no new SQL/services/lifecycle.
|
|
42
|
+
* Missing owner/content bindings refuse before constructing any plugin. */
|
|
43
|
+
export declare const gameStack: (input: GameStackOptions) => ReadonlyArray<VoltroPlugin>;
|
|
44
|
+
|
|
45
|
+
export declare const GameStackDiagnostic: Schema.Struct<{
|
|
46
|
+
readonly code: Schema.Literals<readonly ["missing_configuration", "missing_system"]>;
|
|
47
|
+
readonly system: Schema.Literals<readonly ["auth", "players", "sanctions", "social", "chat", "guilds", "inventory", "economy", "progression", "liveops", "saves", "rooms", "matchmaking", "leaderboards"]>;
|
|
48
|
+
readonly dependency: Schema.NullOr<Schema.Literals<readonly ["auth", "players", "sanctions", "social", "chat", "guilds", "inventory", "economy", "progression", "liveops", "saves", "rooms", "matchmaking", "leaderboards"]>>;
|
|
49
|
+
}>;
|
|
50
|
+
|
|
51
|
+
export declare type GameStackDiagnostic = typeof GameStackDiagnostic.Type;
|
|
52
|
+
|
|
53
|
+
export declare class GameStackError extends GameStackError_base {
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare const GameStackError_base: Schema.Class<GameStackError, Schema.TaggedStruct<"GameStackError", {
|
|
57
|
+
readonly code: Schema.Literals<readonly ["invalid_configuration", "missing_configuration", "duplicate_plugin"]>;
|
|
58
|
+
readonly systems: Schema.$Array<Schema.Literals<readonly ["auth", "players", "sanctions", "social", "chat", "guilds", "inventory", "economy", "progression", "liveops", "saves", "rooms", "matchmaking", "leaderboards"]>>;
|
|
59
|
+
}>, YieldableError>;
|
|
60
|
+
|
|
61
|
+
/** The stack's own plugins that later systems are wired to. */
|
|
62
|
+
export declare interface GameStackInstalled {
|
|
63
|
+
readonly rooms: ReturnType<typeof roomsPlugin> | undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export declare interface GameStackOptions {
|
|
67
|
+
readonly preset?: GamePreset;
|
|
68
|
+
/** Actual project-owned tenant/secret source and guest lifecycle options. */
|
|
69
|
+
readonly auth?: Configured<Configuration<typeof guestAuthPlugin>>;
|
|
70
|
+
readonly players?: Defaultable<Configuration<typeof playersPlugin>>;
|
|
71
|
+
readonly sanctions?: Defaultable<Configuration<typeof sanctionsPlugin>>;
|
|
72
|
+
readonly social?: Defaultable<Configuration<typeof socialPlugin>>;
|
|
73
|
+
readonly chat?: Defaultable<Configuration<typeof chatPlugin>>;
|
|
74
|
+
readonly guilds?: Defaultable<Configuration<typeof guildsPlugin>>;
|
|
75
|
+
readonly inventory?: Configured<Configuration<typeof inventoryPlugin>>;
|
|
76
|
+
readonly economy?: Configured<Configuration<typeof economyPlugin>>;
|
|
77
|
+
readonly progression?: Configured<Configuration<typeof progressionPlugin>>;
|
|
78
|
+
readonly liveops?: Configured<Configuration<typeof liveOpsPlugin>>;
|
|
79
|
+
readonly saves?: Configured<Configuration<typeof savesPlugin>>;
|
|
80
|
+
/** Must include `bindApi`; `roomsPlugin()` alone refuses to boot. */
|
|
81
|
+
readonly rooms?: Configured<Configuration<typeof roomsPlugin>>;
|
|
82
|
+
/** Options, or a function of the installed systems: it receives the stack's own Rooms plugin,
|
|
83
|
+
* so the allocator seats matches in it (`roomsAllocator({ rooms })`). */
|
|
84
|
+
readonly matchmaking?: Configured<Configuration<typeof matchmakingPlugin> | ((installed: GameStackInstalled) => Configuration<typeof matchmakingPlugin>)>;
|
|
85
|
+
readonly leaderboards?: Configured<Configuration<typeof leaderboardsPlugin>>;
|
|
86
|
+
/** Ordinary plugins for provider auth, CMS, notifications or app bridges. */
|
|
87
|
+
readonly additionalPlugins?: ReadonlyArray<VoltroPlugin>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export declare interface GameStackSelection {
|
|
91
|
+
readonly preset: GamePreset;
|
|
92
|
+
readonly systems: ReadonlyArray<GameSystemId>;
|
|
93
|
+
readonly diagnostics: ReadonlyArray<GameStackDiagnostic>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export declare interface GameSystemDefinition {
|
|
97
|
+
readonly id: GameSystemId;
|
|
98
|
+
readonly package: string;
|
|
99
|
+
readonly defaultConfiguration: boolean;
|
|
100
|
+
readonly dependsOn: ReadonlyArray<GameSystemId>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export declare type GameSystemId = typeof GAME_SYSTEM_IDS[number];
|
|
104
|
+
|
|
105
|
+
export declare const GameSystemId: Schema.Literals<readonly ["auth", "players", "sanctions", "social", "chat", "guilds", "inventory", "economy", "progression", "liveops", "saves", "rooms", "matchmaking", "leaderboards"]>;
|
|
106
|
+
|
|
107
|
+
export declare const presetGameSystems: (preset: GamePreset) => ReadonlyArray<GameSystemId>;
|
|
108
|
+
|
|
109
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { GAME_PRESET_IDS as e, GAME_SYSTEMS as t, GAME_SYSTEM_IDS as n, GamePreset as r, GameStackDiagnostic as i, GameSystemId as a, describeGameSystems as o, presetGameSystems as s } from "./systems.js";
|
|
2
|
+
import { GameStackError as c } from "./errors.js";
|
|
3
|
+
import { bindStackEconomyInventory as l, bindStackInboxGrants as u, bindStackRewardDestinations as d } from "./resourceBindings.js";
|
|
4
|
+
import { guestAuthPlugin as f } from "@voltro/plugin-auth";
|
|
5
|
+
import { playersPlugin as p } from "@voltro/plugin-players";
|
|
6
|
+
import { sanctionsPlugin as m } from "@voltro/plugin-sanctions";
|
|
7
|
+
import { socialPlugin as h } from "@voltro/plugin-social";
|
|
8
|
+
import { chatPlugin as g } from "@voltro/plugin-chat";
|
|
9
|
+
import { guildsPlugin as _ } from "@voltro/plugin-guilds";
|
|
10
|
+
import { inventoryPlugin as v } from "@voltro/plugin-inventory";
|
|
11
|
+
import { economyPlugin as y } from "@voltro/plugin-economy";
|
|
12
|
+
import { progressionPlugin as b } from "@voltro/plugin-progression";
|
|
13
|
+
import { liveOpsPlugin as x } from "@voltro/plugin-liveops";
|
|
14
|
+
import { savesPlugin as S } from "@voltro/plugin-saves";
|
|
15
|
+
import { roomsPlugin as C } from "@voltro/plugin-rooms";
|
|
16
|
+
import { matchmakingPlugin as w } from "@voltro/plugin-matchmaking";
|
|
17
|
+
import { leaderboardsPlugin as T } from "@voltro/plugin-leaderboards";
|
|
18
|
+
import { Schema as E } from "effect";
|
|
19
|
+
// src/index.ts
|
|
20
|
+
function D() {
|
|
21
|
+
throw new c({
|
|
22
|
+
code: "invalid_configuration",
|
|
23
|
+
systems: []
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
var O = (e) => {
|
|
27
|
+
(!e || Object.getPrototypeOf(e) !== Object.prototype || Object.getOwnPropertySymbols(e).length) && D();
|
|
28
|
+
let t = Object.getOwnPropertyDescriptors(e);
|
|
29
|
+
Object.entries(t).some(([e, t]) => ![
|
|
30
|
+
...n,
|
|
31
|
+
"preset",
|
|
32
|
+
"additionalPlugins"
|
|
33
|
+
].includes(e) || !t.enumerable || !("value" in t)) && D();
|
|
34
|
+
let i = Object.freeze(Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.value])));
|
|
35
|
+
try {
|
|
36
|
+
E.decodeUnknownSync(E.toType(r))(i.preset ?? "arena");
|
|
37
|
+
} catch {
|
|
38
|
+
D();
|
|
39
|
+
}
|
|
40
|
+
for (let e of n) {
|
|
41
|
+
let t = i[e];
|
|
42
|
+
t === void 0 || typeof t == "boolean" || e === "matchmaking" && typeof t == "function" || t && typeof t == "object" && !Array.isArray(t) || D();
|
|
43
|
+
}
|
|
44
|
+
if (i.additionalPlugins !== void 0) {
|
|
45
|
+
let e = i.additionalPlugins;
|
|
46
|
+
(!Array.isArray(e) || e.length > 64 || Reflect.ownKeys(e).length !== e.length + 1) && D();
|
|
47
|
+
for (let t = 0; t < e.length; t++) {
|
|
48
|
+
let n = Object.getOwnPropertyDescriptor(e, String(t));
|
|
49
|
+
n && "value" in n && n.value && typeof n.value == "object" || D();
|
|
50
|
+
let r = Object.getOwnPropertyDescriptor(n.value, "name");
|
|
51
|
+
(!r || !("value" in r) || typeof r.value != "string" || !r.value.length || r.value.length > 256) && D();
|
|
52
|
+
}
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
...i,
|
|
55
|
+
additionalPlugins: Object.freeze([...e])
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return i;
|
|
59
|
+
}, k = (e) => {
|
|
60
|
+
let t = e.preset ?? "arena", r = new Set(s(t)), i = n.filter((t) => e[t] === void 0 ? r.has(t) : e[t] !== !1), a = i.filter((t) => e[t] !== void 0 && e[t] !== !0);
|
|
61
|
+
return o(t, i, a);
|
|
62
|
+
}, A = (e) => k(O(e)), j = (e) => {
|
|
63
|
+
let t = O(e), n = k(t), r = n.diagnostics.filter((e) => e.code === "missing_configuration").map((e) => e.system);
|
|
64
|
+
if (r.length) throw new c({
|
|
65
|
+
code: "missing_configuration",
|
|
66
|
+
systems: r
|
|
67
|
+
});
|
|
68
|
+
let i = new Set(n.systems), a = [], o = (e, t) => {
|
|
69
|
+
if (t === void 0 || t === !1 || t === !0) throw new c({
|
|
70
|
+
code: "missing_configuration",
|
|
71
|
+
systems: [e]
|
|
72
|
+
});
|
|
73
|
+
return t;
|
|
74
|
+
}, s = (e, t) => e === void 0 || e === !0 ? t : e === !1 ? D() : e;
|
|
75
|
+
i.has("auth") && a.push(f(o("auth", t.auth))), i.has("players") && a.push(p(s(t.players, {}))), i.has("sanctions") && a.push(m(s(t.sanctions, {}))), i.has("social") && a.push(h(s(t.social, {}))), i.has("chat") && a.push(g(s(t.chat, {}))), i.has("guilds") && a.push(_(s(t.guilds, {})));
|
|
76
|
+
let E = i.has("inventory") ? v(o("inventory", t.inventory)) : void 0;
|
|
77
|
+
E && a.push(E);
|
|
78
|
+
let A = i.has("economy") ? y(l(o("economy", t.economy), E)) : void 0;
|
|
79
|
+
A && a.push(A), i.has("progression") && a.push(b(d(o("progression", t.progression), E, A))), i.has("liveops") && a.push(x(u(o("liveops", t.liveops), E, A))), i.has("saves") && a.push(S(o("saves", t.saves)));
|
|
80
|
+
let j = i.has("rooms") ? C(o("rooms", t.rooms)) : void 0;
|
|
81
|
+
if (j && a.push(j), i.has("matchmaking")) {
|
|
82
|
+
let e = o("matchmaking", t.matchmaking);
|
|
83
|
+
a.push(w(typeof e == "function" ? e(Object.freeze({ rooms: j })) : e));
|
|
84
|
+
}
|
|
85
|
+
if (i.has("leaderboards") && a.push(T(o("leaderboards", t.leaderboards))), a.push(...t.additionalPlugins ?? []), new Set(a.map((e) => e.name)).size !== a.length) throw new c({
|
|
86
|
+
code: "duplicate_plugin",
|
|
87
|
+
systems: n.systems
|
|
88
|
+
});
|
|
89
|
+
return Object.freeze(a);
|
|
90
|
+
};
|
|
91
|
+
export { e as GAME_PRESET_IDS, t as GAME_SYSTEMS, n as GAME_SYSTEM_IDS, r as GamePreset, i as GameStackDiagnostic, c as GameStackError, a as GameSystemId, A as describeGameStack, o as describeGameSystems, j as gameStack, s as presetGameSystems };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { GameStackError as e } from "./errors.js";
|
|
2
|
+
import { economyInboxGrants as t } from "@voltro/plugin-liveops/grants";
|
|
3
|
+
// src/resourceBindings.ts
|
|
4
|
+
var n = (t, n) => {
|
|
5
|
+
let r = Object.getOwnPropertyDescriptor(t, n);
|
|
6
|
+
if (r) {
|
|
7
|
+
if (!("value" in r)) throw new e({
|
|
8
|
+
code: "invalid_configuration",
|
|
9
|
+
systems: []
|
|
10
|
+
});
|
|
11
|
+
return r.value;
|
|
12
|
+
}
|
|
13
|
+
}, r = (t) => {
|
|
14
|
+
if (!t || Object.getPrototypeOf(t) !== Object.prototype || Object.getOwnPropertySymbols(t).length) throw new e({
|
|
15
|
+
code: "invalid_configuration",
|
|
16
|
+
systems: []
|
|
17
|
+
});
|
|
18
|
+
let n = Object.getOwnPropertyDescriptors(t);
|
|
19
|
+
if (Object.values(n).some((e) => !e.enumerable || !("value" in e))) throw new e({
|
|
20
|
+
code: "invalid_configuration",
|
|
21
|
+
systems: []
|
|
22
|
+
});
|
|
23
|
+
return Object.fromEntries(Object.entries(n).map(([e, t]) => [e, t.value]));
|
|
24
|
+
}, i = (e, t) => {
|
|
25
|
+
if (!t || n(e, "service") !== void 0) return e;
|
|
26
|
+
let i = t.inventory, a = Object.freeze({ prepareGrant: i.prepareGrant.bind(i) }), o = (e) => !e || n(e, "service") !== void 0 || n(e, "inventory") !== void 0 ? e : {
|
|
27
|
+
...r(e),
|
|
28
|
+
inventory: a
|
|
29
|
+
}, s = n(e, "shop"), c = n(e, "codes"), l = n(e, "containers"), u = n(e, "subscriptions"), d = n(e, "trades"), f = o(s), p = o(c), m = o(l), h = o(u), g = !d || n(d, "service") !== void 0 || n(d, "inventory") !== void 0 ? d : {
|
|
30
|
+
...r(d),
|
|
31
|
+
inventory: Object.freeze({
|
|
32
|
+
prepareReserve: i.prepareReserve.bind(i),
|
|
33
|
+
prepareRelease: i.prepareRelease.bind(i),
|
|
34
|
+
prepareReservationTransfer: i.prepareReservationTransfer.bind(i),
|
|
35
|
+
prepareReserveTransfer: i.prepareReserveTransfer.bind(i),
|
|
36
|
+
reservation: i.reservation.bind(i),
|
|
37
|
+
reservationEvidence: i.reservationEvidence.bind(i)
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
return f === s && p === c && m === l && h === u && g === d ? e : {
|
|
41
|
+
...r(e),
|
|
42
|
+
...f ? { shop: f } : {},
|
|
43
|
+
...p ? { codes: p } : {},
|
|
44
|
+
...m ? { containers: m } : {},
|
|
45
|
+
...h ? { subscriptions: h } : {},
|
|
46
|
+
...g ? { trades: g } : {}
|
|
47
|
+
};
|
|
48
|
+
}, a = (e, t, i) => {
|
|
49
|
+
if (n(e, "service") !== void 0) return e;
|
|
50
|
+
let a = n(e, "delivery");
|
|
51
|
+
if (!a || n(a, "service") !== void 0) return e;
|
|
52
|
+
let o = n(a, "inventory") === void 0 && t !== void 0, s = n(a, "economy") === void 0 && i !== void 0;
|
|
53
|
+
if (!o && !s) return e;
|
|
54
|
+
let c = r(e), l = r(a);
|
|
55
|
+
return {
|
|
56
|
+
...c,
|
|
57
|
+
delivery: {
|
|
58
|
+
...l,
|
|
59
|
+
...o ? { inventory: t.inventory.service() } : {},
|
|
60
|
+
...s ? { economy: i.economy.service() } : {}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}, o = (e, i, a) => {
|
|
64
|
+
if (!i && !a || n(e, "service") !== void 0 || n(e, "grants") !== void 0) return e;
|
|
65
|
+
let o = n(e, "version");
|
|
66
|
+
return o === void 0 || o === "default.v1" ? e : {
|
|
67
|
+
...r(e),
|
|
68
|
+
grants: t({
|
|
69
|
+
...i ? { inventory: i.inventory } : {},
|
|
70
|
+
...a ? { economy: a.economy } : {}
|
|
71
|
+
})
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export { i as bindStackEconomyInventory, o as bindStackInboxGrants, a as bindStackRewardDestinations };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
|
|
3
|
+
/** Exact selection and deterministic dependency diagnostics, no service probes. */
|
|
4
|
+
export declare const describeGameSystems: (preset: GamePreset, systems: ReadonlyArray<GameSystemId>, configured: ReadonlyArray<GameSystemId>) => GameStackSelection;
|
|
5
|
+
|
|
6
|
+
export declare const GAME_PRESET_IDS: readonly ["arena", "cards", "quiz", "world", "fight", "minimal"];
|
|
7
|
+
|
|
8
|
+
/** Composition catalogue, not a runtime/capacity or completed-template claim. */
|
|
9
|
+
export declare const GAME_SYSTEM_IDS: readonly ["auth", "players", "sanctions", "social", "chat", "guilds", "inventory", "economy", "progression", "liveops", "saves", "rooms", "matchmaking", "leaderboards"];
|
|
10
|
+
|
|
11
|
+
export declare const GAME_SYSTEMS: ReadonlyArray<GameSystemDefinition>;
|
|
12
|
+
|
|
13
|
+
export declare type GamePreset = typeof GAME_PRESET_IDS[number];
|
|
14
|
+
|
|
15
|
+
export declare const GamePreset: Schema.Literals<readonly ["arena", "cards", "quiz", "world", "fight", "minimal"]>;
|
|
16
|
+
|
|
17
|
+
export declare const GameStackDiagnostic: Schema.Struct<{
|
|
18
|
+
readonly code: Schema.Literals<readonly ["missing_configuration", "missing_system"]>;
|
|
19
|
+
readonly system: Schema.Literals<readonly ["auth", "players", "sanctions", "social", "chat", "guilds", "inventory", "economy", "progression", "liveops", "saves", "rooms", "matchmaking", "leaderboards"]>;
|
|
20
|
+
readonly dependency: Schema.NullOr<Schema.Literals<readonly ["auth", "players", "sanctions", "social", "chat", "guilds", "inventory", "economy", "progression", "liveops", "saves", "rooms", "matchmaking", "leaderboards"]>>;
|
|
21
|
+
}>;
|
|
22
|
+
|
|
23
|
+
export declare type GameStackDiagnostic = typeof GameStackDiagnostic.Type;
|
|
24
|
+
|
|
25
|
+
export declare interface GameStackSelection {
|
|
26
|
+
readonly preset: GamePreset;
|
|
27
|
+
readonly systems: ReadonlyArray<GameSystemId>;
|
|
28
|
+
readonly diagnostics: ReadonlyArray<GameStackDiagnostic>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare interface GameSystemDefinition {
|
|
32
|
+
readonly id: GameSystemId;
|
|
33
|
+
readonly package: string;
|
|
34
|
+
readonly defaultConfiguration: boolean;
|
|
35
|
+
readonly dependsOn: ReadonlyArray<GameSystemId>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export declare type GameSystemId = typeof GAME_SYSTEM_IDS[number];
|
|
39
|
+
|
|
40
|
+
export declare const GameSystemId: Schema.Literals<readonly ["auth", "players", "sanctions", "social", "chat", "guilds", "inventory", "economy", "progression", "liveops", "saves", "rooms", "matchmaking", "leaderboards"]>;
|
|
41
|
+
|
|
42
|
+
export declare const presetGameSystems: (preset: GamePreset) => ReadonlyArray<GameSystemId>;
|
|
43
|
+
|
|
44
|
+
export { }
|
package/dist/systems.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { Schema as e } from "effect";
|
|
2
|
+
// src/systems.ts
|
|
3
|
+
var t = Object.freeze([
|
|
4
|
+
"auth",
|
|
5
|
+
"players",
|
|
6
|
+
"sanctions",
|
|
7
|
+
"social",
|
|
8
|
+
"chat",
|
|
9
|
+
"guilds",
|
|
10
|
+
"inventory",
|
|
11
|
+
"economy",
|
|
12
|
+
"progression",
|
|
13
|
+
"liveops",
|
|
14
|
+
"saves",
|
|
15
|
+
"rooms",
|
|
16
|
+
"matchmaking",
|
|
17
|
+
"leaderboards"
|
|
18
|
+
]), n = e.Literals(t), r = Object.freeze([
|
|
19
|
+
"arena",
|
|
20
|
+
"cards",
|
|
21
|
+
"quiz",
|
|
22
|
+
"world",
|
|
23
|
+
"fight",
|
|
24
|
+
"minimal"
|
|
25
|
+
]), i = e.Literals(r), a = Object.freeze([
|
|
26
|
+
{
|
|
27
|
+
id: "auth",
|
|
28
|
+
package: "@voltro/plugin-auth",
|
|
29
|
+
defaultConfiguration: !1,
|
|
30
|
+
dependsOn: []
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "players",
|
|
34
|
+
package: "@voltro/plugin-players",
|
|
35
|
+
defaultConfiguration: !0,
|
|
36
|
+
dependsOn: ["auth"]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "sanctions",
|
|
40
|
+
package: "@voltro/plugin-sanctions",
|
|
41
|
+
defaultConfiguration: !0,
|
|
42
|
+
dependsOn: ["auth"]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "social",
|
|
46
|
+
package: "@voltro/plugin-social",
|
|
47
|
+
defaultConfiguration: !0,
|
|
48
|
+
dependsOn: ["auth", "players"]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "chat",
|
|
52
|
+
package: "@voltro/plugin-chat",
|
|
53
|
+
defaultConfiguration: !0,
|
|
54
|
+
dependsOn: [
|
|
55
|
+
"auth",
|
|
56
|
+
"social",
|
|
57
|
+
"sanctions"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "guilds",
|
|
62
|
+
package: "@voltro/plugin-guilds",
|
|
63
|
+
defaultConfiguration: !0,
|
|
64
|
+
dependsOn: ["auth", "social"]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "inventory",
|
|
68
|
+
package: "@voltro/plugin-inventory",
|
|
69
|
+
defaultConfiguration: !1,
|
|
70
|
+
dependsOn: ["auth"]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "economy",
|
|
74
|
+
package: "@voltro/plugin-economy",
|
|
75
|
+
defaultConfiguration: !1,
|
|
76
|
+
dependsOn: ["auth", "inventory"]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "progression",
|
|
80
|
+
package: "@voltro/plugin-progression",
|
|
81
|
+
defaultConfiguration: !1,
|
|
82
|
+
dependsOn: [
|
|
83
|
+
"auth",
|
|
84
|
+
"inventory",
|
|
85
|
+
"economy",
|
|
86
|
+
"liveops"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "liveops",
|
|
91
|
+
package: "@voltro/plugin-liveops",
|
|
92
|
+
defaultConfiguration: !1,
|
|
93
|
+
dependsOn: [
|
|
94
|
+
"auth",
|
|
95
|
+
"inventory",
|
|
96
|
+
"economy"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "saves",
|
|
101
|
+
package: "@voltro/plugin-saves",
|
|
102
|
+
defaultConfiguration: !1,
|
|
103
|
+
dependsOn: ["auth"]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "rooms",
|
|
107
|
+
package: "@voltro/plugin-rooms",
|
|
108
|
+
defaultConfiguration: !1,
|
|
109
|
+
dependsOn: ["auth"]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "matchmaking",
|
|
113
|
+
package: "@voltro/plugin-matchmaking",
|
|
114
|
+
defaultConfiguration: !1,
|
|
115
|
+
dependsOn: ["auth", "rooms"]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "leaderboards",
|
|
119
|
+
package: "@voltro/plugin-leaderboards",
|
|
120
|
+
defaultConfiguration: !1,
|
|
121
|
+
dependsOn: ["auth"]
|
|
122
|
+
}
|
|
123
|
+
].map((e) => Object.freeze({
|
|
124
|
+
...e,
|
|
125
|
+
dependsOn: Object.freeze([...e.dependsOn])
|
|
126
|
+
}))), o = (n) => (e.decodeUnknownSync(e.toType(i))(n), n === "minimal" ? Object.freeze([
|
|
127
|
+
"auth",
|
|
128
|
+
"rooms",
|
|
129
|
+
"matchmaking",
|
|
130
|
+
"leaderboards"
|
|
131
|
+
]) : t), s = e.Struct({
|
|
132
|
+
code: e.Literals(["missing_configuration", "missing_system"]),
|
|
133
|
+
system: n,
|
|
134
|
+
dependency: e.NullOr(n)
|
|
135
|
+
}), c = (r, o, s) => {
|
|
136
|
+
e.decodeUnknownSync(e.toType(i))(r);
|
|
137
|
+
for (let r of [o, s]) {
|
|
138
|
+
if (!Array.isArray(r) || r.length > t.length || new Set(r).size !== r.length) throw Error("Invalid game system selection");
|
|
139
|
+
for (let t of r) e.decodeUnknownSync(e.toType(n))(t);
|
|
140
|
+
}
|
|
141
|
+
if (s.some((e) => !o.includes(e))) throw Error("Configuration outside game system selection");
|
|
142
|
+
let c = t.filter((e) => o.includes(e)), l = new Set(s), u = new Set(c), d = [];
|
|
143
|
+
for (let e of a) if (u.has(e.id)) {
|
|
144
|
+
!e.defaultConfiguration && !l.has(e.id) && d.push(Object.freeze({
|
|
145
|
+
code: "missing_configuration",
|
|
146
|
+
system: e.id,
|
|
147
|
+
dependency: null
|
|
148
|
+
}));
|
|
149
|
+
for (let t of e.dependsOn) u.has(t) || d.push(Object.freeze({
|
|
150
|
+
code: "missing_system",
|
|
151
|
+
system: e.id,
|
|
152
|
+
dependency: t
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
return Object.freeze({
|
|
156
|
+
preset: r,
|
|
157
|
+
systems: Object.freeze(c),
|
|
158
|
+
diagnostics: Object.freeze(d)
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
export { r as GAME_PRESET_IDS, a as GAME_SYSTEMS, t as GAME_SYSTEM_IDS, i as GamePreset, s as GameStackDiagnostic, n as GameSystemId, c as describeGameSystems, o as presetGameSystems };
|
package/package.json
CHANGED
|
@@ -1,6 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/game-stack",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.88.0",
|
|
4
|
+
"description": "Visible composition of ordinary game-system plugins and dependency diagnostics",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"voltro",
|
|
7
|
+
"typescript",
|
|
8
|
+
"framework"
|
|
9
|
+
],
|
|
10
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
11
|
+
"homepage": "https://voltro.dev",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"email": "support@voltro.dev"
|
|
14
|
+
},
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Voltro UG",
|
|
17
|
+
"url": "https://voltro.dev"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./systems": {
|
|
27
|
+
"types": "./dist/systems.d.ts",
|
|
28
|
+
"import": "./dist/systems.js",
|
|
29
|
+
"default": "./dist/systems.js"
|
|
30
|
+
},
|
|
31
|
+
"./errors": {
|
|
32
|
+
"types": "./dist/errors.d.ts",
|
|
33
|
+
"import": "./dist/errors.js",
|
|
34
|
+
"default": "./dist/errors.js"
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json",
|
|
37
|
+
"./fight": {
|
|
38
|
+
"types": "./dist/fight.d.ts",
|
|
39
|
+
"import": "./dist/fight.js",
|
|
40
|
+
"default": "./dist/fight.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"main": "./dist/index.js",
|
|
44
|
+
"module": "./dist/index.js",
|
|
45
|
+
"types": "./dist/index.d.ts",
|
|
46
|
+
"sideEffects": false,
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=24.0.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@voltro/protocol": "0.88.0",
|
|
52
|
+
"@voltro/plugin-auth": "0.88.0",
|
|
53
|
+
"@voltro/plugin-players": "0.88.0",
|
|
54
|
+
"@voltro/plugin-social": "0.88.0",
|
|
55
|
+
"@voltro/plugin-chat": "0.88.0",
|
|
56
|
+
"@voltro/plugin-guilds": "0.88.0",
|
|
57
|
+
"@voltro/plugin-sanctions": "0.88.0",
|
|
58
|
+
"@voltro/plugin-rooms": "0.88.0",
|
|
59
|
+
"@voltro/plugin-matchmaking": "0.88.0",
|
|
60
|
+
"@voltro/plugin-leaderboards": "0.88.0",
|
|
61
|
+
"@voltro/plugin-inventory": "0.88.0",
|
|
62
|
+
"@voltro/plugin-economy": "0.88.0",
|
|
63
|
+
"@voltro/plugin-progression": "0.88.0",
|
|
64
|
+
"@voltro/plugin-liveops": "0.88.0",
|
|
65
|
+
"@voltro/plugin-saves": "0.88.0"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"effect": "4.1.0",
|
|
69
|
+
"react": "^19.0.0"
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public"
|
|
73
|
+
}
|
|
74
|
+
}
|