Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remult

Package Overview
Dependencies
Maintainers
0
Versions
618
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remult - npm Package Compare versions

Comparing version 0.26.16 to 0.26.17

esm/remult-duckdb.js

10

esm/remult-sqlite-core.js

@@ -8,6 +8,8 @@ import { SqlDatabase } from './src/data-providers/sql-database.js';

doesNotSupportReturningSyntax;
constructor(createCommand, end, doesNotSupportReturningSyntax = false) {
doesNotSupportReturningSyntaxOnlyForUpdate;
constructor(createCommand, end, doesNotSupportReturningSyntax = false, doesNotSupportReturningSyntaxOnlyForUpdate = false) {
this.createCommand = createCommand;
this.end = end;
this.doesNotSupportReturningSyntax = doesNotSupportReturningSyntax;
this.doesNotSupportReturningSyntaxOnlyForUpdate = doesNotSupportReturningSyntaxOnlyForUpdate;
}

@@ -27,3 +29,3 @@ orderByNullsFirst;

let e = await dbNamesOf(entity, this.wrapIdentifier);
let sql = `alter table ${e.$entityName} add column ${self.addColumnSqlSyntax(field, e.$dbNameOf(field))}`;
let sql = `alter table ${e.$entityName} add column ${self.addColumnSqlSyntax(field, e.$dbNameOf(field), true)}`;
builder.addSql(sql);

@@ -57,3 +59,3 @@ },

}
addColumnSqlSyntax(x, dbName) {
addColumnSqlSyntax(x, dbName, isAlterTable) {
let result = dbName;

@@ -96,3 +98,3 @@ const nullNumber = x.allowNull ? '' : ' default 0 not null';

else {
result += this.addColumnSqlSyntax(x, e.$dbNameOf(x));
result += this.addColumnSqlSyntax(x, e.$dbNameOf(x), false);
if (x.key == entity.idMetadata.field.key) {

@@ -99,0 +101,0 @@ result += ' primary key';

13

esm/src/data-providers/sql-database.js

@@ -79,2 +79,5 @@ import { FilterConsumerBridgeToSqlRequest, dbNamesOf, isDbReadonly, } from '../filter/filter-consumer-bridge-to-sql-request.js';

end: this.end,
doesNotSupportReturningSyntax: this.sql.doesNotSupportReturningSyntax,
doesNotSupportReturningSyntaxOnlyForUpdate: this.sql.doesNotSupportReturningSyntaxOnlyForUpdate,
orderByNullsFirst: this.sql.orderByNullsFirst,
}));

@@ -348,7 +351,13 @@ }

