🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@peerbit/indexer-interface

Package Overview
Dependencies
Maintainers
0
Versions
200
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@peerbit/indexer-interface - npm Package Compare versions

Comparing version

to
2.0.2-27dca31

dist/src/errors.d.ts

@@ -43,2 +43,7 @@ export declare abstract class PrimitiveValue {

}
export declare class LargeIntegerKey extends IdKey {
key: bigint;
constructor(key: bigint);
get primitive(): bigint;
}
export type Ideable = string | number | bigint | Uint8Array;

@@ -45,0 +50,0 @@ export declare const toId: (obj: Ideable) => IdKey;

32

dist/src/id.js

@@ -48,3 +48,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

if (!Number.isInteger(number) || number > 4294967295 || number < 0) {
throw new Error("Number is not u32");
throw new Error("Number is not u32: " + number);
}

@@ -162,3 +162,24 @@ this.number = number;

export { IntegerKey };
let LargeIntegerKey = class LargeIntegerKey extends IdKey {
key;
constructor(key) {
super();
this.key = key;
}
get primitive() {
return this.key;
}
};
__decorate([
field({ type: "u64" }) // max value is 2^63 - 1 (9007199254740991)
,
__metadata("design:type", BigInt)
], LargeIntegerKey.prototype, "key", void 0);
LargeIntegerKey = __decorate([
variant(3),
__metadata("design:paramtypes", [BigInt])
], LargeIntegerKey);
export { LargeIntegerKey };
const idKeyTypes = new Set(["string", "number", "bigint"]);
const u64Max = 18446744073709551615n;
export const toId = (obj) => {

@@ -172,6 +193,9 @@ if (typeof obj === "string") {

if (typeof obj === "bigint") {
if (obj <= Number.MAX_SAFE_INTEGER && obj >= 0n) {
return new IntegerKey(Number(obj));
if (obj <= u64Max && obj >= 0n) {
return new LargeIntegerKey(obj);
}
throw new Error("BigInt is not less than 2^53. Max value is 9007199254740991");
throw new Error("BigInt is not less than 2^64 - 1. Max value is " +
(2 ** 64 - 1) +
". Provided value: " +
obj);
}

@@ -178,0 +202,0 @@ if (obj instanceof Uint8Array) {

@@ -5,2 +5,3 @@ export * from "./id.js";

export * from "./utils.js";
export * from "./errors.js";
//# sourceMappingURL=index.d.ts.map

@@ -5,2 +5,3 @@ export * from "./id.js";

export * from "./utils.js";
export * from "./errors.js";
//# sourceMappingURL=index.js.map

4

dist/src/query.d.ts

@@ -96,7 +96,7 @@ import { IntegerValue } from "./id.js";

id: string;
path: string;
path: string[];
query: Query[];
constructor(props: {
id?: string;
path: string;
path: string | string[];
query: Query[] | Query | Record<string, string | number | bigint | Uint8Array | boolean | null | undefined>;

@@ -103,0 +103,0 @@ });

@@ -318,3 +318,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

super();
this.path = props.path;
this.path = Array.isArray(props.path) ? props.path : [props.path];
this.id = props.id ?? uuid();

@@ -329,4 +329,4 @@ this.query = toQuery(props.query);

__decorate([
field({ type: "string" }),
__metadata("design:type", String)
field({ type: vec("string") }),
__metadata("design:type", Array)
], Nested.prototype, "path", void 0);

@@ -333,0 +333,0 @@ __decorate([

{
"name": "@peerbit/indexer-interface",
"version": "2.0.1",
"description": "Indexer store interface",
"sideEffects": false,
"type": "module",
"types": "./dist/src/index.d.ts",
"typesVersions": {
"*": {
"*": [
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
],
"src/*": [
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
]
}
},
"files": [
"src",
"dist",
"!dist/e2e",
"!dist/test",
"!**/*.tsbuildinfo"
],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/src/index.js"
}
},
"eslintConfig": {
"extends": "peerbit",
"parserOptions": {
"project": true,
"sourceType": "module"
},
"ignorePatterns": [
"!.aegir.js",
"test/ts-use",
"*.d.ts"
]
},
"publishConfig": {
"access": "public"
},
"scripts": {
"clean": "aegir clean",
"build": "aegir build --no-bundle",
"test": "aegir test",
"lint": "aegir lint"
},
"author": "dao.xyz",
"license": "MIT",
"dependencies": {
"uuid": "^10.0.0",
"@dao-xyz/borsh": "^5.2.3",
"@peerbit/crypto": "^2.3.2"
}
"name": "@peerbit/indexer-interface",
"version": "2.0.2-27dca31",
"description": "Indexer store interface",
"sideEffects": false,
"type": "module",
"types": "./dist/src/index.d.ts",
"typesVersions": {
"*": {
"*": [
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
],
"src/*": [
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
]
}
},
"files": [
"src",
"dist",
"!dist/e2e",
"!dist/test",
"!**/*.tsbuildinfo"
],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/src/index.js"
}
},
"eslintConfig": {
"extends": "peerbit",
"parserOptions": {
"project": true,
"sourceType": "module"
},
"ignorePatterns": [
"!.aegir.js",
"test/ts-use",
"*.d.ts"
]
},
"publishConfig": {
"access": "public"
},
"scripts": {
"clean": "aegir clean",
"build": "aegir build --no-bundle",
"test": "aegir test",
"lint": "aegir lint"
},
"author": "dao.xyz",
"license": "MIT",
"dependencies": {
"uuid": "^10.0.0",
"@dao-xyz/borsh": "^5.2.3",
"@peerbit/crypto": "2.3.2-27dca31"
}
}

@@ -38,3 +38,3 @@ import { field, variant } from "@dao-xyz/borsh";

if (!Number.isInteger(number) || number > 4294967295 || number < 0) {
throw new Error("Number is not u32");
throw new Error("Number is not u32: " + number);
}

@@ -133,2 +133,17 @@ this.number = number;

@variant(3)
export class LargeIntegerKey extends IdKey {
@field({ type: "u64" }) // max value is 2^63 - 1 (9007199254740991)
key: bigint;
constructor(key: bigint) {
super();
this.key = key;
}
get primitive() {
return this.key;
}
}
export type Ideable = string | number | bigint | Uint8Array;

@@ -138,2 +153,3 @@

const u64Max = 18446744073709551615n;
export const toId = (obj: Ideable): IdKey => {

@@ -147,7 +163,10 @@ if (typeof obj === "string") {

if (typeof obj === "bigint") {
if (obj <= Number.MAX_SAFE_INTEGER && obj >= 0n) {
return new IntegerKey(Number(obj));
if (obj <= u64Max && obj >= 0n) {
return new LargeIntegerKey(obj);
}
throw new Error(
"BigInt is not less than 2^53. Max value is 9007199254740991",
"BigInt is not less than 2^64 - 1. Max value is " +
(2 ** 64 - 1) +
". Provided value: " +
obj,
);

@@ -154,0 +173,0 @@ }

@@ -111,3 +111,2 @@ import type { AbstractType } from "@dao-xyz/borsh";

): IndexIterator<T, S>;
getSize(): MaybePromise<number>;

@@ -114,0 +113,0 @@ start(): MaybePromise<void>;

@@ -5,1 +5,2 @@ export * from "./id.js";

export * from "./utils.js";
export * from "./errors.js";

@@ -259,4 +259,4 @@ import { deserialize, field, serialize, variant, vec } from "@dao-xyz/borsh";

@field({ type: "string" })
path: string;
@field({ type: vec("string") })
path: string[];

@@ -268,3 +268,3 @@ @field({ type: vec(Query) })

id?: string;
path: string;
path: string | string[];
query:

@@ -279,3 +279,3 @@ | Query[]

super();
this.path = props.path;
this.path = Array.isArray(props.path) ? props.path : [props.path];
this.id = props.id ?? uuid();

@@ -286,32 +286,2 @@ this.query = toQuery(props.query);

// TODO MemoryCompareQuery can be replaces with ByteMatchQuery? Or Nesteed Queries + ByteMatchQuery?
/* @variant(0)
export class MemoryCompare {
@field({ type: Uint8Array })
bytes: Uint8Array;
@field({ type: "u64" })
offset: bigint;
constructor(opts?: { bytes: Uint8Array; offset: bigint }) {
if (opts) {
this.bytes = opts.bytes;
this.offset = opts.offset;
}
}
}
@variant(4)
export class MemoryCompareQuery extends Query {
@field({ type: vec(MemoryCompare) })
compares: MemoryCompare[];
constructor(opts?: { compares: MemoryCompare[] }) {
super();
if (opts) {
this.compares = opts.compares;
}
}
} */
export type QueryLike =

@@ -318,0 +288,0 @@ | Query[]

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