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.0.0-beta.1 to 1.0.0-beta.2

13

CHANGELOG.md

@@ -0,1 +1,14 @@

## [1.0.0-beta.2](https://github.com/atoms-studio/commercelayer-sdk/compare/1.0.0-beta.1...1.0.0-beta.2) (2021-08-17)
### Features
* **examples:** update to new create/update parameters ([fe8c2bc](https://github.com/atoms-studio/commercelayer-sdk/commit/fe8c2bc127ec14d2cdd2515a09c0447af851350f))
* **resources:** allow omitting attributes for create and update ([3bb85f3](https://github.com/atoms-studio/commercelayer-sdk/commit/3bb85f3c054b6e787d40ab99f29442265950e3c6))
### Bug Fixes
* **auth:** correct customer token expiration after refresh ([97ec0ec](https://github.com/atoms-studio/commercelayer-sdk/commit/97ec0ecccddbd1fde7f925590068fb1903690367))
## [1.0.0-beta.1](https://github.com/atoms-studio/commercelayer-sdk/compare/0.1.0-alpha.8...1.0.0-beta.1) (2021-08-12)

@@ -2,0 +15,0 @@

19

dist/commercelayer-sdk.cjs.js

@@ -670,3 +670,3 @@ 'use strict';

currentCustomerData.customer = null;
currentCustomerData.expires = Date.now() + data.expires_in;
currentCustomerData.expires = Date.now() + data.expires_in * 1000;
yield loadProfile();

@@ -740,7 +740,4 @@ }

};
const requireAttributes = (attributes, config) => {
if (!attributes) {
throw new Error(`[${config.type}] Missing resource attributes`);
}
if (!isObject(attributes)) {
const checkAttributes = (attributes, config) => {
if (attributes && !isObject(attributes)) {
throw new Error(`[${config.type}] Invalid resource attributes, expected object, received ${getType(attributes)}`);

@@ -769,9 +766,9 @@ }

},
create(params) {
create(params = {}) {
if (!params || getType(params) !== 'object') {
throw new Error(`[${config.type}] Invalid resource params, expected object, received ${getType(params)}`);
}
requireAttributes(params.attributes, config);
checkAttributes(params.attributes, config);
checkRelationships(params.relationships, config);
return create(params.attributes, params.query || {}, params.relationships || {}, config);
return create(params.attributes || {}, params.query || {}, params.relationships || {}, config);
},

@@ -783,5 +780,5 @@ update(id, params) {

}
requireAttributes(params.attributes, config);
checkAttributes(params.attributes, config);
checkRelationships(params.relationships, config);
return update(id, params.attributes, params.query || {}, params.relationships || {}, config);
return update(id, params.attributes || {}, params.query || {}, params.relationships || {}, config);
},

@@ -788,0 +785,0 @@ delete(id) {

@@ -662,3 +662,3 @@ import axios from 'axios';

currentCustomerData.customer = null;
currentCustomerData.expires = Date.now() + data.expires_in;
currentCustomerData.expires = Date.now() + data.expires_in * 1000;
yield loadProfile();

@@ -732,7 +732,4 @@ }

};
const requireAttributes = (attributes, config) => {
if (!attributes) {
throw new Error(`[${config.type}] Missing resource attributes`);
}
if (!isObject(attributes)) {
const checkAttributes = (attributes, config) => {
if (attributes && !isObject(attributes)) {
throw new Error(`[${config.type}] Invalid resource attributes, expected object, received ${getType(attributes)}`);

@@ -761,9 +758,9 @@ }

},
create(params) {
create(params = {}) {
if (!params || getType(params) !== 'object') {
throw new Error(`[${config.type}] Invalid resource params, expected object, received ${getType(params)}`);
}
requireAttributes(params.attributes, config);
checkAttributes(params.attributes, config);
checkRelationships(params.relationships, config);
return create(params.attributes, params.query || {}, params.relationships || {}, config);
return create(params.attributes || {}, params.query || {}, params.relationships || {}, config);
},

@@ -775,5 +772,5 @@ update(id, params) {

}
requireAttributes(params.attributes, config);
checkAttributes(params.attributes, config);
checkRelationships(params.relationships, config);
return update(id, params.attributes, params.query || {}, params.relationships || {}, config);
return update(id, params.attributes || {}, params.query || {}, params.relationships || {}, config);
},

@@ -780,0 +777,0 @@ delete(id) {

@@ -39,3 +39,3 @@ import { RequestQuery, RequestParameters } from './api';

export interface ResourceWriteParams<T, U> {
attributes: AttributesPayload<T>;
attributes?: AttributesPayload<T>;
relationships?: RelationshipsPayload<U>;

@@ -48,3 +48,3 @@ query?: RequestParameters;

findAll: (query: RequestQuery) => Promise<ResourcePagination<V>>;
create: (params: ResourceWriteParams<T, U>) => Promise<V>;
create: (params?: ResourceWriteParams<T, U>) => Promise<V>;
update: (id: string, params: ResourceWriteParams<T, U>) => Promise<V>;

@@ -51,0 +51,0 @@ delete: (id: string) => Promise<void>;

{
"name": "@atoms-studio/commercelayer-sdk",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"repository": "git@github.com:atoms-studio/commercelayer-sdk.git",

@@ -15,2 +15,3 @@ "author": "atoms.studio",

"cy:open": "cypress open",
"cy:run": "cypress run",
"release": "release-it",

@@ -17,0 +18,0 @@ "docs:dev": "vitepress dev docs",

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