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

@swp/ledger-sdk

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swp/ledger-sdk - npm Package Compare versions

Comparing version 0.0.33 to 0.0.34

.nyc_output/e5901e81-f89b-4749-b304-cee2a67275e5.json

26

.build/common/dto.d.ts

@@ -55,6 +55,4 @@ export interface Model<DTO> {

}
export interface AccountDTO {
export interface AccountDTO extends NewAccountDTO {
id: string;
type: ActionType.NEW_ACCOUNT;
fields?: Fields;
}

@@ -124,14 +122,24 @@ export interface PaginationParams {

}
export declare enum WebHookType {
NotifyTransfer = "NotifyTransfer"
export declare enum TriggerType {
WebHook = "WebHook"
}
export declare enum TriggerCondition {
Ledger_Transfers = "Ledger_Transfers"
}
export interface NewWebHookDTO {
type: TriggerType.WebHook;
condition: TriggerCondition;
data: WebHookData;
}
export interface WebHookData {
url: string;
hookType: WebHookType;
accountId: string;
}
export interface WebHookDTO {
id: string;
hookType: string;
url: string;
type: TriggerType.WebHook;
condition: TriggerCondition;
data: WebHookData;
}
export declare type TriggerData = WebHookData;
export declare type NewTriggerDTO = NewWebHookDTO;
export declare type TriggerDTO = WebHookDTO;

@@ -22,6 +22,10 @@ "use strict";

})(BoletoStatusCode = exports.BoletoStatusCode || (exports.BoletoStatusCode = {}));
var WebHookType;
(function (WebHookType) {
WebHookType["NotifyTransfer"] = "NotifyTransfer";
})(WebHookType = exports.WebHookType || (exports.WebHookType = {}));
var TriggerType;
(function (TriggerType) {
TriggerType["WebHook"] = "WebHook";
})(TriggerType = exports.TriggerType || (exports.TriggerType = {}));
var TriggerCondition;
(function (TriggerCondition) {
TriggerCondition["Ledger_Transfers"] = "Ledger_Transfers";
})(TriggerCondition = exports.TriggerCondition || (exports.TriggerCondition = {}));
//# sourceMappingURL=dto.js.map

