@crowdedkingdoms/crowdyjs 17.14.0-dev.1 → 18.0.0-dev.1
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/MIGRATION.md +92 -1
- package/README.md +93 -162
- package/dist/crowdy-client.d.ts +12 -31
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +15 -37
- package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
- package/dist/crowdy-dsh/bridge.js +3 -6
- package/dist/crowdy-studio/controller.d.ts +34 -59
- package/dist/crowdy-studio/controller.d.ts.map +1 -1
- package/dist/crowdy-studio/controller.js +96 -225
- package/dist/crowdy-studio/diagnostics.d.ts +3 -12
- package/dist/crowdy-studio/diagnostics.d.ts.map +1 -1
- package/dist/crowdy-studio/dom-shell.d.ts +2 -4
- package/dist/crowdy-studio/dom-shell.d.ts.map +1 -1
- package/dist/crowdy-studio/dom-shell.js +16 -49
- package/dist/crowdy-studio/embed/hud-layer.d.ts +1 -2
- package/dist/crowdy-studio/embed/hud-layer.d.ts.map +1 -1
- package/dist/crowdy-studio/embed/panel.d.ts +3 -13
- package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
- package/dist/crowdy-studio/embed/panel.js +3 -6
- package/dist/crowdy-studio/index.d.ts +1 -3
- package/dist/crowdy-studio/index.d.ts.map +1 -1
- package/dist/crowdy-studio/index.js +0 -2
- package/dist/crowdy-studio/models.d.ts +3 -4
- package/dist/crowdy-studio/models.d.ts.map +1 -1
- package/dist/crowdy-studio/starter-projects.d.ts +8 -12
- package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
- package/dist/crowdy-studio/starter-projects.js +12 -103
- package/dist/domains/appAccess.d.ts +14 -1
- package/dist/domains/appAccess.d.ts.map +1 -1
- package/dist/domains/appAccess.js +37 -1
- package/dist/domains/host.d.ts +3 -3
- package/dist/domains/host.js +3 -3
- package/dist/domains/marketplace.d.ts +9 -70
- package/dist/domains/marketplace.d.ts.map +1 -1
- package/dist/domains/marketplace.js +9 -120
- package/dist/domains/playerWallet.d.ts +6 -12
- package/dist/domains/playerWallet.d.ts.map +1 -1
- package/dist/domains/playerWallet.js +6 -21
- package/dist/errors.d.ts +7 -13
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +6 -10
- package/dist/generated/graphql.d.ts +141 -7083
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +5 -313
- package/dist/grid-mods/exec-client-halves.d.ts +19 -3
- package/dist/grid-mods/exec-client-halves.d.ts.map +1 -1
- package/dist/grid-mods/exec-client-halves.js +17 -2
- package/dist/grid-mods/grid-host-calls.d.ts +29 -17
- package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
- package/dist/grid-mods/grid-host-calls.js +40 -46
- package/dist/grid-mods/mod-runtime.d.ts +18 -11
- package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
- package/dist/grid-mods/mod-runtime.js +4 -2
- package/dist/grid-scope.d.ts +0 -189
- package/dist/grid-scope.d.ts.map +1 -1
- package/dist/grid-scope.js +0 -70
- package/dist/index.d.ts +11 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -16
- package/dist/kit/actions.d.ts +5 -9
- package/dist/kit/actions.d.ts.map +1 -1
- package/dist/kit/actions.js +5 -9
- package/dist/kit/index.d.ts +2 -33
- package/dist/kit/index.d.ts.map +1 -1
- package/dist/kit/index.js +1 -32
- package/dist/kit/kit.d.ts +8 -208
- package/dist/kit/kit.d.ts.map +1 -1
- package/dist/kit/kit.js +5 -163
- package/dist/kit/social.d.ts +1 -3
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/kit/social.js +1 -3
- package/dist/kit/wire.d.ts +16 -5
- package/dist/kit/wire.d.ts.map +1 -1
- package/dist/kit/wire.js +19 -5
- package/dist/live-coding/assets/browser-authoring-index.json +1 -1
- package/dist/live-coding/assets/manifest.json +1 -1
- package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
- package/dist/live-coding/browser-authoring-index.generated.js +1496 -4386
- package/dist/live-coding/rust-analysis.d.ts.map +1 -1
- package/dist/live-coding/rust-analysis.js +30 -34
- package/dist/player-runtime/client-host-calls.d.ts +8 -0
- package/dist/player-runtime/client-host-calls.d.ts.map +1 -0
- package/dist/player-runtime/client-host-calls.js +28 -0
- package/dist/player-runtime/glue-runtime.d.ts +24 -20
- package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
- package/dist/player-runtime/glue-runtime.js +26 -55
- package/dist/player-runtime/glue-sab.d.ts +2 -2
- package/dist/player-runtime/glue-sab.js +2 -2
- package/dist/player-runtime/player-code-broker.d.ts +70 -43
- package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
- package/dist/player-runtime/player-code-broker.js +159 -64
- package/dist/player-runtime/player-glue-worker.d.ts +8 -9
- package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
- package/dist/player-runtime/player-glue-worker.js +26 -11
- package/dist/stores/inbox.d.ts +1 -1
- package/dist/stores/inbox.d.ts.map +1 -1
- package/dist/stores/index.d.ts +0 -11
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +0 -4
- package/dist/stores/session.d.ts +0 -2
- package/dist/stores/session.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/crowdy-studio/model-lint-log.d.ts +0 -76
- package/dist/crowdy-studio/model-lint-log.d.ts.map +0 -1
- package/dist/crowdy-studio/model-lint-log.js +0 -93
- package/dist/crowdy-studio/model-lint.d.ts +0 -61
- package/dist/crowdy-studio/model-lint.d.ts.map +0 -1
- package/dist/crowdy-studio/model-lint.js +0 -45
- package/dist/domains/compute.d.ts +0 -208
- package/dist/domains/compute.d.ts.map +0 -1
- package/dist/domains/compute.js +0 -274
- package/dist/domains/controlPlane.d.ts +0 -38
- package/dist/domains/controlPlane.d.ts.map +0 -1
- package/dist/domains/controlPlane.js +0 -43
- package/dist/domains/gameModel.d.ts +0 -1174
- package/dist/domains/gameModel.d.ts.map +0 -1
- package/dist/domains/gameModel.js +0 -1333
- package/dist/domains/playerCompute.d.ts +0 -91
- package/dist/domains/playerCompute.d.ts.map +0 -1
- package/dist/domains/playerCompute.js +0 -136
- package/dist/domains/playerModel.d.ts +0 -20
- package/dist/domains/playerModel.d.ts.map +0 -1
- package/dist/domains/playerModel.js +0 -54
- package/dist/kit/abilities.d.ts +0 -66
- package/dist/kit/abilities.d.ts.map +0 -1
- package/dist/kit/abilities.js +0 -71
- package/dist/kit/blueprints/combat.d.ts +0 -81
- package/dist/kit/blueprints/combat.d.ts.map +0 -1
- package/dist/kit/blueprints/combat.js +0 -357
- package/dist/kit/blueprints/core.d.ts +0 -222
- package/dist/kit/blueprints/core.d.ts.map +0 -1
- package/dist/kit/blueprints/core.js +0 -185
- package/dist/kit/blueprints/decks.d.ts +0 -50
- package/dist/kit/blueprints/decks.d.ts.map +0 -1
- package/dist/kit/blueprints/decks.js +0 -163
- package/dist/kit/blueprints/economy.d.ts +0 -88
- package/dist/kit/blueprints/economy.d.ts.map +0 -1
- package/dist/kit/blueprints/economy.js +0 -533
- package/dist/kit/blueprints/guild.d.ts +0 -51
- package/dist/kit/blueprints/guild.d.ts.map +0 -1
- package/dist/kit/blueprints/guild.js +0 -50
- package/dist/kit/blueprints/index.d.ts +0 -23
- package/dist/kit/blueprints/index.d.ts.map +0 -1
- package/dist/kit/blueprints/index.js +0 -22
- package/dist/kit/blueprints/inventory.d.ts +0 -84
- package/dist/kit/blueprints/inventory.d.ts.map +0 -1
- package/dist/kit/blueprints/inventory.js +0 -257
- package/dist/kit/blueprints/leaderboards.d.ts +0 -49
- package/dist/kit/blueprints/leaderboards.d.ts.map +0 -1
- package/dist/kit/blueprints/leaderboards.js +0 -126
- package/dist/kit/blueprints/liveops.d.ts +0 -42
- package/dist/kit/blueprints/liveops.d.ts.map +0 -1
- package/dist/kit/blueprints/liveops.js +0 -170
- package/dist/kit/blueprints/locks.d.ts +0 -82
- package/dist/kit/blueprints/locks.d.ts.map +0 -1
- package/dist/kit/blueprints/locks.js +0 -155
- package/dist/kit/blueprints/loot.d.ts +0 -90
- package/dist/kit/blueprints/loot.d.ts.map +0 -1
- package/dist/kit/blueprints/loot.js +0 -229
- package/dist/kit/blueprints/matches.d.ts +0 -84
- package/dist/kit/blueprints/matches.d.ts.map +0 -1
- package/dist/kit/blueprints/matches.js +0 -349
- package/dist/kit/blueprints/moderation.d.ts +0 -32
- package/dist/kit/blueprints/moderation.d.ts.map +0 -1
- package/dist/kit/blueprints/moderation.js +0 -140
- package/dist/kit/blueprints/npcs.d.ts +0 -78
- package/dist/kit/blueprints/npcs.d.ts.map +0 -1
- package/dist/kit/blueprints/npcs.js +0 -125
- package/dist/kit/blueprints/plots.d.ts +0 -63
- package/dist/kit/blueprints/plots.d.ts.map +0 -1
- package/dist/kit/blueprints/plots.js +0 -151
- package/dist/kit/blueprints/progression.d.ts +0 -68
- package/dist/kit/blueprints/progression.d.ts.map +0 -1
- package/dist/kit/blueprints/progression.js +0 -324
- package/dist/kit/blueprints/quests.d.ts +0 -72
- package/dist/kit/blueprints/quests.d.ts.map +0 -1
- package/dist/kit/blueprints/quests.js +0 -285
- package/dist/kit/blueprints/worldsim.d.ts +0 -91
- package/dist/kit/blueprints/worldsim.d.ts.map +0 -1
- package/dist/kit/blueprints/worldsim.js +0 -468
- package/dist/kit/combat.d.ts +0 -141
- package/dist/kit/combat.d.ts.map +0 -1
- package/dist/kit/combat.js +0 -196
- package/dist/kit/decks.d.ts +0 -157
- package/dist/kit/decks.d.ts.map +0 -1
- package/dist/kit/decks.js +0 -186
- package/dist/kit/director.d.ts +0 -88
- package/dist/kit/director.d.ts.map +0 -1
- package/dist/kit/director.js +0 -86
- package/dist/kit/economy.d.ts +0 -289
- package/dist/kit/economy.d.ts.map +0 -1
- package/dist/kit/economy.js +0 -427
- package/dist/kit/engine.d.ts +0 -48
- package/dist/kit/engine.d.ts.map +0 -1
- package/dist/kit/engine.js +0 -113
- package/dist/kit/features.d.ts +0 -60
- package/dist/kit/features.d.ts.map +0 -1
- package/dist/kit/features.js +0 -65
- package/dist/kit/instances.d.ts +0 -52
- package/dist/kit/instances.d.ts.map +0 -1
- package/dist/kit/instances.js +0 -60
- package/dist/kit/inventory.d.ts +0 -129
- package/dist/kit/inventory.d.ts.map +0 -1
- package/dist/kit/inventory.js +0 -200
- package/dist/kit/leaderboards.d.ts +0 -86
- package/dist/kit/leaderboards.d.ts.map +0 -1
- package/dist/kit/leaderboards.js +0 -133
- package/dist/kit/liveops.d.ts +0 -112
- package/dist/kit/liveops.d.ts.map +0 -1
- package/dist/kit/liveops.js +0 -183
- package/dist/kit/loot.d.ts +0 -128
- package/dist/kit/loot.d.ts.map +0 -1
- package/dist/kit/loot.js +0 -160
- package/dist/kit/matches.d.ts +0 -301
- package/dist/kit/matches.d.ts.map +0 -1
- package/dist/kit/matches.js +0 -458
- package/dist/kit/matchmaking.d.ts +0 -57
- package/dist/kit/matchmaking.d.ts.map +0 -1
- package/dist/kit/matchmaking.js +0 -59
- package/dist/kit/minigames.d.ts +0 -30
- package/dist/kit/minigames.d.ts.map +0 -1
- package/dist/kit/minigames.js +0 -38
- package/dist/kit/mobs.d.ts +0 -90
- package/dist/kit/mobs.d.ts.map +0 -1
- package/dist/kit/mobs.js +0 -98
- package/dist/kit/moderation.d.ts +0 -73
- package/dist/kit/moderation.d.ts.map +0 -1
- package/dist/kit/moderation.js +0 -103
- package/dist/kit/movement.d.ts +0 -78
- package/dist/kit/movement.d.ts.map +0 -1
- package/dist/kit/movement.js +0 -103
- package/dist/kit/notifications.d.ts +0 -45
- package/dist/kit/notifications.d.ts.map +0 -1
- package/dist/kit/notifications.js +0 -67
- package/dist/kit/npcs.d.ts +0 -226
- package/dist/kit/npcs.d.ts.map +0 -1
- package/dist/kit/npcs.js +0 -141
- package/dist/kit/objects.d.ts +0 -116
- package/dist/kit/objects.d.ts.map +0 -1
- package/dist/kit/objects.js +0 -119
- package/dist/kit/pets.d.ts +0 -85
- package/dist/kit/pets.d.ts.map +0 -1
- package/dist/kit/pets.js +0 -96
- package/dist/kit/plots.d.ts +0 -85
- package/dist/kit/plots.d.ts.map +0 -1
- package/dist/kit/plots.js +0 -113
- package/dist/kit/progression.d.ts +0 -181
- package/dist/kit/progression.d.ts.map +0 -1
- package/dist/kit/progression.js +0 -265
- package/dist/kit/quests.d.ts +0 -171
- package/dist/kit/quests.d.ts.map +0 -1
- package/dist/kit/quests.js +0 -237
- package/dist/kit/racing.d.ts +0 -85
- package/dist/kit/racing.d.ts.map +0 -1
- package/dist/kit/racing.js +0 -99
- package/dist/kit/shared.d.ts +0 -73
- package/dist/kit/shared.d.ts.map +0 -1
- package/dist/kit/shared.js +0 -101
- package/dist/kit/telemetry.d.ts +0 -66
- package/dist/kit/telemetry.d.ts.map +0 -1
- package/dist/kit/telemetry.js +0 -133
- package/dist/kit/territory.d.ts +0 -97
- package/dist/kit/territory.d.ts.map +0 -1
- package/dist/kit/territory.js +0 -114
- package/dist/kit/worldsim.d.ts +0 -263
- package/dist/kit/worldsim.d.ts.map +0 -1
- package/dist/kit/worldsim.js +0 -268
- package/dist/stores/model.d.ts +0 -81
- package/dist/stores/model.d.ts.map +0 -1
- package/dist/stores/model.js +0 -163
package/dist/kit/leaderboards.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { leaderboardsNames, } from './blueprints/index.js';
|
|
2
|
-
import { kitContainerProperties, kitInvoke, } from './shared.js';
|
|
3
|
-
/**
|
|
4
|
-
* Runtime helpers for the {@link leaderboardsBlueprint} conventions: ensure
|
|
5
|
-
* per-player entries, submit scores (trusted — host by default), and rank.
|
|
6
|
-
* There is no server-side ORDER BY on container lists, so reads fetch a
|
|
7
|
-
* board's entries and sort client-side — fine for the few hundred entries a
|
|
8
|
-
* per-app board holds.
|
|
9
|
-
*
|
|
10
|
-
* Obtained via `client.kit(appId).leaderboards`.
|
|
11
|
-
*/
|
|
12
|
-
export class LeaderboardsKit {
|
|
13
|
-
constructor(appId, gameModel, options = {}, engines) {
|
|
14
|
-
this.appId = appId;
|
|
15
|
-
this.gameModel = gameModel;
|
|
16
|
-
this.engines = engines;
|
|
17
|
-
this.names = leaderboardsNames(options.typePrefix ?? '');
|
|
18
|
-
this.engineModuleName = options.engineModuleName ?? 'board-engine';
|
|
19
|
-
}
|
|
20
|
-
// -- Engine path (Wave 2): server-computed rankings --------------------------
|
|
21
|
-
/**
|
|
22
|
-
* Is a board compute engine deployed + enabled (cached per session)? When
|
|
23
|
-
* true, rankings are computed SERVER-side (tie-aware ranks, percentiles,
|
|
24
|
-
* pages) instead of the blueprint's client-sorted reads.
|
|
25
|
-
*/
|
|
26
|
-
engineAvailable() {
|
|
27
|
-
if (!this.engines)
|
|
28
|
-
return Promise.resolve(false);
|
|
29
|
-
return this.engines.has(this.engineModuleName);
|
|
30
|
-
}
|
|
31
|
-
/** A server-ranked page (rank/percentile computed module-side). */
|
|
32
|
-
async engineTop(boardId, page = 0, perPage = 10) {
|
|
33
|
-
return this.engineInvoke('top', { boardId, page, perPage });
|
|
34
|
-
}
|
|
35
|
-
/** Your (or a subject's) server-computed ranked row. */
|
|
36
|
-
async engineRankOf(boardId, subjectId) {
|
|
37
|
-
return this.engineInvoke('rank_of', subjectId ? { boardId, subjectId } : { boardId });
|
|
38
|
-
}
|
|
39
|
-
/** Submit YOUR OWN score (personal-best semantics) to an engine board. */
|
|
40
|
-
async engineSubmitSelf(boardId, score) {
|
|
41
|
-
return this.engineInvoke('submit_self', { boardId, score });
|
|
42
|
-
}
|
|
43
|
-
/** Frozen season snapshots (top rows per rolled season). */
|
|
44
|
-
async engineSeasons(boardId) {
|
|
45
|
-
return this.engineInvoke('seasons', { boardId });
|
|
46
|
-
}
|
|
47
|
-
async engineInvoke(exportName, params) {
|
|
48
|
-
if (!this.engines) {
|
|
49
|
-
throw new Error('board engine unavailable: compute domain not wired');
|
|
50
|
-
}
|
|
51
|
-
const result = await this.engines.invoke(this.engineModuleName, exportName, params);
|
|
52
|
-
if (!result.success) {
|
|
53
|
-
throw new Error(`leaderboards.${exportName} failed: ${result.reason ?? 'unknown'}`);
|
|
54
|
-
}
|
|
55
|
-
return result.body;
|
|
56
|
-
}
|
|
57
|
-
/** Find-or-create a player's entry on a board. */
|
|
58
|
-
async ensureEntry(ownerUserId, boardId, options = {}) {
|
|
59
|
-
const entries = await this.board(boardId);
|
|
60
|
-
const mine = entries.find((e) => e.ownerUserId === String(ownerUserId));
|
|
61
|
-
if (mine) {
|
|
62
|
-
return this.gameModel.container({
|
|
63
|
-
appId: this.appId,
|
|
64
|
-
containerId: mine.containerId,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return this.gameModel.createContainer({
|
|
68
|
-
appId: this.appId,
|
|
69
|
-
typeName: this.names.entryType,
|
|
70
|
-
displayName: options.displayName ?? `${boardId} ${ownerUserId}`,
|
|
71
|
-
properties: [
|
|
72
|
-
{ key: 'owner_user_id', valueType: 'int', valueJson: String(ownerUserId) },
|
|
73
|
-
{ key: 'board_id', valueType: 'string', valueJson: JSON.stringify(boardId) },
|
|
74
|
-
],
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Submit a score — a **trusted** call (host by default per the blueprint's
|
|
79
|
-
* `submitAuthority`). Resolves with the entry's (possibly kept-best)
|
|
80
|
-
* score.
|
|
81
|
-
*/
|
|
82
|
-
async submit(entryId, points) {
|
|
83
|
-
return kitInvoke(this.gameModel, {
|
|
84
|
-
appId: String(this.appId),
|
|
85
|
-
functionName: this.names.submitFn,
|
|
86
|
-
selfContainerId: entryId,
|
|
87
|
-
params: { points },
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
/** All entries of one board, sorted best-first with 1-based positions. */
|
|
91
|
-
async board(boardId) {
|
|
92
|
-
const containers = await this.gameModel.containers({
|
|
93
|
-
appId: this.appId,
|
|
94
|
-
typeName: this.names.entryType,
|
|
95
|
-
});
|
|
96
|
-
const rows = await Promise.all(containers.map(async (c) => {
|
|
97
|
-
const props = await kitContainerProperties(this.gameModel, String(this.appId), c.containerId);
|
|
98
|
-
return {
|
|
99
|
-
containerId: c.containerId,
|
|
100
|
-
displayName: c.displayName,
|
|
101
|
-
ownerUserId: c.ownerUserId != null ? String(c.ownerUserId) : null,
|
|
102
|
-
boardId: String(props.board_id ?? ''),
|
|
103
|
-
score: Number(props.score ?? 0),
|
|
104
|
-
season: Number(props.season ?? 1),
|
|
105
|
-
position: 0,
|
|
106
|
-
};
|
|
107
|
-
}));
|
|
108
|
-
return rows
|
|
109
|
-
.filter((r) => r.boardId === boardId)
|
|
110
|
-
.sort((a, b) => b.score - a.score)
|
|
111
|
-
.map((r, i) => ({ ...r, position: i + 1 }));
|
|
112
|
-
}
|
|
113
|
-
/** The top `n` of a board (client-side ranking). */
|
|
114
|
-
async top(boardId, n = 10) {
|
|
115
|
-
return (await this.board(boardId)).slice(0, n);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* The entries around one player on a board (`radius` above and below),
|
|
119
|
-
* for "your neighborhood" widgets.
|
|
120
|
-
*/
|
|
121
|
-
async around(boardId, userId, radius = 2) {
|
|
122
|
-
const entries = await this.board(boardId);
|
|
123
|
-
const index = entries.findIndex((e) => e.ownerUserId === String(userId));
|
|
124
|
-
if (index === -1)
|
|
125
|
-
return [];
|
|
126
|
-
return entries.slice(Math.max(0, index - radius), index + radius + 1);
|
|
127
|
-
}
|
|
128
|
-
/** The board's current season (max season across its entries; 1 when empty). */
|
|
129
|
-
async season(boardId) {
|
|
130
|
-
const entries = await this.board(boardId);
|
|
131
|
-
return entries.reduce((max, e) => Math.max(max, e.season), 1);
|
|
132
|
-
}
|
|
133
|
-
}
|
package/dist/kit/liveops.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { GameModelAPI } from '../domains/gameModel.js';
|
|
2
|
-
import type { Scalars } from '../generated/graphql.js';
|
|
3
|
-
import type { EngineDetector } from './engine.js';
|
|
4
|
-
/** Options for {@link LiveopsKit}. */
|
|
5
|
-
export interface LiveopsKitOptions {
|
|
6
|
-
/** The `typePrefix` the liveops blueprint was deployed with. */
|
|
7
|
-
typePrefix?: string;
|
|
8
|
-
/** The scheduler engine module name. Defaults to `'liveops-scheduler'`. */
|
|
9
|
-
moduleName?: string;
|
|
10
|
-
}
|
|
11
|
-
/** A parsed event window. */
|
|
12
|
-
export interface KitEventWindow {
|
|
13
|
-
containerId: string;
|
|
14
|
-
windowId: string;
|
|
15
|
-
active: boolean;
|
|
16
|
-
opensAtMs: number;
|
|
17
|
-
closesAtMs: number;
|
|
18
|
-
modifiers: Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
/** A parsed season definition (+ its battle-pass composition). */
|
|
21
|
-
export interface KitSeason {
|
|
22
|
-
containerId: string;
|
|
23
|
-
seasonId: string;
|
|
24
|
-
active: boolean;
|
|
25
|
-
startsAtMs: number;
|
|
26
|
-
endsAtMs: number;
|
|
27
|
-
passTrack: string;
|
|
28
|
-
passFeatures: string[];
|
|
29
|
-
}
|
|
30
|
-
/** A parsed type-98 zone-change event (BR circles, event areas). */
|
|
31
|
-
export interface ZoneChangeEvent {
|
|
32
|
-
kind: string;
|
|
33
|
-
phase: number | null;
|
|
34
|
-
radiusNow: number;
|
|
35
|
-
centerX: number;
|
|
36
|
-
centerZ: number;
|
|
37
|
-
body: Record<string, unknown>;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Runtime helpers for the liveops blueprint: event windows (admin CRUD +
|
|
41
|
-
* active reads — engine-backed when the liveops-scheduler is deployed),
|
|
42
|
-
* seasons with battle-pass composition, and the type-98 zone-change parser.
|
|
43
|
-
*
|
|
44
|
-
* Obtained via `client.kit(appId).liveops`.
|
|
45
|
-
*/
|
|
46
|
-
export declare class LiveopsKit {
|
|
47
|
-
private readonly appId;
|
|
48
|
-
private readonly gameModel;
|
|
49
|
-
private readonly engines?;
|
|
50
|
-
private readonly names;
|
|
51
|
-
private readonly moduleName;
|
|
52
|
-
constructor(appId: Scalars['BigInt']['input'], gameModel: GameModelAPI, options?: LiveopsKitOptions, engines?: EngineDetector | undefined);
|
|
53
|
-
/** Is the liveops-scheduler engine deployed + enabled (cached)? */
|
|
54
|
-
engineAvailable(): Promise<boolean>;
|
|
55
|
-
/** STUDIO (admin) — create an event window. */
|
|
56
|
-
defineWindow(input: {
|
|
57
|
-
windowId: string;
|
|
58
|
-
displayName?: string;
|
|
59
|
-
opensAtMs?: number;
|
|
60
|
-
closesAtMs?: number;
|
|
61
|
-
modifiers?: Record<string, unknown>;
|
|
62
|
-
}): Promise<{
|
|
63
|
-
__typename?: "GmContainer";
|
|
64
|
-
containerId: string;
|
|
65
|
-
appId: string;
|
|
66
|
-
sessionId: string | null;
|
|
67
|
-
typeName: string;
|
|
68
|
-
displayName: string;
|
|
69
|
-
description: string | null;
|
|
70
|
-
ownerUserId: string | null;
|
|
71
|
-
metadataJson: string;
|
|
72
|
-
}>;
|
|
73
|
-
/** Every window (model read). */
|
|
74
|
-
windows(): Promise<KitEventWindow[]>;
|
|
75
|
-
/**
|
|
76
|
-
* The ACTIVE windows. Engine path (scheduler deployed): the module's
|
|
77
|
-
* authoritative view; otherwise filters the model read.
|
|
78
|
-
*/
|
|
79
|
-
activeWindows(): Promise<KitEventWindow[]>;
|
|
80
|
-
/** STUDIO (admin/automation) — open a window through the model function. */
|
|
81
|
-
openWindow(windowContainerId: string, sessionId?: string): Promise<import("./shared.js").KitInvokeResult<boolean>>;
|
|
82
|
-
/** STUDIO (admin/automation) — close a window through the model function. */
|
|
83
|
-
closeWindow(windowContainerId: string, sessionId?: string): Promise<import("./shared.js").KitInvokeResult<boolean>>;
|
|
84
|
-
/** STUDIO (admin) — create a season (+ battle-pass composition). */
|
|
85
|
-
defineSeason(input: {
|
|
86
|
-
seasonId: string;
|
|
87
|
-
displayName?: string;
|
|
88
|
-
startsAtMs?: number;
|
|
89
|
-
endsAtMs?: number;
|
|
90
|
-
passTrack?: string;
|
|
91
|
-
passFeatures?: string[];
|
|
92
|
-
}): Promise<{
|
|
93
|
-
__typename?: "GmContainer";
|
|
94
|
-
containerId: string;
|
|
95
|
-
appId: string;
|
|
96
|
-
sessionId: string | null;
|
|
97
|
-
typeName: string;
|
|
98
|
-
displayName: string;
|
|
99
|
-
description: string | null;
|
|
100
|
-
ownerUserId: string | null;
|
|
101
|
-
metadataJson: string;
|
|
102
|
-
}>;
|
|
103
|
-
/** Every season (model read). */
|
|
104
|
-
seasons(): Promise<KitSeason[]>;
|
|
105
|
-
/** The active season, when one exists. */
|
|
106
|
-
currentSeason(): Promise<KitSeason | null>;
|
|
107
|
-
/** STUDIO (admin/automation) — activate a season through the model function. */
|
|
108
|
-
activateSeason(seasonContainerId: string, sessionId?: string): Promise<import("./shared.js").KitInvokeResult<boolean>>;
|
|
109
|
-
/** Parse a type-98 zone-change server event (BR circles, event areas). */
|
|
110
|
-
parseZoneChange(bytes: Uint8Array): ZoneChangeEvent | null;
|
|
111
|
-
}
|
|
112
|
-
//# sourceMappingURL=liveops.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"liveops.d.ts","sourceRoot":"","sources":["../../src/kit/liveops.ts"],"names":[],"mappings":"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"}
|
package/dist/kit/liveops.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { liveopsNames } from './blueprints/liveops.js';
|
|
2
|
-
import { kitContainerProperties, kitInvoke } from './shared.js';
|
|
3
|
-
import { parseEngineEvent, EVENT_ZONE_CHANGE } from './wire.js';
|
|
4
|
-
/**
|
|
5
|
-
* Runtime helpers for the liveops blueprint: event windows (admin CRUD +
|
|
6
|
-
* active reads — engine-backed when the liveops-scheduler is deployed),
|
|
7
|
-
* seasons with battle-pass composition, and the type-98 zone-change parser.
|
|
8
|
-
*
|
|
9
|
-
* Obtained via `client.kit(appId).liveops`.
|
|
10
|
-
*/
|
|
11
|
-
export class LiveopsKit {
|
|
12
|
-
constructor(appId, gameModel, options = {}, engines) {
|
|
13
|
-
this.appId = appId;
|
|
14
|
-
this.gameModel = gameModel;
|
|
15
|
-
this.engines = engines;
|
|
16
|
-
this.names = liveopsNames(options.typePrefix ?? '');
|
|
17
|
-
this.moduleName = options.moduleName ?? 'liveops-scheduler';
|
|
18
|
-
}
|
|
19
|
-
/** Is the liveops-scheduler engine deployed + enabled (cached)? */
|
|
20
|
-
engineAvailable() {
|
|
21
|
-
if (!this.engines)
|
|
22
|
-
return Promise.resolve(false);
|
|
23
|
-
return this.engines.has(this.moduleName);
|
|
24
|
-
}
|
|
25
|
-
/** STUDIO (admin) — create an event window. */
|
|
26
|
-
async defineWindow(input) {
|
|
27
|
-
return this.gameModel.createContainer({
|
|
28
|
-
appId: this.appId,
|
|
29
|
-
typeName: this.names.windowType,
|
|
30
|
-
displayName: input.displayName ?? `Window ${input.windowId}`,
|
|
31
|
-
properties: [
|
|
32
|
-
{ key: 'window_id', valueType: 'string', valueJson: JSON.stringify(input.windowId) },
|
|
33
|
-
...(input.opensAtMs !== undefined
|
|
34
|
-
? [{ key: 'opens_at_ms', valueType: 'int', valueJson: String(input.opensAtMs) }]
|
|
35
|
-
: []),
|
|
36
|
-
...(input.closesAtMs !== undefined
|
|
37
|
-
? [{ key: 'closes_at_ms', valueType: 'int', valueJson: String(input.closesAtMs) }]
|
|
38
|
-
: []),
|
|
39
|
-
{
|
|
40
|
-
key: 'modifiers',
|
|
41
|
-
valueType: 'string',
|
|
42
|
-
valueJson: JSON.stringify(JSON.stringify(input.modifiers ?? {})),
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/** Every window (model read). */
|
|
48
|
-
async windows() {
|
|
49
|
-
const containers = await this.gameModel.containers({
|
|
50
|
-
appId: this.appId,
|
|
51
|
-
typeName: this.names.windowType,
|
|
52
|
-
});
|
|
53
|
-
return Promise.all(containers.map(async (c) => {
|
|
54
|
-
const props = await kitContainerProperties(this.gameModel, String(this.appId), c.containerId);
|
|
55
|
-
let modifiers = {};
|
|
56
|
-
try {
|
|
57
|
-
modifiers = JSON.parse(String(props.modifiers ?? '{}'));
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
/* opaque */
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
containerId: c.containerId,
|
|
64
|
-
windowId: String(props.window_id ?? ''),
|
|
65
|
-
active: props.active === true,
|
|
66
|
-
opensAtMs: Number(props.opens_at_ms ?? 0),
|
|
67
|
-
closesAtMs: Number(props.closes_at_ms ?? 0),
|
|
68
|
-
modifiers,
|
|
69
|
-
};
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* The ACTIVE windows. Engine path (scheduler deployed): the module's
|
|
74
|
-
* authoritative view; otherwise filters the model read.
|
|
75
|
-
*/
|
|
76
|
-
async activeWindows() {
|
|
77
|
-
if (this.engines && (await this.engineAvailable())) {
|
|
78
|
-
const result = await this.engines.invoke(this.moduleName, 'active_windows', {});
|
|
79
|
-
if (result.success && Array.isArray(result.body.windows)) {
|
|
80
|
-
const all = await this.windows();
|
|
81
|
-
const activeIds = new Set(result.body.windows.map((w) => String(w.windowId)));
|
|
82
|
-
return all.filter((w) => activeIds.has(w.windowId));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return (await this.windows()).filter((w) => w.active);
|
|
86
|
-
}
|
|
87
|
-
/** STUDIO (admin/automation) — open a window through the model function. */
|
|
88
|
-
async openWindow(windowContainerId, sessionId) {
|
|
89
|
-
return kitInvoke(this.gameModel, {
|
|
90
|
-
appId: String(this.appId),
|
|
91
|
-
functionName: this.names.openWindowFn,
|
|
92
|
-
selfContainerId: windowContainerId,
|
|
93
|
-
...(sessionId !== undefined ? { sessionId } : {}),
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
/** STUDIO (admin/automation) — close a window through the model function. */
|
|
97
|
-
async closeWindow(windowContainerId, sessionId) {
|
|
98
|
-
return kitInvoke(this.gameModel, {
|
|
99
|
-
appId: String(this.appId),
|
|
100
|
-
functionName: this.names.closeWindowFn,
|
|
101
|
-
selfContainerId: windowContainerId,
|
|
102
|
-
...(sessionId !== undefined ? { sessionId } : {}),
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
/** STUDIO (admin) — create a season (+ battle-pass composition). */
|
|
106
|
-
async defineSeason(input) {
|
|
107
|
-
return this.gameModel.createContainer({
|
|
108
|
-
appId: this.appId,
|
|
109
|
-
typeName: this.names.seasonType,
|
|
110
|
-
displayName: input.displayName ?? `Season ${input.seasonId}`,
|
|
111
|
-
properties: [
|
|
112
|
-
{ key: 'season_id', valueType: 'string', valueJson: JSON.stringify(input.seasonId) },
|
|
113
|
-
...(input.startsAtMs !== undefined
|
|
114
|
-
? [{ key: 'starts_at_ms', valueType: 'int', valueJson: String(input.startsAtMs) }]
|
|
115
|
-
: []),
|
|
116
|
-
...(input.endsAtMs !== undefined
|
|
117
|
-
? [{ key: 'ends_at_ms', valueType: 'int', valueJson: String(input.endsAtMs) }]
|
|
118
|
-
: []),
|
|
119
|
-
...(input.passTrack !== undefined
|
|
120
|
-
? [{ key: 'pass_track', valueType: 'string', valueJson: JSON.stringify(input.passTrack) }]
|
|
121
|
-
: []),
|
|
122
|
-
{
|
|
123
|
-
key: 'pass_features',
|
|
124
|
-
valueType: 'string',
|
|
125
|
-
valueJson: JSON.stringify(JSON.stringify(input.passFeatures ?? [])),
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
/** Every season (model read). */
|
|
131
|
-
async seasons() {
|
|
132
|
-
const containers = await this.gameModel.containers({
|
|
133
|
-
appId: this.appId,
|
|
134
|
-
typeName: this.names.seasonType,
|
|
135
|
-
});
|
|
136
|
-
return Promise.all(containers.map(async (c) => {
|
|
137
|
-
const props = await kitContainerProperties(this.gameModel, String(this.appId), c.containerId);
|
|
138
|
-
let passFeatures = [];
|
|
139
|
-
try {
|
|
140
|
-
passFeatures = JSON.parse(String(props.pass_features ?? '[]')).map(String);
|
|
141
|
-
}
|
|
142
|
-
catch {
|
|
143
|
-
/* opaque */
|
|
144
|
-
}
|
|
145
|
-
return {
|
|
146
|
-
containerId: c.containerId,
|
|
147
|
-
seasonId: String(props.season_id ?? ''),
|
|
148
|
-
active: props.active === true,
|
|
149
|
-
startsAtMs: Number(props.starts_at_ms ?? 0),
|
|
150
|
-
endsAtMs: Number(props.ends_at_ms ?? 0),
|
|
151
|
-
passTrack: String(props.pass_track ?? ''),
|
|
152
|
-
passFeatures,
|
|
153
|
-
};
|
|
154
|
-
}));
|
|
155
|
-
}
|
|
156
|
-
/** The active season, when one exists. */
|
|
157
|
-
async currentSeason() {
|
|
158
|
-
return (await this.seasons()).find((s) => s.active) ?? null;
|
|
159
|
-
}
|
|
160
|
-
/** STUDIO (admin/automation) — activate a season through the model function. */
|
|
161
|
-
async activateSeason(seasonContainerId, sessionId) {
|
|
162
|
-
return kitInvoke(this.gameModel, {
|
|
163
|
-
appId: String(this.appId),
|
|
164
|
-
functionName: this.names.activateSeasonFn,
|
|
165
|
-
selfContainerId: seasonContainerId,
|
|
166
|
-
...(sessionId !== undefined ? { sessionId } : {}),
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
/** Parse a type-98 zone-change server event (BR circles, event areas). */
|
|
170
|
-
parseZoneChange(bytes) {
|
|
171
|
-
const parsed = parseEngineEvent(bytes);
|
|
172
|
-
if (!parsed || parsed.eventType !== EVENT_ZONE_CHANGE)
|
|
173
|
-
return null;
|
|
174
|
-
return {
|
|
175
|
-
kind: String(parsed.body.kind ?? ''),
|
|
176
|
-
phase: parsed.body.phase != null ? Number(parsed.body.phase) : null,
|
|
177
|
-
radiusNow: Number(parsed.body.radiusNow ?? 0),
|
|
178
|
-
centerX: Number(parsed.body.centerX ?? 0),
|
|
179
|
-
centerZ: Number(parsed.body.centerZ ?? 0),
|
|
180
|
-
body: parsed.body,
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
}
|
package/dist/kit/loot.d.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import type { GameModelAPI } from '../domains/gameModel.js';
|
|
2
|
-
import type { EngineDetector } from './engine.js';
|
|
3
|
-
import type { Scalars } from '../generated/graphql.js';
|
|
4
|
-
import { type KitInvokeResult } from './shared.js';
|
|
5
|
-
/** Options for {@link LootKit}. Must match the deployed loot blueprint. */
|
|
6
|
-
export interface LootKitOptions {
|
|
7
|
-
/**
|
|
8
|
-
* The big-table loot module (pity timers, audit trails). Defaults to
|
|
9
|
-
* `'loot-engine'`; the gacha-shrine example ships this contract.
|
|
10
|
-
*/
|
|
11
|
-
engineModuleName?: string;
|
|
12
|
-
/** The `typePrefix` the loot blueprint was deployed with. */
|
|
13
|
-
typePrefix?: string;
|
|
14
|
-
}
|
|
15
|
-
/** A parsed view of one loot roll. */
|
|
16
|
-
export interface KitLootRoll {
|
|
17
|
-
containerId: string;
|
|
18
|
-
displayName: string;
|
|
19
|
-
ownerUserId: string | null;
|
|
20
|
-
tableId: string;
|
|
21
|
-
/** Empty until rolled. */
|
|
22
|
-
rolledItemId: string;
|
|
23
|
-
rolledQty: number;
|
|
24
|
-
claimed: boolean;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Runtime helpers for the {@link lootBlueprint} conventions: create durable
|
|
28
|
-
* `LootRoll` containers, roll them (trusted — app admins by default, or the
|
|
29
|
-
* blueprint's event-drop automations), and claim results atomically into an
|
|
30
|
-
* item stack. The weighted selection runs entirely server-side from a stored
|
|
31
|
-
* seed, so clients can neither pick their loot nor claim it twice.
|
|
32
|
-
*
|
|
33
|
-
* Obtained via `client.kit(appId).loot`.
|
|
34
|
-
*/
|
|
35
|
-
export declare class LootKit {
|
|
36
|
-
private readonly appId;
|
|
37
|
-
private readonly gameModel;
|
|
38
|
-
private readonly engines?;
|
|
39
|
-
private readonly names;
|
|
40
|
-
private readonly typePrefix;
|
|
41
|
-
constructor(appId: Scalars['BigInt']['input'], gameModel: GameModelAPI, options?: LootKitOptions, engines?: EngineDetector | undefined);
|
|
42
|
-
private readonly engineModuleName;
|
|
43
|
-
/**
|
|
44
|
-
* Is a big-table loot module deployed + enabled (cached per session)?
|
|
45
|
-
* When true, {@link enginePull} routes rolls through server-held RNG with
|
|
46
|
-
* pity timers + audit trails; the blueprint's weighted model rolls stay
|
|
47
|
-
* for small tables (the coexistence policy — "the server picks the path").
|
|
48
|
-
*/
|
|
49
|
-
engineAvailable(): Promise<boolean>;
|
|
50
|
-
/** Pull from the module's table (pity-timer path); count caps at 10. */
|
|
51
|
-
enginePull(count?: number): Promise<Record<string, unknown>>;
|
|
52
|
-
/** Your pity counters + roll totals from the module. */
|
|
53
|
-
enginePity(): Promise<Record<string, unknown>>;
|
|
54
|
-
/** Your rolling audit trail from the module (dispute resolution). */
|
|
55
|
-
engineAudit(): Promise<Record<string, unknown>>;
|
|
56
|
-
/**
|
|
57
|
-
* Create an unrolled `LootRoll` for a table, owned by `ownerUserId` (who
|
|
58
|
-
* will claim it). Event-drop automations pick from the pool of unrolled
|
|
59
|
-
* rolls — create a few ahead of time for tables wired to `drops`.
|
|
60
|
-
*/
|
|
61
|
-
createRoll(input: {
|
|
62
|
-
ownerUserId: Scalars['BigInt']['input'];
|
|
63
|
-
tableId: string;
|
|
64
|
-
displayName?: string;
|
|
65
|
-
sessionId?: string;
|
|
66
|
-
}): Promise<{
|
|
67
|
-
__typename?: "GmContainer";
|
|
68
|
-
containerId: string;
|
|
69
|
-
appId: string;
|
|
70
|
-
sessionId: string | null;
|
|
71
|
-
typeName: string;
|
|
72
|
-
displayName: string;
|
|
73
|
-
description: string | null;
|
|
74
|
-
ownerUserId: string | null;
|
|
75
|
-
metadataJson: string;
|
|
76
|
-
}>;
|
|
77
|
-
/**
|
|
78
|
-
* Roll a table on an unrolled `LootRoll` — a **trusted** call (default
|
|
79
|
-
* blueprint authority: app admins). Resolves with the rolled item id.
|
|
80
|
-
*
|
|
81
|
-
* @param tableId - The roll container's table (derives the function name);
|
|
82
|
-
* read from the container when omitted.
|
|
83
|
-
*/
|
|
84
|
-
roll(rollId: string, tableId?: string): Promise<KitInvokeResult<string>>;
|
|
85
|
-
/**
|
|
86
|
-
* Claim a rolled loot into a caller-owned stack of the rolled item. The
|
|
87
|
-
* claimed flag and the grant commit atomically. Resolves with the granted
|
|
88
|
-
* quantity.
|
|
89
|
-
*/
|
|
90
|
-
claim(rollId: string, toStackId: string): Promise<KitInvokeResult<number>>;
|
|
91
|
-
/** Read one roll's state. */
|
|
92
|
-
state(rollId: string): Promise<KitLootRoll>;
|
|
93
|
-
/**
|
|
94
|
-
* List a player's rolls, optionally filtered to one table and/or to
|
|
95
|
-
* unclaimed rolled loot (the "your drops" screen).
|
|
96
|
-
*/
|
|
97
|
-
rolls(ownerUserId: Scalars['BigInt']['input'], options?: {
|
|
98
|
-
tableId?: string;
|
|
99
|
-
unclaimedOnly?: boolean;
|
|
100
|
-
}): Promise<KitLootRoll[]>;
|
|
101
|
-
/**
|
|
102
|
-
* Roll/claim audit history from the model event log (each roll records its
|
|
103
|
-
* seed, item, and quantity as applied mutations).
|
|
104
|
-
*/
|
|
105
|
-
history(options?: {
|
|
106
|
-
tableId?: string;
|
|
107
|
-
limit?: number;
|
|
108
|
-
}): Promise<{
|
|
109
|
-
__typename?: "GmEvent";
|
|
110
|
-
eventId: string;
|
|
111
|
-
flowId: string | null;
|
|
112
|
-
sessionId: string | null;
|
|
113
|
-
functionName: string;
|
|
114
|
-
selfContainerId: string | null;
|
|
115
|
-
callerUserId: string | null;
|
|
116
|
-
callerKind: string;
|
|
117
|
-
automationId: string | null;
|
|
118
|
-
paramsJson: string;
|
|
119
|
-
mutationsAppliedJson: string;
|
|
120
|
-
permissionEffectsAppliedJson: string;
|
|
121
|
-
returnValueJson: string | null;
|
|
122
|
-
success: boolean;
|
|
123
|
-
errorMessage: string | null;
|
|
124
|
-
executedAt: string;
|
|
125
|
-
}[]>;
|
|
126
|
-
private toRoll;
|
|
127
|
-
}
|
|
128
|
-
//# sourceMappingURL=loot.d.ts.map
|
package/dist/kit/loot.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loot.d.ts","sourceRoot":"","sources":["../../src/kit/loot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,sCAAsC;AACtC,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,qBAAa,OAAO;IAKhB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAE1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAP3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAY;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAGjB,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EACjC,SAAS,EAAE,YAAY,EACxC,OAAO,GAAE,cAAmB,EACX,OAAO,CAAC,EAAE,cAAc,YAAA;IAO3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAE1C;;;;;OAKG;IACH,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAKnC,wEAAwE;IAClE,UAAU,CAAC,KAAK,SAAI;IAO1B,wDAAwD;IAClD,UAAU;IAOhB,qEAAqE;IAC/D,WAAW;IAOjB;;;;OAIG;IACG,UAAU,CAAC,KAAK,EAAE;QACtB,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;QACxC,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;;;;;;;;;;;IAqBD;;;;;;OAMG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAU9E;;;;OAIG;IACG,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAShF,6BAA6B;IACvB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAYjD;;;OAGG;IACG,KAAK,CACT,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EACvC,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAO,GAC1D,OAAO,CAAC,WAAW,EAAE,CAAC;IAwBzB;;;OAGG;IACG,OAAO,CACX,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO;;;;;;;;;;;;;;;;;;YAYtC,MAAM;CAoBrB"}
|