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

@e-mc/db

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@e-mc/db - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

10

index.js

@@ -123,3 +123,3 @@ "use strict";

const terminate = () => {
this.applyState(batch, 8 /* TRANSACTION.TERMINATE */);
this.applyState(batch, 8 /* TRANSACTION_DB.TERMINATE */);
if (typeof disconnect === 'function') {

@@ -134,3 +134,3 @@ try {

const cleanup = () => {
this.applyState(batch, 16 /* TRANSACTION.ABORT */);
this.applyState(batch, 16 /* TRANSACTION_DB.ABORT */);
terminate();

@@ -166,3 +166,3 @@ if (outResult) {

handleFail(err, item, options) {
this.add(item, 32 /* TRANSACTION.FAIL */);
this.add(item, 32 /* TRANSACTION_DB.FAIL */);
item.transactionFail = true;

@@ -192,7 +192,7 @@ if (options && typeof options.errorQuery === 'function') {

return this.executeQuery(data).catch(() => {
this.applyState([data], 16 /* TRANSACTION.ABORT */);
this.applyState([data], 16 /* TRANSACTION_DB.ABORT */);
return [];
});
});
return tasks.length === 0 ? Promise.resolve(false) : this.allSettled(tasks, ["Execute unassigned queries" /* CMD_DB.EXEC_QUERYUNASSIGNED */, this.moduleName]).then(result => result.length > 0).catch(() => false);
return tasks.length === 0 ? Promise.resolve(false) : this.allSettled(tasks, ["Execute unassigned queries" /* VAL_DB.EXEC_QUERYUNASSIGNED */, this.moduleName]).then(result => result.length > 0).catch(() => false);
}

@@ -199,0 +199,0 @@ readTLSCert(value, cache) {

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

import type { MongoDBDataSource, MongoDBSortValue } from '../../types/lib/db';
import type { MongoDBDataSource, MongoDBFilterValue, MongoDBSortValue } from '../../types/lib/db';

@@ -7,11 +7,4 @@ import type { IDbSourceClient } from '../types';

interface DocumentFilterValue {
value?: DocumentFilter;
options?: CommandOperationOptions;
}
type DocumentFilter = Filter<Document>;
declare const MongoDB: IDbSourceClient<MongoDBDataSource> & {
getFilterValue: (query: DocumentFilter | DocumentFilterValue, coerce?: boolean) => [DocumentFilter, CommandOperationOptions?];
getFilterValue: (query: Filter<Document> | MongoDBFilterValue, coerce?: boolean) => [Filter<Document>, CommandOperationOptions?];
getSortValue: (sort: Sort | string | MongoDBSortValue, coerce?: boolean) => [Sort | string, SortDirection?];

@@ -18,0 +11,0 @@ };

@@ -385,3 +385,3 @@ "use strict";

const getConnection = async (item, credential) => {
item.transactionState = 64 /* TRANSACTION.AUTH */;
item.transactionState = 64 /* TRANSACTION_DB.AUTH */;
const pool = item.usePool && pool_1.default.findKey(POOL_STATE, item.usePool, getPoolKey(connectOnce ? batch[0] : item), ...connectOnce ? [item, batch[0]] : [item]);

@@ -414,3 +414,3 @@ let client;

}
item.transactionState &= ~64 /* TRANSACTION.AUTH */;
item.transactionState &= ~64 /* TRANSACTION_DB.AUTH */;
return client;

@@ -440,3 +440,3 @@ };

}
item.transactionState = 1 /* TRANSACTION.ACTIVE */;
item.transactionState = 1 /* TRANSACTION_DB.ACTIVE */;
const getCollection = (target) => target.db(name, client?.db).collection(table, client?.collection);

@@ -472,3 +472,3 @@ const credential = mongoCredential || onceCredential || getCacheObject(item);

}
this.add(item, 4 /* TRANSACTION.COMMIT */ | 128 /* TRANSACTION.CACHE */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */ | 128 /* TRANSACTION_DB.CACHE */);
return true;

@@ -601,3 +601,3 @@ }

else {
this.add(item, 4 /* TRANSACTION.COMMIT */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */);
resolve(!error ? this.setQueryResult(source, removePoolProperties(mongoCredential || credential), queryString, rows, cacheValue) : rows);

@@ -613,3 +613,3 @@ }

if (rows) {
this.add(item, 4 /* TRANSACTION.COMMIT */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */);
if (targetObject) {

@@ -616,0 +616,0 @@ rows = targetObject(item, rows);

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

const getConnection = async (item, credential) => {
item.transactionState = 64 /* TRANSACTION.AUTH */;
item.transactionState = 64 /* TRANSACTION_DB.AUTH */;
let client;
if (mssqlPool) {
pools.push(client = await mssqlPool.getConnection());
item.transactionState &= ~64 /* TRANSACTION.AUTH */;
item.transactionState &= ~64 /* TRANSACTION_DB.AUTH */;
return client;

@@ -321,3 +321,3 @@ }

}
item.transactionState &= ~64 /* TRANSACTION.AUTH */;
item.transactionState &= ~64 /* TRANSACTION_DB.AUTH */;
return client;

@@ -345,3 +345,3 @@ };

}
item.transactionState = 1 /* TRANSACTION.ACTIVE */;
item.transactionState = 1 /* TRANSACTION_DB.ACTIVE */;
const streamRow = typeof item.streamRow === 'string' ? this.hasCoerce("mssql" /* STRINGS.MODULE_NAME */, 'options', null, credential) && (0, types_1.asFunction)(item.streamRow) : item.streamRow;

@@ -362,3 +362,3 @@ const renewCache = ignoreCache === 0;

}
this.add(item, 4 /* TRANSACTION.COMMIT */ | 128 /* TRANSACTION.CACHE */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */ | 128 /* TRANSACTION_DB.CACHE */);
continue;

