New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@prisma/adapter-neon

Package Overview
Dependencies
Maintainers
0
Versions
2136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma/adapter-neon - npm Package Compare versions

Comparing version 6.5.0-dev.24 to 6.5.0-dev.25

37

dist/index.d.ts
import type { ConnectionInfo } from '@prisma/driver-adapter-utils';
import type { DriverAdapter } from '@prisma/driver-adapter-utils';
import * as neon from '@neondatabase/serverless';
import type { Query } from '@prisma/driver-adapter-utils';
import type { Queryable } from '@prisma/driver-adapter-utils';
import type { Result } from '@prisma/driver-adapter-utils';
import type { ResultSet } from '@prisma/driver-adapter-utils';
import type { SqlConnection } from '@prisma/driver-adapter-utils';
import type { SqlQuery } from '@prisma/driver-adapter-utils';
import type { SqlQueryable } from '@prisma/driver-adapter-utils';
import type { SqlResultSet } from '@prisma/driver-adapter-utils';
import type { TransactionContext } from '@prisma/driver-adapter-utils';

@@ -15,3 +14,3 @@

*/
declare abstract class NeonQueryable implements Queryable {
declare abstract class NeonQueryable implements SqlQueryable {
readonly provider = "postgres";

@@ -22,3 +21,3 @@ readonly adapterName: string;

*/
queryRaw(query: Query): Promise<Result<ResultSet>>;
queryRaw(query: SqlQuery): Promise<SqlResultSet>;
/**

@@ -29,3 +28,3 @@ * Execute a query given as SQL, interpolating the given parameters and

*/
executeRaw(query: Query): Promise<Result<number>>;
executeRaw(query: SqlQuery): Promise<number>;
/**

@@ -36,3 +35,3 @@ * Run a query against the database, returning the result set.

*/
abstract performIO(query: Query): Promise<Result<PerformIOResult>>;
abstract performIO(query: SqlQuery): Promise<PerformIOResult>;
}

@@ -46,3 +45,4 @@

constructor(client: ClientT);
performIO(query: Query): Promise<Result<PerformIOResult>>;
performIO(query: SqlQuery): Promise<PerformIOResult>;
protected onError(e: any): never;
}

@@ -52,16 +52,19 @@

