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

electrodb

Package Overview
Dependencies
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electrodb - npm Package Compare versions

Comparing version 2.4.1 to 2.4.2

2

package.json
{
"name": "electrodb",
"version": "2.4.1",
"version": "2.4.2",
"description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb",

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

@@ -40,3 +40,3 @@ const { QueryTypes, MethodTypes, ItemOperations, ExpressionTypes, TableIndex, TerminalOperation, KeyTypes, IndexTypes } = require("./types");

try {
const {pk, sk} = state.getCompositeAttributes();
const { pk, sk } = state.getCompositeAttributes();
return state

@@ -54,2 +54,18 @@ .setType(QueryTypes.clustered_collection)

}
})
.whenOptions(({ options, state }) => {
if (!options.ignoreOwnership) {
state.query.options.expressions.names = {
...state.query.options.expressions.names,
...state.query.options.identifiers.names,
};
state.query.options.expressions.values = {
...state.query.options.expressions.values,
...state.query.options.identifiers.values,
};
state.query.options.expressions.expression =
state.query.options.expressions.expression.length > 1
? `(${state.query.options.expressions.expression}) AND ${state.query.options.identifiers.expression}`
: `${state.query.options.identifiers.expression}`;
}
});

@@ -77,3 +93,19 @@

.setCollection(collection)
.setPK(entity._expectFacets(facets, pk));
.setPK(entity._expectFacets(facets, pk))
.whenOptions(({ options, state }) => {
if (!options.ignoreOwnership) {
state.query.options.expressions.names = {
...state.query.options.expressions.names,
...state.query.options.identifiers.names,
};
state.query.options.expressions.values = {
...state.query.options.expressions.values,
...state.query.options.identifiers.values,
};
state.query.options.expressions.expression =
state.query.options.expressions.expression.length > 1
? `(${state.query.options.expressions.expression}) AND ${state.query.options.identifiers.expression}`
: `${state.query.options.identifiers.expression}`;
}
});
} catch(err) {

@@ -93,3 +125,9 @@ state.setError(err);

try {
return state.setMethod(MethodTypes.scan);
return state.setMethod(MethodTypes.scan)
.whenOptions(({ state, options }) => {
if (!options.ignoreOwnership) {
state.unsafeApplyFilter(FilterOperationNames.eq, entity.identifiers.entity, entity.getName());
state.unsafeApplyFilter(FilterOperationNames.eq, entity.identifiers.version, entity.getVersion());
}
});
} catch(err) {

@@ -485,6 +523,9 @@ state.setError(err);

}
if (state.query.options.indexType === IndexTypes.clustered && Object.keys(composites).length < sk.length) {
state.unsafeApplyFilter(FilterOperationNames.eq, entity.identifiers.entity, entity.getName())
.unsafeApplyFilter(FilterOperationNames.eq, entity.identifiers.version, entity.getVersion());
}
state.whenOptions(({ options, state }) => {
if (state.query.options.indexType === IndexTypes.clustered && Object.keys(composites).length < sk.length && !options.ignoreOwnership) {
state.unsafeApplyFilter(FilterOperationNames.eq, entity.identifiers.entity, entity.getName())
.unsafeApplyFilter(FilterOperationNames.eq, entity.identifiers.version, entity.getVersion());
}
});
});

@@ -640,16 +681,22 @@ } catch(err) {

const method = state.getMethod();
const normalizedOptions = entity._normalizeExecutionOptions({ provided: [ state.getOptions(), state.query.options, options ] });
state.applyWithOptions(normalizedOptions);
let results;
switch (method) {
case MethodTypes.query:
results = entity._queryParams(state, options);
case MethodTypes.query: {
results = entity._queryParams(state, normalizedOptions);
break;
case MethodTypes.batchWrite:
results = entity._batchWriteParams(state, options);
break
case MethodTypes.batchGet:
results = entity._batchGetParams(state, options);
}
case MethodTypes.batchWrite: {
results = entity._batchWriteParams(state, normalizedOptions);
break;
default:
results = entity._params(state, options);
}
case MethodTypes.batchGet: {
results = entity._batchGetParams(state, normalizedOptions);
break;
}
default: {
results = entity._params(state, normalizedOptions);
break;
}
}

@@ -662,2 +709,10 @@

}
if (options._returnOptions) {
return {
params: results,
options: normalizedOptions,
}
}
return results;

@@ -681,5 +736,4 @@ } catch(err) {

options.terminalOperation = TerminalOperation.go;
let params = clauses.params.action(entity, state, options);
let {config} = entity._applyParameterOptions({}, state.getOptions(), options);
return entity.go(state.getMethod(), params, config);
const paramResults = clauses.params.action(entity, state, { ...options, _returnOptions: true });
return entity.go(state.getMethod(), paramResults.params, paramResults.options);
} catch(err) {

@@ -729,2 +783,3 @@ return Promise.reject(err);

this.subStates = [];
this.applyAfterOptions = [];
this.hasSortKey = hasSortKey;

@@ -923,2 +978,14 @@ this.prev = null;

}
whenOptions(fn) {
if (v.isFunction(fn)) {
this.applyAfterOptions.push((options) => {
fn({ options, state: this });
});
}
}
applyWithOptions(options = {}) {
this.applyAfterOptions.forEach((fn) => fn(options));
}
}

@@ -925,0 +992,0 @@

@@ -394,3 +394,3 @@ const { Entity } = require("./entity");

},
expressions: {
identifiers: {
names: identifiers.names || {},

@@ -402,2 +402,7 @@ values: identifiers.values || {},

},
expressions: {
names: {},
values: {},
expression: '',
},
attributes,

@@ -404,0 +409,0 @@ entities,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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