Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix plain malformed query issues

Steven Teyf1111a2b38cb
diff --git a/apps/web/lib/plain.ts b/apps/web/lib/plain.ts
index 723595de69..b38194fa75 100644
--- a/apps/web/lib/plain.ts
+++ b/apps/web/lib/plain.ts
@@ -8,13 +8,16 @@ export const plain = new PlainClient({
type PlainUser = Pick<Session["user"], "id" | "name" | "email">;
export const upsertPlainCustomer = async (user: PlainUser) => {
+ const fullName = user.name ?? user.email;
+ const shortName = user.name ?? user.email.split("@")[0];
+
return await plain.upsertCustomer({
identifier: {
externalId: user.id,
},
onCreate: {
- fullName: user.name,
- shortName: user.name,
+ fullName,
+ shortName,
email: {
email: user.email,
isVerified: true,
@@ -32,8 +35,12 @@ export const createPlainThread = async ({
user: PlainUser;
} & Omit<CreateThreadInput, "customerIdentifier">) => {
let plainCustomerId: string | undefined;
+ if (!user.email) {
+ throw new Error("User email is required");
+ }
+
const plainCustomer = await plain.getCustomerByEmail({
- email: user.email ?? "",
+ email: user.email,
});
if (plainCustomer.data) {
@@ -41,8 +48,8 @@ export const createPlainThread = async ({
} else {
const { data } = await upsertPlainCustomer({
id: user.id,
- name: user.name ?? "",
- email: user.email ?? "",
+ name: user.name,
+ email: user.email,
});
if (data) {
plainCustomerId = data.customer.id;
diff --git a/apps/web/package.json b/apps/web/package.json
index a801cfe662..270a9e40a1 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -41,7 +41,7 @@
"@splinetool/runtime": "^1.2.8",
"@stripe/stripe-js": "^1.44.1",
"@tanstack/react-table": "^8.17.3",
- "@team-plain/typescript-sdk": "^4.5.0",
+ "@team-plain/typescript-sdk": "^5.8.0",
"@types/base-x": "^3.0.10",
"@types/bcryptjs": "^2.4.6",
"@upstash/qstash": "^2.3.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 62489678b2..8b7fc77cbd 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -41,7 +41,7 @@ importers:
version: 1.0.7([email protected])
'@boxyhq/saml-jackson':
specifier: 1.41.0
'@chronark/zod-bird':
specifier: ^0.3.9
version: 0.3.9
@@ -112,8 +112,8 @@ importers:
specifier: ^8.17.3
'@team-plain/typescript-sdk':
- specifier: ^4.5.0
- version: 4.5.0
+ specifier: ^5.8.0
+ version: 5.8.0
'@types/base-x':
specifier: ^3.0.10
version: 3.0.10
@@ -296,7 +296,7 @@ importers:
react-pdf-tailwind:
specifier: ^2.3.0
react-spring:
specifier: ^9.5.5
@@ -411,7 +411,7 @@ importers:
version: 15.1.0([email protected])
tailwindcss:
specifier: ^3.4.4
tsx:
specifier: ^4.19.2
version: 4.19.2
@@ -493,10 +493,10 @@ importers:
version: 5.0.10
ts-node:
specifier: ^10.9.2
tsup:
specifier: ^6.7.0
type-fest:
specifier: ^4.26.1
version: 4.26.1
@@ -526,7 +526,7 @@ importers:
version: 18.2.0([email protected])
react-email:
specifier: ^2.1.6
resend:
specifier: ^4.0.0
@@ -558,7 +558,7 @@ importers:
version: link:../../tsconfig
tsup:
specifier: ^6.1.3
typescript:
specifier: ^5.1.6
version: 5.6.2
@@ -598,7 +598,7 @@ importers:
version: link:../../tsconfig
tsup:
specifier: ^6.1.3
typescript:
specifier: ^5.1.6
version: 5.6.2
@@ -645,7 +645,7 @@ importers:
devDependencies:
'@stripe/ui-extension-tools':
specifier: ^0.0.1
'@types/react':
specifier: ^19.0.2
version: 19.0.2
@@ -657,10 +657,10 @@ importers:
dependencies:
'@tailwindcss/forms':
specifier: ^0.5.6
'@tailwindcss/typography':
specifier: ^0.5.9
tailwind-scrollbar-hide:
specifier: ^1.1.7
version: 1.1.7
@@ -670,10 +670,10 @@ importers:
devDependencies:
'@tailwindcss/container-queries':
specifier: ^0.1.1
tailwindcss:
specifier: ^3.4.4
packages/tsconfig: {}
@@ -847,13 +847,13 @@ importers:
version: 18.2.0
tailwindcss:
specifier: ^3.4.4
tsconfig:
specifier: workspace:*
version: link:../tsconfig
tsup:
specifier: ^6.1.3
typescript:
specifier: ^5.1.6
version: 5.1.6
@@ -905,7 +905,7 @@ importers:
version: link:../tsconfig
tsup:
specifier: ^6.1.3
typescript:
specifier: ^5.1.6
version: 5.1.6
@@ -4972,8 +4972,8 @@ packages:
resolution: {integrity: sha512-mPBodDGVL+fl6d90wUREepHa/7lhsghg2A3vFpakEhrhtbIlgNAZiMr7ccTgak5qbHqF14Fwy+W1yFWQt+WmYQ==}
engines: {node: '>=12'}
- '@team-plain/[email protected]':
- resolution: {integrity: sha512-+m9sfToLtlkV6wOnpYBxGnRwEpvn4zcaXHhA+C4lst52U6cvTzTCw2t7z2EYgXqe/IG/5voR5DiiyKK1vIM32g==}
+ '@team-plain/[email protected]':
+ resolution: {integrity: sha512-qgDGX96yDsdTo5+Yh8R+rhtInmAm90w17607B2Ugik8Ij0H1wocjjp8xtMxHruSmms5ani43Y5xRxVFPSxYVeg==}
'@tediousjs/[email protected]':
resolution: {integrity: sha512-7qSgZbincDDDFyRweCIEvZULFAw5iz/DeunhvuxpL31nfntX3P4Yd4HkHBRg9H8CdqY1e5WFN1PZIz/REL9MVQ==}
@@ -13445,7 +13445,7 @@ snapshots:
'@opentelemetry/sdk-metrics': 1.30.1(@opentelemetry/[email protected])
'@opentelemetry/semantic-conventions': 1.29.0
dependencies:
'@aws-sdk/client-dynamodb': 3.758.0
'@aws-sdk/credential-providers': 3.758.0
@@ -13470,7 +13470,7 @@ snapshots:
reflect-metadata: 0.2.2
ripemd160: 2.0.2
sqlite3: 5.1.7
transitivePeerDependencies:
- '@google-cloud/spanner'
- '@mongodb-js/zstd'
@@ -14060,7 +14060,7 @@ snapshots:
jest-util: 27.5.1
slash: 3.0.0
dependencies:
'@jest/console': 27.5.1
'@jest/reporters': 27.5.1
@@ -14074,7 +14074,7 @@ snapshots:
exit: 0.1.2
graceful-fs: 4.2.11
jest-changed-files: 27.5.1
- jest-config: 27.5.1([email protected]([email protected]))
jest-haste-map: 27.5.1
jest-message-util: 27.5.1
jest-regex-util: 27.5.1
@@ -16953,7 +16953,7 @@ snapshots:
react: 17.0.2
stripe: 13.11.0
dependencies:
'@types/jest': 28.1.8
'@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
@@ -16961,9 +16961,9 @@ snapshots:
eslint: 8.48.0
eslint-plugin-react: 7.34.1([email protected])
eslint-plugin-react-hooks: 4.6.2([email protected])
jest-transform-stub: 2.0.0
typescript: 4.9.5
transitivePeerDependencies:
- '@babel/core'
@@ -17048,22 +17048,22 @@ snapshots:
dependencies:
defer-to-connect: 2.0.1
dependencies:
- tailwindcss: 3.4.4([email protected]([email protected]))
dependencies:
mini-svg-data-uri: 1.4.4
- tailwindcss: 3.4.4([email protected]([email protected]))
dependencies:
lodash.castarray: 4.4.0
lodash.isplainobject: 4.0.6
lodash.merge: 4.6.2
postcss-selector-parser: 6.0.10
- tailwindcss: 3.4.4([email protected]([email protected]))
dependencies:
@@ -17073,12 +17073,13 @@ snapshots:
'@tanstack/[email protected]': {}
- '@team-plain/[email protected]':
+ '@team-plain/[email protected]':
dependencies:
'@graphql-typed-document-node/core': 3.2.0([email protected])
ajv: 8.12.0
ajv-formats: 2.1.1([email protected])
graphql: 16.8.1
+ lodash.get: 4.4.2
zod: 3.22.4
'@tediousjs/[email protected]': {}
@@ -20702,16 +20703,16 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
- '@jest/core': 27.5.1([email protected]([email protected]))
'@jest/test-result': 27.5.1
'@jest/types': 27.5.1
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
import-local: 3.1.0
- jest-config: 27.5.1([email protected]([email protected]))
jest-util: 27.5.1
jest-validate: 27.5.1
prompts: 2.4.2
@@ -20723,7 +20724,7 @@ snapshots:
- ts-node
- utf-8-validate
dependencies:
'@babel/core': 7.24.5
'@jest/test-sequencer': 27.5.1
@@ -20750,7 +20751,7 @@ snapshots:
slash: 3.0.0
strip-json-comments: 3.1.1
optionalDependencies:
- ts-node: 10.9.2([email protected])
transitivePeerDependencies:
- bufferutil
- canvas
@@ -21121,11 +21122,11 @@ snapshots:
merge-stream: 2.0.0
supports-color: 8.1.1
dependencies:
- '@jest/core': 27.5.1([email protected]([email protected]))
import-local: 3.1.0
transitivePeerDependencies:
- bufferutil
- canvas
@@ -22889,69 +22890,61 @@ snapshots:
camelcase-css: 2.0.1
postcss: 8.4.38
dependencies:
lilconfig: 2.1.0
yaml: 1.10.2
optionalDependencies:
postcss: 8.4.31
dependencies:
lilconfig: 2.1.0
yaml: 1.10.2
optionalDependencies:
postcss: 8.4.31
dependencies:
lilconfig: 2.1.0
yaml: 1.10.2
optionalDependencies:
postcss: 8.4.38
dependencies:
lilconfig: 2.1.0
yaml: 1.10.2
optionalDependencies:
postcss: 8.4.38
- dependencies:
- lilconfig: 2.1.0
- yaml: 1.10.2
- optionalDependencies:
- postcss: 8.4.38
-
dependencies:
lilconfig: 2.1.0
yaml: 2.3.4
optionalDependencies:
postcss: 8.4.38
dependencies:
lilconfig: 2.1.0
yaml: 2.3.4
optionalDependencies:
postcss: 8.4.38
- ts-node: 10.9.2(@types/[email protected])([email protected])
dependencies:
lilconfig: 2.1.0
yaml: 2.3.4
optionalDependencies:
postcss: 8.4.38
dependencies:
@@ -23203,7 +23196,7 @@ snapshots:
react: 19.0.0
scheduler: 0.25.0
dependencies:
'@babel/core': 7.24.5
'@babel/parser': 7.24.5
@@ -23243,7 +23236,7 @@ snapshots:
source-map-js: 1.0.2
stacktrace-parser: 0.1.10
tailwind-merge: 2.2.0
- tailwindcss: 3.4.0([email protected]([email protected]))
typescript: 5.1.6
transitivePeerDependencies:
- '@opentelemetry/api'
@@ -23354,10 +23347,10 @@ snapshots:
react: 18.2.0
react-dom: 18.2.0([email protected])
dependencies:
'@react-pdf/renderer': 3.4.5([email protected])([email protected])
transitivePeerDependencies:
- encoding
- react
@@ -24460,7 +24453,7 @@ snapshots:
dependencies:
'@alloc/quick-lru': 5.2.0
arg: 5.0.2
@@ -24479,7 +24472,7 @@ snapshots:
postcss: 8.4.38
postcss-import: 15.1.0([email protected])
postcss-js: 4.0.1([email protected])
postcss-nested: 6.0.1([email protected])
postcss-selector-parser: 6.0.13
resolve: 1.22.6
@@ -24487,7 +24480,7 @@ snapshots:
transitivePeerDependencies:
- ts-node
dependencies:
'@alloc/quick-lru': 5.2.0
arg: 5.0.2
@@ -24506,7 +24499,7 @@ snapshots:
postcss: 8.4.38
postcss-import: 15.1.0([email protected])
postcss-js: 4.0.1([email protected])
postcss-nested: 6.0.1([email protected])
postcss-selector-parser: 6.0.13
resolve: 1.22.6
@@ -24514,7 +24507,7 @@ snapshots:
transitivePeerDependencies:
- ts-node
dependencies:
'@alloc/quick-lru': 5.2.0
arg: 5.0.2
@@ -24533,7 +24526,7 @@ snapshots:
postcss: 8.4.38
postcss-import: 15.1.0([email protected])
postcss-js: 4.0.1([email protected])
postcss-nested: 6.0.1([email protected])
postcss-selector-parser: 6.0.13
resolve: 1.22.6
@@ -24541,7 +24534,7 @@ snapshots:
transitivePeerDependencies:
- ts-node
dependencies:
'@alloc/quick-lru': 5.2.0
arg: 5.0.2
@@ -24560,7 +24553,7 @@ snapshots:
postcss: 8.4.38
postcss-import: 15.1.0([email protected])
postcss-js: 4.0.1([email protected])
postcss-nested: 6.0.1([email protected])
postcss-selector-parser: 6.0.13
resolve: 1.22.6
@@ -24620,7 +24613,7 @@ snapshots:
ansi-escapes: 4.3.2
supports-hyperlinks: 2.3.0
dependencies:
'@jridgewell/trace-mapping': 0.3.25
jest-worker: 27.5.1
@@ -24723,11 +24716,11 @@ snapshots:
dependencies:
bs-logger: 0.2.6
fast-json-stable-stringify: 2.1.0
jest-util: 27.5.1
json5: 2.2.3
lodash.memoize: 4.1.2
@@ -24740,7 +24733,7 @@ snapshots:
'@types/jest': 28.1.8
babel-jest: 27.5.1(@babel/[email protected])
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.11
@@ -24754,14 +24747,14 @@ snapshots:
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
- typescript: 5.1.6
+ typescript: 4.9.5
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
optionalDependencies:
'@swc/core': 1.3.101(@swc/[email protected])
optional: true
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.11
@@ -24775,13 +24768,14 @@ snapshots:
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
- typescript: 5.6.2
+ typescript: 5.1.6
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
optionalDependencies:
'@swc/core': 1.3.101(@swc/[email protected])
+ optional: true
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.11
@@ -24798,25 +24792,29 @@ snapshots:
typescript: 5.4.4
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
+ optionalDependencies:
+ '@swc/core': 1.3.101(@swc/[email protected])
optional: true
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.11
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
+ '@types/node': 18.11.9
acorn: 8.11.3
acorn-walk: 8.3.2
arg: 4.1.3
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
- typescript: 4.9.5
+ typescript: 5.6.2
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
- optional: true
+ optionalDependencies:
+ '@swc/core': 1.3.101(@swc/[email protected])
optionalDependencies:
@@ -24826,7 +24824,7 @@ snapshots:
dependencies:
bundle-require: 3.1.2([email protected])
cac: 6.7.14
@@ -24836,7 +24834,7 @@ snapshots:
execa: 5.1.1
globby: 11.1.0
joycon: 3.1.1
resolve-from: 5.0.0
rollup: 2.79.1
source-map: 0.8.0-beta.0
@@ -24850,7 +24848,7 @@ snapshots:
- supports-color
- ts-node
dependencies:
bundle-require: 3.1.2([email protected])
cac: 6.7.14
@@ -24860,7 +24858,7 @@ snapshots:
execa: 5.1.1
globby: 11.1.0
joycon: 3.1.1
resolve-from: 5.0.0
rollup: 2.79.1
source-map: 0.8.0-beta.0
@@ -24874,7 +24872,7 @@ snapshots:
- supports-color
- ts-node
dependencies:
bundle-require: 4.2.1([email protected])
cac: 6.7.14
@@ -24884,7 +24882,7 @@ snapshots:
execa: 5.1.1
globby: 11.1.0
joycon: 3.1.1
resolve-from: 5.0.0
rollup: 3.29.5
source-map: 0.8.0-beta.0
@@ -24898,31 +24896,7 @@ snapshots:
- supports-color
- ts-node
- dependencies:
- bundle-require: 4.2.1([email protected])
- cac: 6.7.14
- chokidar: 3.5.3
- debug: 4.3.4
- esbuild: 0.17.19
- execa: 5.1.1
- globby: 11.1.0
- joycon: 3.1.1
- resolve-from: 5.0.0
- rollup: 3.29.5
- source-map: 0.8.0-beta.0
- sucrase: 3.34.0
- tree-kill: 1.2.2
- optionalDependencies:
- '@swc/core': 1.3.101(@swc/[email protected])
- postcss: 8.4.38
- typescript: 5.6.2
- transitivePeerDependencies:
- - supports-color
- - ts-node
-
dependencies:
bundle-require: 4.2.1([email protected])
cac: 6.7.14
@@ -24932,7 +24906,7 @@ snapshots:
execa: 5.1.1
globby: 11.1.0
joycon: 3.1.1
resolve-from: 5.0.0
rollup: 3.29.5
source-map: 0.8.0-beta.0
@@ -25102,7 +25076,7 @@ snapshots:
dependencies:
is-typedarray: 1.0.0
dependencies:
'@sqltools/formatter': 1.2.5
ansis: 3.17.0
@@ -25125,7 +25099,7 @@ snapshots:
pg: 8.13.3
redis: 4.7.0
sqlite3: 5.1.7
- ts-node: 10.9.2(@types/[email protected])([email protected])
transitivePeerDependencies:
- supports-color
@@ -25544,7 +25518,7 @@ snapshots:
neo-async: 2.6.2
schema-utils: 3.3.0
tapable: 2.2.1
- terser-webpack-plugin: 5.3.10(@swc/[email protected](@swc/[email protected]))([email protected])([email protected])
watchpack: 2.4.0
webpack-sources: 3.2.3
transitivePeerDependencies: