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

@heycharles/browser-sdk

Package Overview
Dependencies
Maintainers
1
Versions
666
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@heycharles/browser-sdk - npm Package Compare versions

Comparing version 2.19.0 to 2.20.0

8

CHANGELOG.md

@@ -0,1 +1,9 @@

# [2.20.0](https://github.com/c-commerce/charles-browser-sdk/compare/v2.19.0...v2.20.0) (2020-03-21)
### Features
* **docs:** enhance overall, exports ([7c13856](https://github.com/c-commerce/charles-browser-sdk/commit/7c13856fa7d760eef7e4cc7b5d50def7c5688ebe))
* **docs:** exlcude even more hidden logic ([72ef938](https://github.com/c-commerce/charles-browser-sdk/commit/72ef938259c5f545a3b1fa391227cf36ccbf8ebc))
# [2.19.0](https://github.com/c-commerce/charles-browser-sdk/compare/v2.18.1...v2.19.0) (2020-03-21)

@@ -2,0 +10,0 @@

@@ -70,5 +70,11 @@ "use strict";

var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* @ignore
*/
_this._rawPayload = null;
return _this;
}
/**
* @ignore
*/
Entity.prototype.setRawPayload = function (p) {

@@ -78,2 +84,5 @@ this._rawPayload = p;

};
/**
* @ignore
*/
Entity.prototype.handleError = function (err) {

@@ -84,2 +93,6 @@ if (this.listeners('error').length > 0)

};
/**
* Change this object on the remote by partially applying a change object to it as diff.
* @param changePart
*/
Entity.prototype.patch = function (changePart) {

@@ -93,2 +106,5 @@ return __awaiter(this, void 0, void 0, function () {

};
/**
* @ignore
*/
Entity.prototype._patch = function (changePart) {

@@ -105,2 +121,4 @@ var _a, _b;

throw new TypeError('patch requires incoming object to be set.');
if (this.id === null || this.id === undefined)
throw new TypeError('patch requires id to be set.');
_c.label = 1;

@@ -134,2 +152,5 @@ case 1:

};
/**
* Create this object on the remote.
*/
Entity.prototype.post = function () {

@@ -143,2 +164,5 @@ return __awaiter(this, void 0, void 0, function () {

};
/**
* @ignore
*/
Entity.prototype._post = function () {

@@ -174,2 +198,54 @@ var _a, _b;

};
/**
* Delete this object on the remote.
*/
Entity.prototype.delete = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
// we allow implementers to override us by calling ._delete directly and e.g. handle our error differently
return [2 /*return*/, this._delete()];
});
});
};
/**
* @ignore
*/
Entity.prototype._delete = function () {
var _a, _b;
return __awaiter(this, void 0, void 0, function () {
var opts, response, err_3;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
if (this.id === null || this.id === undefined)
throw new TypeError('delete requires id to be set.');
_c.label = 1;
case 1:
_c.trys.push([1, 3, , 4]);
opts = {
method: 'DELETE',
url: ((_a = this.universe) === null || _a === void 0 ? void 0 : _a.universeBase) + "/" + this.endpoint + "/" + this.id,
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
data: undefined,
responseType: 'json'
};
return [4 /*yield*/, ((_b = this.http) === null || _b === void 0 ? void 0 : _b.getClient()(opts))];
case 2:
response = _c.sent();
this.deserialize(response.data.data[0]);
return [2 /*return*/, this];
case 3:
err_3 = _c.sent();
throw new EntityPostError(undefined, { error: err_3 });
case 4: return [2 /*return*/];
}
});
});
};
/**
* Save a change to this local object, by either creating or patching it on the remote.
* @param payload
*/
Entity.prototype.save = function (payload) {

@@ -183,2 +259,5 @@ return __awaiter(this, void 0, void 0, function () {

};
/**
* @ignore
*/
Entity.prototype._save = function (payload) {

@@ -185,0 +264,0 @@ return __awaiter(this, void 0, void 0, function () {

14

dist/entities/asset/asset.js

@@ -168,10 +168,10 @@ "use strict";

Assets.prototype.post = function (payload, options) {
var _a, _b, _c;
var _a, _b;
return __awaiter(this, void 0, void 0, function () {
var opts, res, data, err_3;
var _this = this;
return __generator(this, function (_d) {
switch (_d.label) {
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_d.trys.push([0, 2, , 3]);
_c.trys.push([0, 2, , 3]);
opts = {

@@ -186,4 +186,4 @@ timeout: 60000,

case 1:
res = _d.sent();
data = (_c = res) === null || _c === void 0 ? void 0 : _c.data.data;
res = _c.sent();
data = res === null || res === void 0 ? void 0 : res.data.data;
return [2 /*return*/, data.map(function (item) {

@@ -193,3 +193,3 @@ return Asset.create(item, _this.universe, _this.http);

case 2:
err_3 = _d.sent();
err_3 = _c.sent();
throw new AssetsPostError(undefined, { error: err_3 });

@@ -196,0 +196,0 @@ case 3: return [2 /*return*/];

@@ -57,2 +57,7 @@ "use strict";

var errors_1 = require("../../errors");
/**
* Manage people, that usually are generated from channel users.
*
* @category Entity
*/
var Person = /** @class */ (function (_super) {

@@ -59,0 +64,0 @@ __extends(Person, _super);

@@ -57,2 +57,7 @@ "use strict";

var errors_1 = require("../../errors");
/**
* Manage prodcucts.
*
* @category Entity
*/
var Product = /** @class */ (function (_super) {

@@ -59,0 +64,0 @@ __extends(Product, _super);

@@ -57,2 +57,7 @@ "use strict";

var errors_1 = require("../../errors");
/**
* Manage staff members.
*
* @category Entity
*/
var Staff = /** @class */ (function (_super) {

@@ -59,0 +64,0 @@ __extends(Staff, _super);

@@ -57,2 +57,7 @@ "use strict";

var errors_1 = require("../../errors");
/**
* Manage tickets in a business context.
*
* @category Entity
*/
var Ticket = /** @class */ (function (_super) {

@@ -59,0 +64,0 @@ __extends(Ticket, _super);

@@ -10,17 +10,60 @@ /// <reference types="node" />

}
export interface EntityRawPayload {
readonly id?: string;
}
export default abstract class Entity<Payload, RawPayload> extends EventEmitter {
protected abstract universe: Universe;
protected abstract http: Universe['http'];
/**
* @ignore
*/
protected _rawPayload?: RawPayload | null;
abstract id?: string;
abstract endpoint: string;
/**
* @ignore
*/
protected setRawPayload(p: RawPayload): Entity<Payload, RawPayload>;
/**
* Convert object to a JS struct.
*/
abstract serialize(): RawPayload;
protected abstract deserialize(rawPayload: RawPayload): Entity<Payload, RawPayload>;
/**
* @ignore
*/
protected handleError(err: Error): Error;
/**
* Change this object on the remote by partially applying a change object to it as diff.
* @param changePart
*/
patch(changePart: RawPayload): Promise<Entity<Payload, RawPayload>>;
/**
* @ignore
*/
protected _patch(changePart: RawPayload): Promise<Entity<Payload, RawPayload>>;
/**
* Create this object on the remote.
*/
post(): Promise<Entity<Payload, RawPayload>>;
/**
* @ignore
*/
protected _post(): Promise<Entity<Payload, RawPayload>>;
/**
* Delete this object on the remote.
*/
delete(): Promise<Entity<Payload, RawPayload>>;
/**
* @ignore
*/
protected _delete(): Promise<Entity<Payload, RawPayload>>;
/**
* Save a change to this local object, by either creating or patching it on the remote.
* @param payload
*/
save(payload?: RawPayload): Promise<Entity<Payload, RawPayload>>;
/**
* @ignore
*/
protected _save(payload?: RawPayload): Promise<Entity<Payload, RawPayload>>;

@@ -27,0 +70,0 @@ }

@@ -1,2 +0,2 @@

import Entity, { EntityOptions } from '../_base';
import Entity, { EntityOptions, EntityRawPayload } from '../_base';
import { Universe } from '../../universe';

@@ -11,4 +11,8 @@ import { BaseError } from '../../errors';

}
export interface AssetRawPayload {
readonly id?: string;
/**
* Manage assets.
*
* @category Entity
*/
export interface AssetRawPayload extends EntityRawPayload {
readonly created_at?: string;

@@ -48,3 +52,3 @@ readonly updated_at?: string;

endpoint: string;
id?: string;
id?: AssetPayload['id'];
createdAt?: AssetPayload['createdAt'];

@@ -51,0 +55,0 @@ updatedAt?: AssetPayload['updatedAt'];

@@ -1,2 +0,2 @@

import Entity, { EntityOptions } from '../_base';
import Entity, { EntityOptions, EntityRawPayload } from '../_base';
import { Universe } from '../../universe';

@@ -7,4 +7,3 @@ import { BaseError } from '../../errors';

}
export interface PersonAddressRawPayload {
readonly id?: string;
export interface PersonAddressRawPayload extends EntityRawPayload {
readonly person?: string;

@@ -22,4 +21,3 @@ readonly created_at?: string;

}
export interface PersonPhonenumberRawPayload {
readonly id?: string;
export interface PersonPhonenumberRawPayload extends EntityRawPayload {
readonly person?: string;

@@ -33,4 +31,3 @@ readonly created_at?: string;

}
export interface PersonRawPayload {
readonly id?: string;
export interface PersonRawPayload extends EntityRawPayload {
readonly created_at?: string;

@@ -70,2 +67,7 @@ readonly updated_at?: string;

}
/**
* Manage people, that usually are generated from channel users.
*
* @category Entity
*/
export declare class Person extends Entity<PersonPayload, PersonRawPayload> {

@@ -77,3 +79,3 @@ protected universe: Universe;

endpoint: string;
id?: string;
id?: PersonPayload['id'];
createdAt?: PersonPayload['createdAt'];

@@ -80,0 +82,0 @@ updatedAt?: PersonPayload['updatedAt'];

@@ -1,2 +0,2 @@

import Entity, { EntityOptions } from '../_base';
import Entity, { EntityOptions, EntityRawPayload } from '../_base';
import { Universe } from '../../universe';

@@ -21,4 +21,3 @@ import { BaseError } from '../../errors';

}
export interface ProductRawPayload {
readonly id?: string;
export interface ProductRawPayload extends EntityRawPayload {
readonly created_at?: string;

@@ -130,2 +129,7 @@ readonly updated_at?: string;

}
/**
* Manage prodcucts.
*
* @category Entity
*/
export declare class Product extends Entity<ProductPayload, ProductRawPayload> {

@@ -137,3 +141,3 @@ protected universe: Universe;

endpoint: string;
id?: string;
id?: ProductPayload['id'];
createdAt?: ProductPayload['createdAt'];

@@ -147,2 +151,6 @@ updatedAt?: ProductPayload['updatedAt'];

description?: ProductPayload['description'];
/**
* Prices of a product.
*/
prices?: ProductPayload['prices'];
brand?: ProductPayload['brand'];

@@ -189,3 +197,2 @@ assets?: ProductPayload['assets'];

metadata?: ProductPayload['metadata'];
prices?: ProductPayload['prices'];
constructor(options: ProductOptions);

@@ -192,0 +199,0 @@ protected deserialize(rawPayload: ProductRawPayload): Product;

@@ -1,2 +0,2 @@

import Entity, { EntityOptions } from '../_base';
import Entity, { EntityOptions, EntityRawPayload } from '../_base';
import { Universe } from '../../universe';

@@ -7,4 +7,3 @@ import { BaseError } from '../../errors';

}
export interface StaffRawPayload {
readonly id?: string;
export interface StaffRawPayload extends EntityRawPayload {
readonly created_at?: string;

@@ -33,2 +32,7 @@ readonly updated_at?: string;

}
/**
* Manage staff members.
*
* @category Entity
*/
export declare class Staff extends Entity<StaffPayload, StaffRawPayload> {

@@ -40,3 +44,3 @@ protected universe: Universe;

endpoint: string;
id?: string;
id?: StaffPayload['id'];
createdAt?: StaffPayload['createdAt'];

@@ -43,0 +47,0 @@ updatedAt?: StaffPayload['updatedAt'];

@@ -1,2 +0,2 @@

import Entity, { EntityOptions } from '../_base';
import Entity, { EntityOptions, EntityRawPayload } from '../_base';
import { Universe } from '../../universe';

@@ -7,4 +7,3 @@ import { BaseError } from '../../errors';

}
export interface TicketRawPayload {
readonly id?: string;
export interface TicketRawPayload extends EntityRawPayload {
readonly created_at?: string;

@@ -50,2 +49,7 @@ readonly updated_at?: string;

}
/**
* Manage tickets in a business context.
*
* @category Entity
*/
export declare class Ticket extends Entity<TicketPayload, TicketRawPayload> {

@@ -57,3 +61,3 @@ protected universe: Universe;

endpoint: string;
id?: string;
id?: TicketPayload['id'];
createdAt?: TicketPayload['createdAt'];

@@ -60,0 +64,0 @@ updatedAt?: TicketPayload['updatedAt'];

{
"name": "@heycharles/browser-sdk",
"version": "2.19.0",
"version": "2.20.0",
"description": "The Browser SDK for the Charles APIs.",

@@ -29,3 +29,3 @@ "keywords": [],

"build:docs:all": "npm run build:docs && npm run build:storybooks",
"build:docs": "typedoc --out docs --target es6 --theme minimal --mode file src",
"build:docs": "typedoc --out docs --target es6 --hideGenerator --excludeExternals --excludeNotExported --excludeProtected --categorizeByGroup true --defaultCategory \"Misc.\" --theme minimal --mode file src",
"build:storybooks:prepare": "(cd examples/vue && npm i && cd -)",

@@ -134,3 +134,3 @@ "build:storybooks": "(cd examples/vue && npm run build-storybook && cd -)",

"ts-loader": "^6.2.1",
"ts-node": "^8.6.2",
"ts-node": "^8.7.0",
"tsify": "^4.0.1",

@@ -140,4 +140,4 @@ "tslint": "^6.0.0",

"tslint-config-standard": "^9.0.0",
"typedoc": "^0.16.10",
"typescript": "3.7.5",
"typedoc": "^0.17.1",
"typescript": "3.8.3",
"validate-commit-msg": "^2.14.0"

@@ -144,0 +144,0 @@ },

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 too big to display

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