Skip to content

Commit ae5e5b5

Browse files
author
Sujay Jayakar
committed
Remove node10stubs
1 parent b6836c8 commit ae5e5b5

File tree

12 files changed

+245
-289
lines changed

12 files changed

+245
-289
lines changed

example/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Example app
2-
This app uses the Twilio component.
32

3+
This app uses the Twilio component.

example/convex/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* to compile TypeScript because differences between tsconfig.json files can
2424
* cause the code to be compiled differently.
2525
*/
26-
"customConditions": ["@convex-dev/component-source"]
26+
"customConditions": ["@convex-dev/component-source"]
2727
},
2828
"include": ["./**/*"],
2929
"exclude": ["./_generated"]

example/package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"dependencies": {
1111
"@convex-dev/twilio": "file:..",
12-
"convex": "^1.16.5"
12+
"convex": "~1.16.5 || ~1.17.0"
1313
},
1414
"devDependencies": {
1515
"@eslint/eslintrc": "^3.1.0",

node10stubs.mjs

Lines changed: 0 additions & 86 deletions
This file was deleted.

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "@convex-dev/twilio",
3+
"description": "Convex component for sending/receiving SMS messages with Twilio.",
34
"version": "0.1.2",
45
"type": "module",
56
"repository": "github:get-convex/twilio",
@@ -8,7 +9,7 @@
89
"email": "support@convex.dev",
910
"url": "https://github.com/get-convex/twilio/issues"
1011
},
11-
"licenese": "Apache-2.0",
12+
"license": "Apache-2.0",
1213
"keywords": [
1314
"convex",
1415
"twilio",
@@ -19,14 +20,11 @@
1920
"build:esm": "tsc --project ./esm.json && echo '{\\n \"type\": \"module\"\\n}' > dist/esm/package.json",
2021
"build:cjs": "tsc --project ./commonjs.json && echo '{\\n \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json",
2122
"typecheck": "tsc --noEmit",
22-
"prepare": "npm run build",
23-
"prepack": "node node10stubs.mjs",
24-
"postpack": "node node10stubs.mjs --cleanup"
23+
"prepare": "npm run build"
2524
},
2625
"files": [
2726
"dist",
28-
"src",
29-
"frontend"
27+
"src"
3028
],
3129
"exports": {
3230
"./package.json": "./package.json",

src/client/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class Twilio<
4343
httpPrefix?: string;
4444
incomingMessageCallback?: MessageHandler;
4545
defaultOutgoingMessageCallback?: MessageHandler;
46-
} & From
46+
} & From,
4747
) {
4848
this.accountSid =
4949
options?.TWILIO_ACCOUNT_SID ?? process.env.TWILIO_ACCOUNT_SID!;
@@ -53,7 +53,7 @@ export class Twilio<
5353
throw new Error(
5454
"Missing Twilio credentials\n\n" +
5555
"npx convex env set TWILIO_ACCOUNT_SID=ACxxxxx\n" +
56-
"npx convex env set TWILIO_AUTH_TOKEN=xxxxx"
56+
"npx convex env set TWILIO_AUTH_TOKEN=xxxxx",
5757
);
5858
}
5959
this.defaultFrom = options.defaultFrom;
@@ -105,7 +105,7 @@ export class Twilio<
105105
incomingMessageCallback:
106106
this.incomingMessageCallback &&
107107
(await createFunctionHandle(this.incomingMessageCallback)),
108-
}
108+
},
109109
);
110110

