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

workers-qb

Package Overview
Dependencies
Maintainers
0
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workers-qb - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

14

dist/index.d.ts

@@ -0,1 +1,3 @@

import { SqlStorage } from '@cloudflare/workers-types/experimental';
declare enum OrderTypes {

@@ -248,2 +250,12 @@ ASC = "ASC",

export { type ArrayResult, ConflictTypes, type ConflictUpsert, type D1Meta, D1QB, type D1Result, type DefaultObject, type DefaultReturnObject, type Delete, type DeleteReturning, type DeleteWithoutReturning, FetchTypes, type Insert, type InsertMultiple, type InsertOne, type InsertWithoutReturning, type Join, JoinTypes, type OneResult, OrderTypes, PGQB, type PGResult, type Primitive, Query, QueryBuilder, Raw, type RawQuery, type RawQueryFetchAll, type RawQueryFetchOne, type RawQueryWithoutFetching, type SelectAll, type SelectOne, type Update, type UpdateReturning, type UpdateWithoutReturning, type Where, type test };
declare class DurableObjectDatabaseQB extends QueryBuilder<{}> {
db: SqlStorage;
constructor(db: SqlStorage);
execute(query: Query): Promise<{
results: Record<string, string | number | ArrayBuffer | null> | undefined;
} | {
results: Record<string, string | number | ArrayBuffer | null>[];
}>;
}
export { type ArrayResult, ConflictTypes, type ConflictUpsert, type D1Meta, D1QB, type D1Result, type DefaultObject, type DefaultReturnObject, type Delete, type DeleteReturning, type DeleteWithoutReturning, DurableObjectDatabaseQB, FetchTypes, type Insert, type InsertMultiple, type InsertOne, type InsertWithoutReturning, type Join, JoinTypes, type OneResult, OrderTypes, PGQB, type PGResult, type Primitive, Query, QueryBuilder, Raw, type RawQuery, type RawQueryFetchAll, type RawQueryFetchOne, type RawQueryWithoutFetching, type SelectAll, type SelectOne, type Update, type UpdateReturning, type UpdateWithoutReturning, type Where, type test };

@@ -25,2 +25,3 @@ "use strict";

D1QB: () => D1QB,
DurableObjectDatabaseQB: () => DurableObjectDatabaseQB,
FetchTypes: () => FetchTypes,

@@ -602,2 +603,43 @@ JoinTypes: () => JoinTypes,

};
// src/databases/do.ts
var DurableObjectDatabaseQB = class extends QueryBuilder {
db;
constructor(db) {
super();
this.db = db;
}
async execute(query) {
if (this._debugger) {
console.log({
"workers-qb": {
query: query.query,
arguments: query.arguments,
fetchType: query.fetchType
}
});
}
if (query.arguments) {
let stmt = this.db.prepare(query.query);
const result = stmt(...query.arguments);
if (query.fetchType == "ONE" /* ONE */) {
return {
results: Array.from(result)[0]
};
}
return {
results: Array.from(result)
};
}
const cursor = this.db.exec(query.query);
if (query.fetchType == "ONE" /* ONE */) {
return {
results: Array.from(cursor)[0]
};
}
return {
results: Array.from(cursor)
};
}
};
// Annotate the CommonJS export names for ESM import in node:

@@ -607,2 +649,3 @@ 0 && (module.exports = {

D1QB,
DurableObjectDatabaseQB,
FetchTypes,

@@ -609,0 +652,0 @@ JoinTypes,

3

package.json
{
"name": "workers-qb",
"version": "1.4.1",
"version": "1.4.2",
"description": "Zero dependencies Query Builder for Cloudflare Workers",

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

"devDependencies": {
"@cloudflare/workers-types": "^4.20240815.0",
"@types/jest": "^29.5.12",

@@ -61,0 +62,0 @@ "@typescript-eslint/eslint-plugin": "^4.31.1",

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