Skip to content

Commit

Permalink
chore(js-connectors): fix typo in conversion.ts, update JS deps, bu…
Browse files Browse the repository at this point in the history
…mp npm version to `0.0.8` (#4156)

* chore(js-connectors): fix typo

* chore(js-connectors): update deps

* chore(js-connectors): version bump to 0.0.8
  • Loading branch information
jkomyno authored Aug 22, 2023
1 parent 9c82a05 commit 98bd6d1
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 147 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jkomyno/prisma-js-connector-utils",
"version": "0.0.1",
"version": "0.0.8",
"description": "Internal set of utilities and types for Prisma's JS Connectors.",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jkomyno/prisma-neon-js-connector",
"version": "0.0.1",
"version": "0.0.8",
"description": "Prisma's JS Connector for \"@neondatabase/serverless\"",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
4 changes: 2 additions & 2 deletions query-engine/js-connectors/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"keywords": [],
"author": "",
"devDependencies": {
"@types/node": "^20.4.5",
"tsup": "^7.1.0",
"@types/node": "^20.5.1",
"tsup": "^7.2.0",
"typescript": "^5.1.6"
}
}
4 changes: 2 additions & 2 deletions query-engine/js-connectors/js/pg-js-connector/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jkomyno/prisma-pg-js-connector",
"version": "0.0.1",
"version": "0.0.8",
"description": "Prisma's JS Connector for \"pg\"",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand All @@ -19,7 +19,7 @@
"sideEffects": false,
"dependencies": {
"@jkomyno/prisma-js-connector-utils": "workspace:*",
"pg": "^8.11.2"
"pg": "^8.11.3"
},
"devDependencies": {
"@types/pg": "^8.10.2"
Expand Down
36 changes: 18 additions & 18 deletions query-engine/js-connectors/js/pg-js-connector/src/conversion.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ColumnTypeEnum, type ColumnType } from '@jkomyno/prisma-js-connector-utils'
import { types } from 'pg'

const NeonColumnType = types.builtins
const PgColumnType = types.builtins

/**
* This is a simplification of quaint's value inference logic. Take a look at quaint's conversion.rs
Expand All @@ -10,31 +10,31 @@ const NeonColumnType = types.builtins
*/
export function fieldToColumnType(fieldTypeId: number): ColumnType {
switch (fieldTypeId) {
case NeonColumnType['INT2']:
case NeonColumnType['INT4']:
case PgColumnType['INT2']:
case PgColumnType['INT4']:
return ColumnTypeEnum.Int32
case NeonColumnType['INT8']:
case PgColumnType['INT8']:
return ColumnTypeEnum.Int64
case NeonColumnType['FLOAT4']:
case PgColumnType['FLOAT4']:
return ColumnTypeEnum.Float
case NeonColumnType['FLOAT8']:
case PgColumnType['FLOAT8']:
return ColumnTypeEnum.Double
case NeonColumnType['BOOL']:
case PgColumnType['BOOL']:
return ColumnTypeEnum.Boolean
case NeonColumnType['DATE']:
case PgColumnType['DATE']:
return ColumnTypeEnum.Date
case NeonColumnType['TIME']:
case PgColumnType['TIME']:
return ColumnTypeEnum.Time
case NeonColumnType['TIMESTAMP']:
case PgColumnType['TIMESTAMP']:
return ColumnTypeEnum.DateTime
case NeonColumnType['NUMERIC']:
case PgColumnType['NUMERIC']:
return ColumnTypeEnum.Numeric
case NeonColumnType['BPCHAR']:
case PgColumnType['BPCHAR']:
return ColumnTypeEnum.Char
case NeonColumnType['TEXT']:
case NeonColumnType['VARCHAR']:
case PgColumnType['TEXT']:
case PgColumnType['VARCHAR']:
return ColumnTypeEnum.Text
case NeonColumnType['JSONB']:
case PgColumnType['JSONB']:
return ColumnTypeEnum.Json
default:
if (fieldTypeId >= 10000) {
Expand All @@ -46,6 +46,6 @@ export function fieldToColumnType(fieldTypeId: number): ColumnType {
}

// return string instead of JavaScript Date object
types.setTypeParser(NeonColumnType.DATE, date => date)
types.setTypeParser(NeonColumnType.TIME, date => date)
types.setTypeParser(NeonColumnType.TIMESTAMP, date => date)
types.setTypeParser(PgColumnType.DATE, date => date)
types.setTypeParser(PgColumnType.TIME, date => date)
types.setTypeParser(PgColumnType.TIMESTAMP, date => date)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jkomyno/prisma-planetscale-js-connector",
"version": "0.0.1",
"version": "0.0.8",
"description": "Prisma's JS Connector for \"@planetscale/database\"",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand All @@ -18,7 +18,7 @@
"license": "Apache-2.0",
"sideEffects": false,
"dependencies": {
"@planetscale/database": "^1.10.0",
"@jkomyno/prisma-js-connector-utils": "workspace:*"
"@jkomyno/prisma-js-connector-utils": "workspace:*",
"@planetscale/database": "^1.11.0"
}
}
Loading

0 comments on commit 98bd6d1

Please sign in to comment.