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

@instantdb/core

Package Overview
Dependencies
Maintainers
0
Versions
205
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@instantdb/core - npm Package Compare versions

Comparing version 0.14.20 to 0.14.21

17

__tests__/src/instaml.test.js

@@ -29,2 +29,18 @@ import { test, expect } from "vitest";

test("ignores id attrs", () => {
const testId = uuid();
const ops = instatx.tx.books[testId].update({ title: "New Title", id: 'ploop' });
const result = instaml.transform(zenecaAttrs, ops);
const expected = [
["add-triple", testId, zenecaAttrToId["books/title"], "New Title"],
["add-triple", testId, zenecaAttrToId["books/id"], testId],
];
expect(result).toHaveLength(expected.length);
for (const item of expected) {
expect(result).toContainEqual(item);
}
});
test("optimistically adds attrs if they don't exist", () => {

@@ -681,1 +697,2 @@ const testId = uuid();

});

12

dist/instaml.js

@@ -193,3 +193,13 @@ "use strict";

}
function toTxSteps(attrs, [action, ...args]) {
function removeIdFromArgs(step) {
const [op, etype, eid, obj] = step;
if (!obj) {
return step;
}
const newObj = Object.assign({}, obj);
delete newObj.id;
return [op, etype, eid, newObj];
}
function toTxSteps(attrs, step) {
const [action, ...args] = removeIdFromArgs(step);
switch (action) {

@@ -196,0 +206,0 @@ case "merge":

@@ -184,3 +184,13 @@ import { getOps, isLookup, parseLookup } from "./instatx";

}
function toTxSteps(attrs, [action, ...args]) {
function removeIdFromArgs(step) {
const [op, etype, eid, obj] = step;
if (!obj) {
return step;
}
const newObj = Object.assign({}, obj);
delete newObj.id;
return [op, etype, eid, newObj];
}
function toTxSteps(attrs, step) {
const [action, ...args] = removeIdFromArgs(step);
switch (action) {

@@ -187,0 +197,0 @@ case "merge":

2

package.json
{
"name": "@instantdb/core",
"version": "v0.14.20",
"version": "v0.14.21",
"description": "Instant's core local abstraction",

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

@@ -210,4 +210,14 @@ import { getOps, isLookup, parseLookup } from "./instatx";

}
function removeIdFromArgs(step) {
const [op, etype, eid, obj] = step;
if (!obj) {
return step;
}
const newObj = {...obj};
delete newObj.id
return [op, etype, eid, newObj]
}
function toTxSteps(attrs, [action, ...args]) {
function toTxSteps(attrs, step) {
const [action, ...args] = removeIdFromArgs(step);
switch (action) {

@@ -214,0 +224,0 @@ case "merge":

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 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