let { colKeys, select } = this.buildSelect(e);
if (!this.sql._getSourceSql().doesNotSupportReturningSyntax)
let returning = true;
if (this.sql._getSourceSql().doesNotSupportReturningSyntax)
returning = false;
if (returning &&
this.sql._getSourceSql().doesNotSupportReturningSyntaxOnlyForUpdate)
returning = false;
if (returning)
statement += ' returning ' + select;
return r.execute(statement).then((sqlResult) => {
this.sql._getSourceSql().afterMutation?.();
if (this.sql._getSourceSql().doesNotSupportReturningSyntax) {
if (!returning) {
return getRowAfterUpdate(this.entity, this, data, id, 'update');

@@ -355,0 +364,0 @@ }

export const flags = {
error500RetryCount: 4,
};
//y1 - 'test expression columns without aliases'
//p1 - see if I can fix the no alias problem in selects
//p1 - add luid - it's cool for order by.

@@ -14,2 +16,3 @@ //p1 - replace uuid with crypto.randomUUID and allow custom fallback

//p1 - Fix hagai and starter project to latest ts
//y1 - talk about the $ sign in my filter rules - no other orm uses that (part of sql work, with $ etc)
//y1 TODO - discuss next auth withRemult paradox - the gift that keeps on giving - it's doing something crazy there!!

@@ -16,0 +19,0 @@ //p1 - fix chaining of saving and saved in multiple entity options args

{
"name": "remult",
"version": "0.26.16",
"version": "0.26.17",
"description": "A CRUD framework for full-stack TypeScript",

@@ -124,2 +124,7 @@ "homepage": "https://remult.dev",

},
"./remult-duckdb": {
"require": "./remult-duckdb.js",
"import": "./esm/remult-duckdb.js",
"types": "./remult-duckdb.d.ts"
},
"./remult-bun-sqlite": {

@@ -126,0 +131,0 @@ "require": "./remult-bun-sqlite.js",

import type { EntityMetadata } from './src/remult3/remult3.js';
import type { SqlCommand, SqlImplementation } from './src/sql-command.js';
import type { FieldMetadata } from './src/column-interfaces.js';
import type { CanBuildMigrations, MigrationBuilder, MigrationCode } from './migrations/migration-types.js';

@@ -8,3 +9,4 @@ export declare class SqliteCoreDataProvider implements SqlImplementation, CanBuildMigrations {

doesNotSupportReturningSyntax: boolean;
constructor(createCommand: () => SqlCommand, end: () => Promise<void>, doesNotSupportReturningSyntax?: boolean);
doesNotSupportReturningSyntaxOnlyForUpdate: boolean;
constructor(createCommand: () => SqlCommand, end: () => Promise<void>, doesNotSupportReturningSyntax?: boolean, doesNotSupportReturningSyntaxOnlyForUpdate?: boolean);
orderByNullsFirst?: boolean;

@@ -18,7 +20,7 @@ getLimitSqlSyntax(limit: number, offset: number): string;

dropTable(entity: EntityMetadata): Promise<void>;
private addColumnSqlSyntax;
addColumnSqlSyntax(x: FieldMetadata, dbName: string, isAlterTable: boolean): string;
createTableIfNotExist(entity: EntityMetadata<any>): Promise<void>;
supportsJsonColumnType?: boolean;
private getCreateTableSql;
getCreateTableSql(entity: EntityMetadata<any>): Promise<string>;
wrapIdentifier(name: string): string;
}

@@ -9,7 +9,9 @@ "use strict";

var SqliteCoreDataProvider = /** @class */ (function () {
function SqliteCoreDataProvider(createCommand, end, doesNotSupportReturningSyntax) {
function SqliteCoreDataProvider(createCommand, end, doesNotSupportReturningSyntax, doesNotSupportReturningSyntaxOnlyForUpdate) {
if (doesNotSupportReturningSyntax === void 0) { doesNotSupportReturningSyntax = false; }
if (doesNotSupportReturningSyntaxOnlyForUpdate === void 0) { doesNotSupportReturningSyntaxOnlyForUpdate = false; }
this.createCommand = createCommand;
this.end = end;
this.doesNotSupportReturningSyntax = doesNotSupportReturningSyntax;
this.doesNotSupportReturningSyntaxOnlyForUpdate = doesNotSupportReturningSyntaxOnlyForUpdate;
}

@@ -43,3 +45,3 @@ SqliteCoreDataProvider.prototype.getLimitSqlSyntax = function (limit, offset) {

e = _a.sent();
sql = "alter table ".concat(e.$entityName, " add column ").concat(self.addColumnSqlSyntax(field, e.$dbNameOf(field)));
sql = "alter table ".concat(e.$entityName, " add column ").concat(self.addColumnSqlSyntax(field, e.$dbNameOf(field), true));
builder.addSql(sql);

@@ -141,3 +143,3 @@ return [2 /*return*/];

};
SqliteCoreDataProvider.prototype.addColumnSqlSyntax = function (x, dbName) {
SqliteCoreDataProvider.prototype.addColumnSqlSyntax = function (x, dbName, isAlterTable) {
var result = dbName;

@@ -201,3 +203,3 @@ var nullNumber = x.allowNull ? '' : ' default 0 not null';

else {
result += this.addColumnSqlSyntax(x, e.$dbNameOf(x));
result += this.addColumnSqlSyntax(x, e.$dbNameOf(x), false);
if (x.key == entity.idMetadata.field.key) {

@@ -204,0 +206,0 @@ result += ' primary key';

@@ -1,2 +0,2 @@

import { SqlImplementation } from './index.js';
import type { SqlImplementation } from './index.js';
import { SqliteCoreDataProvider } from './remult-sqlite-core.js';

@@ -3,0 +3,0 @@ import type { Client } from '@libsql/client';

@@ -139,2 +139,5 @@ "use strict";

end: this.end,
doesNotSupportReturningSyntax: this.sql.doesNotSupportReturningSyntax,
doesNotSupportReturningSyntaxOnlyForUpdate: this.sql.doesNotSupportReturningSyntaxOnlyForUpdate,
orderByNullsFirst: this.sql.orderByNullsFirst,
}))];

@@ -478,3 +481,3 @@ case 2:

return tslib_1.__awaiter(this, void 0, void 0, function () {
var e, r, statement, added, _a, _b, x, v, idFilter, f, _c, _d, colKeys, select;
var e, r, statement, added, _a, _b, x, v, idFilter, f, _c, _d, colKeys, select, returning;
var e_5, _e;

@@ -522,3 +525,9 @@ var _this = this;

_d = this.buildSelect(e), colKeys = _d.colKeys, select = _d.select;
if (!this.sql._getSourceSql().doesNotSupportReturningSyntax)
returning = true;
if (this.sql._getSourceSql().doesNotSupportReturningSyntax)
returning = false;
if (returning &&
this.sql._getSourceSql().doesNotSupportReturningSyntaxOnlyForUpdate)
returning = false;
if (returning)
statement += ' returning ' + select;

@@ -528,3 +537,3 @@ return [2 /*return*/, r.execute(statement).then(function (sqlResult) {

(_b = (_a = _this.sql._getSourceSql()).afterMutation) === null || _b === void 0 ? void 0 : _b.call(_a);
if (_this.sql._getSourceSql().doesNotSupportReturningSyntax) {
if (!returning) {
return getRowAfterUpdate(_this.entity, _this, data, id, 'update');

@@ -531,0 +540,0 @@ }

@@ -7,2 +7,4 @@ "use strict";

};
//y1 - 'test expression columns without aliases'
//p1 - see if I can fix the no alias problem in selects
//p1 - add luid - it's cool for order by.

@@ -18,2 +20,3 @@ //p1 - replace uuid with crypto.randomUUID and allow custom fallback

//p1 - Fix hagai and starter project to latest ts
//y1 - talk about the $ sign in my filter rules - no other orm uses that (part of sql work, with $ etc)
//y1 TODO - discuss next auth withRemult paradox - the gift that keeps on giving - it's doing something crazy there!!

@@ -20,0 +23,0 @@ //p1 - fix chaining of saving and saved in multiple entity options args

@@ -11,2 +11,3 @@ import type { EntityMetadata } from './remult3/remult3.js';

doesNotSupportReturningSyntax?: boolean;
doesNotSupportReturningSyntaxOnlyForUpdate?: boolean;
orderByNullsFirst?: boolean;

@@ -13,0 +14,0 @@ end(): Promise<void>;

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