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

@minka/ledger-sdk

Package Overview
Dependencies
Maintainers
6
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@minka/ledger-sdk - npm Package Compare versions

Comparing version 2.11.0 to 2.11.4

4

format/src/lib/validation.js

@@ -26,3 +26,3 @@ "use strict";

*/
exports.HANDLE_REGEX = /^[a-z][a-z0-9_\-.]*$/;
exports.HANDLE_REGEX = /^[a-z][a-z0-9_\-.:]*$/;
/**

@@ -85,3 +85,3 @@ * Regular expression which matches the address used in source

if (!exports.HANDLE_REGEX.test(value)) {
throw new Error(`Only values with lowercase letters, digits, _, -, and . are allowed.`);
throw new Error(`Only values with lowercase letters, digits, _, -, :, and . are allowed.`);
}

@@ -88,0 +88,0 @@ return;

{
"name": "@minka/ledger-sdk",
"version": "2.11.0",
"version": "2.11.4",
"description": "SDK for Minka Ledger",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -137,2 +137,19 @@ /**

/**
* Gets active ledger
* @returns active ledger handle
*/
getActiveLedger(): string;
/**
* Asserts the client doesn't have
* an active ledger set in context
* @throws {LedgerSdkError}
*/
protected assertSingleTenant(): void;
/**
* Asserts the client has
* an active ledger set in context
* @throws {LedgerSdkError}
*/
protected assertMultiTenant(): void;
/**
* Sets record identifier to context.

@@ -139,0 +156,0 @@ *

@@ -324,2 +324,29 @@ "use strict";

/**
* Gets active ledger
* @returns active ledger handle
*/
getActiveLedger() {
return this.activeLedger;
}
/**
* Asserts the client doesn't have
* an active ledger set in context
* @throws {LedgerSdkError}
*/
assertSingleTenant() {
if (this.activeLedger) {
throw new ledger_sdk_error_1.LedgerSdkError(new Error('Active ledger should not be set in context'));
}
}
/**
* Asserts the client has
* an active ledger set in context
* @throws {LedgerSdkError}
*/
assertMultiTenant() {
if (!this.activeLedger) {
throw new ledger_sdk_error_1.LedgerSdkError(new Error('Active ledger should be set in context'));
}
}
/**
* Sets record identifier to context.

@@ -326,0 +353,0 @@ *

@@ -6,3 +6,3 @@ /**

import { AxiosResponse } from 'axios';
import { JwtConfig, Ledger, LedgerIdentifier, LedgerPagedList, LedgerRecord } from "../../../types/src";
import { JwtConfig, Ledger, LedgerPagedList, LedgerRecord } from "../../../types/src";
import { BaseClient } from '../common/clients/base-client';

@@ -75,3 +75,4 @@ import { CreateRecordBuilder } from '../common/services/create-record-builder';

/**
* Gets a ledger instance by identifier (luid or handle).
* Gets the ledger instance from active ledger identifier
* set in context.
*

@@ -81,6 +82,5 @@ * @see {Ledger}

* current user doesn't have access to this instance
* @param id a unique instance handle
* @returns a single instance response with the requested instance
*/
read(id: LedgerIdentifier, authParams?: Partial<JwtConfig>): Promise<LedgerResponse>;
read(authParams?: Partial<JwtConfig>): Promise<LedgerResponse>;
/**

@@ -87,0 +87,0 @@ * Queries instances from a ledger.

@@ -14,2 +14,3 @@ "use strict";

const LEDGERS_PATH = '/ledgers';
const LEDGER_PATH = '/ledger';
/**

@@ -56,2 +57,3 @@ * Single instance API response.

init(record) {
this.assertSingleTenant();
const builder = new create_record_builder_1.CreateRecordBuilder(async (record, authParams) => {

@@ -74,3 +76,3 @@ return this.createRecord(LEDGERS_PATH, LedgerResponse, record, authParams);

const builder = new update_record_builder_1.UpdateRecordBuilder(async (record, authParams) => {
return this.updateRecord(`${LEDGERS_PATH}/${encodeURIComponent(record.data.handle)}`, LedgerResponse, record, authParams);
return this.updateRecord(LEDGER_PATH, LedgerResponse, record, authParams);
});

@@ -93,3 +95,3 @@ record = lodash_1.default.cloneDeep(record);

const builder = new update_record_builder_1.UpdateRecordBuilder(async (record, authParams) => {
return this.updateRecord(`${LEDGERS_PATH}/${encodeURIComponent(record.data.handle)}`, LedgerResponse, record, authParams);
return this.updateRecord(LEDGER_PATH, LedgerResponse, record, authParams);
});

@@ -101,3 +103,4 @@ record = lodash_1.default.cloneDeep(record);

/**
* Gets a ledger instance by identifier (luid or handle).
* Gets the ledger instance from active ledger identifier
* set in context.
*

@@ -107,7 +110,6 @@ * @see {Ledger}

* current user doesn't have access to this instance
* @param id a unique instance handle
* @returns a single instance response with the requested instance
*/
async read(id, authParams) {
return this.getRecord(`${LEDGERS_PATH}/${encodeURIComponent(id)}`, LedgerResponse, authParams);
async read(authParams) {
return this.getRecord(LEDGER_PATH, LedgerResponse, authParams);
}

@@ -122,2 +124,3 @@ /**

async list(params) {
this.assertSingleTenant();
return this.getRecordsList(LEDGERS_PATH, LedgersResponse, params);

@@ -124,0 +127,0 @@ }

@@ -142,4 +142,6 @@ "use strict";

this.advice,
this.ledger,
];
this.clients = [...this.multitenantClients, this.ledger];
// single tenant clients should be include here
this.clients = [...this.multitenantClients];
this.handle = {

@@ -146,0 +148,0 @@ unique: () => {

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

import { LedgerAccess } from './ledger-access';
import { LedgerHash } from './ledger-hash';

@@ -11,2 +12,6 @@ export type LedgerBaseData = {

parent?: LedgerHash;
/**
* Determines access controls for the schema.
*/
access?: LedgerAccess;
};

@@ -34,3 +34,3 @@ import { LedgerAccess } from '../common/ledger-access';

*/
export type LedgerCircleSigner = LedgerBaseData & {
export type LedgerCircleSigner = Omit<LedgerBaseData, 'access'> & {
/**

@@ -37,0 +37,0 @@ * A circle this relationship belongs to.

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