@indietabletop/appkit 5.4.0 → 5.5.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/lib/client.ts CHANGED
@@ -297,9 +297,17 @@ export class IndieTabletopClient {
297
297
  }
298
298
 
299
299
  async logout() {
300
- return await this.fetch("/v1/sessions", object({ message: string() }), {
301
- method: "DELETE",
302
- });
300
+ const result = await this.fetch(
301
+ "/v1/sessions",
302
+ object({ message: string() }),
303
+ { method: "DELETE" },
304
+ );
305
+
306
+ // Emit sessionExpired to make sure that relevant listeners are run as if the
307
+ // session was expired.
308
+ this.dispatchEvent("sessionExpired");
309
+
310
+ return result;
303
311
  }
304
312
 
305
313
  async join(payload: {
@@ -67,7 +67,16 @@ export function createAppMachineProvider<
67
67
  >(options: {
68
68
  database: ModernIDB<Schema, Indexes> & DatabaseAppMachineMethods;
69
69
  client: IndieTabletopClient;
70
- pullGameDataFor: GameCode | GameCode[];
70
+
71
+ /**
72
+ * Which games should the machine pull game data for?
73
+ *
74
+ * If null is provided, no data will be pulled.
75
+ *
76
+ * @remarks Honestly this is a bit hacky and we should have a better way to
77
+ * disable sync entirely for apps that don't need it (e.g. the Creators App).
78
+ */
79
+ pullGameDataFor: GameCode | GameCode[] | null;
71
80
  }) {
72
81
  const { client, database } = options;
73
82
 
@@ -123,6 +132,10 @@ export function createAppMachineProvider<
123
132
 
124
133
  const pullChanges = fromPromise<PullResult, PullChangesInput>(
125
134
  async ({ input }) => {
135
+ if (!options.pullGameDataFor) {
136
+ return new Success({ pulled: [] });
137
+ }
138
+
126
139
  const result = await client.pullUserData({
127
140
  include: options.pullGameDataFor,
128
141
  sinceTs: input.sinceTs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indietabletop/appkit",
3
- "version": "5.4.0",
3
+ "version": "5.5.1",
4
4
  "description": "A collection of modules used in apps built by Indie Tabletop Club",
5
5
  "private": false,
6
6
  "type": "module",
@@ -60,5 +60,6 @@
60
60
  "workerDirectory": [
61
61
  "public"
62
62
  ]
63
- }
63
+ },
64
+ "packageManager": "npm@11.7.0+sha512.c22099a6fff8d5b2286c2a09df5352b4858a7c0c716320f58989d60ad8b29ecf2ce6fdfe97ccb41c23ffb1272e1fa079f868487dd6b81d02a2a9e199c095a117"
64
65
  }