@teamkeel/functions-runtime 0.396.7 → 0.396.8-next.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/database.js +13 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamkeel/functions-runtime",
3
- "version": "0.396.7",
3
+ "version": "0.396.8-next.1",
4
4
  "description": "Internal package used by @teamkeel/sdk",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/database.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const { Kysely, PostgresDialect, CamelCasePlugin } = require("kysely");
2
2
  const neonserverless = require("@neondatabase/serverless");
3
+ const types = require("@neondatabase/serverless");
3
4
  const { AsyncLocalStorage } = require("async_hooks");
4
5
  const { AuditContextPlugin } = require("./auditing");
5
6
  const pg = require("pg");
@@ -140,15 +141,15 @@ class InstrumentedClient extends pg.Client {
140
141
  }
141
142
 
142
143
  function getDialect() {
143
- // Adding a custom type parser for numeric fields: see https://kysely.dev/docs/recipes/data-types#configuring-runtime-javascript-types
144
- // 1700 = type for NUMERIC
145
- pg.types.setTypeParser(1700, function (val) {
146
- return parseFloat(val);
147
- });
148
-
149
144
  const dbConnType = process.env["KEEL_DB_CONN_TYPE"];
150
145
  switch (dbConnType) {
151
146
  case "pg":
147
+ // Adding a custom type parser for numeric fields: see https://kysely.dev/docs/recipes/data-types#configuring-runtime-javascript-types
148
+ // 1700 = type for NUMERIC
149
+ pg.types.setTypeParser(1700, function (val) {
150
+ return parseFloat(val);
151
+ });
152
+
152
153
  return new PostgresDialect({
153
154
  pool: new InstrumentedPool({
154
155
  Client: InstrumentedClient,
@@ -169,6 +170,12 @@ function getDialect() {
169
170
  }),
170
171
  });
171
172
  case "neon":
173
+ // Adding a custom type parser for numeric fields: see https://kysely.dev/docs/recipes/data-types#configuring-runtime-javascript-types
174
+ // 1700 = type for NUMERIC
175
+ types.setTypeParser(1700, function (val) {
176
+ return parseFloat(val);
177
+ });
178
+
172
179
  neonserverless.neonConfig.webSocketConstructor = ws;
173
180
 
174
181
  const pool = new InstrumentedNeonServerlessPool({