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

@perspect3vism/ad4m

Package Overview
Dependencies
Maintainers
4
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@perspect3vism/ad4m - npm Package Compare versions

Comparing version 0.1.31 to 0.1.32

lib/expression/ExpressionRef.d.ts

19

lib/language/Language.d.ts
import type { Address } from '../Address';
import { DID } from '../DID';
import type { Expression } from '../expression/Expression';
import type { LinkQuery } from '../perspectives/LinkQuery';
import { Perspective, PerspectiveExpression } from '../perspectives/Perspective';
import { PerspectiveDiff } from '../perspectives/PerspectiveDiff';
export interface Language {

@@ -14,3 +14,3 @@ readonly name: string;

readonly directMessageAdapter?: DirectMessageAdapter;
readonly linksAdapter?: LinksAdapter;
readonly linksAdapter?: LinkSyncAdapter;
readonly expressionUI?: ExpressionUI;

@@ -46,12 +46,13 @@ readonly settingsUI?: SettingsUI;

}
export declare type NewLinksObserver = (added: Expression[], removed: Expression[]) => void;
export interface LinksAdapter {
export declare type PerspectiveDiffObserver = (diff: PerspectiveDiff) => void;
export interface LinkSyncAdapter {
writable(): boolean;
public(): boolean;
others(): Promise<DID[]>;
addLink(linkExpression: Expression): any;
updateLink(oldLinkExpression: Expression, newLinkExpression: Expression): any;
removeLink(link: Expression): any;
getLinks(query: LinkQuery): Promise<Expression[]>;
addCallback(callback: NewLinksObserver): any;
latestRevision(): Promise<string>;
currentRevision(): Promise<string>;
pull(): Promise<PerspectiveDiff>;
render(): Promise<Perspective>;
commit(diff: PerspectiveDiff): Promise<string>;
addCallback(callback: PerspectiveDiffObserver): any;
}

@@ -58,0 +59,0 @@ export declare type MessageCallback = (message: PerspectiveExpression) => void;

@@ -14,2 +14,3 @@ export declare class Link {

export declare class LinkExpression extends LinkExpression_base {
hash(): number;
}

@@ -21,3 +22,2 @@ declare const LinkExpressionInput_base: any;

export declare function isLink(l: any): boolean;
export declare function hashLinkExpression(link: LinkExpression): number;
export {};

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.hashLinkExpression = exports.isLink = exports.linkEqual = exports.LinkExpressionInput = exports.LinkExpression = exports.LinkInput = exports.Link = void 0;
exports.isLink = exports.linkEqual = exports.LinkExpressionInput = exports.LinkExpression = exports.LinkInput = exports.Link = void 0;
const type_graphql_1 = require("type-graphql");

@@ -59,2 +59,13 @@ const Expression_1 = require("../expression/Expression");

let LinkExpression = class LinkExpression extends (0, Expression_1.ExpressionGeneric)(Link) {
hash() {
const mash = JSON.stringify(this.data, Object.keys(this.data).sort()) +
JSON.stringify(this.author) + this.timestamp;
let hash = 0, i, chr;
for (i = 0; i < mash.length; i++) {
chr = mash.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
}
};

@@ -85,13 +96,1 @@ LinkExpression = __decorate([

exports.isLink = isLink;
function hashLinkExpression(link) {
const mash = JSON.stringify(link.data, Object.keys(link.data).sort()) +
JSON.stringify(link.author) + link.timestamp;
let hash = 0, i, chr;
for (i = 0; i < mash.length; i++) {
chr = mash.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
}
exports.hashLinkExpression = hashLinkExpression;

@@ -20,4 +20,5 @@ import "reflect-metadata";

export * from "./perspectives/PerspectiveProxy";
export * from "./perspectives/PerspectiveDiff";
export * from "./perspectives/LinkQuery";
export * from "./neighbourhood/Neighbourhood";
export * from "./typeDefs";

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

__exportStar(require("./perspectives/PerspectiveProxy"), exports);
__exportStar(require("./perspectives/PerspectiveDiff"), exports);
__exportStar(require("./perspectives/LinkQuery"), exports);
__exportStar(require("./neighbourhood/Neighbourhood"), exports);
__exportStar(require("./typeDefs"), exports);
import type { Address } from '../Address';
import { DID } from '../DID';
import type { Expression } from '../expression/Expression';
import type { LinkQuery } from '../perspectives/LinkQuery';
import { Perspective, PerspectiveExpression } from '../perspectives/Perspective';
import { PerspectiveDiff } from '../perspectives/PerspectiveDiff';
export interface Language {

@@ -14,3 +14,3 @@ readonly name: string;

readonly directMessageAdapter?: DirectMessageAdapter;
readonly linksAdapter?: LinksAdapter;
readonly linksAdapter?: LinkSyncAdapter;
readonly expressionUI?: ExpressionUI;

@@ -46,12 +46,13 @@ readonly settingsUI?: SettingsUI;

}
export declare type NewLinksObserver = (added: Expression[], removed: Expression[]) => void;
export interface LinksAdapter {
export declare type PerspectiveDiffObserver = (diff: PerspectiveDiff) => void;
export interface LinkSyncAdapter {
writable(): boolean;
public(): boolean;
others(): Promise<DID[]>;
addLink(linkExpression: Expression): any;
updateLink(oldLinkExpression: Expression, newLinkExpression: Expression): any;
removeLink(link: Expression): any;
getLinks(query: LinkQuery): Promise<Expression[]>;
addCallback(callback: NewLinksObserver): any;
latestRevision(): Promise<string>;
currentRevision(): Promise<string>;
pull(): Promise<PerspectiveDiff>;
render(): Promise<Perspective>;
commit(diff: PerspectiveDiff): Promise<string>;
addCallback(callback: PerspectiveDiffObserver): any;
}

@@ -58,0 +59,0 @@ export declare type MessageCallback = (message: PerspectiveExpression) => void;

@@ -14,2 +14,3 @@ export declare class Link {

export declare class LinkExpression extends LinkExpression_base {
hash(): number;
}

@@ -21,3 +22,2 @@ declare const LinkExpressionInput_base: any;

export declare function isLink(l: any): boolean;
export declare function hashLinkExpression(link: LinkExpression): number;
export {};

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.hashLinkExpression = exports.isLink = exports.linkEqual = exports.LinkExpressionInput = exports.LinkExpression = exports.LinkInput = exports.Link = void 0;
exports.isLink = exports.linkEqual = exports.LinkExpressionInput = exports.LinkExpression = exports.LinkInput = exports.Link = void 0;
const type_graphql_1 = require("type-graphql");

@@ -59,2 +59,13 @@ const Expression_1 = require("../expression/Expression");

let LinkExpression = class LinkExpression extends (0, Expression_1.ExpressionGeneric)(Link) {
hash() {
const mash = JSON.stringify(this.data, Object.keys(this.data).sort()) +
JSON.stringify(this.author) + this.timestamp;
let hash = 0, i, chr;
for (i = 0; i < mash.length; i++) {
chr = mash.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
}
};

@@ -85,13 +96,1 @@ LinkExpression = __decorate([

exports.isLink = isLink;
function hashLinkExpression(link) {
const mash = JSON.stringify(link.data, Object.keys(link.data).sort()) +
JSON.stringify(link.author) + link.timestamp;
let hash = 0, i, chr;
for (i = 0; i < mash.length; i++) {
chr = mash.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
}
exports.hashLinkExpression = hashLinkExpression;
{
"name": "@perspect3vism/ad4m",
"version": "0.1.31",
"version": "0.1.32",
"description": "*The Agent-Centric Distributed Application Meta-ontology* or just: *Agent-Centric DApp Meta-ontology* * A new meta-ontology for interoperable, decentralized application design * A spanning-layer to enable seamless integration between Holochain DNAs, blockchains, linked-data structures/ontologies and centralized back-ends * The basis for turning distinct, monolithic and siloed apps into a global, open and interoperable sense-making network",

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

@@ -20,4 +20,5 @@ import "reflect-metadata";

export * from "./perspectives/PerspectiveProxy";
export * from "./perspectives/PerspectiveDiff";
export * from "./perspectives/LinkQuery";
export * from "./neighbourhood/Neighbourhood";
export * from "./typeDefs";
import type { Address } from '../Address'
import { DID } from '../DID';
import type { Expression } from '../expression/Expression'
import type { LinkQuery } from '../perspectives/LinkQuery'
import { Perspective, PerspectiveExpression } from '../perspectives/Perspective';
import { PerspectiveDiff } from '../perspectives/PerspectiveDiff';
import { InputType, Field, ObjectType } from "type-graphql";

@@ -30,3 +30,3 @@

// Optional adpater for sharing links
readonly linksAdapter?: LinksAdapter;
readonly linksAdapter?: LinkSyncAdapter;

@@ -107,6 +107,13 @@ readonly expressionUI?: ExpressionUI;

export type NewLinksObserver = (added: Expression[], removed: Expression[])=>void;
export type PerspectiveDiffObserver = (diff: PerspectiveDiff)=>void;
// Implement this if your Language can share Links between Agents' Perspectives
export interface LinksAdapter {
// Interface for "Link Languages" that facilitate the synchronization
// between agents' local Perspectives inside a Neighbourhood.
// The assumption is that every version of the shared Perspective
// is labeled with a unique revision string.
// Changes are committed and retrieved through diffs.
// Think of a LinkSyncAdapter as a git branch to which agents commit
// their changes to and pull diffs from their current revision
// to the latest one.
export interface LinkSyncAdapter {
writable(): boolean;

@@ -116,10 +123,20 @@ public(): boolean;

addLink(linkExpression: Expression);
updateLink(oldLinkExpression: Expression, newLinkExpression: Expression);
removeLink(link: Expression);
// Call this to check if there are new changes
// (compare returned revision with last one that was pulled)
latestRevision(): Promise<string>;
getLinks(query: LinkQuery): Promise<Expression[]>;
// What revision are we on now -> what changes are included in output of render()
currentRevision(): Promise<string>;
// Get push notified by added links
addCallback(callback: NewLinksObserver);
// Check for and get new changes.
pull(): Promise<PerspectiveDiff>;
// Returns the full, rendered Perspective at currentRevision,
render(): Promise<Perspective>;
// Publish changes.
commit(diff: PerspectiveDiff): Promise<string>;
// Get push notification when a diff got published
addCallback(callback: PerspectiveDiffObserver);
}

@@ -126,0 +143,0 @@

@@ -35,3 +35,15 @@ import { Field, InputType, ObjectType } from "type-graphql";

@ObjectType()
export class LinkExpression extends ExpressionGeneric(Link) {};
export class LinkExpression extends ExpressionGeneric(Link) {
hash(): number {
const mash = JSON.stringify(this.data, Object.keys(this.data).sort()) +
JSON.stringify(this.author) + this.timestamp
let hash = 0, i, chr;
for (i = 0; i < mash.length; i++) {
chr = mash.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
}
};

@@ -52,13 +64,1 @@ @InputType()

}
export function hashLinkExpression(link: LinkExpression): number {
const mash = JSON.stringify(link.data, Object.keys(link.data).sort()) +
JSON.stringify(link.author) + link.timestamp
let hash = 0, i, chr;
for (i = 0; i < mash.length; i++) {
chr = mash.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
}

@@ -13,4 +13,4 @@ import PerspectiveClient, { LinkCallback, PerspectiveHandleCallback } from "./PerspectiveClient";

#client: PerspectiveClient
#perspectiveLinkAddedCallbacks: PerspectiveHandleCallback[]
#perspectiveLinkRemovedCallbacks: PerspectiveHandleCallback[]
#perspectiveLinkAddedCallbacks: LinkCallback[]
#perspectiveLinkRemovedCallbacks: LinkCallback[]
#executeAction

@@ -17,0 +17,0 @@

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