New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@atoms-studio/commercelayer-sdk

Package Overview
Dependencies
Maintainers
5
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atoms-studio/commercelayer-sdk - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

12

CHANGELOG.md

@@ -0,1 +1,13 @@

### [1.3.2](https://github.com/atoms-studio/commercelayer-sdk/compare/1.3.1...1.3.2) (2022-02-01)
### Features
* update all polymorphic relationships ([5ac69af](https://github.com/atoms-studio/commercelayer-sdk/commit/5ac69af15949a3f9c05bee35147adf852aa6e5e0))
### Bug Fixes
* properly handle polymorphic relationships ([39f6bd3](https://github.com/atoms-studio/commercelayer-sdk/commit/39f6bd376e9405cbbcffc7f6ca8033b6874eaffd))
### [1.3.1](https://github.com/atoms-studio/commercelayer-sdk/compare/1.3.0...1.3.1) (2022-01-11)

@@ -2,0 +14,0 @@

27

dist/commercelayer-sdk.cjs.js

@@ -202,6 +202,8 @@ 'use strict';

relationshipKeys.forEach((relationshipKey) => {
var _a;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const configRelationships = config.relationships;
const relationshipTypeConfig = configRelationships[relationshipKey];
// Only add relationships supported by the config
if (configRelationships[relationshipKey]) {
if (relationshipTypeConfig) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any

@@ -214,5 +216,10 @@ const relationshipValue = relationships[relationshipKey] || {

}
if (typeof relationshipTypeConfig === 'object' &&
relationshipTypeConfig.polymorphic &&
(typeof relationshipValue === 'string' || !relationshipValue.type)) {
throw new Error(`You must pass a type for relationship "${relationshipKey}" because it is polymorphic`);
}
serialized.data.relationships[relationshipKey] = {
data: {
type: configRelationships[relationshipKey],
type: (_a = relationshipValue.type) !== null && _a !== void 0 ? _a : relationshipTypeConfig,
// Support passing a relationship as id or as a full object

@@ -985,3 +992,5 @@ id: typeof relationshipValue === 'string'

payment_method: 'payment_methods',
payment_source: 'payment_sources',
payment_source: {
polymorphic: true,
},
line_items: 'line_items',

@@ -1031,3 +1040,5 @@ shipments: 'shipments',

order: 'orders',
item: 'items',
item: {
polymorphic: true,
},
line_item_options: 'line_item_options',

@@ -1270,3 +1281,5 @@ shipment_line_items: 'line_items',

relationships: {
attachable: 'attachables', // TODO: this is a polymorphic relation
attachable: {
polymorphic: true,
},
},

@@ -1430,3 +1443,5 @@ };

customer: 'customers',
payment_source: 'payment_sources', // TODO: this is a polymorphic relation
payment_source: {
polymorphic: true,
},
},

@@ -1433,0 +1448,0 @@ };

@@ -194,6 +194,8 @@ import axios from 'axios';

relationshipKeys.forEach((relationshipKey) => {
var _a;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const configRelationships = config.relationships;
const relationshipTypeConfig = configRelationships[relationshipKey];
// Only add relationships supported by the config
if (configRelationships[relationshipKey]) {
if (relationshipTypeConfig) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any

@@ -206,5 +208,10 @@ const relationshipValue = relationships[relationshipKey] || {

}
if (typeof relationshipTypeConfig === 'object' &&
relationshipTypeConfig.polymorphic &&
(typeof relationshipValue === 'string' || !relationshipValue.type)) {
throw new Error(`You must pass a type for relationship "${relationshipKey}" because it is polymorphic`);
}
serialized.data.relationships[relationshipKey] = {
data: {
type: configRelationships[relationshipKey],
type: (_a = relationshipValue.type) !== null && _a !== void 0 ? _a : relationshipTypeConfig,
// Support passing a relationship as id or as a full object

@@ -977,3 +984,5 @@ id: typeof relationshipValue === 'string'

payment_method: 'payment_methods',
payment_source: 'payment_sources',
payment_source: {
polymorphic: true,
},
line_items: 'line_items',

@@ -1023,3 +1032,5 @@ shipments: 'shipments',

order: 'orders',
item: 'items',
item: {
polymorphic: true,
},
line_item_options: 'line_item_options',

@@ -1262,3 +1273,5 @@ shipment_line_items: 'line_items',

relationships: {
attachable: 'attachables', // TODO: this is a polymorphic relation
attachable: {
polymorphic: true,
},
},

@@ -1422,3 +1435,5 @@ };

customer: 'customers',
payment_source: 'payment_sources', // TODO: this is a polymorphic relation
payment_source: {
polymorphic: true,
},
},

@@ -1425,0 +1440,0 @@ };

import { RequestQuery, RequestParameters } from './api';
export interface PolymorphicRelationship {
polymorphic: true;
}
export interface ResourceConfig<T, U> {
type: string;
attributes: (keyof T)[];
relationships: Record<keyof U, string>;
relationships: Record<keyof U, string | PolymorphicRelationship>;
}

@@ -7,0 +10,0 @@ export interface CommonResourceAttributes {

{
"name": "@atoms-studio/commercelayer-sdk",
"version": "1.3.1",
"version": "1.3.2",
"repository": "git@github.com:atoms-studio/commercelayer-sdk.git",

@@ -5,0 +5,0 @@ "author": "atoms.studio",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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