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

producteca-sdk

Package Overview
Dependencies
Maintainers
5
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

producteca-sdk - npm Package Compare versions

Comparing version 1.14.3 to 2.0.0

57

build/productsApi.js

@@ -17,5 +17,2 @@ (function() {

function ProductsApi() {
this._convert = __bind(this._convert, this);
this._convertNewToDeprecated = __bind(this._convertNewToDeprecated, this);
this._convertDeprecatedToNew = __bind(this._convertDeprecatedToNew, this);
this._convertJsonToProduct = __bind(this._convertJsonToProduct, this);

@@ -55,3 +52,3 @@ this._convertJsonToProducts = __bind(this._convertJsonToProducts, this);

ProductsApi.prototype.findByCode = function(code, $select) {
return this._findMany("sku eq '" + code + "'", $select);
return this._findMany("code eq '" + code + "'", $select);
};

@@ -64,3 +61,3 @@

ProductsApi.prototype.create = function(product) {
return this.client.postAsync("/products", this._convertNewToDeprecated(product));
return this.client.postAsync("/products", product);
};

@@ -71,5 +68,2 @@

url = "/products/" + productId + "/variations";
variations = (this._convertNewToDeprecated({
variations: variations
})).variations;
return this.client.postAsync(url, variations);

@@ -91,3 +85,3 @@ };

ProductsApi.prototype.update = function(id, update) {
return this.client.putAsync("/products/" + id, this._convertNewToDeprecated(update));
return this.client.putAsync("/products/" + id, update);
};

@@ -157,48 +151,5 @@

ProductsApi.prototype._convertJsonToProduct = function(json) {
return new Product(this._convertDeprecatedToNew(json));
return new Product(json);
};
ProductsApi.prototype._convertDeprecatedToNew = function(product) {
var _ref;
if (product == null) {
return;
}
product = _.cloneDeep(product);
this._convert(product, "sku", "code");
this._convert(product, "description", "name");
if ((_ref = product.variations) != null) {
_ref.forEach((function(_this) {
return function(variation) {
return _this._convert(variation, "barcode", "sku");
};
})(this));
}
return product;
};
ProductsApi.prototype._convertNewToDeprecated = function(product) {
var _ref;
if (product == null) {
return;
}
product = _.cloneDeep(product);
this._convert(product, "code", "sku");
this._convert(product, "name", "description");
if ((_ref = product.variations) != null) {
_ref.forEach((function(_this) {
return function(variation) {
return _this._convert(variation, "sku", "barcode");
};
})(this));
}
return product;
};
ProductsApi.prototype._convert = function(obj, oldProperty, newProperty) {
if ((obj[newProperty] == null) && obj[oldProperty]) {
obj[newProperty] = obj[oldProperty];
return delete obj[oldProperty];
}
};
return ProductsApi;

@@ -205,0 +156,0 @@

@@ -17,5 +17,2 @@ (function() {

function SalesOrdersApi(endpoint) {
this._convert = __bind(this._convert, this);
this._convertNewToDeprecated = __bind(this._convertNewToDeprecated, this);
this._convertDeprecatedToNew = __bind(this._convertDeprecatedToNew, this);
this._buildSalesOrdersFilters = __bind(this._buildSalesOrdersFilters, this);

@@ -51,17 +48,3 @@ this.deletePayment = __bind(this.deletePayment, this);

SalesOrdersApi.prototype.get = function(id) {
return this.client.getAsync("/salesorders/" + id).then((function(_this) {
return function(salesOrder) {
var _ref;
if ((_ref = salesOrder.lines) != null) {
_ref.map(function(it) {
it.product = _this._convertDeprecatedToNew(it.product);
if (it.variation != null) {
_this._convert(it.variation, "barcode", "sku");
}
return it;
});
}
return salesOrder;
};
})(this));
return this.client.getAsync("/salesorders/" + id);
};

@@ -169,45 +152,2 @@

SalesOrdersApi.prototype._convertDeprecatedToNew = function(product) {
var _ref;
if (product == null) {
return;
}
product = _.cloneDeep(product);
this._convert(product, "sku", "code");
this._convert(product, "description", "name");
if ((_ref = product.variations) != null) {
_ref.forEach((function(_this) {
return function(variation) {
return _this._convert(variation, "barcode", "sku");
};
})(this));
}
return product;
};
SalesOrdersApi.prototype._convertNewToDeprecated = function(product) {
var _ref;
if (product == null) {
return;
}
product = _.cloneDeep(product);
this._convert(product, "code", "sku");
this._convert(product, "name", "description");
if ((_ref = product.variations) != null) {
_ref.forEach((function(_this) {
return function(variation) {
return _this._convert(variation, "sku", "barcode");
};
})(this));
}
return product;
};
SalesOrdersApi.prototype._convert = function(obj, oldProperty, newProperty) {
if ((obj[newProperty] == null) && obj[oldProperty]) {
obj[newProperty] = obj[oldProperty];
return delete obj[oldProperty];
}
};
return SalesOrdersApi;

@@ -214,0 +154,0 @@

2

package.json

@@ -8,3 +8,3 @@ {

},
"version": "1.14.3",
"version": "2.0.0",
"main": "build/sdk.js",

@@ -11,0 +11,0 @@ "dependencies": {

# Producteca SDK

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

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

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

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