@crowdedkingdoms/crowdyjs 17.14.0-dev.1 → 18.0.1-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 +129 -1
- package/README.md +97 -164
- 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/apps.d.ts +1 -10
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +1 -16
- package/dist/domains/host.d.ts +3 -3
- package/dist/domains/host.js +3 -3
- package/dist/domains/hosting.d.ts +0 -6
- package/dist/domains/hosting.d.ts.map +1 -1
- package/dist/domains/hosting.js +1 -16
- 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/organizations.d.ts +1 -9
- package/dist/domains/organizations.d.ts.map +1 -1
- package/dist/domains/organizations.js +1 -15
- package/dist/domains/payments.d.ts +5 -48
- package/dist/domains/payments.d.ts.map +1 -1
- package/dist/domains/payments.js +5 -57
- 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/domains/quotas.d.ts +20 -7
- package/dist/domains/quotas.d.ts.map +1 -1
- package/dist/domains/quotas.js +15 -6
- package/dist/domains/users.d.ts +7 -74
- package/dist/domains/users.d.ts.map +1 -1
- package/dist/domains/users.js +7 -105
- 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 +955 -8272
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +5 -329
- 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 +12 -18
- 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
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Blueprint builders for the Game Kit, one module per game concept, re-exported
|
|
3
|
-
* here as a stable barrel (import paths from `kit/index.js` and the package
|
|
4
|
-
* root are unchanged as builders are added).
|
|
5
|
-
*/
|
|
6
|
-
export { andPolicies, composeBlueprints, featureGate, kitPolicyJson, mergeBlueprints, ownerEquals, ownerEqualsCaller, ownerMirrorProperty, toSnakeCase, trustedAuthorityFields, } from './core.js';
|
|
7
|
-
export { combatBlueprint, combatNames, } from './combat.js';
|
|
8
|
-
export { decksBlueprint, decksNames, } from './decks.js';
|
|
9
|
-
export { economyBlueprint, economyCurrencyFn, economyNames, } from './economy.js';
|
|
10
|
-
export { guildBlueprint, guildNames, } from './guild.js';
|
|
11
|
-
export { inventoryBlueprint, inventoryBarterFunctionName, inventoryCraftFunctionName, inventoryNames, } from './inventory.js';
|
|
12
|
-
export { leaderboardsBlueprint, leaderboardsNames, } from './leaderboards.js';
|
|
13
|
-
export { lootBlueprint, lootNames, lootRollFn, } from './loot.js';
|
|
14
|
-
export { lockBlueprint, lockNames, } from './locks.js';
|
|
15
|
-
export { questsBlueprint, questsNames, } from './quests.js';
|
|
16
|
-
export { progressionBlueprint, progressionNames, } from './progression.js';
|
|
17
|
-
export { plotBlueprint, plotNames, } from './plots.js';
|
|
18
|
-
export { matchesBlueprint, matchesNames, } from './matches.js';
|
|
19
|
-
export { npcBehaviorFunctionName, npcBlueprint, } from './npcs.js';
|
|
20
|
-
export { worldsimBlueprint, worldsimNames, } from './worldsim.js';
|
|
21
|
-
export { liveopsBlueprint, liveopsNames, } from './liveops.js';
|
|
22
|
-
export { moderationBlueprint, moderationNames, } from './moderation.js';
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { type KitBlueprint, type KitOwnerIdKind } from './core.js';
|
|
2
|
-
/** Options for {@link inventoryBlueprint}. */
|
|
3
|
-
export interface InventoryBlueprintOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Prefix applied to the container type names (e.g. `'Bank'` →
|
|
6
|
-
* `BankInventory` / `BankItemStack`) and, snake-cased, to the function
|
|
7
|
-
* names (`bank_grant_stack`, …). Lets several independent inventory systems
|
|
8
|
-
* coexist in one app. Defaults to none.
|
|
9
|
-
*/
|
|
10
|
-
typePrefix?: string;
|
|
11
|
-
/** Default `max_slots` on new inventories. Defaults to 24. */
|
|
12
|
-
maxSlots?: number;
|
|
13
|
-
/** Exclusive upper bound for stack `slot` indexes. Defaults to 64. */
|
|
14
|
-
slotCount?: number;
|
|
15
|
-
/**
|
|
16
|
-
* Recipes compiled into atomic Model functions. Each generated function
|
|
17
|
-
* consumes every input stack and grants the output stack in ONE
|
|
18
|
-
* transaction; all refs must be caller-owned and item ids must match.
|
|
19
|
-
*/
|
|
20
|
-
recipes?: InventoryRecipeSpec[];
|
|
21
|
-
/** Item-for-item offers compiled into atomic barter functions. */
|
|
22
|
-
barters?: InventoryBarterSpec[];
|
|
23
|
-
/** Owner mirror representation. Defaults to `int`; legacy worlds may use `string`. */
|
|
24
|
-
ownerIdKind?: KitOwnerIdKind;
|
|
25
|
-
/**
|
|
26
|
-
* Who may instantiate ItemStack rows. Defaults to `member` for backwards
|
|
27
|
-
* compatibility; competitive games should use `admin` and create empty
|
|
28
|
-
* stacks through a trusted compute/bootstrap path.
|
|
29
|
-
*/
|
|
30
|
-
stackInstantiableBy?: 'member' | 'admin';
|
|
31
|
-
/**
|
|
32
|
-
* Who may call the generic grant function. `owner` preserves the original
|
|
33
|
-
* sandbox-friendly behavior; competitive games should use `server` and
|
|
34
|
-
* grant only through trusted transactions/referees.
|
|
35
|
-
*/
|
|
36
|
-
grantAuthority?: 'owner' | 'server';
|
|
37
|
-
}
|
|
38
|
-
export interface InventoryRecipeSpec {
|
|
39
|
-
recipeId: string;
|
|
40
|
-
inputs: Array<{
|
|
41
|
-
itemId: string;
|
|
42
|
-
quantity: number;
|
|
43
|
-
}>;
|
|
44
|
-
output: {
|
|
45
|
-
itemId: string;
|
|
46
|
-
quantity: number;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
export interface InventoryBarterSpec {
|
|
50
|
-
barterId: string;
|
|
51
|
-
pay: {
|
|
52
|
-
itemId: string;
|
|
53
|
-
quantity: number;
|
|
54
|
-
};
|
|
55
|
-
receive: {
|
|
56
|
-
itemId: string;
|
|
57
|
-
quantity: number;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
export declare function inventoryCraftFunctionName(recipeId: string, typePrefix?: string): string;
|
|
61
|
-
export declare function inventoryBarterFunctionName(barterId: string, typePrefix?: string): string;
|
|
62
|
-
/** Names derived by {@link inventoryBlueprint} for a given prefix. */
|
|
63
|
-
export interface InventoryNames {
|
|
64
|
-
inventoryType: string;
|
|
65
|
-
stackType: string;
|
|
66
|
-
grantFn: string;
|
|
67
|
-
consumeFn: string;
|
|
68
|
-
moveFn: string;
|
|
69
|
-
transferFn: string;
|
|
70
|
-
containsEdge: string;
|
|
71
|
-
}
|
|
72
|
-
/** Compute the type/function names an inventory blueprint (and its runtime helper) uses. */
|
|
73
|
-
export declare function inventoryNames(typePrefix?: string): InventoryNames;
|
|
74
|
-
/**
|
|
75
|
-
* Blueprint for a server-authoritative **inventory**: a per-player
|
|
76
|
-
* `Inventory` container plus `ItemStack` containers (`item_id`, `quantity`,
|
|
77
|
-
* `slot`), and owner-gated functions to grant, consume, move, and transfer
|
|
78
|
-
* stacks. Quantity guards live in the invoke policies, so an untrusted client
|
|
79
|
-
* can never overdraw or touch another player's items.
|
|
80
|
-
*
|
|
81
|
-
* Runtime counterpart: `client.kit(appId).inventory`.
|
|
82
|
-
*/
|
|
83
|
-
export declare function inventoryBlueprint(options?: InventoryBlueprintOptions): KitBlueprint;
|
|
84
|
-
//# sourceMappingURL=inventory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inventory.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/inventory.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AAEnB,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAChC,kEAAkE;IAClE,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAChC,sFAAsF;IACtF,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CACrC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9C;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,SAAK,GAAG,MAAM,CAGpF;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,SAAK,GAAG,MAAM,CAGrF;AAED,sEAAsE;AACtE,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,UAAU,SAAK,GAAG,cAAc,CAW9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,yBAA8B,GACtC,YAAY,CAiPd"}
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import { kitPolicyJson, ownerEqualsCaller, ownerMirrorProperty, toSnakeCase, } from './core.js';
|
|
2
|
-
export function inventoryCraftFunctionName(recipeId, typePrefix = '') {
|
|
3
|
-
const prefix = typePrefix ? `${toSnakeCase(typePrefix)}_` : '';
|
|
4
|
-
return `${prefix}craft_${toSnakeCase(recipeId)}`;
|
|
5
|
-
}
|
|
6
|
-
export function inventoryBarterFunctionName(barterId, typePrefix = '') {
|
|
7
|
-
const prefix = typePrefix ? `${toSnakeCase(typePrefix)}_` : '';
|
|
8
|
-
return `${prefix}barter_${toSnakeCase(barterId)}`;
|
|
9
|
-
}
|
|
10
|
-
/** Compute the type/function names an inventory blueprint (and its runtime helper) uses. */
|
|
11
|
-
export function inventoryNames(typePrefix = '') {
|
|
12
|
-
const fnPrefix = typePrefix ? `${toSnakeCase(typePrefix)}_` : '';
|
|
13
|
-
return {
|
|
14
|
-
inventoryType: `${typePrefix}Inventory`,
|
|
15
|
-
stackType: `${typePrefix}ItemStack`,
|
|
16
|
-
grantFn: `${fnPrefix}grant_stack`,
|
|
17
|
-
consumeFn: `${fnPrefix}consume_stack`,
|
|
18
|
-
moveFn: `${fnPrefix}move_stack`,
|
|
19
|
-
transferFn: `${fnPrefix}transfer_stack`,
|
|
20
|
-
containsEdge: 'inventory_contains',
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Blueprint for a server-authoritative **inventory**: a per-player
|
|
25
|
-
* `Inventory` container plus `ItemStack` containers (`item_id`, `quantity`,
|
|
26
|
-
* `slot`), and owner-gated functions to grant, consume, move, and transfer
|
|
27
|
-
* stacks. Quantity guards live in the invoke policies, so an untrusted client
|
|
28
|
-
* can never overdraw or touch another player's items.
|
|
29
|
-
*
|
|
30
|
-
* Runtime counterpart: `client.kit(appId).inventory`.
|
|
31
|
-
*/
|
|
32
|
-
export function inventoryBlueprint(options = {}) {
|
|
33
|
-
const { typePrefix = '', maxSlots = 24, slotCount = 64, recipes = [], barters = [], ownerIdKind = 'int', stackInstantiableBy = 'member', grantAuthority = 'owner', } = options;
|
|
34
|
-
const names = inventoryNames(typePrefix);
|
|
35
|
-
const ownerOnly = kitPolicyJson({ type: 'owner_of_self' });
|
|
36
|
-
for (const recipe of recipes) {
|
|
37
|
-
if (recipe.inputs.length === 0 || recipe.inputs.length > 6) {
|
|
38
|
-
throw new Error(`inventory recipe '${recipe.recipeId}' must have 1-6 inputs`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const recipeFunctions = recipes.map((recipe) => {
|
|
42
|
-
const inputParams = recipe.inputs.map((_, index) => ({
|
|
43
|
-
name: `input_${index}_id`,
|
|
44
|
-
valueType: 'container_ref',
|
|
45
|
-
required: true,
|
|
46
|
-
}));
|
|
47
|
-
const guards = recipe.inputs.flatMap((input, index) => [
|
|
48
|
-
ownerEqualsCaller(`ref($input_${index}_id).owner_user_id`, ownerIdKind),
|
|
49
|
-
`ref($input_${index}_id).item_id == "${input.itemId}"`,
|
|
50
|
-
`ref($input_${index}_id).quantity >= ${input.quantity}`,
|
|
51
|
-
]);
|
|
52
|
-
guards.push(ownerEqualsCaller('ref($output_id).owner_user_id', ownerIdKind));
|
|
53
|
-
guards.push(`ref($output_id).item_id == "${recipe.output.itemId}"`);
|
|
54
|
-
return {
|
|
55
|
-
name: inventoryCraftFunctionName(recipe.recipeId, typePrefix),
|
|
56
|
-
containerTypeName: names.inventoryType,
|
|
57
|
-
returnType: 'int',
|
|
58
|
-
parameters: [
|
|
59
|
-
...inputParams,
|
|
60
|
-
{ name: 'output_id', valueType: 'container_ref', required: true },
|
|
61
|
-
],
|
|
62
|
-
mutations: [
|
|
63
|
-
...recipe.inputs.map((input, index) => ({
|
|
64
|
-
target: `ref($input_${index}_id)`,
|
|
65
|
-
property: 'quantity',
|
|
66
|
-
expression: `ref($input_${index}_id).quantity - ${input.quantity}`,
|
|
67
|
-
})),
|
|
68
|
-
{
|
|
69
|
-
target: 'ref($output_id)',
|
|
70
|
-
property: 'quantity',
|
|
71
|
-
expression: `ref($output_id).quantity + ${recipe.output.quantity}`,
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
returnExpression: 'ref($output_id).quantity',
|
|
75
|
-
invokePolicyJson: kitPolicyJson({
|
|
76
|
-
type: 'and',
|
|
77
|
-
rules: [
|
|
78
|
-
{ type: 'owner_of_self' },
|
|
79
|
-
{ type: 'condition', expression: guards.join(' && ') },
|
|
80
|
-
],
|
|
81
|
-
}),
|
|
82
|
-
autonomousInvocable: true,
|
|
83
|
-
description: `Atomically craft '${recipe.recipeId}': consume all inputs and grant the output, or write nothing.`,
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
const barterFunctions = barters.map((barter) => ({
|
|
87
|
-
name: inventoryBarterFunctionName(barter.barterId, typePrefix),
|
|
88
|
-
containerTypeName: names.inventoryType,
|
|
89
|
-
returnType: 'int',
|
|
90
|
-
parameters: [
|
|
91
|
-
{ name: 'pay_id', valueType: 'container_ref', required: true },
|
|
92
|
-
{ name: 'receive_id', valueType: 'container_ref', required: true },
|
|
93
|
-
],
|
|
94
|
-
mutations: [
|
|
95
|
-
{
|
|
96
|
-
target: 'ref($pay_id)',
|
|
97
|
-
property: 'quantity',
|
|
98
|
-
expression: `ref($pay_id).quantity - ${barter.pay.quantity}`,
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
target: 'ref($receive_id)',
|
|
102
|
-
property: 'quantity',
|
|
103
|
-
expression: `ref($receive_id).quantity + ${barter.receive.quantity}`,
|
|
104
|
-
},
|
|
105
|
-
],
|
|
106
|
-
returnExpression: 'ref($receive_id).quantity',
|
|
107
|
-
invokePolicyJson: kitPolicyJson({
|
|
108
|
-
type: 'and',
|
|
109
|
-
rules: [
|
|
110
|
-
{ type: 'owner_of_self' },
|
|
111
|
-
{
|
|
112
|
-
type: 'condition',
|
|
113
|
-
expression: [
|
|
114
|
-
ownerEqualsCaller('ref($pay_id).owner_user_id', ownerIdKind),
|
|
115
|
-
`ref($pay_id).item_id == "${barter.pay.itemId}"`,
|
|
116
|
-
`ref($pay_id).quantity >= ${barter.pay.quantity}`,
|
|
117
|
-
ownerEqualsCaller('ref($receive_id).owner_user_id', ownerIdKind),
|
|
118
|
-
`ref($receive_id).item_id == "${barter.receive.itemId}"`,
|
|
119
|
-
].join(' && '),
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
}),
|
|
123
|
-
autonomousInvocable: true,
|
|
124
|
-
description: `Atomically execute barter '${barter.barterId}', or write nothing.`,
|
|
125
|
-
}));
|
|
126
|
-
return {
|
|
127
|
-
name: names.inventoryType,
|
|
128
|
-
containerTypes: [
|
|
129
|
-
{
|
|
130
|
-
typeName: names.inventoryType,
|
|
131
|
-
displayName: names.inventoryType,
|
|
132
|
-
instantiableBy: 'member',
|
|
133
|
-
description: 'A bag of item stacks owned by one player.',
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
typeName: names.stackType,
|
|
137
|
-
displayName: names.stackType,
|
|
138
|
-
instantiableBy: stackInstantiableBy,
|
|
139
|
-
description: 'One stack of a single item type in an inventory slot.',
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
propertyDefinitions: [
|
|
143
|
-
{
|
|
144
|
-
containerTypeName: names.inventoryType,
|
|
145
|
-
key: 'max_slots',
|
|
146
|
-
valueType: 'int',
|
|
147
|
-
defaultValueJson: String(maxSlots),
|
|
148
|
-
},
|
|
149
|
-
{ containerTypeName: names.stackType, key: 'item_id', valueType: 'string' },
|
|
150
|
-
ownerMirrorProperty(names.stackType, ownerIdKind),
|
|
151
|
-
{
|
|
152
|
-
containerTypeName: names.stackType,
|
|
153
|
-
key: 'quantity',
|
|
154
|
-
valueType: 'int',
|
|
155
|
-
defaultValueJson: '0',
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
containerTypeName: names.stackType,
|
|
159
|
-
key: 'slot',
|
|
160
|
-
valueType: 'int',
|
|
161
|
-
defaultValueJson: '0',
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
functions: [
|
|
165
|
-
{
|
|
166
|
-
name: names.grantFn,
|
|
167
|
-
containerTypeName: names.stackType,
|
|
168
|
-
returnType: 'int',
|
|
169
|
-
parameters: [{ name: 'amount', valueType: 'int', required: true }],
|
|
170
|
-
mutations: [
|
|
171
|
-
{
|
|
172
|
-
target: 'self',
|
|
173
|
-
property: 'quantity',
|
|
174
|
-
expression: 'self.quantity + max(0, $amount)',
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
returnExpression: 'self.quantity',
|
|
178
|
-
invokePolicyJson: grantAuthority === 'server'
|
|
179
|
-
? kitPolicyJson({ type: 'is_automation' })
|
|
180
|
-
: ownerOnly,
|
|
181
|
-
invokeScope: grantAuthority === 'server' ? 'internal' : undefined,
|
|
182
|
-
autonomousInvocable: grantAuthority === 'server' ? true : undefined,
|
|
183
|
-
description: grantAuthority === 'server'
|
|
184
|
-
? 'Trusted server/compute grant; players cannot mint items.'
|
|
185
|
-
: 'Add items to a stack the caller owns.',
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
name: names.consumeFn,
|
|
189
|
-
containerTypeName: names.stackType,
|
|
190
|
-
returnType: 'int',
|
|
191
|
-
parameters: [{ name: 'amount', valueType: 'int', required: true }],
|
|
192
|
-
mutations: [
|
|
193
|
-
{ target: 'self', property: 'quantity', expression: 'self.quantity - $amount' },
|
|
194
|
-
],
|
|
195
|
-
returnExpression: 'self.quantity',
|
|
196
|
-
invokePolicyJson: kitPolicyJson({
|
|
197
|
-
type: 'and',
|
|
198
|
-
rules: [
|
|
199
|
-
{ type: 'owner_of_self' },
|
|
200
|
-
{
|
|
201
|
-
type: 'condition',
|
|
202
|
-
expression: '$amount > 0 && self.quantity >= $amount',
|
|
203
|
-
},
|
|
204
|
-
],
|
|
205
|
-
}),
|
|
206
|
-
description: 'Spend items from a stack; refuses to overdraw.',
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: names.moveFn,
|
|
210
|
-
containerTypeName: names.stackType,
|
|
211
|
-
returnType: 'int',
|
|
212
|
-
parameters: [{ name: 'to_slot', valueType: 'int', required: true }],
|
|
213
|
-
mutations: [
|
|
214
|
-
{
|
|
215
|
-
target: 'self',
|
|
216
|
-
property: 'slot',
|
|
217
|
-
expression: `clamp($to_slot, 0, ${slotCount - 1})`,
|
|
218
|
-
},
|
|
219
|
-
],
|
|
220
|
-
returnExpression: 'self.slot',
|
|
221
|
-
invokePolicyJson: ownerOnly,
|
|
222
|
-
description: 'Move a stack to another slot.',
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: names.transferFn,
|
|
226
|
-
containerTypeName: names.stackType,
|
|
227
|
-
returnType: 'int',
|
|
228
|
-
parameters: [
|
|
229
|
-
{ name: 'to_id', valueType: 'container_ref', required: true },
|
|
230
|
-
{ name: 'amount', valueType: 'int', required: true },
|
|
231
|
-
],
|
|
232
|
-
mutations: [
|
|
233
|
-
{ target: 'self', property: 'quantity', expression: 'self.quantity - $amount' },
|
|
234
|
-
{
|
|
235
|
-
target: 'ref($to_id)',
|
|
236
|
-
property: 'quantity',
|
|
237
|
-
expression: 'ref($to_id).quantity + $amount',
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
returnExpression: 'self.quantity',
|
|
241
|
-
invokePolicyJson: kitPolicyJson({
|
|
242
|
-
type: 'and',
|
|
243
|
-
rules: [
|
|
244
|
-
{ type: 'owner_of_self' },
|
|
245
|
-
{
|
|
246
|
-
type: 'condition',
|
|
247
|
-
expression: '$amount > 0 && self.quantity >= $amount && ref($to_id).item_id == self.item_id',
|
|
248
|
-
},
|
|
249
|
-
],
|
|
250
|
-
}),
|
|
251
|
-
description: 'Atomically move items between two stacks of the same item type.',
|
|
252
|
-
},
|
|
253
|
-
...recipeFunctions,
|
|
254
|
-
...barterFunctions,
|
|
255
|
-
],
|
|
256
|
-
};
|
|
257
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type KitBlueprint, type KitOwnerIdKind, type KitTrustedAuthority } from './core.js';
|
|
2
|
-
/** Options for {@link leaderboardsBlueprint}. */
|
|
3
|
-
export interface LeaderboardsBlueprintOptions {
|
|
4
|
-
/** Prefix for the type/function names. Defaults to none. */
|
|
5
|
-
typePrefix?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Who may submit scores: `'host'` (the elected host referees; default),
|
|
8
|
-
* `'server'` (app admins / studio backend), or `'automation'` (e.g. an
|
|
9
|
-
* event automation on the match layer's `end_match`).
|
|
10
|
-
*/
|
|
11
|
-
submitAuthority?: KitTrustedAuthority;
|
|
12
|
-
/**
|
|
13
|
-
* When true (default), submitting keeps the best score
|
|
14
|
-
* (`max(self.score, $points)`); when false, submissions overwrite.
|
|
15
|
-
*/
|
|
16
|
-
keepBest?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* When set, adds a cron automation that rolls the season: bumps `season`
|
|
19
|
-
* and resets `score`/`rank` on EVERY entry (e.g. `'0 0 1 * *'` for
|
|
20
|
-
* monthly seasons).
|
|
21
|
-
*/
|
|
22
|
-
seasonCron?: string;
|
|
23
|
-
/** Owner-mirror typing (see the kit convention). Defaults to `'int'`. */
|
|
24
|
-
ownerIdKind?: KitOwnerIdKind;
|
|
25
|
-
}
|
|
26
|
-
/** Names derived by {@link leaderboardsBlueprint} for a given prefix. */
|
|
27
|
-
export interface LeaderboardsNames {
|
|
28
|
-
entryType: string;
|
|
29
|
-
submitFn: string;
|
|
30
|
-
rollSeasonFn: string;
|
|
31
|
-
seasonAutomation: string;
|
|
32
|
-
}
|
|
33
|
-
/** Compute the type/function names a leaderboards blueprint (and its runtime helper) uses. */
|
|
34
|
-
export declare function leaderboardsNames(typePrefix?: string): LeaderboardsNames;
|
|
35
|
-
/**
|
|
36
|
-
* Blueprint for **leaderboards**: per-player `LeaderboardEntry` rows keyed
|
|
37
|
-
* by a `board_id`, written only through the trusted `submit_score`
|
|
38
|
-
* (host-refereed by default — configure `submitAuthority`), with optional
|
|
39
|
-
* cron **season rolls**.
|
|
40
|
-
*
|
|
41
|
-
* Ranking is honest about the platform: container lists have no server-side
|
|
42
|
-
* ORDER BY, so `kit.leaderboards.top()` fetches a board's entries and sorts
|
|
43
|
-
* client-side — fine for the few hundred entries a per-app board holds.
|
|
44
|
-
* Automation selectors' `pick: highest` covers server-side top-1 needs.
|
|
45
|
-
*
|
|
46
|
-
* Runtime counterpart: `client.kit(appId).leaderboards`.
|
|
47
|
-
*/
|
|
48
|
-
export declare function leaderboardsBlueprint(options?: LeaderboardsBlueprintOptions): KitBlueprint;
|
|
49
|
-
//# sourceMappingURL=leaderboards.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"leaderboards.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/leaderboards.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AAEnB,iDAAiD;AACjD,MAAM,WAAW,4BAA4B;IAC3C,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B;AAED,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAAC,UAAU,SAAK,GAAG,iBAAiB,CAQpE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,4BAAiC,GACzC,YAAY,CAiHd"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { kitPolicyJson, ownerMirrorProperty, toSnakeCase, trustedAuthorityFields, } from './core.js';
|
|
2
|
-
/** Compute the type/function names a leaderboards blueprint (and its runtime helper) uses. */
|
|
3
|
-
export function leaderboardsNames(typePrefix = '') {
|
|
4
|
-
const fnPrefix = typePrefix ? `${toSnakeCase(typePrefix)}_` : '';
|
|
5
|
-
return {
|
|
6
|
-
entryType: `${typePrefix}LeaderboardEntry`,
|
|
7
|
-
submitFn: `${fnPrefix}submit_score`,
|
|
8
|
-
rollSeasonFn: `${fnPrefix}roll_season`,
|
|
9
|
-
seasonAutomation: `${fnPrefix.replace(/_/g, '-')}season-roll`,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Blueprint for **leaderboards**: per-player `LeaderboardEntry` rows keyed
|
|
14
|
-
* by a `board_id`, written only through the trusted `submit_score`
|
|
15
|
-
* (host-refereed by default — configure `submitAuthority`), with optional
|
|
16
|
-
* cron **season rolls**.
|
|
17
|
-
*
|
|
18
|
-
* Ranking is honest about the platform: container lists have no server-side
|
|
19
|
-
* ORDER BY, so `kit.leaderboards.top()` fetches a board's entries and sorts
|
|
20
|
-
* client-side — fine for the few hundred entries a per-app board holds.
|
|
21
|
-
* Automation selectors' `pick: highest` covers server-side top-1 needs.
|
|
22
|
-
*
|
|
23
|
-
* Runtime counterpart: `client.kit(appId).leaderboards`.
|
|
24
|
-
*/
|
|
25
|
-
export function leaderboardsBlueprint(options = {}) {
|
|
26
|
-
const { typePrefix = '', submitAuthority = 'host', keepBest = true, seasonCron, ownerIdKind: kind = 'int', } = options;
|
|
27
|
-
const names = leaderboardsNames(typePrefix);
|
|
28
|
-
const propertyDefinitions = [
|
|
29
|
-
ownerMirrorProperty(names.entryType, kind),
|
|
30
|
-
{
|
|
31
|
-
containerTypeName: names.entryType,
|
|
32
|
-
key: 'board_id',
|
|
33
|
-
valueType: 'string',
|
|
34
|
-
defaultValueJson: '""',
|
|
35
|
-
description: "Which leaderboard this entry belongs to (e.g. 'weekly_kills').",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
containerTypeName: names.entryType,
|
|
39
|
-
key: 'score',
|
|
40
|
-
valueType: 'int',
|
|
41
|
-
defaultValueJson: '0',
|
|
42
|
-
description: 'The ranked score, written only through submit_score.',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
containerTypeName: names.entryType,
|
|
46
|
-
key: 'season',
|
|
47
|
-
valueType: 'int',
|
|
48
|
-
defaultValueJson: '1',
|
|
49
|
-
description: 'Season counter, bumped by the season-roll automation.',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
containerTypeName: names.entryType,
|
|
53
|
-
key: 'rank',
|
|
54
|
-
valueType: 'int',
|
|
55
|
-
defaultValueJson: '0',
|
|
56
|
-
description: 'Optional stamped rank (0 = unstamped; ranking is client-side by default).',
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
const functions = [
|
|
60
|
-
{
|
|
61
|
-
name: names.submitFn,
|
|
62
|
-
containerTypeName: names.entryType,
|
|
63
|
-
returnType: 'int',
|
|
64
|
-
parameters: [
|
|
65
|
-
{
|
|
66
|
-
name: 'points',
|
|
67
|
-
valueType: 'int',
|
|
68
|
-
required: true,
|
|
69
|
-
description: 'The score to submit.',
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
mutations: [
|
|
73
|
-
{
|
|
74
|
-
target: 'self',
|
|
75
|
-
property: 'score',
|
|
76
|
-
expression: keepBest ? 'max(self.score, $points)' : '$points',
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
returnExpression: 'self.score',
|
|
80
|
-
...trustedAuthorityFields(submitAuthority),
|
|
81
|
-
description: `Trusted score submission (${keepBest ? 'keeps the best score' : 'overwrites'}); never a plain player call.`,
|
|
82
|
-
},
|
|
83
|
-
];
|
|
84
|
-
const automations = [];
|
|
85
|
-
if (seasonCron !== undefined) {
|
|
86
|
-
functions.push({
|
|
87
|
-
name: names.rollSeasonFn,
|
|
88
|
-
containerTypeName: names.entryType,
|
|
89
|
-
returnType: 'int',
|
|
90
|
-
mutations: [
|
|
91
|
-
{ target: 'self', property: 'season', expression: 'self.season + 1' },
|
|
92
|
-
{ target: 'self', property: 'score', expression: '0' },
|
|
93
|
-
{ target: 'self', property: 'rank', expression: '0' },
|
|
94
|
-
],
|
|
95
|
-
returnExpression: 'self.season',
|
|
96
|
-
invokePolicyJson: kitPolicyJson({ type: 'is_automation' }),
|
|
97
|
-
autonomousInvocable: true,
|
|
98
|
-
description: 'Season roll (automation-only): bumps the season and resets scores.',
|
|
99
|
-
});
|
|
100
|
-
automations.push({
|
|
101
|
-
name: names.seasonAutomation,
|
|
102
|
-
functionName: names.rollSeasonFn,
|
|
103
|
-
targetMode: 'type',
|
|
104
|
-
targetTypeName: names.entryType,
|
|
105
|
-
triggerType: 'schedule',
|
|
106
|
-
scheduleKind: 'cron',
|
|
107
|
-
cronExpr: seasonCron,
|
|
108
|
-
maxTargets: 500,
|
|
109
|
-
description: 'Rolls every leaderboard entry into the next season on the cron.',
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
name: names.entryType,
|
|
114
|
-
containerTypes: [
|
|
115
|
-
{
|
|
116
|
-
typeName: names.entryType,
|
|
117
|
-
displayName: names.entryType,
|
|
118
|
-
instantiableBy: 'member',
|
|
119
|
-
description: "One player's entry on one leaderboard (score writable only via submit_score).",
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
propertyDefinitions,
|
|
123
|
-
functions,
|
|
124
|
-
...(automations.length ? { automations } : {}),
|
|
125
|
-
};
|
|
126
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { type KitBlueprint, type KitTrustedAuthority } from './core.js';
|
|
2
|
-
/** Options for {@link liveopsBlueprint}. */
|
|
3
|
-
export interface LiveopsBlueprintOptions {
|
|
4
|
-
/** Prefix for the type/function names. Defaults to none. */
|
|
5
|
-
typePrefix?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Who may open/close windows and roll seasons: `'server'` (app admins /
|
|
8
|
-
* studio backend; default) or `'automation'` (cron-driven flips).
|
|
9
|
-
*/
|
|
10
|
-
adminAuthority?: KitTrustedAuthority;
|
|
11
|
-
}
|
|
12
|
-
/** Names derived by {@link liveopsBlueprint} for a given prefix. */
|
|
13
|
-
export interface LiveopsNames {
|
|
14
|
-
windowType: string;
|
|
15
|
-
seasonType: string;
|
|
16
|
-
openWindowFn: string;
|
|
17
|
-
closeWindowFn: string;
|
|
18
|
-
activateSeasonFn: string;
|
|
19
|
-
}
|
|
20
|
-
/** Compute the type/function names a liveops blueprint (and its runtime helper) uses. */
|
|
21
|
-
export declare function liveopsNames(typePrefix?: string): LiveopsNames;
|
|
22
|
-
/**
|
|
23
|
-
* Blueprint for **liveops** (matrix P4, P3): event windows, seasons, and
|
|
24
|
-
* battle-pass composition — MODEL-FIRST (the coexistence policy):
|
|
25
|
-
*
|
|
26
|
-
* - `EventWindow` containers carry a `window_id`, an `active` flag, optional
|
|
27
|
-
* `opens_at_ms`/`closes_at_ms` timestamps, and an opaque `modifiers` JSON
|
|
28
|
-
* blob. Admin (or cron-automation) functions flip `active`; when both
|
|
29
|
-
* timestamps are set, the **liveops-scheduler compute engine** flips the
|
|
30
|
-
* flag itself and broadcasts the modifiers on the compute bus
|
|
31
|
-
* (`liveops_window_opened`/`closed`) for other engines to apply — spawn
|
|
32
|
-
* multipliers, weather locks, double gold.
|
|
33
|
-
* - `SeasonDef` containers name a season (`season_id`, `active`,
|
|
34
|
-
* `starts_at_ms`/`ends_at_ms`) and its battle-pass composition: the
|
|
35
|
-
* `pass_track` is a progression-layer track name and `pass_features` a
|
|
36
|
-
* JSON array of feature gates unlocked per tier — a battle pass is a
|
|
37
|
-
* SEASON + PROGRESSION TRACK + FEATURE GATES, no new machinery.
|
|
38
|
-
*
|
|
39
|
-
* Runtime counterpart: `client.kit(appId).liveops`.
|
|
40
|
-
*/
|
|
41
|
-
export declare function liveopsBlueprint(options?: LiveopsBlueprintOptions): KitBlueprint;
|
|
42
|
-
//# sourceMappingURL=liveops.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"liveops.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/liveops.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AAEnB,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAC;CACtC;AAED,oEAAoE;AACpE,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,UAAU,SAAK,GAAG,YAAY,CAS1D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B,GAAG,YAAY,CAqJpF"}
|