export declare class PrismaNeon extends NeonWsQueryable<neon.Pool> implements DriverAdapter {
export declare class PrismaNeon extends NeonWsQueryable<neon.Pool> implements SqlConnection {
private options?;
private isRunning;
constructor(pool: neon.Pool, options?: PrismaNeonOptions | undefined);
getConnectionInfo(): Result<ConnectionInfo>;
transactionContext(): Promise<Result<TransactionContext>>;
close(): Promise<Result<undefined>>;
executeScript(_script: string): Promise<void>;
getConnectionInfo(): ConnectionInfo;
transactionContext(): Promise<TransactionContext>;
dispose(): Promise<void>;
}
export declare class PrismaNeonHTTP extends NeonQueryable implements DriverAdapter {
export declare class PrismaNeonHTTP extends NeonQueryable implements SqlConnection {
private client;
constructor(client: neon.NeonQueryFunction<any, any>);
performIO(query: Query): Promise<Result<PerformIOResult>>;
transactionContext(): Promise<Result<TransactionContext>>;
executeScript(_script: string): Promise<void>;
performIO(query: SqlQuery): Promise<PerformIOResult>;
transactionContext(): Promise<TransactionContext>;
dispose(): Promise<void>;
}

@@ -68,0 +71,0 @@

@@ -384,7 +384,3 @@ "use strict";

debug(`${tag} %O`, query);
const res = await this.performIO(query);
if (!res.ok) {
return (0, import_driver_adapter_utils2.err)(res.error);
}
const { fields, rows } = res.value;
const { fields, rows } = await this.performIO(query);
const columnNames = fields.map((field) => field.name);

@@ -396,3 +392,3 @@ let columnTypes = [];

if (e instanceof UnsupportedNativeDataType) {
return (0, import_driver_adapter_utils2.err)({
throw new import_driver_adapter_utils2.DriverAdapterError({
kind: "UnsupportedNativeDataType",

@@ -404,7 +400,7 @@ type: e.type

}
return (0, import_driver_adapter_utils2.ok)({
return {
columnNames,
columnTypes,
rows
});
};
}

@@ -419,3 +415,3 @@ /**

debug(`${tag} %O`, query);
return (await this.performIO(query)).map((r) => r.rowCount ?? 0);
return (await this.performIO(query)).rowCount ?? 0;
}

@@ -459,19 +455,22 @@ };

);
return (0, import_driver_adapter_utils2.ok)(result);
return result;
} catch (e) {
debug("Error in performIO: %O", e);
if (e && typeof e.code === "string" && typeof e.severity === "string" && typeof e.message === "string") {
return (0, import_driver_adapter_utils2.err)({
kind: "postgres",
code: e.code,
severity: e.severity,
message: e.message,
detail: e.detail,
column: e.column,
hint: e.hint
});
}
throw e;
this.onError(e);
}
}
onError(e) {
debug("Error in onError: %O", e);
if (e && typeof e.code === "string" && typeof e.severity === "string" && typeof e.message === "string") {
throw new import_driver_adapter_utils2.DriverAdapterError({
kind: "postgres",
code: e.code,
severity: e.severity,
message: e.message,
detail: e.detail,
column: e.column,
hint: e.hint
});
}
throw e;
}
};

@@ -486,3 +485,2 @@ var NeonTransaction = class extends NeonWsQueryable {

this.client.release();
return Promise.resolve((0, import_driver_adapter_utils2.ok)(void 0));
}

@@ -492,3 +490,2 @@ async rollback() {

this.client.release();
return Promise.resolve((0, import_driver_adapter_utils2.ok)(void 0));
}

@@ -507,3 +504,3 @@ };

debug("%s options: %O", tag, options);
return (0, import_driver_adapter_utils2.ok)(new NeonTransaction(this.conn, options));
return new NeonTransaction(this.conn, options);
}

@@ -524,12 +521,15 @@ };

}
executeScript(_script) {
throw new Error("Not implemented yet");
}
getConnectionInfo() {
return (0, import_driver_adapter_utils2.ok)({
return {
schemaName: this.options?.schema
});
};
}
async transactionContext() {
const conn = await this.client.connect();
return (0, import_driver_adapter_utils2.ok)(new NeonTransactionContext(conn));
return new NeonTransactionContext(conn);
}
async close() {
async dispose() {
if (this.isRunning) {

@@ -539,3 +539,2 @@ await this.client.end();

}
return (0, import_driver_adapter_utils2.ok)(void 0);
}

@@ -548,24 +547,25 @@ };

}
executeScript(_script) {
throw new Error("Not implemented yet");
}
async performIO(query) {
const { sql, args: values } = query;
return (0, import_driver_adapter_utils2.ok)(
await this.client(sql, values, {
arrayMode: true,
fullResults: true,
// pass type parsers to neon() HTTP client, same as in WS client above
//
// requires @neondatabase/serverless >= 0.9.5
// - types option added in https://github.com/neondatabase/serverless/pull/92
types: {
getTypeParser: (oid, format) => {
if (format === "text" && customParsers[oid]) {
return customParsers[oid];
}
return neon.types.getTypeParser(oid, format);
return await this.client(sql, values, {
arrayMode: true,
fullResults: true,
// pass type parsers to neon() HTTP client, same as in WS client above
//
// requires @neondatabase/serverless >= 0.9.5
// - types option added in https://github.com/neondatabase/serverless/pull/92
types: {
getTypeParser: (oid, format) => {
if (format === "text" && customParsers[oid]) {
return customParsers[oid];
}
return neon.types.getTypeParser(oid, format);
}
// type `as` cast required until neon types are corrected:
// https://github.com/neondatabase/serverless/pull/110#issuecomment-2458992991
})
);
}
// type `as` cast required until neon types are corrected:
// https://github.com/neondatabase/serverless/pull/110#issuecomment-2458992991
});
}

@@ -575,2 +575,4 @@ transactionContext() {

}
async dispose() {
}
};

@@ -577,0 +579,0 @@ // Annotate the CommonJS export names for ESM import in node:

{
"name": "@prisma/adapter-neon",
"version": "6.5.0-dev.24",
"version": "6.5.0-dev.25",
"description": "Prisma's driver adapter for \"@neondatabase/serverless\"",

@@ -35,3 +35,3 @@ "main": "dist/index.js",

"postgres-array": "3.0.2",
"@prisma/driver-adapter-utils": "6.5.0-dev.24"
"@prisma/driver-adapter-utils": "6.5.0-dev.25"
},

@@ -38,0 +38,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc