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

@ozkarjs/vhir

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ozkarjs/vhir - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

tests/datasample/heartbeat.json

1

build/src/index.d.ts

@@ -8,1 +8,2 @@ export { Consent } from './resource/consent';

export * from './linearization/ipld';
export { JsonParser } from './utils/jsonParser';

@@ -8,2 +8,3 @@ export { Consent } from './resource/consent';

export * from './linearization/ipld';
export { JsonParser } from './utils/jsonParser';
//# sourceMappingURL=index.js.map

2

build/src/types/monitoring.types.d.ts

@@ -27,3 +27,3 @@ import { type Query } from '../query/query';

export type DatasetInfo = {
keyNumber: number;
keyNumber?: number;
};

@@ -30,0 +30,0 @@ export type MerkleInfo = {

@@ -93,2 +93,13 @@ import { MerkleMap } from 'o1js';

}): MerkleMap;
export declare class JsonParser {
static countKeys(obj: any): number;
static linearDataToMerkleMap(linearData: {
[key: string]: JsonValue;
}): MerkleMap;
static linearizeJson(jsonObject: {
[key: string]: JsonValue;
}, parentKey?: string): {
[key: string]: JsonValue;
};
}
export {};

@@ -42,2 +42,53 @@ import { MerkleMap, Field } from 'o1js';

}
export class JsonParser {
static countKeys(obj) {
let count = 0;
for (let key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
count++;
if (typeof obj[key] === 'object' && obj[key] !== null) {
count += this.countKeys(obj[key]);
}
}
}
return count;
}
static linearDataToMerkleMap(linearData) {
const merkleMap = new MerkleMap();
let value;
for (const [path, value] of Object.entries(linearData)) {
//TODO: handle large strings (bigger than a string packed field)
let fieldValue;
const packedPath = TextInput.fromString(path.toString());
if (typeof value === 'string') {
fieldValue = TextInput.fromString(value.toString()).packed;
}
else if (typeof value === 'number') {
fieldValue = Field(value);
}
else {
fieldValue = Field(0);
}
//TODO: handle integers and booleans
const packedValue = TextInput.fromString(value.toString());
merkleMap.set(packedPath.packed, fieldValue);
}
return merkleMap;
}
static linearizeJson(jsonObject, parentKey = '') {
let kvPairs = {};
for (const key in jsonObject) {
if (!jsonObject.hasOwnProperty(key))
continue;
const fullKey = parentKey ? `${parentKey}.${key}` : key;
if (typeof jsonObject[key] === 'object' && jsonObject[key] !== null) {
Object.assign(kvPairs, linearizeJson(jsonObject[key], fullKey));
}
else {
kvPairs[fullKey] = jsonObject[key];
}
}
return kvPairs;
}
}
//# sourceMappingURL=jsonParser.js.map
{
"name": "@ozkarjs/vhir",
"version": "0.2.4",
"version": "0.2.5",
"author": "",

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

import { PrivateKey, verify } from 'o1js';
import { parseJSON } from '../src/customTypes/jsonParsing';
import jsontest from './data/jsontest.json';
import heartbeat from './data/observations/heartbeat.json';
import heartbeat from './datasample/heartbeat.json';
import { test, expect, it, describe, beforeAll } from '@jest/globals';

@@ -24,3 +22,3 @@ import {

import { type PerformanceData } from '../src/types/monitoring.types.js';
import { Utils } from './utils/utils.js';
// Get the directory name of the current module

@@ -37,6 +35,6 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));

it('correctly verifies value of a specific key', async () => {
const json = parseJSON(JSON.stringify(jsontest));
json.key('value').assertEqualString('"92"');
});
// it('correctly verifies value of a specific key', async () => {
// const json = parseJSON(JSON.stringify(jsontest));
// json.key('value').assertEqualString('"92"');
// });

@@ -181,2 +179,7 @@ it('linearize json and builds a merkle map with direct value storage', async () => {

const keyNumber = Utils.countKeys(heartbeat);
performanceData.datasetInfo ??= {}; // Initialize 'performanceData.datasetInfo' if it is undefined
performanceData.datasetInfo.keyNumber = keyNumber;
const ln = IPLD.LinearModel.fromJS(heartbeat);

@@ -206,6 +209,2 @@

if (!performanceData.datasetInfo) {
performanceData.datasetInfo = { keyNumber: ln.size }; // Initialize with default values
}
performanceData.merkleInfo.merkleLength = map.witnessLength;

@@ -230,3 +229,2 @@

proofE.proof
proofE
);

@@ -249,4 +247,4 @@

__dirname,
'logs/performance/jsonproving/',
`light-${timestamp}.json`
'perflogs/',
`heartbeat-${timestamp}.json`
);

@@ -253,0 +251,0 @@ fs.writeFileSync(logPath, JSON.stringify(performanceData, null, 2));

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