@epic-web/workshop-presence 6.49.0 → 6.49.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/dist/presence.js CHANGED
@@ -2,6 +2,13 @@ import { z } from 'zod';
2
2
  export const partykitRoom = 'epic-web-presence';
3
3
  // export const partykitBaseUrl = `http://127.0.0.1:1999/parties/main/${partykitRoom}`
4
4
  export const partykitBaseUrl = `https://epic-web-presence.kentcdodds.partykit.dev/parties/main/${partykitRoom}`;
5
+ export const RepoStatusSchema = z.object({
6
+ updatesAvailable: z.boolean().nullable().optional(),
7
+ commitsAhead: z.number().nullable().optional(),
8
+ commitsBehind: z.number().nullable().optional(),
9
+ localCommit: z.string().nullable().optional(),
10
+ remoteCommit: z.string().nullable().optional(),
11
+ });
5
12
  export const LocationSchema = z.object({
6
13
  workshopTitle: z.string().nullable().optional(),
7
14
  origin: z.string().nullable().optional(),
@@ -17,13 +24,10 @@ export const LocationSchema = z.object({
17
24
  })
18
25
  .nullable()
19
26
  .optional(),
20
- });
21
- export const RepoStatusSchema = z.object({
22
- updatesAvailable: z.boolean().nullable().optional(),
23
- commitsAhead: z.number().nullable().optional(),
24
- commitsBehind: z.number().nullable().optional(),
25
- localCommit: z.string().nullable().optional(),
26
- remoteCommit: z.string().nullable().optional(),
27
+ // Version of the epicshop app for this location/workshop
28
+ epicshopVersion: z.string().nullable().optional(),
29
+ // Repository status (updates available, commits ahead/behind) for this location/workshop
30
+ repoStatus: RepoStatusSchema.nullable().optional(),
27
31
  });
28
32
  export const UserSchema = z.object({
29
33
  id: z.string(),
@@ -39,10 +43,6 @@ export const UserSchema = z.object({
39
43
  location: LocationSchema.nullable().optional(),
40
44
  // Multiple locations when user is connected from multiple workshops
41
45
  locations: z.array(LocationSchema).nullable().optional(),
42
- // Version of the epicshop app the user is running
43
- epicshopVersion: z.string().nullable().optional(),
44
- // Repository status (updates available, commits ahead/behind)
45
- repoStatus: RepoStatusSchema.nullable().optional(),
46
46
  });
47
47
  export const MessageSchema = z
48
48
  .object({
@@ -20,6 +20,14 @@ export declare const presenceCache: {
20
20
  exerciseNumber?: number | null | undefined;
21
21
  stepNumber?: number | null | undefined;
22
22
  } | null | undefined;
23
+ epicshopVersion?: string | null | undefined;
24
+ repoStatus?: {
25
+ updatesAvailable?: boolean | null | undefined;
26
+ commitsAhead?: number | null | undefined;
27
+ commitsBehind?: number | null | undefined;
28
+ localCommit?: string | null | undefined;
29
+ remoteCommit?: string | null | undefined;
30
+ } | null | undefined;
23
31
  } | null | undefined;
24
32
  locations?: {
25
33
  workshopTitle?: string | null | undefined;
@@ -30,15 +38,15 @@ export declare const presenceCache: {
30
38
  exerciseNumber?: number | null | undefined;
31
39
  stepNumber?: number | null | undefined;
32
40
  } | null | undefined;
41
+ epicshopVersion?: string | null | undefined;
42
+ repoStatus?: {
43
+ updatesAvailable?: boolean | null | undefined;
44
+ commitsAhead?: number | null | undefined;
45
+ commitsBehind?: number | null | undefined;
46
+ localCommit?: string | null | undefined;
47
+ remoteCommit?: string | null | undefined;
48
+ } | null | undefined;
33
49
  }[] | null | undefined;
34
- epicshopVersion?: string | null | undefined;
35
- repoStatus?: {
36
- updatesAvailable?: boolean | null | undefined;
37
- commitsAhead?: number | null | undefined;
38
- commitsBehind?: number | null | undefined;
39
- localCommit?: string | null | undefined;
40
- remoteCommit?: string | null | undefined;
41
- } | null | undefined;
42
50
  }[]>) => import("@epic-web/cachified").CacheEntry<{
43
51
  id: string;
44
52
  hasAccess?: boolean | null | undefined;
@@ -57,6 +65,14 @@ export declare const presenceCache: {
57
65
  exerciseNumber?: number | null | undefined;
58
66
  stepNumber?: number | null | undefined;
59
67
  } | null | undefined;
68
+ epicshopVersion?: string | null | undefined;
69
+ repoStatus?: {
70
+ updatesAvailable?: boolean | null | undefined;
71
+ commitsAhead?: number | null | undefined;
72
+ commitsBehind?: number | null | undefined;
73
+ localCommit?: string | null | undefined;
74
+ remoteCommit?: string | null | undefined;
75
+ } | null | undefined;
60
76
  } | null | undefined;
61
77
  locations?: {
62
78
  workshopTitle?: string | null | undefined;
@@ -67,15 +83,15 @@ export declare const presenceCache: {
67
83
  exerciseNumber?: number | null | undefined;
68
84
  stepNumber?: number | null | undefined;
69
85
  } | null | undefined;
86
+ epicshopVersion?: string | null | undefined;
87
+ repoStatus?: {
88
+ updatesAvailable?: boolean | null | undefined;
89
+ commitsAhead?: number | null | undefined;
90
+ commitsBehind?: number | null | undefined;
91
+ localCommit?: string | null | undefined;
92
+ remoteCommit?: string | null | undefined;
93
+ } | null | undefined;
70
94
  }[] | null | undefined;
71
- epicshopVersion?: string | null | undefined;
72
- repoStatus?: {
73
- updatesAvailable?: boolean | null | undefined;
74
- commitsAhead?: number | null | undefined;
75
- commitsBehind?: number | null | undefined;
76
- localCommit?: string | null | undefined;
77
- remoteCommit?: string | null | undefined;
78
- } | null | undefined;
79
95
  }[]>;