@@ -397,3 +397,3 @@ }

else {
this.add(item, 4 /* TRANSACTION.COMMIT */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */);
if (output) {

@@ -400,0 +400,0 @@ output['__recordset__'] = 0;

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

const getConnection = async (item, credential) => {
item.transactionState = 64 /* TRANSACTION.AUTH */;
item.transactionState = 64 /* TRANSACTION_DB.AUTH */;
let client;
if (mysqlPool) {
pools.push(client = await mysqlPool.getConnection());
item.transactionState &= ~64 /* TRANSACTION.AUTH */;
item.transactionState &= ~64 /* TRANSACTION_DB.AUTH */;
return client;

@@ -181,3 +181,3 @@ }

}
item.transactionState &= ~64 /* TRANSACTION.AUTH */;
item.transactionState &= ~64 /* TRANSACTION_DB.AUTH */;
return client;

@@ -215,3 +215,3 @@ };

}
item.transactionState = 1 /* TRANSACTION.ACTIVE */;
item.transactionState = 1 /* TRANSACTION_DB.ACTIVE */;
const renewCache = ignoreCache === 0;

@@ -231,3 +231,3 @@ const cacheValue = renewCache ? { sessionKey, renewCache } : sessionKey;

}
this.add(item, 4 /* TRANSACTION.COMMIT */ | 128 /* TRANSACTION.CACHE */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */ | 128 /* TRANSACTION_DB.CACHE */);
continue;

@@ -287,3 +287,3 @@ }

else {
this.add(item, 4 /* TRANSACTION.COMMIT */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */);
resolve(!error ? this.setQueryResult(source, removePoolProperties(credential), queryString, rows, cacheValue) : rows);

@@ -300,3 +300,3 @@ }

const [rows] = await client.query(query, params);
this.add(item, 4 /* TRANSACTION.COMMIT */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */);
resolve(Array.isArray(rows) && !rows.some(row => row.constructor.name === 'OkPacket') ? this.setQueryResult(source, removePoolProperties(credential), queryString, rows, cacheValue) : null);

@@ -303,0 +303,0 @@ }

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

const getConnection = async (item, credential) => {
item.transactionState = 64 /* TRANSACTION.AUTH */;
item.transactionState = 64 /* TRANSACTION_DB.AUTH */;
let client;
if (oraclePool) {
clients.push(client = await oraclePool.getConnection());
item.transactionState &= ~64 /* TRANSACTION.AUTH */;
item.transactionState &= ~64 /* TRANSACTION_DB.AUTH */;
return client;

@@ -227,3 +227,3 @@ }

}
item.transactionState &= ~64 /* TRANSACTION.AUTH */;
item.transactionState &= ~64 /* TRANSACTION_DB.AUTH */;
return client;

@@ -251,3 +251,3 @@ };

}
item.transactionState = 1 /* TRANSACTION.ACTIVE */;
item.transactionState = 1 /* TRANSACTION_DB.ACTIVE */;
const streamRow = typeof item.streamRow === 'string' ? this.hasCoerce("oracle" /* STRINGS.MODULE_NAME */, 'options', null, credential) && (0, types_1.asFunction)(item.streamRow) : item.streamRow;

