@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.
Files changed (289) hide show
  1. package/MIGRATION.md +129 -1
  2. package/README.md +97 -164
  3. package/dist/crowdy-client.d.ts +12 -31
  4. package/dist/crowdy-client.d.ts.map +1 -1
  5. package/dist/crowdy-client.js +15 -37
  6. package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
  7. package/dist/crowdy-dsh/bridge.js +3 -6
  8. package/dist/crowdy-studio/controller.d.ts +34 -59
  9. package/dist/crowdy-studio/controller.d.ts.map +1 -1
  10. package/dist/crowdy-studio/controller.js +96 -225
  11. package/dist/crowdy-studio/diagnostics.d.ts +3 -12
  12. package/dist/crowdy-studio/diagnostics.d.ts.map +1 -1
  13. package/dist/crowdy-studio/dom-shell.d.ts +2 -4
  14. package/dist/crowdy-studio/dom-shell.d.ts.map +1 -1
  15. package/dist/crowdy-studio/dom-shell.js +16 -49
  16. package/dist/crowdy-studio/embed/hud-layer.d.ts +1 -2
  17. package/dist/crowdy-studio/embed/hud-layer.d.ts.map +1 -1
  18. package/dist/crowdy-studio/embed/panel.d.ts +3 -13
  19. package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
  20. package/dist/crowdy-studio/embed/panel.js +3 -6
  21. package/dist/crowdy-studio/index.d.ts +1 -3
  22. package/dist/crowdy-studio/index.d.ts.map +1 -1
  23. package/dist/crowdy-studio/index.js +0 -2
  24. package/dist/crowdy-studio/models.d.ts +3 -4
  25. package/dist/crowdy-studio/models.d.ts.map +1 -1
  26. package/dist/crowdy-studio/starter-projects.d.ts +8 -12
  27. package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
  28. package/dist/crowdy-studio/starter-projects.js +12 -103
  29. package/dist/domains/appAccess.d.ts +14 -1
  30. package/dist/domains/appAccess.d.ts.map +1 -1
  31. package/dist/domains/appAccess.js +37 -1
  32. package/dist/domains/apps.d.ts +1 -10
  33. package/dist/domains/apps.d.ts.map +1 -1
  34. package/dist/domains/apps.js +1 -16
  35. package/dist/domains/host.d.ts +3 -3
  36. package/dist/domains/host.js +3 -3
  37. package/dist/domains/hosting.d.ts +0 -6
  38. package/dist/domains/hosting.d.ts.map +1 -1
  39. package/dist/domains/hosting.js +1 -16
  40. package/dist/domains/marketplace.d.ts +9 -70
  41. package/dist/domains/marketplace.d.ts.map +1 -1
  42. package/dist/domains/marketplace.js +9 -120
  43. package/dist/domains/organizations.d.ts +1 -9
  44. package/dist/domains/organizations.d.ts.map +1 -1
  45. package/dist/domains/organizations.js +1 -15
  46. package/dist/domains/payments.d.ts +5 -48
  47. package/dist/domains/payments.d.ts.map +1 -1
  48. package/dist/domains/payments.js +5 -57
  49. package/dist/domains/playerWallet.d.ts +6 -12
  50. package/dist/domains/playerWallet.d.ts.map +1 -1
  51. package/dist/domains/playerWallet.js +6 -21
  52. package/dist/domains/quotas.d.ts +20 -7
  53. package/dist/domains/quotas.d.ts.map +1 -1
  54. package/dist/domains/quotas.js +15 -6
  55. package/dist/domains/users.d.ts +7 -74
  56. package/dist/domains/users.d.ts.map +1 -1
  57. package/dist/domains/users.js +7 -105
  58. package/dist/errors.d.ts +7 -13
  59. package/dist/errors.d.ts.map +1 -1
  60. package/dist/errors.js +6 -10
  61. package/dist/generated/graphql.d.ts +955 -8272
  62. package/dist/generated/graphql.d.ts.map +1 -1
  63. package/dist/generated/graphql.js +5 -329
  64. package/dist/grid-mods/exec-client-halves.d.ts +19 -3
  65. package/dist/grid-mods/exec-client-halves.d.ts.map +1 -1
  66. package/dist/grid-mods/exec-client-halves.js +17 -2
  67. package/dist/grid-mods/grid-host-calls.d.ts +29 -17
  68. package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
  69. package/dist/grid-mods/grid-host-calls.js +40 -46
  70. package/dist/grid-mods/mod-runtime.d.ts +18 -11
  71. package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
  72. package/dist/grid-mods/mod-runtime.js +4 -2
  73. package/dist/grid-scope.d.ts +0 -189
  74. package/dist/grid-scope.d.ts.map +1 -1
  75. package/dist/grid-scope.js +0 -70
  76. package/dist/index.d.ts +12 -18
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +10 -16
  79. package/dist/kit/actions.d.ts +5 -9
  80. package/dist/kit/actions.d.ts.map +1 -1
  81. package/dist/kit/actions.js +5 -9
  82. package/dist/kit/index.d.ts +2 -33
  83. package/dist/kit/index.d.ts.map +1 -1
  84. package/dist/kit/index.js +1 -32
  85. package/dist/kit/kit.d.ts +8 -208
  86. package/dist/kit/kit.d.ts.map +1 -1
  87. package/dist/kit/kit.js +5 -163
  88. package/dist/kit/social.d.ts +1 -3
  89. package/dist/kit/social.d.ts.map +1 -1
  90. package/dist/kit/social.js +1 -3
  91. package/dist/kit/wire.d.ts +16 -5
  92. package/dist/kit/wire.d.ts.map +1 -1
  93. package/dist/kit/wire.js +19 -5
  94. package/dist/live-coding/assets/browser-authoring-index.json +1 -1
  95. package/dist/live-coding/assets/manifest.json +1 -1
  96. package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
  97. package/dist/live-coding/browser-authoring-index.generated.js +1496 -4386
  98. package/dist/live-coding/rust-analysis.d.ts.map +1 -1
  99. package/dist/live-coding/rust-analysis.js +30 -34
  100. package/dist/player-runtime/client-host-calls.d.ts +8 -0
  101. package/dist/player-runtime/client-host-calls.d.ts.map +1 -0
  102. package/dist/player-runtime/client-host-calls.js +28 -0
  103. package/dist/player-runtime/glue-runtime.d.ts +24 -20
  104. package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
  105. package/dist/player-runtime/glue-runtime.js +26 -55
  106. package/dist/player-runtime/glue-sab.d.ts +2 -2
  107. package/dist/player-runtime/glue-sab.js +2 -2
  108. package/dist/player-runtime/player-code-broker.d.ts +70 -43
  109. package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
  110. package/dist/player-runtime/player-code-broker.js +159 -64
  111. package/dist/player-runtime/player-glue-worker.d.ts +8 -9
  112. package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
  113. package/dist/player-runtime/player-glue-worker.js +26 -11
  114. package/dist/stores/inbox.d.ts +1 -1
  115. package/dist/stores/inbox.d.ts.map +1 -1
  116. package/dist/stores/index.d.ts +0 -11
  117. package/dist/stores/index.d.ts.map +1 -1
  118. package/dist/stores/index.js +0 -4
  119. package/dist/stores/session.d.ts +0 -2
  120. package/dist/stores/session.d.ts.map +1 -1
  121. package/package.json +1 -1
  122. package/dist/crowdy-studio/model-lint-log.d.ts +0 -76
  123. package/dist/crowdy-studio/model-lint-log.d.ts.map +0 -1
  124. package/dist/crowdy-studio/model-lint-log.js +0 -93
  125. package/dist/crowdy-studio/model-lint.d.ts +0 -61
  126. package/dist/crowdy-studio/model-lint.d.ts.map +0 -1
  127. package/dist/crowdy-studio/model-lint.js +0 -45
  128. package/dist/domains/compute.d.ts +0 -208
  129. package/dist/domains/compute.d.ts.map +0 -1
  130. package/dist/domains/compute.js +0 -274
  131. package/dist/domains/controlPlane.d.ts +0 -38
  132. package/dist/domains/controlPlane.d.ts.map +0 -1
  133. package/dist/domains/controlPlane.js +0 -43
  134. package/dist/domains/gameModel.d.ts +0 -1174
  135. package/dist/domains/gameModel.d.ts.map +0 -1
  136. package/dist/domains/gameModel.js +0 -1333
  137. package/dist/domains/playerCompute.d.ts +0 -91
  138. package/dist/domains/playerCompute.d.ts.map +0 -1
  139. package/dist/domains/playerCompute.js +0 -136
  140. package/dist/domains/playerModel.d.ts +0 -20
  141. package/dist/domains/playerModel.d.ts.map +0 -1
  142. package/dist/domains/playerModel.js +0 -54
  143. package/dist/kit/abilities.d.ts +0 -66
  144. package/dist/kit/abilities.d.ts.map +0 -1
  145. package/dist/kit/abilities.js +0 -71
  146. package/dist/kit/blueprints/combat.d.ts +0 -81
  147. package/dist/kit/blueprints/combat.d.ts.map +0 -1
  148. package/dist/kit/blueprints/combat.js +0 -357
  149. package/dist/kit/blueprints/core.d.ts +0 -222
  150. package/dist/kit/blueprints/core.d.ts.map +0 -1
  151. package/dist/kit/blueprints/core.js +0 -185
  152. package/dist/kit/blueprints/decks.d.ts +0 -50
  153. package/dist/kit/blueprints/decks.d.ts.map +0 -1
  154. package/dist/kit/blueprints/decks.js +0 -163
  155. package/dist/kit/blueprints/economy.d.ts +0 -88
  156. package/dist/kit/blueprints/economy.d.ts.map +0 -1
  157. package/dist/kit/blueprints/economy.js +0 -533
  158. package/dist/kit/blueprints/guild.d.ts +0 -51
  159. package/dist/kit/blueprints/guild.d.ts.map +0 -1
  160. package/dist/kit/blueprints/guild.js +0 -50
  161. package/dist/kit/blueprints/index.d.ts +0 -23
  162. package/dist/kit/blueprints/index.d.ts.map +0 -1
  163. package/dist/kit/blueprints/index.js +0 -22
  164. package/dist/kit/blueprints/inventory.d.ts +0 -84
  165. package/dist/kit/blueprints/inventory.d.ts.map +0 -1
  166. package/dist/kit/blueprints/inventory.js +0 -257
  167. package/dist/kit/blueprints/leaderboards.d.ts +0 -49
  168. package/dist/kit/blueprints/leaderboards.d.ts.map +0 -1
  169. package/dist/kit/blueprints/leaderboards.js +0 -126
  170. package/dist/kit/blueprints/liveops.d.ts +0 -42
  171. package/dist/kit/blueprints/liveops.d.ts.map +0 -1
  172. package/dist/kit/blueprints/liveops.js +0 -170
  173. package/dist/kit/blueprints/locks.d.ts +0 -82
  174. package/dist/kit/blueprints/locks.d.ts.map +0 -1
  175. package/dist/kit/blueprints/locks.js +0 -155
  176. package/dist/kit/blueprints/loot.d.ts +0 -90
  177. package/dist/kit/blueprints/loot.d.ts.map +0 -1
  178. package/dist/kit/blueprints/loot.js +0 -229
  179. package/dist/kit/blueprints/matches.d.ts +0 -84
  180. package/dist/kit/blueprints/matches.d.ts.map +0 -1
  181. package/dist/kit/blueprints/matches.js +0 -349
  182. package/dist/kit/blueprints/moderation.d.ts +0 -32
  183. package/dist/kit/blueprints/moderation.d.ts.map +0 -1
  184. package/dist/kit/blueprints/moderation.js +0 -140
  185. package/dist/kit/blueprints/npcs.d.ts +0 -78
  186. package/dist/kit/blueprints/npcs.d.ts.map +0 -1
  187. package/dist/kit/blueprints/npcs.js +0 -125
  188. package/dist/kit/blueprints/plots.d.ts +0 -63
  189. package/dist/kit/blueprints/plots.d.ts.map +0 -1
  190. package/dist/kit/blueprints/plots.js +0 -151
  191. package/dist/kit/blueprints/progression.d.ts +0 -68
  192. package/dist/kit/blueprints/progression.d.ts.map +0 -1
  193. package/dist/kit/blueprints/progression.js +0 -324
  194. package/dist/kit/blueprints/quests.d.ts +0 -72
  195. package/dist/kit/blueprints/quests.d.ts.map +0 -1
  196. package/dist/kit/blueprints/quests.js +0 -285
  197. package/dist/kit/blueprints/worldsim.d.ts +0 -91
  198. package/dist/kit/blueprints/worldsim.d.ts.map +0 -1
  199. package/dist/kit/blueprints/worldsim.js +0 -468
  200. package/dist/kit/combat.d.ts +0 -141
  201. package/dist/kit/combat.d.ts.map +0 -1
  202. package/dist/kit/combat.js +0 -196
  203. package/dist/kit/decks.d.ts +0 -157
  204. package/dist/kit/decks.d.ts.map +0 -1
  205. package/dist/kit/decks.js +0 -186
  206. package/dist/kit/director.d.ts +0 -88
  207. package/dist/kit/director.d.ts.map +0 -1
  208. package/dist/kit/director.js +0 -86
  209. package/dist/kit/economy.d.ts +0 -289
  210. package/dist/kit/economy.d.ts.map +0 -1
  211. package/dist/kit/economy.js +0 -427
  212. package/dist/kit/engine.d.ts +0 -48
  213. package/dist/kit/engine.d.ts.map +0 -1
  214. package/dist/kit/engine.js +0 -113
  215. package/dist/kit/features.d.ts +0 -60
  216. package/dist/kit/features.d.ts.map +0 -1
  217. package/dist/kit/features.js +0 -65
  218. package/dist/kit/instances.d.ts +0 -52
  219. package/dist/kit/instances.d.ts.map +0 -1
  220. package/dist/kit/instances.js +0 -60
  221. package/dist/kit/inventory.d.ts +0 -129
  222. package/dist/kit/inventory.d.ts.map +0 -1
  223. package/dist/kit/inventory.js +0 -200
  224. package/dist/kit/leaderboards.d.ts +0 -86
  225. package/dist/kit/leaderboards.d.ts.map +0 -1
  226. package/dist/kit/leaderboards.js +0 -133
  227. package/dist/kit/liveops.d.ts +0 -112
  228. package/dist/kit/liveops.d.ts.map +0 -1
  229. package/dist/kit/liveops.js +0 -183
  230. package/dist/kit/loot.d.ts +0 -128
  231. package/dist/kit/loot.d.ts.map +0 -1
  232. package/dist/kit/loot.js +0 -160
  233. package/dist/kit/matches.d.ts +0 -301
  234. package/dist/kit/matches.d.ts.map +0 -1
  235. package/dist/kit/matches.js +0 -458
  236. package/dist/kit/matchmaking.d.ts +0 -57
  237. package/dist/kit/matchmaking.d.ts.map +0 -1
  238. package/dist/kit/matchmaking.js +0 -59
  239. package/dist/kit/minigames.d.ts +0 -30
  240. package/dist/kit/minigames.d.ts.map +0 -1
  241. package/dist/kit/minigames.js +0 -38
  242. package/dist/kit/mobs.d.ts +0 -90
  243. package/dist/kit/mobs.d.ts.map +0 -1
  244. package/dist/kit/mobs.js +0 -98
  245. package/dist/kit/moderation.d.ts +0 -73
  246. package/dist/kit/moderation.d.ts.map +0 -1
  247. package/dist/kit/moderation.js +0 -103
  248. package/dist/kit/movement.d.ts +0 -78
  249. package/dist/kit/movement.d.ts.map +0 -1
  250. package/dist/kit/movement.js +0 -103
  251. package/dist/kit/notifications.d.ts +0 -45
  252. package/dist/kit/notifications.d.ts.map +0 -1
  253. package/dist/kit/notifications.js +0 -67
  254. package/dist/kit/npcs.d.ts +0 -226
  255. package/dist/kit/npcs.d.ts.map +0 -1
  256. package/dist/kit/npcs.js +0 -141
  257. package/dist/kit/objects.d.ts +0 -116
  258. package/dist/kit/objects.d.ts.map +0 -1
  259. package/dist/kit/objects.js +0 -119
  260. package/dist/kit/pets.d.ts +0 -85
  261. package/dist/kit/pets.d.ts.map +0 -1
  262. package/dist/kit/pets.js +0 -96
  263. package/dist/kit/plots.d.ts +0 -85
  264. package/dist/kit/plots.d.ts.map +0 -1
  265. package/dist/kit/plots.js +0 -113
  266. package/dist/kit/progression.d.ts +0 -181
  267. package/dist/kit/progression.d.ts.map +0 -1
  268. package/dist/kit/progression.js +0 -265
  269. package/dist/kit/quests.d.ts +0 -171
  270. package/dist/kit/quests.d.ts.map +0 -1
  271. package/dist/kit/quests.js +0 -237
  272. package/dist/kit/racing.d.ts +0 -85
  273. package/dist/kit/racing.d.ts.map +0 -1
  274. package/dist/kit/racing.js +0 -99
  275. package/dist/kit/shared.d.ts +0 -73
  276. package/dist/kit/shared.d.ts.map +0 -1
  277. package/dist/kit/shared.js +0 -101
  278. package/dist/kit/telemetry.d.ts +0 -66
  279. package/dist/kit/telemetry.d.ts.map +0 -1
  280. package/dist/kit/telemetry.js +0 -133
  281. package/dist/kit/territory.d.ts +0 -97
  282. package/dist/kit/territory.d.ts.map +0 -1
  283. package/dist/kit/territory.js +0 -114
  284. package/dist/kit/worldsim.d.ts +0 -263
  285. package/dist/kit/worldsim.d.ts.map +0 -1
  286. package/dist/kit/worldsim.js +0 -268
  287. package/dist/stores/model.d.ts +0 -81
  288. package/dist/stores/model.d.ts.map +0 -1
  289. package/dist/stores/model.js +0 -163
@@ -1,170 +0,0 @@
1
- import { kitPolicyJson, toSnakeCase, trustedAuthorityFields, } from './core.js';
2
- /** Compute the type/function names a liveops blueprint (and its runtime helper) uses. */
3
- export function liveopsNames(typePrefix = '') {
4
- const fnPrefix = typePrefix ? `${toSnakeCase(typePrefix)}_` : '';
5
- return {
6
- windowType: `${typePrefix}EventWindow`,
7
- seasonType: `${typePrefix}SeasonDef`,
8
- openWindowFn: `${fnPrefix}open_window`,
9
- closeWindowFn: `${fnPrefix}close_window`,
10
- activateSeasonFn: `${fnPrefix}activate_season`,
11
- };
12
- }
13
- /**
14
- * Blueprint for **liveops** (matrix P4, P3): event windows, seasons, and
15
- * battle-pass composition — MODEL-FIRST (the coexistence policy):
16
- *
17
- * - `EventWindow` containers carry a `window_id`, an `active` flag, optional
18
- * `opens_at_ms`/`closes_at_ms` timestamps, and an opaque `modifiers` JSON
19
- * blob. Admin (or cron-automation) functions flip `active`; when both
20
- * timestamps are set, the **liveops-scheduler compute engine** flips the
21
- * flag itself and broadcasts the modifiers on the compute bus
22
- * (`liveops_window_opened`/`closed`) for other engines to apply — spawn
23
- * multipliers, weather locks, double gold.
24
- * - `SeasonDef` containers name a season (`season_id`, `active`,
25
- * `starts_at_ms`/`ends_at_ms`) and its battle-pass composition: the
26
- * `pass_track` is a progression-layer track name and `pass_features` a
27
- * JSON array of feature gates unlocked per tier — a battle pass is a
28
- * SEASON + PROGRESSION TRACK + FEATURE GATES, no new machinery.
29
- *
30
- * Runtime counterpart: `client.kit(appId).liveops`.
31
- */
32
- export function liveopsBlueprint(options = {}) {
33
- const { typePrefix = '', adminAuthority = 'server' } = options;
34
- const names = liveopsNames(typePrefix);
35
- const trusted = trustedAuthorityFields(adminAuthority);
36
- const propertyDefinitions = [
37
- {
38
- containerTypeName: names.windowType,
39
- key: 'window_id',
40
- valueType: 'string',
41
- defaultValueJson: '""',
42
- description: 'Stable id other systems reference (unique per app by convention).',
43
- },
44
- {
45
- containerTypeName: names.windowType,
46
- key: 'active',
47
- valueType: 'bool',
48
- defaultValueJson: 'false',
49
- description: 'Live flag. Flipped by the admin functions, cron automations, or the liveops-scheduler engine (timestamp windows).',
50
- },
51
- {
52
- containerTypeName: names.windowType,
53
- key: 'opens_at_ms',
54
- valueType: 'int',
55
- defaultValueJson: '0',
56
- description: 'Optional epoch-ms open time (with closes_at_ms, the scheduler owns the flag).',
57
- },
58
- {
59
- containerTypeName: names.windowType,
60
- key: 'closes_at_ms',
61
- valueType: 'int',
62
- defaultValueJson: '0',
63
- description: 'Optional epoch-ms close time.',
64
- },
65
- {
66
- containerTypeName: names.windowType,
67
- key: 'modifiers',
68
- valueType: 'string',
69
- defaultValueJson: '"{}"',
70
- description: 'Opaque JSON broadcast on the compute bus when the window opens/closes (consumed by engines).',
71
- },
72
- {
73
- containerTypeName: names.seasonType,
74
- key: 'season_id',
75
- valueType: 'string',
76
- defaultValueJson: '""',
77
- description: 'Stable season id (e.g. "s3").',
78
- },
79
- {
80
- containerTypeName: names.seasonType,
81
- key: 'active',
82
- valueType: 'bool',
83
- defaultValueJson: 'false',
84
- description: 'The one live season (activate_season deactivates the rest by convention).',
85
- },
86
- {
87
- containerTypeName: names.seasonType,
88
- key: 'starts_at_ms',
89
- valueType: 'int',
90
- defaultValueJson: '0',
91
- description: 'Season start (epoch ms; informational).',
92
- },
93
- {
94
- containerTypeName: names.seasonType,
95
- key: 'ends_at_ms',
96
- valueType: 'int',
97
- defaultValueJson: '0',
98
- description: 'Season end (epoch ms; informational).',
99
- },
100
- {
101
- containerTypeName: names.seasonType,
102
- key: 'pass_track',
103
- valueType: 'string',
104
- defaultValueJson: '""',
105
- description: "Battle-pass composition: the progression layer's track name whose tiers gate rewards.",
106
- },
107
- {
108
- containerTypeName: names.seasonType,
109
- key: 'pass_features',
110
- valueType: 'string',
111
- defaultValueJson: '"[]"',
112
- description: 'Battle-pass composition: JSON array of feature-gate keys unlocked per pass tier.',
113
- },
114
- ];
115
- const functions = [
116
- {
117
- name: names.openWindowFn,
118
- containerTypeName: names.windowType,
119
- returnType: 'bool',
120
- mutations: [{ target: 'self', property: 'active', expression: 'true' }],
121
- returnExpression: 'self.active',
122
- invokePolicyJson: trusted.invokePolicyJson ?? kitPolicyJson({ type: 'is_automation' }),
123
- ...(trusted.autonomousInvocable !== undefined
124
- ? { autonomousInvocable: trusted.autonomousInvocable }
125
- : {}),
126
- description: 'Open the window (admin/automation). The liveops-scheduler engine broadcasts the modifiers on the next tick.',
127
- },
128
- {
129
- name: names.closeWindowFn,
130
- containerTypeName: names.windowType,
131
- returnType: 'bool',
132
- mutations: [{ target: 'self', property: 'active', expression: 'false' }],
133
- returnExpression: 'self.active',
134
- invokePolicyJson: trusted.invokePolicyJson ?? kitPolicyJson({ type: 'is_automation' }),
135
- ...(trusted.autonomousInvocable !== undefined
136
- ? { autonomousInvocable: trusted.autonomousInvocable }
137
- : {}),
138
- description: 'Close the window (admin/automation).',
139
- },
140
- {
141
- name: names.activateSeasonFn,
142
- containerTypeName: names.seasonType,
143
- returnType: 'bool',
144
- mutations: [{ target: 'self', property: 'active', expression: 'true' }],
145
- returnExpression: 'self.active',
146
- invokePolicyJson: trusted.invokePolicyJson ?? kitPolicyJson({ type: 'is_automation' }),
147
- ...(trusted.autonomousInvocable !== undefined
148
- ? { autonomousInvocable: trusted.autonomousInvocable }
149
- : {}),
150
- description: 'Activate this season (admin/automation). Deactivate the previous season separately (one live season by convention).',
151
- },
152
- ];
153
- return {
154
- name: 'liveops',
155
- containerTypes: [
156
- {
157
- typeName: names.windowType,
158
- displayName: 'Liveops event window',
159
- description: 'A liveops window: active flag + optional timestamps + modifier JSON broadcast by the scheduler engine.',
160
- },
161
- {
162
- typeName: names.seasonType,
163
- displayName: 'Liveops season',
164
- description: 'A season definition; battle passes compose a season with a progression track + feature gates.',
165
- },
166
- ],
167
- propertyDefinitions,
168
- functions,
169
- };
170
- }
@@ -1,82 +0,0 @@
1
- import { type KitBlueprint, type KitInvokePolicy } from './core.js';
2
- /**
3
- * The authority source that may operate a lockable object. Several may be
4
- * combined (any one grants access — they are OR'd):
5
- *
6
- * - `owner` — only the container's owner (`owner_of_self`); "only the owner
7
- * of this chest can open it".
8
- * - `key` — the caller must own a matching key item; "if a player has key 1
9
- * they can open door 1". Adds a required `key_id` (`container_ref`) param.
10
- * - `gridPermission` — the caller must hold a runtime grid permission; ties
11
- * the object to a world region ("movement permission on chunk X opens the
12
- * doors in it").
13
- * - `groupPermission` — the caller must be in a team/group (optionally with a
14
- * specific group permission).
15
- * - `custom` — any hand-written {@link KitInvokePolicy} rule.
16
- */
17
- export type LockAuthority = {
18
- kind: 'owner';
19
- } | {
20
- kind: 'key';
21
- } | {
22
- kind: 'gridPermission';
23
- key: string;
24
- gridId?: string;
25
- } | {
26
- /**
27
- * The caller must hold the runtime permission on the grid covering the
28
- * chunk the OBJECT stands in (`cx`/`cy`/`cz` int properties, seeded via
29
- * `ObjectsKit.create({ chunk })`). No hand-pinned grid id — one function
30
- * serves every such object in the world. `mode` picks the covering grid
31
- * when several overlap: 'first' (enforcement parity, default) |
32
- * 'smallest' (innermost plot) | 'largest'. Requires game-api v0.13.12+.
33
- */
34
- kind: 'chunkPermission';
35
- key: string;
36
- mode?: 'first' | 'smallest' | 'largest';
37
- } | {
38
- kind: 'groupPermission';
39
- groupId: string;
40
- permission?: string;
41
- } | {
42
- kind: 'custom';
43
- rule: KitInvokePolicy;
44
- };
45
- /** Options for {@link lockBlueprint}. */
46
- export interface LockBlueprintOptions {
47
- /**
48
- * Container type name for the lockable object (`Door`, `Chest`, `Gate`, …).
49
- * Also drives the function names (`open_door` / `close_door`). Defaults to
50
- * `'Lockable'`.
51
- */
52
- objectTypeName?: string;
53
- /** Key item type name (only used with a `key` authority). Defaults to `<objectTypeName>Key`. */
54
- keyTypeName?: string;
55
- /** One or more authority sources; any one grants access. */
56
- authority: LockAuthority | LockAuthority[];
57
- /**
58
- * Extra policy rule AND'ed on top of the OR'd authorities — e.g.
59
- * `featureGate('vip')` for members-only doors regardless of keys.
60
- */
61
- policyExtra?: KitInvokePolicy;
62
- }
63
- /** Names derived by {@link lockBlueprint} for a given object type. */
64
- export interface LockNames {
65
- objectType: string;
66
- keyType: string;
67
- openFn: string;
68
- closeFn: string;
69
- }
70
- /** Compute the type/function names a lock blueprint (and its runtime helper) uses. */
71
- export declare function lockNames(objectTypeName?: string, keyTypeName?: string): LockNames;
72
- /**
73
- * Blueprint for a **lockable game object** (door, chest, gate, switch) whose
74
- * `open`/`close` functions are gated by a configurable authority source:
75
- * ownership, a key item the caller must hold, a runtime grid permission, a
76
- * team/group permission, or any custom policy rule. Multiple authorities are
77
- * OR'd, so "the owner, or anyone with the right key" is one blueprint.
78
- *
79
- * Runtime counterpart: `client.kit(appId).objects`.
80
- */
81
- export declare function lockBlueprint(options: LockBlueprintOptions): KitBlueprint;
82
- //# sourceMappingURL=locks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/locks.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GACf;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD;IACE;;;;;;;OAOG;IACH,IAAI,EAAE,iBAAiB,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;CACzC,GACD;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAE9C,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gGAAgG;IAChG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,SAAS,EAAE,aAAa,GAAG,aAAa,EAAE,CAAC;IAC3C;;;OAGG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,sEAAsE;AACtE,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,sFAAsF;AACtF,wBAAgB,SAAS,CACvB,cAAc,SAAa,EAC3B,WAAW,CAAC,EAAE,MAAM,GACnB,SAAS,CAQX;AAwCD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,YAAY,CA6GzE"}
@@ -1,155 +0,0 @@
1
- import { andPolicies, kitPolicyJson, toSnakeCase, } from './core.js';
2
- /** Compute the type/function names a lock blueprint (and its runtime helper) uses. */
3
- export function lockNames(objectTypeName = 'Lockable', keyTypeName) {
4
- const snake = toSnakeCase(objectTypeName);
5
- return {
6
- objectType: objectTypeName,
7
- keyType: keyTypeName ?? `${objectTypeName}Key`,
8
- openFn: `open_${snake}`,
9
- closeFn: `close_${snake}`,
10
- };
11
- }
12
- function lockAuthorityRule(authority) {
13
- switch (authority.kind) {
14
- case 'owner':
15
- return { type: 'owner_of_self' };
16
- case 'key':
17
- // Container ownership is not readable from expressions, so the key
18
- // mirrors its owner into an `owner_user_id` property; the condition
19
- // verifies both the match and the ownership server-side.
20
- return {
21
- type: 'condition',
22
- expression: 'ref($key_id).key_id == self.required_key_id && ref($key_id).owner_user_id == $caller_user_id',
23
- };
24
- case 'gridPermission':
25
- return {
26
- type: 'grid_permission',
27
- key: authority.key,
28
- ...(authority.gridId !== undefined ? { gridId: authority.gridId } : {}),
29
- };
30
- case 'chunkPermission':
31
- // Resolved per-invocation against the grid covering the object's chunk.
32
- return {
33
- type: 'condition',
34
- expression: `has_chunk_permission($caller_user_id, "${authority.key}", self.cx, self.cy, self.cz, "${authority.mode ?? 'first'}")`,
35
- };
36
- case 'groupPermission':
37
- return {
38
- type: 'group_permission',
39
- groupId: authority.groupId,
40
- ...(authority.permission !== undefined
41
- ? { permission: authority.permission }
42
- : {}),
43
- };
44
- case 'custom':
45
- return authority.rule;
46
- }
47
- }
48
- /**
49
- * Blueprint for a **lockable game object** (door, chest, gate, switch) whose
50
- * `open`/`close` functions are gated by a configurable authority source:
51
- * ownership, a key item the caller must hold, a runtime grid permission, a
52
- * team/group permission, or any custom policy rule. Multiple authorities are
53
- * OR'd, so "the owner, or anyone with the right key" is one blueprint.
54
- *
55
- * Runtime counterpart: `client.kit(appId).objects`.
56
- */
57
- export function lockBlueprint(options) {
58
- const authorities = Array.isArray(options.authority)
59
- ? options.authority
60
- : [options.authority];
61
- if (authorities.length === 0) {
62
- throw new Error('lockBlueprint requires at least one authority source');
63
- }
64
- const names = lockNames(options.objectTypeName, options.keyTypeName);
65
- const usesKey = authorities.some((a) => a.kind === 'key');
66
- const usesChunk = authorities.some((a) => a.kind === 'chunkPermission');
67
- const rules = authorities.map(lockAuthorityRule);
68
- const policy = rules.length === 1 ? rules[0] : { type: 'or', rules };
69
- const policyJson = kitPolicyJson(andPolicies(policy, options.policyExtra));
70
- const parameters = usesKey
71
- ? [{ name: 'key_id', valueType: 'container_ref', required: true }]
72
- : [];
73
- const containerTypes = [
74
- {
75
- typeName: names.objectType,
76
- displayName: names.objectType,
77
- instantiableBy: 'admin',
78
- description: 'A lockable world object operated through gated functions.',
79
- },
80
- ];
81
- const propertyDefinitions = [
82
- {
83
- containerTypeName: names.objectType,
84
- key: 'is_open',
85
- valueType: 'bool',
86
- defaultValueJson: 'false',
87
- },
88
- ];
89
- if (usesChunk) {
90
- // The chunk the object stands in, read by has_chunk_permission().
91
- for (const axis of ['cx', 'cy', 'cz']) {
92
- propertyDefinitions.push({
93
- containerTypeName: names.objectType,
94
- key: axis,
95
- valueType: 'int',
96
- defaultValueJson: '0',
97
- });
98
- }
99
- }
100
- if (usesKey) {
101
- propertyDefinitions.push({
102
- containerTypeName: names.objectType,
103
- key: 'required_key_id',
104
- valueType: 'string',
105
- });
106
- containerTypes.push({
107
- typeName: names.keyType,
108
- displayName: names.keyType,
109
- instantiableBy: 'admin',
110
- description: 'A key item granting access to matching lockable objects.',
111
- });
112
- propertyDefinitions.push({ containerTypeName: names.keyType, key: 'key_id', valueType: 'string' }, {
113
- containerTypeName: names.keyType,
114
- key: 'owner_user_id',
115
- valueType: 'int',
116
- });
117
- }
118
- const openMutation = {
119
- target: 'self',
120
- property: 'is_open',
121
- expression: 'true',
122
- };
123
- const closeMutation = {
124
- target: 'self',
125
- property: 'is_open',
126
- expression: 'false',
127
- };
128
- return {
129
- name: names.objectType,
130
- containerTypes,
131
- propertyDefinitions,
132
- functions: [
133
- {
134
- name: names.openFn,
135
- containerTypeName: names.objectType,
136
- returnType: 'bool',
137
- parameters,
138
- mutations: [openMutation],
139
- returnExpression: 'self.is_open',
140
- invokePolicyJson: policyJson,
141
- description: `Open a ${names.objectType}; the invoke policy decides who may.`,
142
- },
143
- {
144
- name: names.closeFn,
145
- containerTypeName: names.objectType,
146
- returnType: 'bool',
147
- parameters,
148
- mutations: [closeMutation],
149
- returnExpression: 'self.is_open',
150
- invokePolicyJson: policyJson,
151
- description: `Close a ${names.objectType}; same authority as opening.`,
152
- },
153
- ],
154
- };
155
- }
@@ -1,90 +0,0 @@
1
- import { type KitBlueprint, type KitOwnerIdKind, type KitTrustedAuthority } from './core.js';
2
- /** One weighted entry of a loot table. */
3
- export interface LootEntrySpec {
4
- itemId: string;
5
- /** Relative weight (> 0); probabilities are weights normalized per table. */
6
- weight: number;
7
- /** Minimum quantity granted. Defaults to 1. */
8
- minQty?: number;
9
- /** Maximum quantity granted. Defaults to `minQty`. */
10
- maxQty?: number;
11
- }
12
- /** One loot table, unrolled into a single expression at blueprint-build time. */
13
- export interface LootTableSpec {
14
- /** Stable table identifier; also derives the roll function name. */
15
- tableId: string;
16
- /** 1–16 weighted entries (the expression parser caps chain length). */
17
- entries: LootEntrySpec[];
18
- }
19
- /** An event-triggered drop: rolls a pooled LootRoll when a model event fires. */
20
- export interface LootDropSpec {
21
- /** Automation name (unique per app), e.g. `'goblin-drop'`. */
22
- name: string;
23
- /** The table to roll. */
24
- tableId: string;
25
- /** The model event that triggers the drop (e.g. a `mob_died` function). */
26
- onEvent: 'function_invoked' | 'property_changed' | 'container_created';
27
- functionName?: string;
28
- containerTypeName?: string;
29
- propertyKey?: string;
30
- /**
31
- * `property_changed` only: which writes roll the drop. Properties mutated
32
- * by kit functions (a mob's `hp` reaching 0, say) need `'function'` or
33
- * `'any'`; the default `'direct'` only sees client `setProperty` calls.
34
- */
35
- writeSource?: 'direct' | 'function' | 'any';
36
- debounceMs?: number;
37
- /** Rolls per event. Defaults to 1. */
38
- maxTargets?: number;
39
- }
40
- /** Options for {@link lootBlueprint}. */
41
- export interface LootBlueprintOptions {
42
- /** Prefix for the type/function names. Defaults to none. */
43
- typePrefix?: string;
44
- /** The loot tables; entries are unrolled into expressions at build time. */
45
- tables: LootTableSpec[];
46
- /**
47
- * Who may roll. Defaults to `'server'` (app admins / studio backend);
48
- * automations configured via `drops` may always roll (trusted automations
49
- * bypass invoke policies, and the roll functions are marked
50
- * `autonomousInvocable` when drops reference their table).
51
- */
52
- rollAuthority?: KitTrustedAuthority;
53
- /**
54
- * Event-triggered drops: each rolls an UNROLLED pooled `LootRoll` container
55
- * of its table when the event fires (automations mutate — they cannot
56
- * create containers — so keep a small pool of pre-created rolls per table).
57
- */
58
- drops?: LootDropSpec[];
59
- /** Owner-mirror typing (see the kit convention). Defaults to `'int'`. */
60
- ownerIdKind?: KitOwnerIdKind;
61
- }
62
- /** Names derived by {@link lootBlueprint} for a given prefix. */
63
- export interface LootNames {
64
- rollType: string;
65
- claimFn: string;
66
- /** Snake-cased function-name prefix (empty without a `typePrefix`). */
67
- fnPrefix: string;
68
- }
69
- /** Compute the type/function names a loot blueprint (and its runtime helper) uses. */
70
- export declare function lootNames(typePrefix?: string): LootNames;
71
- /** The roll function name for one table. */
72
- export declare function lootRollFn(tableId: string, typePrefix?: string): string;
73
- /**
74
- * Blueprint for **loot tables & drops**: weighted tables are unrolled into
75
- * pure expressions at blueprint-build time (the expression language is
76
- * loop-free), rolled server-side into durable `LootRoll` containers, and
77
- * claimed atomically into an item stack. Covers chest rolls, mob drops, and
78
- * gacha pulls.
79
- *
80
- * Flow: create a `LootRoll` (member) for a table → `roll_<table>` (trusted:
81
- * server scope by default, or an event automation via `drops`) stores a
82
- * single `rand()` seed and resolves item + quantity from it in one
83
- * transaction → the owner claims with `claim_roll`, which marks the roll
84
- * claimed AND grants the stack in the same invoke (no double-claim, no
85
- * client-chosen rewards).
86
- *
87
- * Runtime counterpart: `client.kit(appId).loot`.
88
- */
89
- export declare function lootBlueprint(options: LootBlueprintOptions): KitBlueprint;
90
- //# sourceMappingURL=loot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loot.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/loot.ts"],"names":[],"mappings":"AAIA,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AAEnB,0CAA0C;AAC1C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,iFAAiF;AACjF,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AAED,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAC3B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,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;;;;OAIG;IACH,WAAW,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,yEAAyE;IACzE,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B;AAED,iEAAiE;AACjE,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,UAAU,SAAK,GAAG,SAAS,CAOpD;AAED,4CAA4C;AAC5C,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,SAAK,GAAG,MAAM,CAGnE;AAwCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,YAAY,CAwLzE"}