111111
return new Response(null, { status: 200 });
@@ -134,7 +134,7 @@ export class Twilio<
134134
} & (From["defaultFrom"] extends string
135135
? { from?: string }
136136
: { from: string })
137-
>
137+
>,
138138
) {
139139
const from = args.from ?? this.defaultFrom;
140140
if (!from) {
@@ -260,7 +260,7 @@ export class Twilio<
260260
*/
261261
async getMessagesFrom(
262262
ctx: RunQueryCtx,
263-
args: { from: string; limit?: number }
263+
args: { from: string; limit?: number },
264264
) {
265265
return ctx.runQuery(this.componentApi.messages.getFrom, {
266266
...args,
@@ -279,7 +279,7 @@ export class Twilio<
279279
*/
280280
async getMessagesByCounterparty(
281281
ctx: RunQueryCtx,
282-
args: { counterparty: string; limit?: number }
282+
args: { counterparty: string; limit?: number },
283283
) {
284284
return ctx.runQuery(this.componentApi.messages.getByCounterparty, {
285285
...args,
@@ -325,7 +325,7 @@ declare global {
325325

326326
if (typeof Convex === "undefined") {
327327
throw new Error(
328-
"this is Convex backend code, but it's running somewhere else!"
328+
"this is Convex backend code, but it's running somewhere else!",
329329
);
330330
}
331331
type componentApiType = UseApi<typeof api>;

src/component/messages.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const create = action({
4242
To: args.to,
4343
Body: args.body,
4444
StatusCallback: args.status_callback,
45-
}
45+
},
4646
);
4747
// store some properties as fields and the rest as a nested object
4848
const databaseMessage = convertToDatabaseMessage(message);
@@ -83,9 +83,9 @@ export const list = query({
8383
ctx.db
8484
.query("messages")
8585
.withIndex("by_account_sid", (q) =>
86-
q.eq("account_sid", args.account_sid)
86+
q.eq("account_sid", args.account_sid),
8787
),
88-
args.limit
88+
args.limit,
8989
);
9090
},
9191
});
@@ -101,9 +101,9 @@ export const listIncoming = query({
101101
ctx.db
102102
.query("messages")
103103
.withIndex("by_account_sid_and_direction", (q) =>
104-
q.eq("account_sid", args.account_sid).eq("direction", "inbound")
104+
q.eq("account_sid", args.account_sid).eq("direction", "inbound"),
105105
),
106-
args.limit
106+
args.limit,
107107
);
108108
},
109109
});
@@ -118,9 +118,9 @@ export const listOutgoing = query({
118118
ctx.db
119119
.query("messages")
120120
.withIndex("by_account_sid_and_direction", (q) =>
121-
q.eq("account_sid", args.account_sid).eq("direction", "outbound-api")
121+
q.eq("account_sid", args.account_sid).eq("direction", "outbound-api"),
122122
),
123-
args.limit
123+
args.limit,
124124
);
125125
},
126126
});
@@ -135,7 +135,7 @@ export const getBySid = query({
135135
const message = await ctx.db
136136
.query("messages")
137137
.withIndex("by_sid", (q) =>
138-
q.eq("account_sid", args.account_sid).eq("sid", args.sid)
138+
q.eq("account_sid", args.account_sid).eq("sid", args.sid),
139139
)
140140
.first();
141141
return message && withoutSystemFields(message);
@@ -154,9 +154,9 @@ export const getTo = query({
154154
ctx.db
155155
.query("messages")
156156
.withIndex("by_to", (q) =>
157-
q.eq("account_sid", args.account_sid).eq("to", args.to)
157+
q.eq("account_sid", args.account_sid).eq("to", args.to),
158158
),
159-
args.limit
159+
args.limit,
160160
);
161161
},
162162
});
@@ -173,9 +173,9 @@ export const getFrom = query({
173173
ctx.db
174174
.query("messages")
175175
.withIndex("by_from", (q) =>
176-
q.eq("account_sid", args.account_sid).eq("from", args.from)
176+
q.eq("account_sid", args.account_sid).eq("from", args.from),
177177
),
178-
args.limit
178+
args.limit,
179179
);
180180
},
181181
});
@@ -194,9 +194,9 @@ export const getByCounterparty = query({
194194
.withIndex("by_counterparty", (q) =>
195195
q
196196
.eq("account_sid", args.account_sid)
197-
.eq("counterparty", args.counterparty)
197+
.eq("counterparty", args.counterparty),
198198
),
199-
args.limit
199+
args.limit,
200200
);
201201
},
202202
});
@@ -212,7 +212,7 @@ export const updateStatus = mutation({
212212
const message = await ctx.db
213213
.query("messages")
214214
.withIndex("by_sid", (q) =>
215-
q.eq("account_sid", args.account_sid).eq("sid", args.sid)
215+
q.eq("account_sid", args.account_sid).eq("sid", args.sid),
216216
)
217217
.first();
218218
if (!message) {
@@ -236,7 +236,7 @@ export const getFromTwilioBySidAndInsert = action({
236236
args.account_sid,
237237
args.auth_token,
238238
{},
239-
"GET"
239+
"GET",
240240
);
241241
const databaseMessage = convertToDatabaseMessage(message);
242242
return ctx.runMutation(internal.messages.insert, {
@@ -300,7 +300,7 @@ function convertToDatabaseMessage(message: any) {
300300

301301
async function takeOrCollectFields(
302302
query: Query<NamedTableInfo<DataModel, "messages">>,
303-
limit: number | undefined
303+
limit: number | undefined,
304304
): Promise<Message[]> {
305305
let messagesPromise;
306306
if (limit) {

0 commit comments

Comments
 (0)