tempest.games 0.3.9 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/app/assets/{index-CuDmqoP5.js → index-suqgKgd6.js} +220 -220
- package/app/index.html +1 -1
- package/bin/backend.bun.js +37 -5
- package/bin/backend.worker.bug-rangers.bun.js +201 -41
- package/bin/frontend.bun.js +32 -5
- package/bin/setup-db.bun.js +2 -2
- package/package.json +4 -4
package/app/index.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
/>
|
|
11
11
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
12
12
|
<title>TEMPEST</title>
|
|
13
|
-
<script type="module" crossorigin src="/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/assets/index-suqgKgd6.js"></script>
|
|
14
14
|
<link rel="stylesheet" crossorigin href="/assets/index-oxk15HrU.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
package/bin/backend.bun.js
CHANGED
|
@@ -4146,7 +4146,7 @@ function realtimeMutableFamilyProvider({
|
|
|
4146
4146
|
} else {
|
|
4147
4147
|
exposedSubKeys = staticIndex;
|
|
4148
4148
|
}
|
|
4149
|
-
const shouldExpose = isAvailable(exposedSubKeys, subKey);
|
|
4149
|
+
const shouldExpose = exposedSubKeys && isAvailable(exposedSubKeys, subKey);
|
|
4150
4150
|
if (shouldExpose) {
|
|
4151
4151
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
4152
4152
|
exposeFamilyMembers(subKey);
|
|
@@ -4159,6 +4159,8 @@ function realtimeMutableFamilyProvider({
|
|
|
4159
4159
|
if (dynamicIndex) {
|
|
4160
4160
|
coreSubscriptions.add(subscribeToState(store, dynamicIndex, `expose-family:${family.key}:${socket.id}`, ({ newValue: newExposedSubKeys }) => {
|
|
4161
4161
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `has the following keys available for family "${family.key}"`, newExposedSubKeys);
|
|
4162
|
+
if (newExposedSubKeys === null)
|
|
4163
|
+
return;
|
|
4162
4164
|
for (const subKey of newExposedSubKeys) {
|
|
4163
4165
|
if (familyMemberSubscriptionsWanted.has(stringifyJson(subKey))) {
|
|
4164
4166
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is retroactively approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
@@ -4550,7 +4552,7 @@ function realtimeAtomFamilyProvider({
|
|
|
4550
4552
|
} else {
|
|
4551
4553
|
exposedSubKeys = staticIndex;
|
|
4552
4554
|
}
|
|
4553
|
-
const shouldExpose = isAvailable2(exposedSubKeys, subKey);
|
|
4555
|
+
const shouldExpose = exposedSubKeys && isAvailable2(exposedSubKeys, subKey);
|
|
4554
4556
|
if (shouldExpose) {
|
|
4555
4557
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
4556
4558
|
exposeFamilyMembers(subKey);
|
|
@@ -4563,6 +4565,8 @@ function realtimeAtomFamilyProvider({
|
|
|
4563
4565
|
if (dynamicIndex) {
|
|
4564
4566
|
coreSubscriptions.add(subscribeToState(store, dynamicIndex, `expose-family:${family.key}:${socket.id}`, ({ newValue: newExposedSubKeys }) => {
|
|
4565
4567
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `has the following keys available for family "${family.key}"`, newExposedSubKeys);
|
|
4568
|
+
if (newExposedSubKeys === null)
|
|
4569
|
+
return;
|
|
4566
4570
|
for (const subKey of newExposedSubKeys) {
|
|
4567
4571
|
if (familyMemberSubscriptionsWanted.has(stringifyJson(subKey))) {
|
|
4568
4572
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is retroactively approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
@@ -4662,7 +4666,7 @@ var storageSync = (storage, { stringify, parse }, key) => ({ setSelf, onSet }) =
|
|
|
4662
4666
|
var init_web = () => {};
|
|
4663
4667
|
|
|
4664
4668
|
// ../../packages/atom.io/dist/realtime-client/index.js
|
|
4665
|
-
var mySocketKeyAtom, myUserKeyAtom, myRoomKeySelector, optimisticUpdateQueueAtom, confirmedUpdateQueueAtom;
|
|
4669
|
+
var mySocketKeyAtom, myUserKeyAtom, myRoomKeySelector, usersHereSelector, roomOwnerSelector, optimisticUpdateQueueAtom, confirmedUpdateQueueAtom;
|
|
4666
4670
|
var init_realtime_client = __esm(() => {
|
|
4667
4671
|
init_main();
|
|
4668
4672
|
init_main();
|
|
@@ -4696,6 +4700,29 @@ var init_realtime_client = __esm(() => {
|
|
|
4696
4700
|
return null;
|
|
4697
4701
|
}
|
|
4698
4702
|
});
|
|
4703
|
+
usersHereSelector = selector({
|
|
4704
|
+
key: `usersHere`,
|
|
4705
|
+
get: ({ get, find }) => {
|
|
4706
|
+
const myRoomKey = get(myRoomKeySelector);
|
|
4707
|
+
if (!myRoomKey)
|
|
4708
|
+
return null;
|
|
4709
|
+
const [usersInRoomsAtoms] = getInternalRelations(usersInRooms, `split`);
|
|
4710
|
+
return get(find(usersInRoomsAtoms, myRoomKey));
|
|
4711
|
+
}
|
|
4712
|
+
});
|
|
4713
|
+
roomOwnerSelector = selector({
|
|
4714
|
+
key: `roomOwner`,
|
|
4715
|
+
get: ({ get }) => {
|
|
4716
|
+
const myRoomKey = get(myRoomKeySelector);
|
|
4717
|
+
if (!myRoomKey)
|
|
4718
|
+
return null;
|
|
4719
|
+
const [, ownerOfRoomsAtoms] = getInternalRelations(ownersOfRooms, `split`);
|
|
4720
|
+
const owner = get(ownerOfRoomsAtoms, myRoomKey);
|
|
4721
|
+
for (const userKey of owner)
|
|
4722
|
+
return userKey;
|
|
4723
|
+
return null;
|
|
4724
|
+
}
|
|
4725
|
+
});
|
|
4699
4726
|
optimisticUpdateQueueAtom = atom({
|
|
4700
4727
|
key: `optimisticUpdateQueue`,
|
|
4701
4728
|
default: () => []
|
|
@@ -21990,7 +22017,7 @@ var require_dist2 = __commonJS((exports, module) => {
|
|
|
21990
22017
|
module.exports.Socket = socket_1.Socket;
|
|
21991
22018
|
});
|
|
21992
22019
|
|
|
21993
|
-
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.
|
|
22020
|
+
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.5/node_modules/@t3-oss/env-core/dist/standard.js
|
|
21994
22021
|
function ensureSynchronous(value, message) {
|
|
21995
22022
|
if (value instanceof Promise)
|
|
21996
22023
|
throw new Error(message);
|
|
@@ -22017,7 +22044,7 @@ function parseWithDictionary(dictionary, value) {
|
|
|
22017
22044
|
}
|
|
22018
22045
|
var init_standard = () => {};
|
|
22019
22046
|
|
|
22020
|
-
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.
|
|
22047
|
+
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.5/node_modules/@t3-oss/env-core/dist/index.js
|
|
22021
22048
|
function createEnv(opts) {
|
|
22022
22049
|
const runtimeEnv = opts.runtimeEnvStrict ?? opts.runtimeEnv ?? process.env;
|
|
22023
22050
|
if (opts.emptyStringAsUndefined ?? false) {
|
|
@@ -88200,6 +88227,10 @@ var cpuCountAtom = atom2({
|
|
|
88200
88227
|
}
|
|
88201
88228
|
]
|
|
88202
88229
|
});
|
|
88230
|
+
var isAdminAtom = atom2({
|
|
88231
|
+
key: `isAdmin`,
|
|
88232
|
+
default: false
|
|
88233
|
+
});
|
|
88203
88234
|
|
|
88204
88235
|
// src/library/username-state.ts
|
|
88205
88236
|
init_drizzle_orm();
|
|
@@ -88284,6 +88315,7 @@ var serveSocket = (config3) => {
|
|
|
88284
88315
|
const provideFamily = realtimeAtomFamilyProvider(config3);
|
|
88285
88316
|
const mutualsSelector = findState(mutualUsersSelector2, consumer);
|
|
88286
88317
|
const unsubFunctions = [
|
|
88318
|
+
provideState(isAdminAtom, findState(roomAdminsSelectors, consumer)),
|
|
88287
88319
|
provideState(cpuCountAtom),
|
|
88288
88320
|
provideFamily(usernameAtoms, mutualsSelector),
|
|
88289
88321
|
provideRooms({
|
|
@@ -12823,7 +12823,7 @@ function realtimeMutableFamilyProvider({
|
|
|
12823
12823
|
} else {
|
|
12824
12824
|
exposedSubKeys = staticIndex;
|
|
12825
12825
|
}
|
|
12826
|
-
const shouldExpose = isAvailable(exposedSubKeys, subKey);
|
|
12826
|
+
const shouldExpose = exposedSubKeys && isAvailable(exposedSubKeys, subKey);
|
|
12827
12827
|
if (shouldExpose) {
|
|
12828
12828
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
12829
12829
|
exposeFamilyMembers(subKey);
|
|
@@ -12836,6 +12836,8 @@ function realtimeMutableFamilyProvider({
|
|
|
12836
12836
|
if (dynamicIndex) {
|
|
12837
12837
|
coreSubscriptions.add(subscribeToState(store, dynamicIndex, `expose-family:${family.key}:${socket.id}`, ({ newValue: newExposedSubKeys }) => {
|
|
12838
12838
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `has the following keys available for family "${family.key}"`, newExposedSubKeys);
|
|
12839
|
+
if (newExposedSubKeys === null)
|
|
12840
|
+
return;
|
|
12839
12841
|
for (const subKey of newExposedSubKeys) {
|
|
12840
12842
|
if (familyMemberSubscriptionsWanted.has(stringifyJson(subKey))) {
|
|
12841
12843
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is retroactively approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
@@ -13227,7 +13229,7 @@ function realtimeAtomFamilyProvider({
|
|
|
13227
13229
|
} else {
|
|
13228
13230
|
exposedSubKeys = staticIndex;
|
|
13229
13231
|
}
|
|
13230
|
-
const shouldExpose = isAvailable2(exposedSubKeys, subKey);
|
|
13232
|
+
const shouldExpose = exposedSubKeys && isAvailable2(exposedSubKeys, subKey);
|
|
13231
13233
|
if (shouldExpose) {
|
|
13232
13234
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
13233
13235
|
exposeFamilyMembers(subKey);
|
|
@@ -13240,6 +13242,8 @@ function realtimeAtomFamilyProvider({
|
|
|
13240
13242
|
if (dynamicIndex) {
|
|
13241
13243
|
coreSubscriptions.add(subscribeToState(store, dynamicIndex, `expose-family:${family.key}:${socket.id}`, ({ newValue: newExposedSubKeys }) => {
|
|
13242
13244
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `has the following keys available for family "${family.key}"`, newExposedSubKeys);
|
|
13245
|
+
if (newExposedSubKeys === null)
|
|
13246
|
+
return;
|
|
13243
13247
|
for (const subKey of newExposedSubKeys) {
|
|
13244
13248
|
if (familyMemberSubscriptionsWanted.has(stringifyJson(subKey))) {
|
|
13245
13249
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is retroactively approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
@@ -13318,7 +13322,7 @@ var init_realtime_state_provider = __esm(() => {
|
|
|
13318
13322
|
var init_realtime_state_receiver = () => {};
|
|
13319
13323
|
|
|
13320
13324
|
// ../../packages/atom.io/dist/realtime-client/index.js
|
|
13321
|
-
var mySocketKeyAtom2, myUserKeyAtom2, myRoomKeySelector2, optimisticUpdateQueueAtom, confirmedUpdateQueueAtom;
|
|
13325
|
+
var mySocketKeyAtom2, myUserKeyAtom2, myRoomKeySelector2, usersHereSelector2, roomOwnerSelector2, optimisticUpdateQueueAtom, confirmedUpdateQueueAtom;
|
|
13322
13326
|
var init_realtime_client = __esm(() => {
|
|
13323
13327
|
init_main();
|
|
13324
13328
|
init_main();
|
|
@@ -13352,6 +13356,29 @@ var init_realtime_client = __esm(() => {
|
|
|
13352
13356
|
return null;
|
|
13353
13357
|
}
|
|
13354
13358
|
});
|
|
13359
|
+
usersHereSelector2 = selector({
|
|
13360
|
+
key: `usersHere`,
|
|
13361
|
+
get: ({ get, find }) => {
|
|
13362
|
+
const myRoomKey = get(myRoomKeySelector2);
|
|
13363
|
+
if (!myRoomKey)
|
|
13364
|
+
return null;
|
|
13365
|
+
const [usersInRoomsAtoms] = getInternalRelations(usersInRooms2, `split`);
|
|
13366
|
+
return get(find(usersInRoomsAtoms, myRoomKey));
|
|
13367
|
+
}
|
|
13368
|
+
});
|
|
13369
|
+
roomOwnerSelector2 = selector({
|
|
13370
|
+
key: `roomOwner`,
|
|
13371
|
+
get: ({ get }) => {
|
|
13372
|
+
const myRoomKey = get(myRoomKeySelector2);
|
|
13373
|
+
if (!myRoomKey)
|
|
13374
|
+
return null;
|
|
13375
|
+
const [, ownerOfRoomsAtoms] = getInternalRelations(ownersOfRooms2, `split`);
|
|
13376
|
+
const owner = get(ownerOfRoomsAtoms, myRoomKey);
|
|
13377
|
+
for (const userKey of owner)
|
|
13378
|
+
return userKey;
|
|
13379
|
+
return null;
|
|
13380
|
+
}
|
|
13381
|
+
});
|
|
13355
13382
|
optimisticUpdateQueueAtom = atom({
|
|
13356
13383
|
key: `optimisticUpdateQueue`,
|
|
13357
13384
|
default: () => []
|
|
@@ -15176,7 +15203,7 @@ var require_src2 = __commonJS((exports, module2) => {
|
|
|
15176
15203
|
}
|
|
15177
15204
|
});
|
|
15178
15205
|
|
|
15179
|
-
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.
|
|
15206
|
+
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.5/node_modules/@t3-oss/env-core/dist/standard.js
|
|
15180
15207
|
function ensureSynchronous(value3, message) {
|
|
15181
15208
|
if (value3 instanceof Promise)
|
|
15182
15209
|
throw new Error(message);
|
|
@@ -15203,7 +15230,7 @@ function parseWithDictionary(dictionary, value3) {
|
|
|
15203
15230
|
}
|
|
15204
15231
|
var init_standard = () => {};
|
|
15205
15232
|
|
|
15206
|
-
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.
|
|
15233
|
+
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.5/node_modules/@t3-oss/env-core/dist/index.js
|
|
15207
15234
|
function createEnv(opts) {
|
|
15208
15235
|
const runtimeEnv = opts.runtimeEnvStrict ?? opts.runtimeEnv ?? process.env;
|
|
15209
15236
|
if (opts.emptyStringAsUndefined ?? false) {
|
|
@@ -15337,13 +15364,6 @@ function atomFamily2(options) {
|
|
|
15337
15364
|
return createRegularAtomFamily(IMPLICIT.STORE, options);
|
|
15338
15365
|
}
|
|
15339
15366
|
|
|
15340
|
-
// ../../packages/atom.io/src/main/find-state.ts
|
|
15341
|
-
init_internal();
|
|
15342
|
-
function findState(token, key) {
|
|
15343
|
-
const state = findInStore(IMPLICIT.STORE, token, key);
|
|
15344
|
-
return state;
|
|
15345
|
-
}
|
|
15346
|
-
|
|
15347
15367
|
// ../../packages/atom.io/src/main/get-state.ts
|
|
15348
15368
|
init_internal();
|
|
15349
15369
|
function getState2(...params) {
|
|
@@ -15352,9 +15372,6 @@ function getState2(...params) {
|
|
|
15352
15372
|
|
|
15353
15373
|
// ../../packages/atom.io/src/main/join.ts
|
|
15354
15374
|
init_internal();
|
|
15355
|
-
function findRelations(token, key) {
|
|
15356
|
-
return findRelationsInStore(IMPLICIT.STORE, token, key);
|
|
15357
|
-
}
|
|
15358
15375
|
function getInternalRelations2(token, split) {
|
|
15359
15376
|
return getInternalRelationsFromStore(IMPLICIT.STORE, token, split);
|
|
15360
15377
|
}
|
|
@@ -15600,6 +15617,34 @@ var myRoomKeySelector = selector({
|
|
|
15600
15617
|
return null;
|
|
15601
15618
|
}
|
|
15602
15619
|
});
|
|
15620
|
+
var usersHereSelector = selector({
|
|
15621
|
+
key: `usersHere`,
|
|
15622
|
+
get: ({ get, find }) => {
|
|
15623
|
+
const myRoomKey = get(myRoomKeySelector);
|
|
15624
|
+
if (!myRoomKey)
|
|
15625
|
+
return null;
|
|
15626
|
+
const [usersInRoomsAtoms] = getInternalRelations(usersInRooms2, `split`);
|
|
15627
|
+
const users = get(find(usersInRoomsAtoms, myRoomKey));
|
|
15628
|
+
return users;
|
|
15629
|
+
}
|
|
15630
|
+
});
|
|
15631
|
+
var roomOwnerSelector = selector({
|
|
15632
|
+
key: `roomOwner`,
|
|
15633
|
+
get: ({ get }) => {
|
|
15634
|
+
const myRoomKey = get(myRoomKeySelector);
|
|
15635
|
+
if (!myRoomKey)
|
|
15636
|
+
return null;
|
|
15637
|
+
const [, ownerOfRoomsAtoms] = getInternalRelations(ownersOfRooms2, `split`);
|
|
15638
|
+
const owner = get(ownerOfRoomsAtoms, myRoomKey);
|
|
15639
|
+
for (const userKey of owner)
|
|
15640
|
+
return userKey;
|
|
15641
|
+
return null;
|
|
15642
|
+
}
|
|
15643
|
+
});
|
|
15644
|
+
|
|
15645
|
+
// ../../packages/atom.io/src/realtime-client/pull-atom.ts
|
|
15646
|
+
init_internal();
|
|
15647
|
+
init_realtime();
|
|
15603
15648
|
|
|
15604
15649
|
// ../../packages/atom.io/src/realtime-client/create-subscriber.ts
|
|
15605
15650
|
init_internal();
|
|
@@ -15644,6 +15689,59 @@ function createSubscriber(socket, key, open) {
|
|
|
15644
15689
|
};
|
|
15645
15690
|
}
|
|
15646
15691
|
|
|
15692
|
+
// ../../packages/atom.io/src/realtime-client/pull-atom.ts
|
|
15693
|
+
function pullAtom(store, socket, token) {
|
|
15694
|
+
return createSubscriber(socket, token.key, (key) => {
|
|
15695
|
+
const stopWatching = employSocket2(socket, `serve:${key}`, (data) => {
|
|
15696
|
+
setIntoStore(store, token, data);
|
|
15697
|
+
});
|
|
15698
|
+
socket.emit(`sub:${token.key}`);
|
|
15699
|
+
return () => {
|
|
15700
|
+
socket.emit(`unsub:${key}`);
|
|
15701
|
+
stopWatching();
|
|
15702
|
+
};
|
|
15703
|
+
});
|
|
15704
|
+
}
|
|
15705
|
+
|
|
15706
|
+
// ../../packages/atom.io/src/realtime-client/pull-atom-family-member.ts
|
|
15707
|
+
init_internal();
|
|
15708
|
+
init_realtime();
|
|
15709
|
+
function pullAtomFamilyMember(store, socket, family, key) {
|
|
15710
|
+
const token = findInStore(store, family, key);
|
|
15711
|
+
return createSubscriber(socket, token.key, () => {
|
|
15712
|
+
const stopWatching = employSocket2(socket, `serve:${token.key}`, (data) => {
|
|
15713
|
+
setIntoStore(store, token, data);
|
|
15714
|
+
});
|
|
15715
|
+
socket.emit(`sub:${family.key}`, key);
|
|
15716
|
+
return () => {
|
|
15717
|
+
socket.emit(`unsub:${token.key}`);
|
|
15718
|
+
stopWatching();
|
|
15719
|
+
};
|
|
15720
|
+
});
|
|
15721
|
+
}
|
|
15722
|
+
|
|
15723
|
+
// ../../packages/atom.io/src/realtime-client/pull-mutable-atom.ts
|
|
15724
|
+
init_internal();
|
|
15725
|
+
init_realtime();
|
|
15726
|
+
function pullMutableAtom(store, socket, token) {
|
|
15727
|
+
const jsonToken = getJsonToken(store, token);
|
|
15728
|
+
const updateToken = getUpdateToken(token);
|
|
15729
|
+
return createSubscriber(socket, token.key, () => {
|
|
15730
|
+
const stopWatchingForInit = employSocket2(socket, `init:${token.key}`, (data) => {
|
|
15731
|
+
setIntoStore(store, jsonToken, data);
|
|
15732
|
+
});
|
|
15733
|
+
const stopWatchingForUpdate = employSocket2(socket, `next:${token.key}`, (data) => {
|
|
15734
|
+
setIntoStore(store, updateToken, data);
|
|
15735
|
+
});
|
|
15736
|
+
socket.emit(`sub:${token.key}`);
|
|
15737
|
+
return () => {
|
|
15738
|
+
socket.emit(`unsub:${token.key}`);
|
|
15739
|
+
stopWatchingForInit();
|
|
15740
|
+
stopWatchingForUpdate();
|
|
15741
|
+
};
|
|
15742
|
+
});
|
|
15743
|
+
}
|
|
15744
|
+
|
|
15647
15745
|
// ../../packages/atom.io/src/realtime-client/pull-mutable-atom-family-member.ts
|
|
15648
15746
|
init_internal();
|
|
15649
15747
|
init_realtime();
|
|
@@ -15667,6 +15765,69 @@ function pullMutableAtomFamilyMember(store, socket, family, key) {
|
|
|
15667
15765
|
});
|
|
15668
15766
|
}
|
|
15669
15767
|
|
|
15768
|
+
// ../../packages/atom.io/src/realtime-client/pull-selector-roots.ts
|
|
15769
|
+
init_internal();
|
|
15770
|
+
init_json();
|
|
15771
|
+
function pullSelectorRoots(store, socket, selectorToken) {
|
|
15772
|
+
const atomSubscriptions = new Map;
|
|
15773
|
+
const start = () => {
|
|
15774
|
+
const atomKeys = store.selectorAtoms.getRelatedKeys(selectorToken.key);
|
|
15775
|
+
if (atomKeys) {
|
|
15776
|
+
for (const [atomKey, unsub] of atomSubscriptions) {
|
|
15777
|
+
if (!atomKeys.has(atomKey)) {
|
|
15778
|
+
unsub();
|
|
15779
|
+
atomSubscriptions.delete(atomKey);
|
|
15780
|
+
}
|
|
15781
|
+
}
|
|
15782
|
+
for (const atomKey of atomKeys) {
|
|
15783
|
+
if (atomSubscriptions.has(atomKey)) {
|
|
15784
|
+
continue;
|
|
15785
|
+
}
|
|
15786
|
+
const atom3 = store.atoms.get(atomKey);
|
|
15787
|
+
switch (atom3.type) {
|
|
15788
|
+
case `atom`: {
|
|
15789
|
+
if (atom3.family) {
|
|
15790
|
+
const { subKey: serializedSubKey } = atom3.family;
|
|
15791
|
+
const subKey = parseJson2(serializedSubKey);
|
|
15792
|
+
const family = getFamilyOfToken(store, atom3);
|
|
15793
|
+
atomSubscriptions.set(atomKey, pullAtomFamilyMember(store, socket, family, subKey));
|
|
15794
|
+
} else {
|
|
15795
|
+
atomSubscriptions.set(atomKey, pullAtom(store, socket, atom3));
|
|
15796
|
+
}
|
|
15797
|
+
break;
|
|
15798
|
+
}
|
|
15799
|
+
case `mutable_atom`: {
|
|
15800
|
+
if (atom3.family) {
|
|
15801
|
+
const { subKey: serializedSubKey } = atom3.family;
|
|
15802
|
+
const subKey = parseJson2(serializedSubKey);
|
|
15803
|
+
const family = getFamilyOfToken(store, atom3);
|
|
15804
|
+
atomSubscriptions.set(atomKey, pullMutableAtomFamilyMember(store, socket, family, subKey));
|
|
15805
|
+
} else {
|
|
15806
|
+
atomSubscriptions.set(atomKey, pullMutableAtom(store, socket, atom3));
|
|
15807
|
+
}
|
|
15808
|
+
break;
|
|
15809
|
+
}
|
|
15810
|
+
}
|
|
15811
|
+
}
|
|
15812
|
+
}
|
|
15813
|
+
};
|
|
15814
|
+
const unsubFromSelector = subscribeToState(store, selectorToken, `pull-watches-dependencies`, () => {
|
|
15815
|
+
start();
|
|
15816
|
+
});
|
|
15817
|
+
start();
|
|
15818
|
+
return () => {
|
|
15819
|
+
for (const [, unsub] of atomSubscriptions)
|
|
15820
|
+
unsub();
|
|
15821
|
+
atomSubscriptions.clear();
|
|
15822
|
+
unsubFromSelector();
|
|
15823
|
+
};
|
|
15824
|
+
}
|
|
15825
|
+
|
|
15826
|
+
// ../../packages/atom.io/src/realtime-client/pull-selector.ts
|
|
15827
|
+
function pullSelector(store, socket, token) {
|
|
15828
|
+
return pullSelectorRoots(store, socket, token);
|
|
15829
|
+
}
|
|
15830
|
+
|
|
15670
15831
|
// src/backend.worker.bug-rangers.bun.ts
|
|
15671
15832
|
init_realtime_server();
|
|
15672
15833
|
|
|
@@ -28937,8 +29098,10 @@ var setupGroupsSelector = selector2({
|
|
|
28937
29098
|
if (!roomKey) {
|
|
28938
29099
|
return { notReady, readyDoesNotWantFirst, readyWantsFirst };
|
|
28939
29100
|
}
|
|
28940
|
-
const
|
|
28941
|
-
|
|
29101
|
+
const usersHere = get(usersHereSelector);
|
|
29102
|
+
if (usersHere === null) {
|
|
29103
|
+
return { notReady, readyDoesNotWantFirst, readyWantsFirst };
|
|
29104
|
+
}
|
|
28942
29105
|
for (const userKey of usersHere) {
|
|
28943
29106
|
const playerReadyStatus = get(playerReadyStatusAtoms, userKey);
|
|
28944
29107
|
if (turnOrder.includes(userKey))
|
|
@@ -29064,12 +29227,19 @@ function pureShuffle(array) {
|
|
|
29064
29227
|
}
|
|
29065
29228
|
|
|
29066
29229
|
// src/backend.worker.bug-rangers.bun.ts
|
|
29067
|
-
var parent = process.
|
|
29230
|
+
var parent = process.PS ??= new ParentSocket(process);
|
|
29068
29231
|
Object.assign(console, parent.logger, { log: parent.logger.info });
|
|
29069
29232
|
parent.on(`timeToStop`, function gracefulExit() {
|
|
29070
29233
|
parent.logger.info(`\uD83D\uDEEC game worker exiting`);
|
|
29071
29234
|
process.exit(0);
|
|
29072
29235
|
});
|
|
29236
|
+
(function globalSetup() {
|
|
29237
|
+
if (process.globalSetupDone)
|
|
29238
|
+
return;
|
|
29239
|
+
process.globalSetupDone = true;
|
|
29240
|
+
pullSelector(IMPLICIT.STORE, parentSocket, usersHereSelector);
|
|
29241
|
+
pullSelector(IMPLICIT.STORE, parentSocket, roomOwnerSelector);
|
|
29242
|
+
})();
|
|
29073
29243
|
IMPLICIT.STORE.loggers[0] = new AtomIOLogger2(`info`, (...params) => {
|
|
29074
29244
|
if (![`\u2B55`, `\uD83D\uDD34`, `\uD83D\uDFE2`, `\uD83D\uDEAB`, `\u274C`, `\uD83D\uDC40`, `\uD83D\uDE48`].includes(params[0])) {
|
|
29075
29245
|
return false;
|
|
@@ -29105,42 +29275,30 @@ var bugRangersGuard = {
|
|
|
29105
29275
|
turnRestart: type([]),
|
|
29106
29276
|
turnEnd: type([])
|
|
29107
29277
|
};
|
|
29108
|
-
var ROOM_KEY = process.env[`REALTIME_ROOM_KEY`];
|
|
29109
|
-
var usersInRoomsAtoms = getInternalRelations2(usersInRooms);
|
|
29110
|
-
var ownersOfRoomsAtoms = getInternalRelations2(ownersOfRooms);
|
|
29111
|
-
(function globalSetup() {
|
|
29112
|
-
if (process.globalSetupDone)
|
|
29113
|
-
return;
|
|
29114
|
-
process.globalSetupDone = true;
|
|
29115
|
-
pullMutableAtomFamilyMember(IMPLICIT.STORE, parentSocket, usersInRoomsAtoms, ROOM_KEY);
|
|
29116
|
-
pullMutableAtomFamilyMember(IMPLICIT.STORE, parentSocket, ownersOfRoomsAtoms, ROOM_KEY);
|
|
29117
|
-
})();
|
|
29118
29278
|
parent.receiveRelay((socket, userKey) => {
|
|
29119
29279
|
const config3 = { socket, consumer: userKey };
|
|
29120
29280
|
const exposeState = realtimeStateProvider(config3);
|
|
29121
29281
|
const exposeMutable = realtimeMutableProvider(config3);
|
|
29122
29282
|
const exposeFamily = realtimeAtomFamilyProvider(config3);
|
|
29123
29283
|
const gameSocket = guardSocket(socket, bugRangersGuard, parent.logger.error);
|
|
29124
|
-
const usersHereAtom = findState(usersInRoomsAtoms, ROOM_KEY);
|
|
29125
29284
|
const coreStack = [];
|
|
29126
|
-
coreStack.push(exposeState(turnNumberAtom), exposeState(gameStateAtom), exposeState(turnInProgressAtom), exposeMutable(playerTurnOrderAtom), exposeMutable(gameTilesAtom), exposeFamily(playerReadyStatusAtoms,
|
|
29285
|
+
coreStack.push(exposeState(turnNumberAtom), exposeState(gameStateAtom), exposeState(turnInProgressAtom), exposeMutable(playerTurnOrderAtom), exposeMutable(gameTilesAtom), exposeFamily(playerReadyStatusAtoms, usersHereSelector), exposeFamily(playerColorAtoms, usersHereSelector), exposeFamily(playerRemainingCubesAtoms, usersHereSelector), exposeFamily(playerRemainingTilesAtoms, usersHereSelector), exposeFamily(tileOwnerAtoms, gameTilesAtom), exposeFamily(tileCubeCountAtoms, gameTilesAtom), exposeFamily(gameTilesStackHeightAtoms, gameTilesAtom), employSocket(gameSocket, `wantFirst`, () => {
|
|
29127
29286
|
const gameState = getState2(gameStateAtom);
|
|
29128
|
-
if (gameState
|
|
29129
|
-
|
|
29130
|
-
|
|
29287
|
+
if (gameState !== `setup`)
|
|
29288
|
+
return;
|
|
29289
|
+
setState(playerReadyStatusAtoms, userKey, `readyWantsFirst`);
|
|
29131
29290
|
}), employSocket(gameSocket, `wantNotFirst`, () => {
|
|
29132
29291
|
const gameState = getState2(gameStateAtom);
|
|
29133
|
-
if (gameState
|
|
29134
|
-
|
|
29135
|
-
|
|
29292
|
+
if (gameState !== `setup`)
|
|
29293
|
+
return;
|
|
29294
|
+
setState(playerReadyStatusAtoms, userKey, `readyDoesNotWantFirst`);
|
|
29136
29295
|
}), employSocket(gameSocket, `startGame`, async () => {
|
|
29137
|
-
const ownerOfRoomSelector = findRelations(ownersOfRooms, ROOM_KEY).userKeyOfRoom;
|
|
29138
|
-
const ownerOfRoom = getState2(ownerOfRoomSelector);
|
|
29139
29296
|
const gameState = getState2(gameStateAtom);
|
|
29140
|
-
if (ownerOfRoom !== userKey)
|
|
29141
|
-
return;
|
|
29142
29297
|
if (gameState !== `setup`)
|
|
29143
29298
|
return;
|
|
29299
|
+
const ownerOfRoom = getState2(roomOwnerSelector);
|
|
29300
|
+
if (ownerOfRoom !== userKey)
|
|
29301
|
+
return;
|
|
29144
29302
|
const setupGroups = getState2(setupGroupsSelector);
|
|
29145
29303
|
setState(gameStateAtom, `playing`);
|
|
29146
29304
|
const firstPlayersShuffled = pureShuffle(setupGroups.readyWantsFirst);
|
|
@@ -29423,7 +29581,9 @@ parent.receiveRelay((socket, userKey) => {
|
|
|
29423
29581
|
coreStack.push(employSocket(socket, `RESET_GAME`, () => {
|
|
29424
29582
|
setState(gameStateAtom, `setup`);
|
|
29425
29583
|
setState(playerTurnOrderAtom, (permanent) => (permanent.length = 0, permanent));
|
|
29426
|
-
const usersHere = getState2(
|
|
29584
|
+
const usersHere = getState2(usersHereSelector);
|
|
29585
|
+
if (usersHere === null)
|
|
29586
|
+
return;
|
|
29427
29587
|
for (const u of usersHere) {
|
|
29428
29588
|
setState(playerReadyStatusAtoms, u, `notReady`);
|
|
29429
29589
|
setState(playerColorAtoms, u, null);
|
package/bin/frontend.bun.js
CHANGED
|
@@ -12802,7 +12802,7 @@ function realtimeMutableFamilyProvider({
|
|
|
12802
12802
|
} else {
|
|
12803
12803
|
exposedSubKeys = staticIndex;
|
|
12804
12804
|
}
|
|
12805
|
-
const shouldExpose = isAvailable(exposedSubKeys, subKey);
|
|
12805
|
+
const shouldExpose = exposedSubKeys && isAvailable(exposedSubKeys, subKey);
|
|
12806
12806
|
if (shouldExpose) {
|
|
12807
12807
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
12808
12808
|
exposeFamilyMembers(subKey);
|
|
@@ -12815,6 +12815,8 @@ function realtimeMutableFamilyProvider({
|
|
|
12815
12815
|
if (dynamicIndex) {
|
|
12816
12816
|
coreSubscriptions.add(subscribeToState(store, dynamicIndex, `expose-family:${family.key}:${socket.id}`, ({ newValue: newExposedSubKeys }) => {
|
|
12817
12817
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `has the following keys available for family "${family.key}"`, newExposedSubKeys);
|
|
12818
|
+
if (newExposedSubKeys === null)
|
|
12819
|
+
return;
|
|
12818
12820
|
for (const subKey of newExposedSubKeys) {
|
|
12819
12821
|
if (familyMemberSubscriptionsWanted.has(stringifyJson(subKey))) {
|
|
12820
12822
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is retroactively approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
@@ -13206,7 +13208,7 @@ function realtimeAtomFamilyProvider({
|
|
|
13206
13208
|
} else {
|
|
13207
13209
|
exposedSubKeys = staticIndex;
|
|
13208
13210
|
}
|
|
13209
|
-
const shouldExpose = isAvailable2(exposedSubKeys, subKey);
|
|
13211
|
+
const shouldExpose = exposedSubKeys && isAvailable2(exposedSubKeys, subKey);
|
|
13210
13212
|
if (shouldExpose) {
|
|
13211
13213
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
13212
13214
|
exposeFamilyMembers(subKey);
|
|
@@ -13219,6 +13221,8 @@ function realtimeAtomFamilyProvider({
|
|
|
13219
13221
|
if (dynamicIndex) {
|
|
13220
13222
|
coreSubscriptions.add(subscribeToState(store, dynamicIndex, `expose-family:${family.key}:${socket.id}`, ({ newValue: newExposedSubKeys }) => {
|
|
13221
13223
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `has the following keys available for family "${family.key}"`, newExposedSubKeys);
|
|
13224
|
+
if (newExposedSubKeys === null)
|
|
13225
|
+
return;
|
|
13222
13226
|
for (const subKey of newExposedSubKeys) {
|
|
13223
13227
|
if (familyMemberSubscriptionsWanted.has(stringifyJson(subKey))) {
|
|
13224
13228
|
store.logger.info(`\uD83D\uDC40`, `user`, consumer, `is retroactively approved for a subscription to`, subKey, `in family "${family.key}"`);
|
|
@@ -13318,7 +13322,7 @@ var storageSync = (storage, { stringify, parse: parse2 }, key) => ({ setSelf, on
|
|
|
13318
13322
|
var init_web = () => {};
|
|
13319
13323
|
|
|
13320
13324
|
// ../../packages/atom.io/dist/realtime-client/index.js
|
|
13321
|
-
var mySocketKeyAtom, myUserKeyAtom, myRoomKeySelector, optimisticUpdateQueueAtom, confirmedUpdateQueueAtom;
|
|
13325
|
+
var mySocketKeyAtom, myUserKeyAtom, myRoomKeySelector, usersHereSelector, roomOwnerSelector, optimisticUpdateQueueAtom, confirmedUpdateQueueAtom;
|
|
13322
13326
|
var init_realtime_client = __esm(() => {
|
|
13323
13327
|
init_main();
|
|
13324
13328
|
init_main();
|
|
@@ -13352,6 +13356,29 @@ var init_realtime_client = __esm(() => {
|
|
|
13352
13356
|
return null;
|
|
13353
13357
|
}
|
|
13354
13358
|
});
|
|
13359
|
+
usersHereSelector = selector({
|
|
13360
|
+
key: `usersHere`,
|
|
13361
|
+
get: ({ get, find }) => {
|
|
13362
|
+
const myRoomKey = get(myRoomKeySelector);
|
|
13363
|
+
if (!myRoomKey)
|
|
13364
|
+
return null;
|
|
13365
|
+
const [usersInRoomsAtoms] = getInternalRelations(usersInRooms, `split`);
|
|
13366
|
+
return get(find(usersInRoomsAtoms, myRoomKey));
|
|
13367
|
+
}
|
|
13368
|
+
});
|
|
13369
|
+
roomOwnerSelector = selector({
|
|
13370
|
+
key: `roomOwner`,
|
|
13371
|
+
get: ({ get }) => {
|
|
13372
|
+
const myRoomKey = get(myRoomKeySelector);
|
|
13373
|
+
if (!myRoomKey)
|
|
13374
|
+
return null;
|
|
13375
|
+
const [, ownerOfRoomsAtoms] = getInternalRelations(ownersOfRooms, `split`);
|
|
13376
|
+
const owner = get(ownerOfRoomsAtoms, myRoomKey);
|
|
13377
|
+
for (const userKey of owner)
|
|
13378
|
+
return userKey;
|
|
13379
|
+
return null;
|
|
13380
|
+
}
|
|
13381
|
+
});
|
|
13355
13382
|
optimisticUpdateQueueAtom = atom({
|
|
13356
13383
|
key: `optimisticUpdateQueue`,
|
|
13357
13384
|
default: () => []
|
|
@@ -13453,7 +13480,7 @@ var init_realtime_server = __esm(() => {
|
|
|
13453
13480
|
init_server_socket_state();
|
|
13454
13481
|
});
|
|
13455
13482
|
|
|
13456
|
-
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.
|
|
13483
|
+
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.5/node_modules/@t3-oss/env-core/dist/standard.js
|
|
13457
13484
|
function ensureSynchronous(value2, message) {
|
|
13458
13485
|
if (value2 instanceof Promise)
|
|
13459
13486
|
throw new Error(message);
|
|
@@ -13480,7 +13507,7 @@ function parseWithDictionary(dictionary, value2) {
|
|
|
13480
13507
|
}
|
|
13481
13508
|
var init_standard = () => {};
|
|
13482
13509
|
|
|
13483
|
-
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.
|
|
13510
|
+
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.5/node_modules/@t3-oss/env-core/dist/index.js
|
|
13484
13511
|
function createEnv(opts) {
|
|
13485
13512
|
const runtimeEnv = opts.runtimeEnvStrict ?? opts.runtimeEnv ?? process.env;
|
|
13486
13513
|
if (opts.emptyStringAsUndefined ?? false) {
|
package/bin/setup-db.bun.js
CHANGED
|
@@ -5598,7 +5598,7 @@ async function migrate(db, config) {
|
|
|
5598
5598
|
await db.dialect.migrate(migrations, db.session, config);
|
|
5599
5599
|
}
|
|
5600
5600
|
|
|
5601
|
-
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.
|
|
5601
|
+
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.5/node_modules/@t3-oss/env-core/dist/standard.js
|
|
5602
5602
|
function ensureSynchronous(value, message) {
|
|
5603
5603
|
if (value instanceof Promise)
|
|
5604
5604
|
throw new Error(message);
|
|
@@ -5624,7 +5624,7 @@ function parseWithDictionary(dictionary, value) {
|
|
|
5624
5624
|
return { value: result };
|
|
5625
5625
|
}
|
|
5626
5626
|
|
|
5627
|
-
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.
|
|
5627
|
+
// ../../node_modules/.pnpm/@t3-oss+env-core@0.13.10_arktype@2.1.29_typescript@5.9.3_zod@4.3.5/node_modules/@t3-oss/env-core/dist/index.js
|
|
5628
5628
|
function createEnv(opts) {
|
|
5629
5629
|
const runtimeEnv = opts.runtimeEnvStrict ?? opts.runtimeEnv ?? process.env;
|
|
5630
5630
|
if (opts.emptyStringAsUndefined ?? false) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tempest.games",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"arktype": "2.1.29",
|
|
38
38
|
"cron": "4.4.0",
|
|
39
39
|
"drizzle-orm": "0.45.1",
|
|
40
|
-
"motion": "12.
|
|
40
|
+
"motion": "12.24.0",
|
|
41
41
|
"nanoid": "5.1.6",
|
|
42
42
|
"openai": "6.15.0",
|
|
43
43
|
"postgres": "3.4.7",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"socket.io-client": "4.8.3",
|
|
51
51
|
"three": "0.182.0",
|
|
52
52
|
"three-stdlib": "2.36.1",
|
|
53
|
-
"atom.io": "0.46.
|
|
53
|
+
"atom.io": "0.46.17",
|
|
54
54
|
"safedeposit": "0.1.2",
|
|
55
55
|
"treetrunks": "0.1.5"
|
|
56
56
|
},
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"vite": "7.3.0",
|
|
77
77
|
"vite-tsconfig-paths": "6.0.3",
|
|
78
78
|
"vitest": "4.0.16",
|
|
79
|
-
"flightdeck": "0.3.
|
|
79
|
+
"flightdeck": "0.3.37",
|
|
80
80
|
"varmint": "0.5.11"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|