80
96
  get: (key: string) => import("@epic-web/cachified").CacheEntry<{
81
97
  id: string;
@@ -95,6 +111,14 @@ export declare const presenceCache: {
95
111
  exerciseNumber?: number | null | undefined;
96
112
  stepNumber?: number | null | undefined;
97
113
  } | null | undefined;
114
+ epicshopVersion?: string | null | undefined;
115
+ repoStatus?: {
116
+ updatesAvailable?: boolean | null | undefined;
117
+ commitsAhead?: number | null | undefined;
118
+ commitsBehind?: number | null | undefined;
119
+ localCommit?: string | null | undefined;
120
+ remoteCommit?: string | null | undefined;
121
+ } | null | undefined;
98
122
  } | null | undefined;
99
123
  locations?: {
100
124
  workshopTitle?: string | null | undefined;
@@ -105,15 +129,15 @@ export declare const presenceCache: {
105
129
  exerciseNumber?: number | null | undefined;
106
130
  stepNumber?: number | null | undefined;
107
131
  } | null | undefined;
132
+ epicshopVersion?: string | null | undefined;
133
+ repoStatus?: {
134
+ updatesAvailable?: boolean | null | undefined;
135
+ commitsAhead?: number | null | undefined;
136
+ commitsBehind?: number | null | undefined;
137
+ localCommit?: string | null | undefined;
138
+ remoteCommit?: string | null | undefined;
139
+ } | null | undefined;
108
140
  }[] | null | undefined;
109
- epicshopVersion?: string | null | undefined;
110
- repoStatus?: {
111
- updatesAvailable?: boolean | null | undefined;
112
- commitsAhead?: number | null | undefined;
113
- commitsBehind?: number | null | undefined;
114
- localCommit?: string | null | undefined;
115
- remoteCommit?: string | null | undefined;
116
- } | null | undefined;
117
141
  }[]> | undefined;
118
142
  delete: (key: string) => boolean;
119
143
  };
@@ -74,37 +74,22 @@ export async function getPresentUsers({ timings, request, } = {}) {
74
74
  catch {
75
75
  // Ignore errors from checking for updates
76
76
  }
77
- // If opted out, include user with minimal info (just id and optOut flag)
78
- if (isOptOut) {
79
- const optOutUser = {
80
- id: userId,
81
- optOut: true,
82
- loggedInProductHosts,
83
- epicshopVersion,
84
- repoStatus,
85
- };
86
- return uniqueUsers([...users.filter((u) => u.id !== userId), optOutUser]);
87
- }
88
- // Build full user info
89
- const user = {
90
- id: userId,
91
- loggedInProductHosts,
92
- epicshopVersion,
93
- repoStatus,
94
- };
95
77
  const config = getWorkshopConfig();
96
78
  const url = request ? new URL(request.url) : undefined;
97
- user.location = {
79
+ // Build location with version and repo status
80
+ const location = {
98
81
  workshopTitle: config.title,
99
82
  origin: url ? url.origin : undefined,
100
83
  productHost: config.product.host,
84
+ epicshopVersion,
85
+ repoStatus,
101
86
  };
102
87
  if (url) {
103
88
  if (url.pathname.startsWith('/exercise/')) {
104
89
  const [exerciseNumber, stepNumber, type] = url.pathname
105
90
  .split('/')
106
91
  .slice(2);
107
- user.location.exercise = {
92
+ location.exercise = {
108
93
  exerciseNumber: isNaN(Number(exerciseNumber))
109
94
  ? null
110
95
  : Number(exerciseNumber),
@@ -117,6 +102,22 @@ export async function getPresentUsers({ timings, request, } = {}) {
117
102
  };
118
103
  }
119
104
  }
105
+ // If opted out, include user with minimal info but still include location
106
+ if (isOptOut) {
107
+ const optOutUser = {
108
+ id: userId,
109
+ optOut: true,
110
+ loggedInProductHosts,
111
+ location,
112
+ };
113
+ return uniqueUsers([...users.filter((u) => u.id !== userId), optOutUser]);
114
+ }
115
+ // Build full user info
116
+ const user = {
117
+ id: userId,
118
+ loggedInProductHosts,
119
+ location,
120
+ };
120
121
  if (authInfo) {
121
122
  const [userInfo, hasAccess] = await Promise.all([
122
123
  getUserInfo({ request, timings }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epic-web/workshop-presence",
3
- "version": "6.49.0",
3
+ "version": "6.49.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -14,7 +14,7 @@
14
14
  "deploy": "partykit deploy"
15
15
  },
16
16
  "dependencies": {
17
- "@epic-web/workshop-utils": "6.49.0",
17
+ "@epic-web/workshop-utils": "6.49.1",
18
18
  "zod": "^3.25.76"
19
19
  },
20
20
  "devDependencies": {