@@ -268,3 +268,3 @@ const renewCache = ignoreCache === 0;

}
this.add(item, 4 /* TRANSACTION.COMMIT */ | 128 /* TRANSACTION.CACHE */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */ | 128 /* TRANSACTION_DB.CACHE */);
continue;

@@ -320,3 +320,3 @@ }

else {
this.add(item, 4 /* TRANSACTION.COMMIT */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */);
resolve(!error ? this.setQueryResult(source, removePoolProperties(credential), queryString, rows, cacheValue) : rows);

@@ -329,3 +329,3 @@ }

const { rows } = await client.execute(query, params || [], executeOptions);
this.add(item, 4 /* TRANSACTION.COMMIT */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */);
resolve(rows ? this.setQueryResult(source, removePoolProperties(credential), queryString, rows, cacheValue) : null);

@@ -332,0 +332,0 @@ }

{
"name": "@e-mc/db",
"version": "0.0.1",
"version": "0.0.2",
"description": "DB modules for e-mc.",

@@ -23,5 +23,5 @@ "main": "index.js",

"dependencies": {
"@e-mc/core": "0.0.1",
"@e-mc/request": "0.0.1"
"@e-mc/core": "0.0.2",
"@e-mc/request": "0.0.2"
}
}

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

const getConnection = async (item, credential) => {
item.transactionState = 64 /* TRANSACTION.AUTH */;
item.transactionState = 64 /* TRANSACTION_DB.AUTH */;
let client;
if (postgresPool) {
pools.push(client = await postgresPool.getConnection());
item.transactionState &= ~64 /* TRANSACTION.AUTH */;
item.transactionState &= ~64 /* TRANSACTION_DB.AUTH */;
return client;

@@ -172,3 +172,3 @@ }

}
item.transactionState &= ~64 /* TRANSACTION.AUTH */;
item.transactionState &= ~64 /* TRANSACTION_DB.AUTH */;
return client;

@@ -196,3 +196,3 @@ };

}
item.transactionState = 1 /* TRANSACTION.ACTIVE */;
item.transactionState = 1 /* TRANSACTION_DB.ACTIVE */;
const renewCache = ignoreCache === 0;

@@ -212,3 +212,3 @@ const cacheValue = renewCache ? { sessionKey, renewCache } : sessionKey;

}
this.add(item, 4 /* TRANSACTION.COMMIT */ | 128 /* TRANSACTION.CACHE */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */ | 128 /* TRANSACTION_DB.CACHE */);
continue;

@@ -240,3 +240,3 @@ }

const { rows, command } = await client.query(query, params);
this.add(item, 4 /* TRANSACTION.COMMIT */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */);
resolve(rows.length || command === 'SELECT' ? this.setQueryResult(source, removePoolProperties(credential), queryString, rows, cacheValue) : null);

@@ -243,0 +243,0 @@ }

@@ -180,3 +180,3 @@ "use strict";

const getConnection = async (item, credential) => {
item.transactionState = 64 /* TRANSACTION.AUTH */;
item.transactionState = 64 /* TRANSACTION_DB.AUTH */;
let client;

@@ -203,3 +203,3 @@ if (item.usePool) {

}
item.transactionState &= ~64 /* TRANSACTION.AUTH */;
item.transactionState &= ~64 /* TRANSACTION_DB.AUTH */;
return client;

@@ -228,3 +228,3 @@ };

}
item.transactionState = 1 /* TRANSACTION.ACTIVE */;
item.transactionState = 1 /* TRANSACTION_DB.ACTIVE */;
const uuidKey = (credential.uuidKey || (credential.uuidKey = (onceCredential ? batch[0] : item).credential?.uuidKey));

@@ -258,3 +258,3 @@ const targetObject = typeof checkObject === 'string' ? this.hasCoerce("redis" /* STRINGS.MODULE_NAME */, 'options', uuidKey) && (0, types_1.asFunction)(checkObject) : checkObject;

}
this.add(item, 4 /* TRANSACTION.COMMIT */ | 128 /* TRANSACTION.CACHE */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */ | 128 /* TRANSACTION_DB.CACHE */);
continue;

@@ -509,3 +509,3 @@ }

}
this.add(item, 4 /* TRANSACTION.COMMIT */);
this.add(item, 4 /* TRANSACTION_DB.COMMIT */);
resolve(this.setQueryResult(source, removePoolProperties(redisCredential || credential), queryString, rows, cacheValue));

@@ -512,0 +512,0 @@ }

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