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

@forestadmin/datasource-customizer

Package Overview
Dependencies
Maintainers
0
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forestadmin/datasource-customizer - npm Package Compare versions

Comparing version 1.45.2 to 1.45.3

1

dist/decorators/override/collection.d.ts

@@ -13,3 +13,4 @@ import { Caller, CollectionDecorator, Filter, RecordData } from '@forestadmin/datasource-toolkit';

addDeleteHandler(handler: UpdateOverrideHandler): void;
private cleanRecordsInPlace;
}
//# sourceMappingURL=collection.d.ts.map

@@ -9,3 +9,5 @@ "use strict";

const context = new context_1.CreateOverrideCustomizationContext(this.childCollection, caller, data);
return this.createHandler(context);
const records = await this.createHandler(context);
this.cleanRecordsInPlace(records);
return records;
}

@@ -37,4 +39,25 @@ return super.create(caller, data);

}
/* Avoid copying the records to keep the same reference and avoid performance issues */
cleanRecordsInPlace(records) {
if (!Array.isArray(records)) {
throw new datasource_toolkit_1.ValidationError(`The records must be an array of objects`);
}
records.forEach(result => {
let hasPrimaryKey = false;
Object.keys(result).forEach(key => {
const field = this.schema.fields[key];
if (!field || field.type !== 'Column') {
delete result[key];
}
else if (datasource_toolkit_1.SchemaUtils.isPrimaryKey(this.schema, key)) {
hasPrimaryKey = true;
}
});
if (!hasPrimaryKey) {
throw new datasource_toolkit_1.ValidationError(`The record does not contain any primary key field`);
}
});
}
}
exports.default = OverrideCollectionDecorator;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sbGVjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9kZWNvcmF0b3JzL292ZXJyaWRlL2NvbGxlY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx3RUFBa0c7QUFFbEcsdUNBSW1CO0FBR25CLE1BQXFCLDJC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0Y7QUE5RUQsOENBOEVDIn0=

2

package.json
{
"name": "@forestadmin/datasource-customizer",
"version": "1.45.2",
"version": "1.45.3",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "license": "GPL-3.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