Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 92 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"convex": "^1.24.8"
},
"dependencies": {
"convex-helpers": "0.1.111"
"convex-helpers": "0.1.111",
"expo-server-sdk": "^5.0.0"
},
Comment on lines +69 to 71
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

expo-server-sdk npm latest version

💡 Result:

The latest npm version of expo-server-sdk (dist-tag latest) is 4.0.0. [1][2]

Install: npm i expo-server-sdk@latest [1]

Sources:
[1] Yarn package page (shows dist-tags and versions) (classic.yarnpkg.com)
[2] UNPKG package.json for v4.0.0 (app.unpkg.com)

Citations:


Update expo-server-sdk to v4.0.0—v5 is not the current version.

The package specifies "^5.0.0", but the latest version on npm is v4.0.0. Update the dependency accordingly.

The original observation about dependency placement remains valid: only import type is used to reference ExpoPushMessage, so the SDK code is never executed at runtime. If the public type export were decoupled, this could move to devDependencies. However, prioritize the version correction first.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 69 - 71, The package.json currently pins
"expo-server-sdk" to "^5.0.0" which is incorrect; change the version string for
the "expo-server-sdk" dependency to "4.0.0" in package.json, then run your
package manager (npm/yarn/pnpm) to update node_modules and the lockfile;
optionally, if the code only uses the exported type ExpoPushMessage via "import
type", consider moving "expo-server-sdk" to devDependencies after verifying no
runtime imports exist, and ensure tests/build succeed after the change.

"devDependencies": {
"@edge-runtime/vm": "5.0.0",
Expand Down
16 changes: 12 additions & 4 deletions src/component/_generated/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
mutableContent?: boolean;
numPreviousFailures: number;
priority?: "default" | "normal" | "high";
sound?: string | null;
icon?: string;
richContent?: { image?: string };
sound?: string | null | { critical?: boolean; name?: string | null; volume?: number };
state:
| "awaiting_delivery"
| "in_progress"
Expand Down Expand Up @@ -93,7 +95,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
mutableContent?: boolean;
numPreviousFailures: number;
priority?: "default" | "normal" | "high";
sound?: string | null;
icon?: string;
richContent?: { image?: string };
sound?: string | null | { critical?: boolean; name?: string | null; volume?: number };
state:
| "awaiting_delivery"
| "in_progress"
Expand Down Expand Up @@ -168,7 +172,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
| "time-sensitive";
mutableContent?: boolean;
priority?: "default" | "normal" | "high";
sound?: string | null;
icon?: string;
richContent?: { image?: string };
sound?: string | null | { critical?: boolean; name?: string | null; volume?: number };
subtitle?: string;
title?: string;
ttl?: number;
Expand Down Expand Up @@ -200,7 +206,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
| "time-sensitive";
mutableContent?: boolean;
priority?: "default" | "normal" | "high";
sound?: string | null;
icon?: string;
richContent?: { image?: string };
sound?: string | null | { critical?: boolean; name?: string | null; volume?: number };
subtitle?: string;
title?: string;
ttl?: number;
Expand Down
13 changes: 8 additions & 5 deletions src/component/internal.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { v, type JSONValue } from "convex/values";
import { v } from "convex/values";
import { internalAction, internalMutation } from "./functions.js";
import { internal } from "./_generated/api.js";
import type { Id } from "./_generated/dataModel.js";
import { ensureCoordinator } from "./helpers.js";
import { notificationFields } from "./schema.js";
import type {
ExpoPushSuccessTicket,
ExpoPushErrorTicket,
} from "expo-server-sdk";

export const markNotificationState = internalMutation({
args: {
Expand Down Expand Up @@ -158,6 +162,8 @@ export const coordinateSendingPushNotifications = internalMutation({
badge: n.metadata.badge ?? undefined,
interruptionLevel: n.metadata.interruptionLevel ?? undefined,
channelId: n.metadata.channelId ?? undefined,
icon: n.metadata.icon ?? undefined,
richContent: n.metadata.richContent ?? undefined,
categoryId: n.metadata.categoryId ?? undefined,
mutableContent: n.metadata.mutableContent ?? undefined,
},
Expand Down Expand Up @@ -274,10 +280,7 @@ export const action_sendPushNotifications = internalAction({
return;
}
const responseBody: {
data: Array<
| { status: "ok"; id: string }
| { status: "error"; message: string; details: JSONValue }
>;
data: Array<ExpoPushSuccessTicket | ExpoPushErrorTicket>;
} = await response.json();
ctx.logger.debug(
`Response from Expo's API: ${JSON.stringify(responseBody)}`,
Expand Down
Loading
Loading