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

@automerge/automerge

Package Overview
Dependencies
Maintainers
4
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@automerge/automerge - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0-alpha.1

4

dist/cjs/low_level.js

@@ -14,6 +14,6 @@ "use strict";

exports.ApiHandler = {
create(textV2, actor) {
create(options) {
throw new RangeError("Automerge.use() not called");
},
load(data, textV2, actor) {
load(data, options) {
throw new RangeError("Automerge.use() not called (load)");

@@ -20,0 +20,0 @@ },

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

const patchCallback = opts.patchCallback;
const handle = low_level_1.ApiHandler.create(opts.enableTextV2 || false, opts.actor);
handle.enablePatches(true);
const text_v1 = !(opts.enableTextV2 || false);
const actor = opts.actor;
const handle = low_level_1.ApiHandler.create({ actor, text_v1 });
handle.enableFreeze(!!opts.freeze);

@@ -234,3 +235,15 @@ handle.registerDatatype("counter", (n) => new types_1.Counter(n));

const nextState = Object.assign(Object.assign({}, state), { heads: undefined });
const nextDoc = state.handle.applyPatches(doc, nextState, callback);
let nextDoc;
if (callback != null) {
let headsBefore = state.heads;
let { value, patches } = state.handle.applyAndReturnPatches(doc, nextState);
if (patches.length > 0) {
let before = view(doc, headsBefore || []);
callback(patches, { before, after: value });
}
nextDoc = value;
}
else {
nextDoc = state.handle.applyPatches(doc, nextState);
}
state.heads = heads;

@@ -322,4 +335,5 @@ return nextDoc;

const patchCallback = opts.patchCallback;
const handle = low_level_1.ApiHandler.load(data, opts.enableTextV2 || false, actor);
handle.enablePatches(true);
const text_v1 = !(opts.enableTextV2 || false);
const unchecked = opts.unchecked || false;
const handle = low_level_1.ApiHandler.load(data, { text_v1, actor, unchecked });
handle.enableFreeze(!!opts.freeze);

@@ -326,0 +340,0 @@ handle.registerDatatype("counter", (n) => new types_1.Counter(n));

@@ -10,6 +10,6 @@ export function UseApi(api) {

export const ApiHandler = {
create(textV2, actor) {
create(options) {
throw new RangeError("Automerge.use() not called");
},
load(data, textV2, actor) {
load(data, options) {
throw new RangeError("Automerge.use() not called (load)");

@@ -16,0 +16,0 @@ },

@@ -56,4 +56,5 @@ var __rest = (this && this.__rest) || function (s, e) {

const patchCallback = opts.patchCallback;
const handle = ApiHandler.create(opts.enableTextV2 || false, opts.actor);
handle.enablePatches(true);
const text_v1 = !(opts.enableTextV2 || false);
const actor = opts.actor;
const handle = ApiHandler.create({ actor, text_v1 });
handle.enableFreeze(!!opts.freeze);

@@ -217,3 +218,15 @@ handle.registerDatatype("counter", (n) => new Counter(n));

const nextState = Object.assign(Object.assign({}, state), { heads: undefined });
const nextDoc = state.handle.applyPatches(doc, nextState, callback);
let nextDoc;
if (callback != null) {
let headsBefore = state.heads;
let { value, patches } = state.handle.applyAndReturnPatches(doc, nextState);
if (patches.length > 0) {
let before = view(doc, headsBefore || []);
callback(patches, { before, after: value });
}
nextDoc = value;
}
else {
nextDoc = state.handle.applyPatches(doc, nextState);
}
state.heads = heads;

@@ -304,4 +317,5 @@ return nextDoc;

const patchCallback = opts.patchCallback;
const handle = ApiHandler.load(data, opts.enableTextV2 || false, actor);
handle.enablePatches(true);
const text_v1 = !(opts.enableTextV2 || false);
const unchecked = opts.unchecked || false;
const handle = ApiHandler.load(data, { text_v1, actor, unchecked });
handle.enableFreeze(!!opts.freeze);

@@ -308,0 +322,0 @@ handle.registerDatatype("counter", (n) => new Counter(n));

@@ -76,2 +76,4 @@ /** @hidden **/

enableTextV2?: boolean;
/** @hidden */
unchecked?: boolean;
};

@@ -78,0 +80,0 @@ /** @hidden */

@@ -6,3 +6,3 @@ export { Text } from "./text";

import { Counter } from "./counter";
import type { Patch, PatchInfo } from "@automerge/automerge-wasm";
import type { Patch } from "@automerge/automerge-wasm";
export type { Patch, Mark, MarkRange } from "@automerge/automerge-wasm";

@@ -28,2 +28,6 @@ export type AutomergeValue = ScalarValue | {

};
export type PatchInfo<T> = {
before: Doc<T>;
after: Doc<T>;
};
/**

@@ -30,0 +34,0 @@ * Callback which is called by various methods in this library to notify the

@@ -7,3 +7,3 @@ {

],
"version": "2.0.3",
"version": "2.1.0-alpha.1",
"description": "Javascript implementation of automerge, backed by @automerge/automerge-wasm",

@@ -39,3 +39,3 @@ "homepage": "https://github.com/automerge/automerge/tree/main/javascript",

"@typescript-eslint/parser": "^5.46.0",
"denoify": "^1.4.5",
"denoify": "1.4.5",
"eslint": "^8.29.0",

@@ -51,6 +51,9 @@ "fast-sha256": "^1.3.0",

},
"resolutions": {
"denoify/evt": "2.4.18"
},
"dependencies": {
"@automerge/automerge-wasm": "^0.1.26",
"@automerge/automerge-wasm": "^0.2.0",
"uuid": "^9.0.0"
}
}
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