Compare commits

...

6 Commits

Author SHA1 Message Date
Anselm
cb60088d2a Publish
- jazz-example-todo@0.0.8
 - cojson@0.0.21
 - jazz-browser@0.0.4
 - jazz-browser-auth-local@0.0.4
 - jazz-react@0.0.14
 - jazz-react-auth-local@0.0.11
 - jazz-storage-indexeddb@0.0.8
2023-08-17 22:24:01 +01:00
Anselm
a59d5d3b70 Fix max call stack size tsc errors 2023-08-17 22:23:47 +01:00
Anselm
dcdf829a05 Publish
- jazz-example-todo@0.0.7
 - cojson@0.0.20
 - jazz-browser@0.0.3
 - jazz-browser-auth-local@0.0.3
 - jazz-react@0.0.13
 - jazz-react-auth-local@0.0.10
 - jazz-storage-indexeddb@0.0.7
2023-08-17 22:04:08 +01:00
Anselm
a907321d02 Fix main and types fields 2023-08-17 22:03:43 +01:00
Anselm
a2b9be9dd0 Lint 2023-08-17 21:52:58 +01:00
Anselm
432d114438 Lint 2023-08-17 21:51:44 +01:00
12 changed files with 53 additions and 47 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-todo",
"private": true,
"version": "0.0.6",
"version": "0.0.8",
"type": "module",
"scripts": {
"dev": "vite",
@@ -14,8 +14,8 @@
"@radix-ui/react-slot": "^1.0.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"jazz-react": "^0.0.12",
"jazz-react-auth-local": "^0.0.9",
"jazz-react": "^0.0.14",
"jazz-react-auth-local": "^0.0.11",
"lucide-react": "^0.265.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",

View File

@@ -2,10 +2,10 @@
"name": "cojson",
"module": "dist/index.js",
"main": "dist/index.js",
"types": "src/index.ts",
"types": "dist/index.d.ts",
"type": "module",
"license": "MIT",
"version": "0.0.19",
"version": "0.0.21",
"devDependencies": {
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.2.1",

View File

@@ -1,6 +1,6 @@
import { CoID, ContentType } from './contentType.js';
import { RawCoID } from './ids.js';
export type JsonAtom = string | number | boolean | null;
export type JsonValue = JsonAtom | JsonArray | JsonObject | CoID<ContentType>;
export type JsonValue = JsonAtom | JsonArray | JsonObject | RawCoID;
export type JsonArray = JsonValue[];
export type JsonObject = { [key: string]: JsonValue; };

View File

@@ -1,11 +1,11 @@
{
"name": "jazz-browser-auth-local",
"version": "0.0.2",
"main": "src/index.ts",
"types": "src/index.ts",
"version": "0.0.4",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
"dependencies": {
"jazz-browser": "^0.0.2",
"jazz-browser": "^0.0.4",
"typescript": "^5.1.6"
},
"scripts": {

View File

@@ -1,12 +1,12 @@
{
"name": "jazz-browser",
"version": "0.0.2",
"main": "src/index.ts",
"types": "src/index.ts",
"version": "0.0.4",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
"dependencies": {
"cojson": "^0.0.19",
"jazz-storage-indexeddb": "^0.0.6",
"cojson": "^0.0.21",
"jazz-storage-indexeddb": "^0.0.8",
"typescript": "^5.1.6"
},
"scripts": {

View File

@@ -4,8 +4,8 @@ import {
CojsonInternalTypes,
SessionID,
SyncMessage,
Peer
} from "cojson";
import { Peer } from "cojson/src/sync";
import { ReadableStream, WritableStream } from "isomorphic-streams";
import { IDBStorage } from "jazz-storage-indexeddb";

View File

@@ -1,12 +1,12 @@
{
"name": "jazz-react-auth-local",
"version": "0.0.9",
"main": "src/index.tsx",
"types": "src/index.tsx",
"version": "0.0.11",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
"dependencies": {
"jazz-browser-auth-local": "^0.0.2",
"jazz-react": "^0.0.12",
"jazz-browser-auth-local": "^0.0.4",
"jazz-react": "^0.0.14",
"typescript": "^5.1.6"
},
"devDependencies": {
@@ -16,7 +16,7 @@
"react": "^17.0.2"
},
"scripts": {
"lint": "eslint src/**/*.ts",
"lint": "eslint src/**/*.tsx",
"build": "npm run lint && rm -rf ./dist && tsc --declaration --sourceMap --outDir dist",
"prepublishOnly": "npm run build"
}

View File

@@ -1,12 +1,12 @@
{
"name": "jazz-react",
"version": "0.0.12",
"main": "src/index.tsx",
"types": "src/index.tsx",
"version": "0.0.14",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
"dependencies": {
"cojson": "^0.0.19",
"jazz-browser": "^0.0.2",
"cojson": "^0.0.21",
"jazz-browser": "^0.0.4",
"typescript": "^5.1.6"
},
"devDependencies": {

View File

@@ -1,11 +1,11 @@
{
"name": "jazz-storage-indexeddb",
"version": "0.0.6",
"main": "src/index.ts",
"types": "src/index.ts",
"version": "0.0.8",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
"dependencies": {
"cojson": "^0.0.19",
"cojson": "^0.0.21",
"typescript": "^5.1.6"
},
"devDependencies": {

View File

@@ -1,16 +1,15 @@
import { expect, test } from "vitest";
import { LocalNode } from "cojson";
import { getAgentID, newRandomAgentSecret } from "cojson/src/crypto";
import { newRandomSessionID } from "cojson/src/coValue";
import { AnonymousControlledAccount } from "cojson/src/account";
import { AnonymousControlledAccount, LocalNode, cojsonInternals } from "cojson";
import { IDBStorage } from ".";
test.skip("Should be able to initialize and load from empty DB", async () => {
const agentSecret = newRandomAgentSecret();
const agentSecret = cojsonInternals.newRandomAgentSecret();
const node = new LocalNode(
new AnonymousControlledAccount(agentSecret),
newRandomSessionID(getAgentID(agentSecret))
cojsonInternals.newRandomSessionID(
cojsonInternals.getAgentID(agentSecret)
)
);
node.sync.addPeer(await IDBStorage.asPeer({ trace: true }));
@@ -25,14 +24,18 @@ test.skip("Should be able to initialize and load from empty DB", async () => {
});
test("Should be able to sync data to database and then load that from a new node", async () => {
const agentSecret = newRandomAgentSecret();
const agentSecret = cojsonInternals.newRandomAgentSecret();
const node1 = new LocalNode(
new AnonymousControlledAccount(agentSecret),
newRandomSessionID(getAgentID(agentSecret))
cojsonInternals.newRandomSessionID(
cojsonInternals.getAgentID(agentSecret)
)
);
node1.sync.addPeer(await IDBStorage.asPeer({ trace: true, localNodeName: "node1" }));
node1.sync.addPeer(
await IDBStorage.asPeer({ trace: true, localNodeName: "node1" })
);
console.log("yay!");
@@ -48,10 +51,14 @@ test("Should be able to sync data to database and then load that from a new node
const node2 = new LocalNode(
new AnonymousControlledAccount(agentSecret),
newRandomSessionID(getAgentID(agentSecret))
cojsonInternals.newRandomSessionID(
cojsonInternals.getAgentID(agentSecret)
)
);
node2.sync.addPeer(await IDBStorage.asPeer({ trace: true, localNodeName: "node2" }));
node2.sync.addPeer(
await IDBStorage.asPeer({ trace: true, localNodeName: "node2" })
);
const map2 = await node2.load(map.id);

View File

@@ -1,5 +1,4 @@
import { LocalNode, cojsonInternals, SessionID, SyncMessage, Peer } from "cojson";
import { CojsonInternalTypes } from "cojson";
import { cojsonInternals, SessionID, SyncMessage, Peer, CojsonInternalTypes } from "cojson";
import {
ReadableStream,
WritableStream,
@@ -390,7 +389,7 @@ export class IDBStorage {
);
tx.onerror = (event) => {
const target = event.target as {
const target = event.target as unknown as {
error: DOMException;
source?: { name: string };
} | null;

View File

@@ -7655,7 +7655,7 @@ typescript@5.0.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.2.tgz#891e1a90c5189d8506af64b9ef929fca99ba1ee5"
integrity sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==
"typescript@>=3 < 6", typescript@^5.0.2, typescript@^5.1.6:
"typescript@>=3 < 6", typescript@^5.0.2, typescript@^5.1.3, typescript@^5.1.6:
version "5.1.6"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274"
integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==