@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,32 +0,0 @@
|
|
|
1
|
-
import { type KitBlueprint } from './core.js';
|
|
2
|
-
/** Options for {@link moderationBlueprint}. */
|
|
3
|
-
export interface ModerationBlueprintOptions {
|
|
4
|
-
/** Prefix for the type/function names. Defaults to none. */
|
|
5
|
-
typePrefix?: string;
|
|
6
|
-
}
|
|
7
|
-
/** Names derived by {@link moderationBlueprint} for a given prefix. */
|
|
8
|
-
export interface ModerationNames {
|
|
9
|
-
reportType: string;
|
|
10
|
-
muteType: string;
|
|
11
|
-
fileReportFn: string;
|
|
12
|
-
resolveReportFn: string;
|
|
13
|
-
}
|
|
14
|
-
/** Compute the type/function names a moderation blueprint (and its runtime helper) uses. */
|
|
15
|
-
export declare function moderationNames(typePrefix?: string): ModerationNames;
|
|
16
|
-
/**
|
|
17
|
-
* Blueprint for **moderation** (matrix P6) — MODEL + CLIENT, no compute:
|
|
18
|
-
*
|
|
19
|
-
* - `ModReport` containers are the escalation queue: any player files one
|
|
20
|
-
* against a subject (`file_report` is member-instantiable through the
|
|
21
|
-
* runtime helper — the caller's own report row); app admins read the
|
|
22
|
-
* open queue and `resolve_report` with a disposition.
|
|
23
|
-
* - `ModMute` containers are per-player mute lists (client-enforced: the
|
|
24
|
-
* runtime helper filters chat client-side — mutes are personal, not
|
|
25
|
-
* punitive).
|
|
26
|
-
* - ENFORCEMENT stays on existing platform surfaces: admins revoke access
|
|
27
|
-
* tiers / grid permissions; nothing new to trust here.
|
|
28
|
-
*
|
|
29
|
-
* Runtime counterpart: `client.kit(appId).moderation`.
|
|
30
|
-
*/
|
|
31
|
-
export declare function moderationBlueprint(options?: ModerationBlueprintOptions): KitBlueprint;
|
|
32
|
-
//# sourceMappingURL=moderation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"moderation.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/moderation.ts"],"names":[],"mappings":"AACA,OAAO,EAAuC,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAEnF,+CAA+C;AAC/C,MAAM,WAAW,0BAA0B;IACzC,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,uEAAuE;AACvE,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,UAAU,SAAK,GAAG,eAAe,CAQhE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,0BAA+B,GAAG,YAAY,CAqH1F"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { toSnakeCase, trustedAuthorityFields } from './core.js';
|
|
2
|
-
/** Compute the type/function names a moderation blueprint (and its runtime helper) uses. */
|
|
3
|
-
export function moderationNames(typePrefix = '') {
|
|
4
|
-
const fnPrefix = typePrefix ? `${toSnakeCase(typePrefix)}_` : '';
|
|
5
|
-
return {
|
|
6
|
-
reportType: `${typePrefix}ModReport`,
|
|
7
|
-
muteType: `${typePrefix}ModMute`,
|
|
8
|
-
fileReportFn: `${fnPrefix}file_report`,
|
|
9
|
-
resolveReportFn: `${fnPrefix}resolve_report`,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Blueprint for **moderation** (matrix P6) — MODEL + CLIENT, no compute:
|
|
14
|
-
*
|
|
15
|
-
* - `ModReport` containers are the escalation queue: any player files one
|
|
16
|
-
* against a subject (`file_report` is member-instantiable through the
|
|
17
|
-
* runtime helper — the caller's own report row); app admins read the
|
|
18
|
-
* open queue and `resolve_report` with a disposition.
|
|
19
|
-
* - `ModMute` containers are per-player mute lists (client-enforced: the
|
|
20
|
-
* runtime helper filters chat client-side — mutes are personal, not
|
|
21
|
-
* punitive).
|
|
22
|
-
* - ENFORCEMENT stays on existing platform surfaces: admins revoke access
|
|
23
|
-
* tiers / grid permissions; nothing new to trust here.
|
|
24
|
-
*
|
|
25
|
-
* Runtime counterpart: `client.kit(appId).moderation`.
|
|
26
|
-
*/
|
|
27
|
-
export function moderationBlueprint(options = {}) {
|
|
28
|
-
const { typePrefix = '' } = options;
|
|
29
|
-
const names = moderationNames(typePrefix);
|
|
30
|
-
const propertyDefinitions = [
|
|
31
|
-
{
|
|
32
|
-
containerTypeName: names.reportType,
|
|
33
|
-
key: 'reporter_user_id',
|
|
34
|
-
valueType: 'string',
|
|
35
|
-
defaultValueJson: '""',
|
|
36
|
-
description: 'Who filed the report.',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
containerTypeName: names.reportType,
|
|
40
|
-
key: 'subject_user_id',
|
|
41
|
-
valueType: 'string',
|
|
42
|
-
defaultValueJson: '""',
|
|
43
|
-
description: 'Who the report is about.',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
containerTypeName: names.reportType,
|
|
47
|
-
key: 'reason',
|
|
48
|
-
valueType: 'string',
|
|
49
|
-
defaultValueJson: '""',
|
|
50
|
-
description: "App-defined category ('harassment', 'cheating', 'spam', ...).",
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
containerTypeName: names.reportType,
|
|
54
|
-
key: 'detail',
|
|
55
|
-
valueType: 'string',
|
|
56
|
-
defaultValueJson: '""',
|
|
57
|
-
description: 'Free-text context from the reporter (client-truncated).',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
containerTypeName: names.reportType,
|
|
61
|
-
key: 'status',
|
|
62
|
-
valueType: 'string',
|
|
63
|
-
defaultValueJson: '"open"',
|
|
64
|
-
description: "Queue state: 'open' | 'actioned' | 'dismissed'.",
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
containerTypeName: names.reportType,
|
|
68
|
-
key: 'resolution',
|
|
69
|
-
valueType: 'string',
|
|
70
|
-
defaultValueJson: '""',
|
|
71
|
-
description: 'Admin note recorded by resolve_report.',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
containerTypeName: names.reportType,
|
|
75
|
-
key: 'filed_at_ms',
|
|
76
|
-
valueType: 'int',
|
|
77
|
-
defaultValueJson: '0',
|
|
78
|
-
description: 'Client-reported epoch ms (informational; the event log holds server time).',
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
containerTypeName: names.muteType,
|
|
82
|
-
key: 'owner_user_id',
|
|
83
|
-
valueType: 'string',
|
|
84
|
-
defaultValueJson: '""',
|
|
85
|
-
description: 'Whose mute list this row belongs to (kit owner mirror).',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
containerTypeName: names.muteType,
|
|
89
|
-
key: 'muted_user_id',
|
|
90
|
-
valueType: 'string',
|
|
91
|
-
defaultValueJson: '""',
|
|
92
|
-
description: 'The muted player (client-side chat filtering).',
|
|
93
|
-
},
|
|
94
|
-
];
|
|
95
|
-
const functions = [
|
|
96
|
-
{
|
|
97
|
-
name: names.resolveReportFn,
|
|
98
|
-
containerTypeName: names.reportType,
|
|
99
|
-
returnType: 'string',
|
|
100
|
-
parameters: [
|
|
101
|
-
{
|
|
102
|
-
name: 'status',
|
|
103
|
-
valueType: 'string',
|
|
104
|
-
required: true,
|
|
105
|
-
description: "'actioned' or 'dismissed'.",
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
name: 'resolution',
|
|
109
|
-
valueType: 'string',
|
|
110
|
-
required: true,
|
|
111
|
-
description: 'Admin disposition note.',
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
mutations: [
|
|
115
|
-
{ target: 'self', property: 'status', expression: '$status' },
|
|
116
|
-
{ target: 'self', property: 'resolution', expression: '$resolution' },
|
|
117
|
-
],
|
|
118
|
-
returnExpression: 'self.status',
|
|
119
|
-
...trustedAuthorityFields('server'),
|
|
120
|
-
description: 'Close a report with a disposition (app admins). Enforcement happens on platform surfaces (tier revocation, grid permissions).',
|
|
121
|
-
},
|
|
122
|
-
];
|
|
123
|
-
return {
|
|
124
|
-
name: 'moderation',
|
|
125
|
-
containerTypes: [
|
|
126
|
-
{
|
|
127
|
-
typeName: names.reportType,
|
|
128
|
-
displayName: 'Moderation report',
|
|
129
|
-
description: 'One player report in the escalation queue (open/actioned/dismissed).',
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
typeName: names.muteType,
|
|
133
|
-
displayName: 'Moderation mute',
|
|
134
|
-
description: 'One personal mute entry (client-enforced chat filtering).',
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
propertyDefinitions,
|
|
138
|
-
functions,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { FunctionMutationInput, FunctionParamInput, Scalars, SeedPropertyDefInput } from '../../generated/graphql.js';
|
|
2
|
-
import { type KitBlueprint, type KitSelectorSpec } from './core.js';
|
|
3
|
-
/** A trigger for an NPC behavior: a schedule (interval or cron) or a model event. */
|
|
4
|
-
export type NpcBehaviorTrigger = {
|
|
5
|
-
intervalMs: number;
|
|
6
|
-
} | {
|
|
7
|
-
cronExpr: string;
|
|
8
|
-
} | {
|
|
9
|
-
onEvent: 'function_invoked' | 'property_changed' | 'container_created';
|
|
10
|
-
functionName?: string;
|
|
11
|
-
containerTypeName?: string;
|
|
12
|
-
propertyKey?: string;
|
|
13
|
-
/**
|
|
14
|
-
* `property_changed` only: which writes wake the behavior. NPC state is
|
|
15
|
-
* written by behavior functions rather than by clients, so reacting to
|
|
16
|
-
* one needs `'function'` or `'any'` — the default `'direct'` sees only
|
|
17
|
-
* client `setProperty` calls.
|
|
18
|
-
*/
|
|
19
|
-
writeSource?: 'direct' | 'function' | 'any';
|
|
20
|
-
debounceMs?: number;
|
|
21
|
-
};
|
|
22
|
-
/** One server-driven NPC behavior: a model function plus the automation that drives it. */
|
|
23
|
-
export interface NpcBehaviorSpec {
|
|
24
|
-
/**
|
|
25
|
-
* Automation name (unique per app), e.g. `'npc-wander'`. Also derives the
|
|
26
|
-
* default function name (`npc_wander`).
|
|
27
|
-
*/
|
|
28
|
-
name: string;
|
|
29
|
-
/** Entry-point function name. Defaults to the snake-cased behavior name. */
|
|
30
|
-
functionName?: string;
|
|
31
|
-
/** The property writes the behavior performs each tick. */
|
|
32
|
-
mutations: FunctionMutationInput[];
|
|
33
|
-
/** Typed parameters (bind them from a selector or static `paramsJson`). */
|
|
34
|
-
parameters?: FunctionParamInput[];
|
|
35
|
-
/** What makes the behavior run. */
|
|
36
|
-
trigger: NpcBehaviorTrigger;
|
|
37
|
-
/**
|
|
38
|
-
* Selector choosing/filtering targets and binding params (see the Game API
|
|
39
|
-
* "Autonomous Processes → Selectors" guide), including grid-permission
|
|
40
|
-
* predicates ({@link KitSelectorSpec}). JSON-encoded at deploy.
|
|
41
|
-
*/
|
|
42
|
-
selector?: KitSelectorSpec;
|
|
43
|
-
/**
|
|
44
|
-
* Convenience: only NPCs whose `role` property equals this act (adds a
|
|
45
|
-
* `selfWhere` filter when no explicit `selector` is given).
|
|
46
|
-
*/
|
|
47
|
-
role?: string;
|
|
48
|
-
/** Fan-out cap per run. Defaults to 8. */
|
|
49
|
-
maxTargets?: number;
|
|
50
|
-
/** Static params merged into every call. */
|
|
51
|
-
params?: Record<string, unknown>;
|
|
52
|
-
/** Identity the automation acts as; omit for a trusted server caller. */
|
|
53
|
-
runAsUserId?: Scalars['BigInt']['input'];
|
|
54
|
-
}
|
|
55
|
-
/** Options for {@link npcBlueprint}. */
|
|
56
|
-
export interface NpcBlueprintOptions {
|
|
57
|
-
/** NPC container type name. Defaults to `'Npc'`. */
|
|
58
|
-
typeName?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Extra property definitions beyond the defaults (`role`, `x`, `y`, `z`,
|
|
61
|
-
* `behavior_state`, `health`). `containerTypeName` is filled in.
|
|
62
|
-
*/
|
|
63
|
-
extraProperties?: Omit<SeedPropertyDefInput, 'containerTypeName'>[];
|
|
64
|
-
/** The server-driven behaviors this NPC archetype has. */
|
|
65
|
-
behaviors: NpcBehaviorSpec[];
|
|
66
|
-
}
|
|
67
|
-
/** Compute the function/automation names an NPC behavior deploys under. */
|
|
68
|
-
export declare function npcBehaviorFunctionName(behavior: NpcBehaviorSpec): string;
|
|
69
|
-
/**
|
|
70
|
-
* Blueprint for an **NPC archetype**: an admin-instantiable container type
|
|
71
|
-
* holding the NPC's durable state, one `autonomousInvocable` model function
|
|
72
|
-
* per behavior (gated `is_automation` so players cannot puppet them), and the
|
|
73
|
-
* automations + event triggers that drive those behaviors on the server.
|
|
74
|
-
*
|
|
75
|
-
* Runtime counterpart: `client.kit(appId).npcs`.
|
|
76
|
-
*/
|
|
77
|
-
export declare function npcBlueprint(options: NpcBlueprintOptions): KitBlueprint;
|
|
78
|
-
//# sourceMappingURL=npcs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"npcs.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/npcs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAClB,OAAO,EAEP,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,WAAW,CAAC;AAEnB,qFAAqF;AACrF,MAAM,MAAM,kBAAkB,GAC1B;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GACtB;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpB;IACE,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEN,2FAA2F;AAC3F,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2DAA2D;IAC3D,SAAS,EAAE,qBAAqB,EAAE,CAAC;IACnC,2EAA2E;IAC3E,UAAU,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAClC,mCAAmC;IACnC,OAAO,EAAE,kBAAkB,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,yEAAyE;IACzE,WAAW,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;CAC1C;AAED,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,EAAE,CAAC;IACpE,0DAA0D;IAC1D,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED,2EAA2E;AAC3E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAEzE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAsHvE"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { kitPolicyJson, toSnakeCase, } from './core.js';
|
|
2
|
-
/** Compute the function/automation names an NPC behavior deploys under. */
|
|
3
|
-
export function npcBehaviorFunctionName(behavior) {
|
|
4
|
-
return behavior.functionName ?? toSnakeCase(behavior.name);
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Blueprint for an **NPC archetype**: an admin-instantiable container type
|
|
8
|
-
* holding the NPC's durable state, one `autonomousInvocable` model function
|
|
9
|
-
* per behavior (gated `is_automation` so players cannot puppet them), and the
|
|
10
|
-
* automations + event triggers that drive those behaviors on the server.
|
|
11
|
-
*
|
|
12
|
-
* Runtime counterpart: `client.kit(appId).npcs`.
|
|
13
|
-
*/
|
|
14
|
-
export function npcBlueprint(options) {
|
|
15
|
-
const typeName = options.typeName ?? 'Npc';
|
|
16
|
-
if (options.behaviors.length === 0) {
|
|
17
|
-
throw new Error('npcBlueprint requires at least one behavior');
|
|
18
|
-
}
|
|
19
|
-
const propertyDefinitions = [
|
|
20
|
-
{
|
|
21
|
-
containerTypeName: typeName,
|
|
22
|
-
key: 'role',
|
|
23
|
-
valueType: 'string',
|
|
24
|
-
defaultValueJson: '""',
|
|
25
|
-
},
|
|
26
|
-
{ containerTypeName: typeName, key: 'x', valueType: 'float', defaultValueJson: '0' },
|
|
27
|
-
{ containerTypeName: typeName, key: 'y', valueType: 'float', defaultValueJson: '0' },
|
|
28
|
-
{ containerTypeName: typeName, key: 'z', valueType: 'float', defaultValueJson: '0' },
|
|
29
|
-
{
|
|
30
|
-
containerTypeName: typeName,
|
|
31
|
-
key: 'behavior_state',
|
|
32
|
-
valueType: 'string',
|
|
33
|
-
defaultValueJson: '"idle"',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
containerTypeName: typeName,
|
|
37
|
-
key: 'health',
|
|
38
|
-
valueType: 'int',
|
|
39
|
-
defaultValueJson: '100',
|
|
40
|
-
},
|
|
41
|
-
...(options.extraProperties ?? []).map((p) => ({
|
|
42
|
-
...p,
|
|
43
|
-
containerTypeName: typeName,
|
|
44
|
-
})),
|
|
45
|
-
];
|
|
46
|
-
const functions = [];
|
|
47
|
-
const automations = [];
|
|
48
|
-
const automationTriggers = [];
|
|
49
|
-
for (const behavior of options.behaviors) {
|
|
50
|
-
const functionName = npcBehaviorFunctionName(behavior);
|
|
51
|
-
functions.push({
|
|
52
|
-
name: functionName,
|
|
53
|
-
containerTypeName: typeName,
|
|
54
|
-
parameters: behavior.parameters,
|
|
55
|
-
mutations: behavior.mutations,
|
|
56
|
-
invokePolicyJson: kitPolicyJson({ type: 'is_automation' }),
|
|
57
|
-
autonomousInvocable: true,
|
|
58
|
-
description: `Server-driven NPC behavior for the '${behavior.name}' automation.`,
|
|
59
|
-
});
|
|
60
|
-
const selector = behavior.selector ??
|
|
61
|
-
(behavior.role !== undefined
|
|
62
|
-
? { selfWhere: [{ key: 'role', op: '==', value: behavior.role }] }
|
|
63
|
-
: undefined);
|
|
64
|
-
const automation = {
|
|
65
|
-
name: behavior.name,
|
|
66
|
-
functionName,
|
|
67
|
-
targetMode: 'type',
|
|
68
|
-
targetTypeName: typeName,
|
|
69
|
-
maxTargets: behavior.maxTargets ?? 8,
|
|
70
|
-
...(selector ? { selectorJson: JSON.stringify(selector) } : {}),
|
|
71
|
-
...(behavior.params ? { paramsJson: JSON.stringify(behavior.params) } : {}),
|
|
72
|
-
...(behavior.runAsUserId !== undefined
|
|
73
|
-
? { runAsUserId: behavior.runAsUserId }
|
|
74
|
-
: {}),
|
|
75
|
-
};
|
|
76
|
-
if ('intervalMs' in behavior.trigger) {
|
|
77
|
-
automation.triggerType = 'schedule';
|
|
78
|
-
automation.scheduleKind = 'interval';
|
|
79
|
-
automation.intervalMs = behavior.trigger.intervalMs;
|
|
80
|
-
}
|
|
81
|
-
else if ('cronExpr' in behavior.trigger) {
|
|
82
|
-
automation.triggerType = 'schedule';
|
|
83
|
-
automation.scheduleKind = 'cron';
|
|
84
|
-
automation.cronExpr = behavior.trigger.cronExpr;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
automation.triggerType = 'event';
|
|
88
|
-
automationTriggers.push({
|
|
89
|
-
automationName: behavior.name,
|
|
90
|
-
onEvent: behavior.trigger.onEvent,
|
|
91
|
-
...(behavior.trigger.functionName !== undefined
|
|
92
|
-
? { functionName: behavior.trigger.functionName }
|
|
93
|
-
: {}),
|
|
94
|
-
...(behavior.trigger.containerTypeName !== undefined
|
|
95
|
-
? { containerTypeName: behavior.trigger.containerTypeName }
|
|
96
|
-
: {}),
|
|
97
|
-
...(behavior.trigger.propertyKey !== undefined
|
|
98
|
-
? { propertyKey: behavior.trigger.propertyKey }
|
|
99
|
-
: {}),
|
|
100
|
-
...(behavior.trigger.writeSource !== undefined
|
|
101
|
-
? { writeSource: behavior.trigger.writeSource }
|
|
102
|
-
: {}),
|
|
103
|
-
...(behavior.trigger.debounceMs !== undefined
|
|
104
|
-
? { debounceMs: behavior.trigger.debounceMs }
|
|
105
|
-
: {}),
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
automations.push(automation);
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
name: typeName,
|
|
112
|
-
containerTypes: [
|
|
113
|
-
{
|
|
114
|
-
typeName,
|
|
115
|
-
displayName: typeName,
|
|
116
|
-
instantiableBy: 'admin',
|
|
117
|
-
description: 'A server-driven non-player character.',
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
propertyDefinitions,
|
|
121
|
-
functions,
|
|
122
|
-
automations,
|
|
123
|
-
automationTriggers,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { type KitBlueprint, type KitInvokePolicy, type KitOwnerIdKind } from './core.js';
|
|
2
|
-
/** Options for {@link plotBlueprint}. */
|
|
3
|
-
export interface PlotBlueprintOptions {
|
|
4
|
-
/** Plot container type name. Defaults to `'Plot'`. */
|
|
5
|
-
typeName?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Runtime permission keys buying/renting grants on the plot's grid.
|
|
8
|
-
* Defaults to `['access', 'update_voxel_data']`.
|
|
9
|
-
*/
|
|
10
|
-
permissionKeys?: string[];
|
|
11
|
-
/** Currency property on the wallet container. Defaults to `'gold'`. */
|
|
12
|
-
currencyProperty?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Property on the wallet container mirroring its owner's user id (the
|
|
15
|
-
* standard kit convention, since expressions can't read container
|
|
16
|
-
* ownership). Defaults to `'owner_user_id'`.
|
|
17
|
-
*/
|
|
18
|
-
walletOwnerProperty?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Also generate `rent_plot`: a TTL grant priced by the plot's `rent_price`
|
|
21
|
-
* property, expiring after `rent_ttl_seconds`. Defaults to false.
|
|
22
|
-
*/
|
|
23
|
-
rentable?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Extra policy rule AND'ed into `buy_plot` — e.g.
|
|
26
|
-
* `featureGate('land_owner')` to sell land only to a paid tier.
|
|
27
|
-
*/
|
|
28
|
-
buyPolicyExtra?: KitInvokePolicy;
|
|
29
|
-
/** Extra policy rule AND'ed into `rent_plot`. */
|
|
30
|
-
rentPolicyExtra?: KitInvokePolicy;
|
|
31
|
-
/**
|
|
32
|
-
* How the `owner_user_id` mirrors are typed on the plot AND the wallet
|
|
33
|
-
* (see the kit owner-mirroring convention). Defaults to `'int'` (the kit
|
|
34
|
-
* standard); set `'string'` for models that mirrored owners as strings
|
|
35
|
-
* (e.g. Blocks with Friends) — generated guards then compare via
|
|
36
|
-
* `to_string($caller_user_id)`, buying writes the owner as a string, and
|
|
37
|
-
* an empty string means "for sale".
|
|
38
|
-
*/
|
|
39
|
-
ownerIdKind?: KitOwnerIdKind;
|
|
40
|
-
}
|
|
41
|
-
/** Names derived by {@link plotBlueprint} for a given plot type. */
|
|
42
|
-
export interface PlotNames {
|
|
43
|
-
plotType: string;
|
|
44
|
-
buyFn: string;
|
|
45
|
-
rentFn: string;
|
|
46
|
-
evictFn: string;
|
|
47
|
-
}
|
|
48
|
-
/** Compute the type/function names a plot blueprint (and its runtime helper) uses. */
|
|
49
|
-
export declare function plotNames(typeName?: string): PlotNames;
|
|
50
|
-
/**
|
|
51
|
-
* Blueprint for **sellable/rentable land**: a `Plot` container mapping a world
|
|
52
|
-
* [grid](../../domains/gameApps.js) to a price, whose `buy`/`rent` functions
|
|
53
|
-
* consume currency AND grant runtime grid permissions in one transaction (via
|
|
54
|
-
* permission effects) — the canonical read+write permission loop. Buying sets
|
|
55
|
-
* the plot's `owner_user_id`; renting grants with a TTL; `evict` revokes.
|
|
56
|
-
* The grants are enforced by the replication layer on movement/voxel writes
|
|
57
|
-
* immediately at commit. Requires game-api v0.13.11+ (effects) — pair with
|
|
58
|
-
* chunk-permission locks (v0.13.12+) for doors that honor the purchase.
|
|
59
|
-
*
|
|
60
|
-
* Runtime counterpart: `client.kit(appId).plots`.
|
|
61
|
-
*/
|
|
62
|
-
export declare function plotBlueprint(options?: PlotBlueprintOptions): KitBlueprint;
|
|
63
|
-
//# sourceMappingURL=plots.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plots.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/plots.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AAEnB,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,iDAAiD;IACjD,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B;AAED,oEAAoE;AACpE,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,QAAQ,SAAS,GAAG,SAAS,CAQtD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,YAAY,CA+I9E"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { andPolicies, kitPolicyJson, ownerEqualsCaller, toSnakeCase, } from './core.js';
|
|
2
|
-
/** Compute the type/function names a plot blueprint (and its runtime helper) uses. */
|
|
3
|
-
export function plotNames(typeName = 'Plot') {
|
|
4
|
-
const snake = toSnakeCase(typeName);
|
|
5
|
-
return {
|
|
6
|
-
plotType: typeName,
|
|
7
|
-
buyFn: `buy_${snake}`,
|
|
8
|
-
rentFn: `rent_${snake}`,
|
|
9
|
-
evictFn: `evict_${snake}`,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Blueprint for **sellable/rentable land**: a `Plot` container mapping a world
|
|
14
|
-
* [grid](../../domains/gameApps.js) to a price, whose `buy`/`rent` functions
|
|
15
|
-
* consume currency AND grant runtime grid permissions in one transaction (via
|
|
16
|
-
* permission effects) — the canonical read+write permission loop. Buying sets
|
|
17
|
-
* the plot's `owner_user_id`; renting grants with a TTL; `evict` revokes.
|
|
18
|
-
* The grants are enforced by the replication layer on movement/voxel writes
|
|
19
|
-
* immediately at commit. Requires game-api v0.13.11+ (effects) — pair with
|
|
20
|
-
* chunk-permission locks (v0.13.12+) for doors that honor the purchase.
|
|
21
|
-
*
|
|
22
|
-
* Runtime counterpart: `client.kit(appId).plots`.
|
|
23
|
-
*/
|
|
24
|
-
export function plotBlueprint(options = {}) {
|
|
25
|
-
const names = plotNames(options.typeName);
|
|
26
|
-
const keys = options.permissionKeys ?? ['access', 'update_voxel_data'];
|
|
27
|
-
const currency = options.currencyProperty ?? 'gold';
|
|
28
|
-
const walletOwner = options.walletOwnerProperty ?? 'owner_user_id';
|
|
29
|
-
const rentable = options.rentable ?? false;
|
|
30
|
-
const kind = options.ownerIdKind ?? 'int';
|
|
31
|
-
const walletParam = [
|
|
32
|
-
{ name: 'wallet_id', valueType: 'container_ref', required: true },
|
|
33
|
-
];
|
|
34
|
-
const walletGuard = (priceExpr, extra) => kitPolicyJson(andPolicies({
|
|
35
|
-
type: 'condition',
|
|
36
|
-
expression: `${ownerEqualsCaller(`ref($wallet_id).${walletOwner}`, kind)} && ref($wallet_id).${currency} >= ${priceExpr}`,
|
|
37
|
-
}, extra));
|
|
38
|
-
const propertyDefinitions = [
|
|
39
|
-
{ containerTypeName: names.plotType, key: 'grid_id', valueType: 'int' },
|
|
40
|
-
{ containerTypeName: names.plotType, key: 'price', valueType: 'int', defaultValueJson: '0' },
|
|
41
|
-
{
|
|
42
|
-
containerTypeName: names.plotType,
|
|
43
|
-
key: 'owner_user_id',
|
|
44
|
-
valueType: kind,
|
|
45
|
-
defaultValueJson: kind === 'string' ? '""' : '0',
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
if (rentable) {
|
|
49
|
-
propertyDefinitions.push({
|
|
50
|
-
containerTypeName: names.plotType,
|
|
51
|
-
key: 'rent_price',
|
|
52
|
-
valueType: 'int',
|
|
53
|
-
defaultValueJson: '0',
|
|
54
|
-
}, {
|
|
55
|
-
containerTypeName: names.plotType,
|
|
56
|
-
key: 'rent_ttl_seconds',
|
|
57
|
-
valueType: 'int',
|
|
58
|
-
defaultValueJson: '86400',
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
const functions = [
|
|
62
|
-
{
|
|
63
|
-
name: names.buyFn,
|
|
64
|
-
containerTypeName: names.plotType,
|
|
65
|
-
returnType: 'int',
|
|
66
|
-
parameters: walletParam,
|
|
67
|
-
mutations: [
|
|
68
|
-
{
|
|
69
|
-
target: 'ref($wallet_id)',
|
|
70
|
-
property: currency,
|
|
71
|
-
expression: `ref($wallet_id).${currency} - self.price`,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
target: 'self',
|
|
75
|
-
property: 'owner_user_id',
|
|
76
|
-
expression: kind === 'string' ? 'to_string($caller_user_id)' : '$caller_user_id',
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
permissionEffects: [
|
|
80
|
-
{
|
|
81
|
-
action: 'grant',
|
|
82
|
-
permissionKeys: keys,
|
|
83
|
-
userExpression: '$caller_user_id',
|
|
84
|
-
gridIdExpression: 'self.grid_id',
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
returnExpression: `ref($wallet_id).${currency}`,
|
|
88
|
-
invokePolicyJson: walletGuard('self.price', options.buyPolicyExtra),
|
|
89
|
-
description: 'Buy this plot: spend the price AND receive grid permissions atomically.',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: names.evictFn,
|
|
93
|
-
containerTypeName: names.plotType,
|
|
94
|
-
parameters: [{ name: 'target_user_id', valueType: 'int', required: true }],
|
|
95
|
-
mutations: [],
|
|
96
|
-
permissionEffects: [
|
|
97
|
-
{
|
|
98
|
-
action: 'revoke',
|
|
99
|
-
permissionKeys: keys,
|
|
100
|
-
userExpression: '$target_user_id',
|
|
101
|
-
gridIdExpression: 'self.grid_id',
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
invokePolicyJson: kitPolicyJson({
|
|
105
|
-
type: 'condition',
|
|
106
|
-
expression: ownerEqualsCaller('self.owner_user_id', kind),
|
|
107
|
-
}),
|
|
108
|
-
description: "Revoke a user's permissions on this plot (owner-gated; admins bypass).",
|
|
109
|
-
},
|
|
110
|
-
];
|
|
111
|
-
if (rentable) {
|
|
112
|
-
functions.push({
|
|
113
|
-
name: names.rentFn,
|
|
114
|
-
containerTypeName: names.plotType,
|
|
115
|
-
returnType: 'int',
|
|
116
|
-
parameters: walletParam,
|
|
117
|
-
mutations: [
|
|
118
|
-
{
|
|
119
|
-
target: 'ref($wallet_id)',
|
|
120
|
-
property: currency,
|
|
121
|
-
expression: `ref($wallet_id).${currency} - self.rent_price`,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
permissionEffects: [
|
|
125
|
-
{
|
|
126
|
-
action: 'grant',
|
|
127
|
-
permissionKeys: keys,
|
|
128
|
-
userExpression: '$caller_user_id',
|
|
129
|
-
gridIdExpression: 'self.grid_id',
|
|
130
|
-
ttlSecondsExpression: 'self.rent_ttl_seconds',
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
returnExpression: `ref($wallet_id).${currency}`,
|
|
134
|
-
invokePolicyJson: walletGuard('self.rent_price', options.rentPolicyExtra),
|
|
135
|
-
description: 'Rent this plot: spend the rent AND receive an expiring grid grant atomically.',
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
name: names.plotType,
|
|
140
|
-
containerTypes: [
|
|
141
|
-
{
|
|
142
|
-
typeName: names.plotType,
|
|
143
|
-
displayName: names.plotType,
|
|
144
|
-
instantiableBy: 'admin',
|
|
145
|
-
description: 'A sellable/rentable plot of land mapped to a world grid.',
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
propertyDefinitions,
|
|
149
|
-
functions,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { type KitBlueprint, type KitOwnerIdKind, type KitTrustedAuthority } from './core.js';
|
|
2
|
-
/** Options for {@link progressionBlueprint}. */
|
|
3
|
-
export interface ProgressionBlueprintOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Prefix applied to the container type names (`'Pvp'` → `PvpProgress` /
|
|
6
|
-
* `PvpSkillDef` / …) and, snake-cased, to the function names
|
|
7
|
-
* (`pvp_grant_xp`, …). Defaults to none.
|
|
8
|
-
*/
|
|
9
|
-
typePrefix?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Who may grant XP. Trusted grants should be `'server'` (the default),
|
|
12
|
-
* `'automation'` (e.g. an event automation on a `mob_died` function), or
|
|
13
|
-
* `'host'` — never plain players.
|
|
14
|
-
*/
|
|
15
|
-
xpAuthority?: KitTrustedAuthority;
|
|
16
|
-
/**
|
|
17
|
-
* Who may adjust the competitive rating (the match layer's
|
|
18
|
-
* `applyMatchResult` calls this). Defaults to `'host'`.
|
|
19
|
-
*/
|
|
20
|
-
ratingAuthority?: KitTrustedAuthority;
|
|
21
|
-
/**
|
|
22
|
-
* The XP curve: an expression over `$level` returning the TOTAL xp required
|
|
23
|
-
* to reach that level. Evaluated via the read-only `fn:` helper-call
|
|
24
|
-
* pattern (`fn:xp_for_level(self.level + 1)`), so the curve lives in ONE
|
|
25
|
-
* `internal` function and every reader stays in sync. Defaults to
|
|
26
|
-
* `'100 * $level * $level'`.
|
|
27
|
-
*/
|
|
28
|
-
xpForLevelExpression?: string;
|
|
29
|
-
/** Skill points granted per level-up. Defaults to 1. */
|
|
30
|
-
skillPointsPerLevel?: number;
|
|
31
|
-
/** Initial competitive rating for new players. Defaults to 1000. */
|
|
32
|
-
initialRating?: number;
|
|
33
|
-
/** Owner-mirror typing (see the kit convention). Defaults to `'int'`. */
|
|
34
|
-
ownerIdKind?: KitOwnerIdKind;
|
|
35
|
-
}
|
|
36
|
-
/** Names derived by {@link progressionBlueprint} for a given prefix. */
|
|
37
|
-
export interface ProgressionNames {
|
|
38
|
-
progressType: string;
|
|
39
|
-
skillDefType: string;
|
|
40
|
-
skillRankType: string;
|
|
41
|
-
achievementDefType: string;
|
|
42
|
-
achievementUnlockType: string;
|
|
43
|
-
xpForLevelFn: string;
|
|
44
|
-
grantXpFn: string;
|
|
45
|
-
buySkillFn: string;
|
|
46
|
-
unlockAchievementFn: string;
|
|
47
|
-
adjustRatingFn: string;
|
|
48
|
-
}
|
|
49
|
-
/** Compute the type/function names a progression blueprint (and its runtime helper) uses. */
|
|
50
|
-
export declare function progressionNames(typePrefix?: string): ProgressionNames;
|
|
51
|
-
/**
|
|
52
|
-
* Blueprint for **character progression**: per-player `Progress` (xp / level /
|
|
53
|
-
* skill points / rating), an admin `SkillDef` catalog with prerequisite
|
|
54
|
-
* chains bought into per-player `SkillRank`s, threshold `AchievementDef`s
|
|
55
|
-
* unlocked into `AchievementUnlock`s, and an ELO-style `adjust_rating` hook
|
|
56
|
-
* for the match layer.
|
|
57
|
-
*
|
|
58
|
-
* Level-ups are computed server-side inside `grant_xp` using the `fn:`
|
|
59
|
-
* helper pattern: the XP curve lives in ONE `internal` function
|
|
60
|
-
* (`xp_for_level`, not directly invocable) that mutation expressions call as
|
|
61
|
-
* `fn:xp_for_level(self.level + 1)`. Ordered mutations see earlier writes,
|
|
62
|
-
* so xp is applied first, then the skill-point award, then the level bump —
|
|
63
|
-
* one level per grant (call repeatedly for multi-level jumps).
|
|
64
|
-
*
|
|
65
|
-
* Runtime counterpart: `client.kit(appId).progression`.
|
|
66
|
-
*/
|
|
67
|
-
export declare function progressionBlueprint(options?: ProgressionBlueprintOptions): KitBlueprint;
|
|
68
|
-
//# sourceMappingURL=progression.d.ts.map
|