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

ts-japi

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-japi - npm Package Compare versions

Comparing version 1.11.0 to 1.11.1

2

.release-please-manifest.json
{
".": "1.11.0"
".": "1.11.1"
}
# Changelog
## [1.11.1](https://github.com/mathematic-inc/ts-japi/compare/v1.11.0...v1.11.1) (2024-04-17)
### Bug Fixes
* correctly serialize input array as array ([#84](https://github.com/mathematic-inc/ts-japi/issues/84)) ([37becd6](https://github.com/mathematic-inc/ts-japi/commit/37becd6ff307cf9ac1e47f1ec40c3e3e9ff09c90))
## [1.11.0](https://github.com/mathematic-inc/ts-japi/compare/v1.10.1...v1.11.0) (2024-04-08)

@@ -4,0 +11,0 @@

@@ -16,5 +16,5 @@ import { DataDocument } from '../interfaces/json-api.interface';

createResource(data: PrimaryType, options?: Partial<SerializerOptions<PrimaryType>>, helpers?: Helpers<PrimaryType>, relatorDataCache?: Map<Relator<any>, Dictionary<any>[]>): Promise<Resource<PrimaryType>>;
private serializeSingle;
private serializeType;
private getSerializerForData;
}
//# sourceMappingURL=polymorphic-serialiser.d.ts.map

@@ -17,4 +17,12 @@ "use strict";

if (Array.isArray(data)) {
const documents = await Promise.all(data.map((d) => {
return this.serializeSingle(d, options);
const documents = await Promise.all(Object.values(data.reduce((acc, d) => {
// group data by type
const type = d[this.key];
if (!acc[type]) {
acc[type] = [];
}
acc[type].push(d);
return acc;
}, {})).map((d) => {
return this.serializeType(d, options);
}));

@@ -31,3 +39,3 @@ return documents.reduce((result, document) => {

else if (data) {
return this.serializeSingle(data, options);
return this.serializeType(data, options);
}

@@ -50,4 +58,4 @@ return Object.values(this.serialisers)[0].serialize(data, options);

}
async serializeSingle(data, options) {
const serializer = this.getSerializerForData(data);
async serializeType(data, options) {
const serializer = this.getSerializerForData(Array.isArray(data) ? data[0] : data);
if (serializer) {

@@ -54,0 +62,0 @@ return serializer.serialize(data, options);

{
"name": "ts-japi",
"version": "1.11.0",
"version": "1.11.1",
"description": "A highly-modular (typescript-friendly)-framework agnostic library for serializing data to the JSON:API specification",

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

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