@@ -18,5 +18,4 @@ export declare enum ErrorCode {

FieldNotFound = "FIELD_NOT_FOUND",
WebHookAlreadyExists = "WEBHOOK_ALREADY_EXISTS",
WebHookFailureOnReceive = "WEBHOOK_FAILURE_ON_RECEIVE",
WebHookInvalidType = "WEBHOOK_INVALID_TYPE",
TriggerInvalidType = "TRIGGER_INVALID_TYPE",
TriggerInvalidCondition = "TRIGGER_INVALID_CONDITION",
AccountAlreadyHasCredential = "ACCOUNT_ALREADY_HAS_CREDENTIAL",

@@ -23,0 +22,0 @@ PermissionDenied = "PERMISSION_DENIED",

@@ -22,5 +22,4 @@ "use strict";

SubErrorCode["FieldNotFound"] = "FIELD_NOT_FOUND";
SubErrorCode["WebHookAlreadyExists"] = "WEBHOOK_ALREADY_EXISTS";
SubErrorCode["WebHookFailureOnReceive"] = "WEBHOOK_FAILURE_ON_RECEIVE";
SubErrorCode["WebHookInvalidType"] = "WEBHOOK_INVALID_TYPE";
SubErrorCode["TriggerInvalidType"] = "TRIGGER_INVALID_TYPE";
SubErrorCode["TriggerInvalidCondition"] = "TRIGGER_INVALID_CONDITION";
SubErrorCode["AccountAlreadyHasCredential"] = "ACCOUNT_ALREADY_HAS_CREDENTIAL";

@@ -27,0 +26,0 @@ SubErrorCode["PermissionDenied"] = "PERMISSION_DENIED";

@@ -16,6 +16,5 @@ import { ErrorCode, SubError, SwpError, SwpResponse } from "./dto";

export declare const newFieldNotFound: (field: string) => SwpError;
export declare const newWebHookAlreadyExists: () => SwpError;
export declare const newWebHookInvalidType: () => SwpError;
export declare const newTriggerInvalidType: () => SwpError;
export declare const newTriggerInvalidCondition: () => SwpError;
export declare const newInvalidAmount: () => SwpError;
export declare const newWebHookFailureOnReceive: () => SwpError;
export declare const newNotFound: (subErrors?: SubError[] | undefined) => SwpError;

@@ -22,0 +21,0 @@ export declare const newBatchLimitExceeded: () => SwpError;

@@ -104,15 +104,15 @@ "use strict";

};
exports.newWebHookAlreadyExists = function () {
exports.newTriggerInvalidType = function () {
return exports.newValidationError([
{
code: dto_1.SubErrorCode.WebHookAlreadyExists,
msg: "Já existe um WebHook cadastrado para essa Conta",
code: dto_1.SubErrorCode.TriggerInvalidType,
msg: "Tipo de Trigger inválido"
}
]);
};
exports.newWebHookInvalidType = function () {
exports.newTriggerInvalidCondition = function () {
return exports.newValidationError([
{
code: dto_1.SubErrorCode.WebHookInvalidType,
msg: "Tipo de WebHook inválido"
code: dto_1.SubErrorCode.TriggerInvalidCondition,
msg: "Condição de Trigger inválida"
}

@@ -129,10 +129,2 @@ ]);

};
exports.newWebHookFailureOnReceive = function () {
return exports.newValidationError([
{
code: dto_1.SubErrorCode.WebHookFailureOnReceive,
msg: "Falha ao receber WebHook",
}
]);
};
exports.newNotFound = function (subErrors) {

@@ -139,0 +131,0 @@ return exports.newSwpError(dto_1.ErrorCode.NotFound, "Recurso não encontrado", subErrors);

@@ -167,8 +167,8 @@ "use strict";

});
describe("newWebhookAlreadyExists", function () { return __awaiter(_this, void 0, void 0, function () {
describe("newTriggerInvalidType", function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
it("should return correctly", function () {
var error = error_1.newWebHookAlreadyExists();
var error = error_1.newTriggerInvalidType();
chai_1.expect(error.code).to.equal(dto_1.ErrorCode.ValidationError);
chai_1.expect(error.subErrors[0].code).to.equal(dto_1.SubErrorCode.WebHookAlreadyExists);
chai_1.expect(error.subErrors[0].code).to.equal(dto_1.SubErrorCode.TriggerInvalidType);
chai_1.expect(error.subErrors.length).to.equal(1);

@@ -179,8 +179,8 @@ });

}); });
describe("newWebHookFailureOnReceive", function () { return __awaiter(_this, void 0, void 0, function () {
describe("newTriggerInvalidCondition", function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
it("should return correctly", function () {
var error = error_1.newWebHookFailureOnReceive();
var error = error_1.newTriggerInvalidCondition();
chai_1.expect(error.code).to.equal(dto_1.ErrorCode.ValidationError);
chai_1.expect(error.subErrors[0].code).to.equal(dto_1.SubErrorCode.WebHookFailureOnReceive);
chai_1.expect(error.subErrors[0].code).to.equal(dto_1.SubErrorCode.TriggerInvalidCondition);
chai_1.expect(error.subErrors.length).to.equal(1);

@@ -213,2 +213,13 @@ });

}); });
describe("newInvalidAmount", function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
it("should return correctly", function () {
var error = error_1.newInvalidAmount();
chai_1.expect(error.code).to.equal(dto_1.ErrorCode.ValidationError);
chai_1.expect(error.subErrors[0].code).to.equal(dto_1.SubErrorCode.InvalidAmount);
chai_1.expect(error.subErrors.length).to.equal(1);
});
return [2 /*return*/];
});
}); });
describe("newNotFound", function () {

@@ -221,2 +232,10 @@ it("should return correctly", function () {

});
describe("newPermissionDenied", function () {
it("should return correctly", function () {
var error = error_1.newPermissionDenied();
chai_1.expect(error.code).to.equal(dto_1.ErrorCode.Unauthorized);
chai_1.expect(error.subErrors[0].code).to.equal(dto_1.SubErrorCode.PermissionDenied);
chai_1.expect(error.subErrors.length).to.equal(1);
});
});
describe("wrapError", function () {

@@ -223,0 +242,0 @@ it("should return correctly for Not Found error", function () {

import { SwpHttp } from "./http";
import { AccountDTO, ActionBatchDTO, AssetDTO, CredentialDTO, NewActionBatchDTO, NewWebHookDTO, SearchOptions, WebHookDTO } from "../common/dto";
import { AccountDTO, ActionBatchDTO, AssetDTO, CredentialDTO, NewActionBatchDTO, NewTriggerDTO, SearchOptions, TriggerDTO } from "../common/dto";
import { SwpSuccessResponse } from "../common/http/dto";

@@ -16,3 +16,4 @@ export declare class Ledger {

newActionBatch(batch: NewActionBatchDTO): Promise<SwpSuccessResponse<ActionBatchDTO>>;
newWebHook(webHook: NewWebHookDTO): Promise<SwpSuccessResponse<WebHookDTO>>;
newTrigger(newTrigger: NewTriggerDTO): Promise<SwpSuccessResponse<TriggerDTO>>;
getTrigger(id: string, opt?: SearchOptions): Promise<SwpSuccessResponse<TriggerDTO>>;
reset(): Promise<SwpSuccessResponse<AccountDTO>>;

@@ -19,0 +20,0 @@ createCredential(childAccountId: string): Promise<SwpSuccessResponse<CredentialDTO>>;

@@ -105,9 +105,16 @@ "use strict";

};
Ledger.prototype.newWebHook = function (webHook) {
Ledger.prototype.newTrigger = function (newTrigger) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.http.post("/webhooks", { body: webHook })];
return [2 /*return*/, this.http.post("/triggers", { body: newTrigger })];
});
});
};
Ledger.prototype.getTrigger = function (id, opt) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.http.get("/triggers/" + id, { searchOptions: opt })];
});
});
};
Ledger.prototype.reset = function () {

@@ -114,0 +121,0 @@ return __awaiter(this, void 0, void 0, function () {

{
"name": "@swp/ledger-sdk",
"version": "0.0.33",
"version": "0.0.34",
"description": "",

@@ -5,0 +5,0 @@ "private": false,

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